1

I'm trying to run u-boot on qemu arm64 virtual machine. (qemu 6.2.0, u-boot v2022.07) so I compiled u-boot using qemu_arm64_defconfig, it does build u-boot (and not u-boot-spl). I made initrd following U-Boot "Wrong Ramdisk Image Format" with initramfs on BeagleBone black. This is the command I made the initrd.img with.

mkimage -A arm64 -T ramdisk -d ../../../busybox-1.32.1/initramfs.cpio.gz initrd.img 

I saw in include/configs/qemu-arm.h,

#define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ "fdt_addr=0x40000000\0" \ "scriptaddr=0x40200000\0" \ "pxefile_addr_r=0x40300000\0" \ "kernel_addr_r=0x40400000\0" \ "ramdisk_addr_r=0x44000000\0" \ BOOTENV 

So, referencing the above environment variables, this is the command I ran qemu with.(qemu generates the dtb at the first DRAM location, 0x40000000).

 qemu-system-aarch64 -machine virt,gic-version=max,secure=on,virtualization=true -cpu max u-boot -m 2G -nographic -bios u-boot.bin -device loader,file=linux-5.15.68/arch/arm64/boot/Image,addr=0x40400000 -device loader,file=initrd.img,addr=0x44000000 

u-boot runs and command prompt comes up. So I ran

=> booti 0x40400000 0x44000000 0x40000000 ## Loading init Ramdisk from Legacy Image at 44000000 ... Image Name: Created: 2023-05-30 2:50:14 UTC Image Type: AArch64 Linux RAMDisk Image (gzip compressed) Data Size: 6671800 Bytes = 6.4 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK ## Flattened Device Tree blob at 40000000 Booting using the fdt blob at 0x40000000 Loading Ramdisk to be771000, end bedcddb8 ... OK Loading Device Tree to 00000000be66e000, end 00000000be770fff ... OK Starting kernel ... 

It shows no process there. What am I doing wrong?

And when u-boot runs (before I give booti command), previously before I give booti command above at the prompt, I see this output.

U-Boot 2022.07 (May 29 2023 - 16:05:33 +0900) DRAM: 2 GiB Core: 45 devices, 12 uclasses, devicetree: board Flash: 32 MiB Loading Environment from Flash... *** Warning - bad CRC, using default environment In: pl011@9000000 Out: pl011@9000000 Err: pl011@9000000 Net: eth0: virtio-net#32 Hit any key to stop autoboot: 0 starting USB... No working controllers found USB is stopped. Please issue 'usb start' first. scanning bus for devices... Device 0: unknown device Device 0: 1af4 VirtIO Block Device Type: Hard Disk Capacity: 6.8 MB = 0.0 GB (14024 x 512) ... is now current device ** No partition table - virtio 0 ** Couldn't find partition virtio 0:1 Device 0: unknown device starting USB... No working controllers found BOOTP broadcast 1 DHCP client bound to address 10.0.2.15 (2 ms) Using virtio-net#32 device TFTP from server 10.0.2.2; our IP address is 10.0.2.15 Filename 'boot.scr.uimg'. Load address: 0x40200000 Loading: * TFTP error: 'Access violation' (2) Not retrying... BOOTP broadcast 1 DHCP client bound to address 10.0.2.15 (0 ms) Using virtio-net#32 device TFTP from server 10.0.2.2; our IP address is 10.0.2.15 Filename 'boot.scr.uimg'. Load address: 0x40400000 Loading: * TFTP error: 'Access violation' (2) Not retrying... 

it looks like u-boot is trying to load uboot.scr.uimg file at 0x40200000. What is uboot.scr.uimg and how can I make it?

2
  • (1) Sorry I cannot really help, never worked with ramfs or qemu, but the log looks okay for me. That's just your U-Boot being configured for different boot sources that you don't use. Let them fail or throw them out of your U-Boot environment, maybe setting some bootdevs setting or something like that. (2) Doesn't your mkimage need the -O linux option? (3) Did you check your Image really start with the kernel (executable ARM code without a legacy header)? Commented May 30, 2023 at 8:11
  • @Philippos Thanks, I tried adding -O linux but it was the same. and using gdb, I could see it actually jumps to linux and I could follow the initial linux assembly code(by using add-symbol-file for the linux). hopefully I could find where it stops. Commented May 30, 2023 at 9:54

1 Answer 1

1

This is a long delayed answer I write here how I solved it later (from my work note).
I later found it stops while initializing things for SVE in linux code. The qemu virtual machine doesn't seem to provide SVE support so I turned of CONFIG_ARM64_SVE and it passed that point. Then I increase the RAM size to 4G and it proceeded to 'Freeing unused kernel memory : 1088K'. And then I changed OPTIONAL_KERNEL_RWX's default to y (from arch/Kconfig) and set STRICT_KERNEL_RWX to n. (I don't know why I have to do this but otherwise it stops). And it proceeded to the shell's prompt but the shell didn't respond to my keyboard input. And finally I added CONFIG_GICV3 in u-boot configuration, (because interrupt was not working, timer and keyboard interrupts didn't work before), and the shell finally worked ok. Hope this helps someone later.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.