qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to run u-boot and make it switch to linux on arm64 virt machine?


From: Chan Kim
Subject: How to run u-boot and make it switch to linux on arm64 virt machine?
Date: Tue, 2 May 2023 22:53:09 +0900

Hello experts,

I'm trying to run u-boot and linux using qemu arm64 virt machine.

I built u-boot like this.(u-boot v2022.07)
$ make ARCH=arm CROSS_COMPILE=aarch64_none_elf- qemu_arm64_defconfig
$ make ARCH=arm CROSS_COMPILE=aarch64_none_elf- -j28
Now I have u-boot file (an elf file).

Because this u-boot program is supposed to run at 0x0 which is flash region
of 'virt', I make flash image.
$ aarch64-none-elf-objcopy -O binary u-boot u-boot.bin
$ dd if=/dev/zero of=pflash.img bs=1c count=1 seek=67108863  (extend it to
size 0x4000000 which is the size of the first flash memory)

I built linux like this. (linux-5.15.68)
$ make ARCH=arm64 CROSS_COMPILE=aarch64_none_elf- defconfig
$ make ARCH=arm64 CROSS_COMPILE=aarch64_none_elf- -j28
Now I have kernel image file arch/arm64/boot/Image.

And I run qemu like this.
qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine
virt,gic-version=max,secure=on,virtualization=true -cpu max -drive
if=pflash,file=pflash.img -m 2G -nographic -device
loader,file=linux-5.15.68/arch/arm64/boot/Image,addr=0x80200000

The result : 
qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine
virt,gic-version=max,secure=on,virtualization=true -cpu max -drive
if=pflash,file=pflash.img -m 2G -nographic -device
loader,file=linux-5.15.68/arch/arm64/boot/Image,addr=0x80200000 
WARNING: Image format was not specified for 'pflash.img' and probing guessed
raw.
         Automatically detecting the format is dangerous for raw images,
write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.


U-Boot 2022.07 (Apr 28 2023 - 14:41:11 +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: unknown device

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 (1 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...

I didn't press any key at the 'Hit any key to stop autoboot : ' above.
Maybe u-boot will jump to the linux address so I should set some config
variable in the u-boot configuration or change linux load address.
Can anybody tell me how I can make it switch to linux automatically?

This is what I see in u-boot directory.(showing any addresses in the .config
file)
ckim@ckim-ubuntu:~/temp/u-boot.v2022.07$ grep 0x .config
CONFIG_SYS_TEXT_BASE=0x00000000
CONFIG_SYS_MALLOC_LEN=0x1000000
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_ENV_SIZE=0x40000
CONFIG_ENV_SECT_SIZE=0x40000
CONFIG_MULTI_DTB_FIT_UNCOMPRESS_SZ=0x8000
CONFIG_ERR_PTR_OFFSET=0x0
CONFIG_DEBUG_UART_BASE=0x9000000
CONFIG_IMX_DCD_ADDR=0x00910000
CONFIG_SYS_MEM_TOP_HIDE=0x0
CONFIG_SYS_LOAD_ADDR=0x40200000
CONFIG_ENV_ADDR=0x4000000
CONFIG_STACK_SIZE=0x1000000
CONFIG_SYS_SRAM_BASE=0x0
CONFIG_SYS_SRAM_SIZE=0x0
CONFIG_FIT_EXTERNAL_OFFSET=0x0
CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000
CONFIG_SYS_MONITOR_BASE=0x00000000
CONFIG_BOOTSTAGE_STASH_SIZE=0x1000
CONFIG_SPL_SYS_STACK_F_CHECK_BYTE=0xaa
CONFIG_BOOTP_PXE_CLIENTARCH=0x16
CONFIG_SYS_DFU_DATA_BUF_SIZE=0x800000
CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
CONFIG_SPL_OF_LIBFDT_ASSUME_MASK=0xff
CONFIG_TPL_OF_LIBFDT_ASSUME_MASK=0xff
CONFIG_VPL_OF_LIBFDT_ASSUME_MASK=0xff

Thank you.

Chan Kim








reply via email to

[Prev in Thread] Current Thread [Next in Thread]