Skip to contentSkip to conversation

RISCV64 - u-boot FDT control address unset on qemu-riscv64_defconfig ?

DISCUSSION Alexander von Gluck IV 1 participant 2 messages Aug 27, 2020

lore
Share & tools
lore
#0 lore raw

Good morning!

I was looking at booting Haiku's riscv64 EFI bootloader under qemu, and noticed several FDT errors:

Device 0: QEMU VirtIO Block Device
Type: Hard Disk
Capacity: 428.0 MB = 0.4 GB (876544 x 512)
... is now current device
Scanning virtio 0:1...
** Unable to read file / **
Failed to load '/'
Found EFI removable media binary efi/boot/bootriscv64.efi libfdt fdt_check_header(): FDT_ERR_BADMAGIC Scanning disk virtio-blk#0...
Found 2 disks
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
595112 bytes read in 4 ms (141.9 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC

A quick look showed this default state:

=> fdt list
No FDT memory address configured. Please configure the FDT address via "fdt addr <address>" command. Aborting!

Tossing in the default fdtcontroladdr seemed to resolve the issue:

=> fdt addr ${fdtcontroladdr}
=> fdt list

/ {
	#address-cells = <0x00000002>;
	#size-cells = <0x00000002>;
	compatible = "riscv-virtio";
	model = "riscv-virtio,qemu";
	flash at 20000000 {
	};
	chosen {
	};
	uart at 10000000 {
	};
	test at 100000 {
	};
	virtio_mmio at 10008000 {
	};
	virtio_mmio at 10007000 {
	};
	virtio_mmio at 10006000 {
	};
	virtio_mmio at 10005000 {
	};
	virtio_mmio at 10004000 {
	};
	virtio_mmio at 10003000 {
	};
	virtio_mmio at 10002000 {
	};
	virtio_mmio at 10001000 {
	};
	cpus {
	};
	memory at 80000000 {
	};
	soc {
	};
};

Shouldn't ${fdtcontroladdr} be the default fdt address on bootup?

Here's my qemu command:

qemu-system-riscv64 -bios ~/Code/firmware/u-boot/riscv64/qemu/u-boot.bin -M virt -device virtio-blk-device,drive=hd -drive file=~/Code/haiku/generated.riscv64/haiku-mmc.image,format=raw,id=hd -m 1024

#1 lore raw
Quoted 7 lines · Alexander von Gluck IV

Good morning!

I was looking at booting Haiku's riscv64 EFI bootloader under qemu, and noticed several FDT errors:
.
.
Shouldn't ${fdtcontroladdr} be the default fdt address on bootup?

Quoted 5 lines

Here's my qemu command:

qemu-system-riscv64 -bios ~/Code/firmware/u-boot/riscv64/qemu/u-boot.bin -M virt -device virtio-blk-device,drive=hd -drive file=~/Code/haiku/generated.riscv64/haiku-mmc.image,format=raw,id=hd -m 1024

Nevermind. I just checked and arm is the same way.

Added a boot.scr loading the fdt at ${fdtcontroladdr}, huzah...

U-Boot 2020.10-rc3 (Aug 27 2020 - 08:30:57 -0500)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  1 GiB
In:    uart at 10000000
Out:   uart at 10000000
Err:   uart at 10000000
Net:   No ethernet found.
Hit any key to stop autoboot:  0 

Device 0: QEMU VirtIO Block Device
Type: Hard Disk
Capacity: 428.0 MB = 0.4 GB (876544 x 512)
... is now current device
Scanning virtio 0:1...
Found U-Boot script /boot.scr
1266 bytes read in 2 ms (618.2 KiB/s)
## Executing script at 88100000
Haiku u-boot script entry
54 bytes read in 0 ms
uEnv.txt says to look for efi bootloader named EFI/BOOT/BOOTRISCV64.EFI on virtio 0! Found EFI/BOOT/BOOTRISCV64.EFI on virtio 0!
Loading bootloader...
595112 bytes read in 1 ms (567.5 MiB/s)
Using internal DTB...
Launching EFI loader...
Scanning disk virtio-blk#0...
Found 2 disks
No EFI system partition

(LOCKUP)