[U-Boot] [PATCH v2] qemu-x86: Use config_distro_bootcmd

Bin Meng
2019-07-02T14:24:20Z

Hi Joshua,

On Tue, Jul 2, 2019 at 9:26 PM Joshua Watt <jpewhacker@gmail.com> wrote:
>
> 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 <JPEWhacker@gmail.com>
> ---
> configs/qemu-x86_64_defconfig | 1 +
> configs/qemu-x86_defconfig | 1 +
> doc/README.x86 | 5 +++++
> include/configs/qemu-x86.h | 25 +++++++++++++++++++++++++
> 4 files changed, 32 insertions(+)
>
> diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
> index d89cd44144..3e9e83efaf 100644
> --- a/configs/qemu-x86_64_defconfig
> +++ b/configs/qemu-x86_64_defconfig
> @@ -62,3 +62,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
> CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
> CONFIG_FRAMEBUFFER_VESA_MODE=0x144
> CONFIG_CONSOLE_SCROLL_LINES=5
> +CONFIG_DISTRO_DEFAULTS=y

I think this should be inserted to a proper place in the defconfig
files. Try "make savedefconfig" and use the generated "defconfig"
file.

> diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
> index 898d656ac3..85bb7b1daf 100644
> --- a/configs/qemu-x86_defconfig
> +++ b/configs/qemu-x86_defconfig
> @@ -50,3 +50,4 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
> CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
> CONFIG_FRAMEBUFFER_VESA_MODE=0x144
> CONFIG_CONSOLE_SCROLL_LINES=5
> +CONFIG_DISTRO_DEFAULTS=y
> diff --git a/doc/README.x86 b/doc/README.x86
> index 8e0a3f36ed..48557ffa51 100644
> --- a/doc/README.x86
> +++ b/doc/README.x86
> @@ -466,6 +466,11 @@ 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'

Thanks for adding some documentation. Do you have any details on for
example how to boot Ubuntu or Fedora on QEMU?

> +
> 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
> diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
> index 64e7a60b8a..097ed414f8 100644
> --- a/include/configs/qemu-x86.h
> +++ b/include/configs/qemu-x86.h
> @@ -10,8 +10,33 @@
> #ifndef __CONFIG_H
> #define __CONFIG_H
>

Regards,
Bin