From 00f237e226bc8a6ecf168ca0d2e1853f203f17d1 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Wed, 3 Jul 2019 12:45:32 -0500 Subject: qemu-x86: Use config_distro_bootcmd Converts qemu x86 machines to boot using distro_config. The intent is to allow u-boot in qemu to be maximally compatible with many boot methods without having to change the config. Previously, u-boot would only boot in a very limited set of circumstances where there was a /boot/vmlinuz on scsi 0:3 with no ramdisk. Signed-off-by: Joshua Watt Reviewed-by: Bin Meng [bmeng: convert doc updates to reST] Signed-off-by: Bin Meng --- doc/board/emulation/qemu-x86.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'doc') diff --git a/doc/board/emulation/qemu-x86.rst b/doc/board/emulation/qemu-x86.rst index c2e704afb2b..db842f2ece6 100644 --- a/doc/board/emulation/qemu-x86.rst +++ b/doc/board/emulation/qemu-x86.rst @@ -54,6 +54,23 @@ If you want to check both consoles, use '-serial stdio'. Multicore is also supported by QEMU via '-smp n' where n is the number of cores to instantiate. Note, the maximum supported CPU number in QEMU is 255. +U-Boot uses 'distro_bootcmd' by default when booting on x86 QEMU. This tries to +load a boot script, kernel, and ramdisk from several different interfaces. For +the default boot order, see 'qemu-x86.h'. For more information, see +'README.distro'. Most Linux distros can be booted by writing a uboot script. +For example, Debian (stretch) can be booted by creating a script file named +'boot.txt' with the contents:: + + setenv bootargs root=/dev/sda1 ro + load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /vmlinuz + load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /initrd.img + zboot ${kernel_addr_r} - ${ramdisk_addr_r} ${filesize} + +Then compile and install it with:: + + $ apt install u-boot-tools && \ + mkimage -T script -C none -n "Boot script" -d boot.txt /boot/boot.scr + The fw_cfg interface in QEMU also provides information about kernel data, initrd, command-line arguments and more. U-Boot supports directly accessing these informtion from fw_cfg interface, which saves the time of loading them -- cgit v1.3.1