From: Joshua Watt <jpewhacker@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd
Date: Tue, 16 Jul 2019 09:19:40 -0500 [thread overview]
Message-ID: <8276a663-9997-281e-6656-3f32d4be4e54@gmail.com> (raw)
In-Reply-To: <20190703174556.11169-1-JPEWhacker@gmail.com>
ping?
On 7/3/19 12:45 PM, Joshua Watt 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 | 17 +++++++++++++++++
> include/configs/qemu-x86.h | 25 +++++++++++++++++++++++++
> 4 files changed, 44 insertions(+)
>
> diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
> index d89cd44144..89118cc3dc 100644
> --- a/configs/qemu-x86_64_defconfig
> +++ b/configs/qemu-x86_64_defconfig
> @@ -12,6 +12,7 @@ CONFIG_SMP=y
> CONFIG_GENERATE_PIRQ_TABLE=y
> CONFIG_GENERATE_MP_TABLE=y
> CONFIG_GENERATE_ACPI_TABLE=y
> +CONFIG_DISTRO_DEFAULTS=y
> CONFIG_BUILD_ROM=y
> CONFIG_FIT=y
> CONFIG_SPL_LOAD_FIT=y
> diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
> index 898d656ac3..a50285beec 100644
> --- a/configs/qemu-x86_defconfig
> +++ b/configs/qemu-x86_defconfig
> @@ -6,6 +6,7 @@ CONFIG_SMP=y
> CONFIG_GENERATE_PIRQ_TABLE=y
> CONFIG_GENERATE_MP_TABLE=y
> CONFIG_GENERATE_ACPI_TABLE=y
> +CONFIG_DISTRO_DEFAULTS=y
> CONFIG_BUILD_ROM=y
> CONFIG_FIT=y
> CONFIG_BOOTSTAGE=y
> diff --git a/doc/README.x86 b/doc/README.x86
> index 8e0a3f36ed..a00ae69acc 100644
> --- a/doc/README.x86
> +++ b/doc/README.x86
> @@ -466,6 +466,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
> 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
>
> +#include <linux/sizes.h>
> +
> +#define BOOT_TARGET_DEVICES(func) \
> + func(USB, usb, 0) \
> + func(SCSI, scsi, 0) \
> + func(VIRTIO, virtio, 0) \
> + func(IDE, ide, 0) \
> + func(DHCP, dhcp, na)
> +
> +#include <config_distro_bootcmd.h>
> #include <configs/x86-common.h>
>
> +#undef CONFIG_ENV_SIZE
> +#define CONFIG_ENV_SIZE SZ_256K
> +
> +#define CONFIG_PREBOOT "pci enum"
> +
> +#undef CONFIG_EXTRA_ENV_SETTINGS
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> + CONFIG_STD_DEVICES_SETTINGS \
> + "scriptaddr=0x7000000\0" \
> + "kernel_addr_r=0x1000000\0" \
> + "ramdisk_addr_r=0x4000000\0" \
> + "consoledev=ttyS0\0" \
> + CONFIG_OTHBOOTARGS \
> + BOOTENV
> +
> #define CONFIG_SYS_MONITOR_LEN (1 << 20)
>
> #define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \
next prev parent reply other threads:[~2019-07-16 14:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 15:16 [U-Boot] [RFC PATCH] qemu-x86: Use config_distro_bootcmd Joshua Watt
2019-06-22 14:51 ` Bin Meng
2019-06-22 14:52 ` Bin Meng
2019-07-02 13:24 ` [U-Boot] [PATCH v2] " Joshua Watt
2019-07-02 14:24 ` Bin Meng
2019-07-02 15:31 ` Joshua Watt
2019-07-03 17:45 ` [U-Boot] [PATCH v3] " Joshua Watt
2019-07-16 14:19 ` Joshua Watt [this message]
2019-07-17 5:43 ` Bin Meng
2019-07-19 9:46 ` Bin Meng
2019-08-14 4:14 ` Heinrich Schuchardt
2019-08-14 7:19 ` Bin Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8276a663-9997-281e-6656-3f32d4be4e54@gmail.com \
--to=jpewhacker@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox