[PATCH v3 0/3] Enable U-Boot at Virtualbox to boot images

From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
The changes are needed to get U-Boot to be started at VirtualBox images supporting distro boot capability (scripts and extlinux.conf). Atm the patch "pci: coreboot: Don't read regions when booting" from Simon Glass is not integrated yet. So AHCI and IDE devices are not handled correctly without this patch. (https://patchwork.ozlabs.org/project/uboot/patch/20230220194927.476708-8-sjg...)
Changes since v2: - DISTROBOOT configuration replaced with BOOTSTD to get more flexibility
Thomas Mittelstaedt (3): X86: Add support for SCSI devices X86: Add bootstd support X86: pxeboot: bugfix: Set variable for size of initrd
boot/pxe_utils.c | 2 +- configs/efi-x86_payload64_defconfig | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-)

From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
U-Boot at VirtualBox must load Linux and boot configuration from disk devices. Here the discs at AHCI (scsi) bus are used to load the need boot data.
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com --- configs/efi-x86_payload64_defconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig index 5cde04a5ac..30a7f31dac 100644 --- a/configs/efi-x86_payload64_defconfig +++ b/configs/efi-x86_payload64_defconfig @@ -7,11 +7,11 @@ CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_PAYLOAD=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y @@ -22,7 +22,6 @@ CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_USB=y -# CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y # CONFIG_CMD_NFS is not set @@ -37,6 +36,9 @@ CONFIG_MAC_PARTITION=y CONFIG_ISO_PARTITION=y CONFIG_EFI_PARTITION=y CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_FAT_INTERFACE="scsi" +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage"

On Thu, 4 May 2023 at 07:43, thomas.mittelstaedt@de.bosch.com wrote:
From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
U-Boot at VirtualBox must load Linux and boot configuration from disk devices. Here the discs at AHCI (scsi) bus are used to load the need boot data.
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
configs/efi-x86_payload64_defconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
Enable bootstd support for U-Boot at VirtualBox described at https://source.denx.de/u-boot/u-boot/-/blob/master/doc/develop/bootstd.rst This is used to boot system images at Virtualbox via - distroboot (extlinux.conf) - boot script
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@bosch.com --- configs/efi-x86_payload64_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig index 30a7f31dac..9e517e742b 100644 --- a/configs/efi-x86_payload64_defconfig +++ b/configs/efi-x86_payload64_defconfig @@ -7,6 +7,7 @@ CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_PAYLOAD=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_BOOTSTD_FULL=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y

On Thu, 4 May 2023 at 07:43, thomas.mittelstaedt@de.bosch.com wrote:
From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
Enable bootstd support for U-Boot at VirtualBox described at https://source.denx.de/u-boot/u-boot/-/blob/master/doc/develop/bootstd.rst This is used to boot system images at Virtualbox via
- distroboot (extlinux.conf)
- boot script
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@bosch.com
configs/efi-x86_payload64_defconfig | 1 + 1 file changed, 1 insertion(+)
Reviewed-by: Simon Glass sjg@chromium.org
Here you are enabling 'full' support which provides a few more features, mostly an enhanced command line.

From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
The problem was, that zboot() didn't work because of missing ramdisc size.
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com --- boot/pxe_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index 3a1e50f2b1..87c32b6e62 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -554,7 +554,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) label->name); goto cleanup; } - + strcpy(initrd_filesize, simple_xtoa(size)); initrd_addr_str = env_get("ramdisk_addr_r"); size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx", initrd_addr_str, size);

On Thu, 4 May 2023 at 07:43, thomas.mittelstaedt@de.bosch.com wrote:
From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
The problem was, that zboot() didn't work because of missing ramdisc size.
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
boot/pxe_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Fixes: 085cbdafca9 ("pxe: simplify label_boot()") Reviewed-by: Simon Glass sjg@chromium.org

Hi Bin,
On Thu, 4 May 2023 at 18:40, Simon Glass sjg@chromium.org wrote:
On Thu, 4 May 2023 at 07:43, thomas.mittelstaedt@de.bosch.com wrote:
From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
The problem was, that zboot() didn't work because of missing ramdisc size.
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
boot/pxe_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Fixes: 085cbdafca9 ("pxe: simplify label_boot()") Reviewed-by: Simon Glass sjg@chromium.org
This patch and some others seem to have been lost. Can you please check here?
https://patchwork.ozlabs.org/project/uboot/list/?series=&submitter=&...
Regards, Simon

Hi Simon,
On Fri, Aug 11, 2023 at 5:33 AM Simon Glass sjg@chromium.org wrote:
Hi Bin,
On Thu, 4 May 2023 at 18:40, Simon Glass sjg@chromium.org wrote:
On Thu, 4 May 2023 at 07:43, thomas.mittelstaedt@de.bosch.com wrote:
From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
The problem was, that zboot() didn't work because of missing ramdisc size.
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
boot/pxe_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Fixes: 085cbdafca9 ("pxe: simplify label_boot()") Reviewed-by: Simon Glass sjg@chromium.org
This patch and some others seem to have been lost. Can you please check here?
https://patchwork.ozlabs.org/project/uboot/list/?series=&submitter=&...
Indeed I missed these. Will take a look soon.
Regards, Bin

Hi Thomas, Simon,
On Fri, Aug 11, 2023 at 8:26 PM Bin Meng bmeng.cn@gmail.com wrote:
Hi Simon,
On Fri, Aug 11, 2023 at 5:33 AM Simon Glass sjg@chromium.org wrote:
Hi Bin,
On Thu, 4 May 2023 at 18:40, Simon Glass sjg@chromium.org wrote:
On Thu, 4 May 2023 at 07:43, thomas.mittelstaedt@de.bosch.com wrote:
From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
The problem was, that zboot() didn't work because of missing ramdisc size.
Signed-off-by: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
boot/pxe_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Fixes: 085cbdafca9 ("pxe: simplify label_boot()") Reviewed-by: Simon Glass sjg@chromium.org
This patch and some others seem to have been lost. Can you please check here?
https://patchwork.ozlabs.org/project/uboot/list/?series=&submitter=&...
Indeed I missed these. Will take a look soon.
I have rebased this series on top of u-boot/master and pushed this to u-boot-x86/master.
Would you please post a patch to efi-payload doc to describe how to test this with Virtual Box? Thanks!
Regards, Bin

Hi Bin,
I have never done this. Can you give me some hints:
- Base version of U-boot - Path and filename for "efi-payload doc" - Some info about format of doc file and /or example to have a look for
Mit freundlichen Grüßen / Best regards
Thomas Mittelstaedt
Cross-Domain Computing Solutions, Engineering BBM Vehicle Computer 3 (XC-CT/EBV3) Robert Bosch GmbH | Postfach 10 02 61 | 31102 Hildesheim | GERMANY | www.bosch.com Tel. +49 5121 49-2965 | Mobil +49 160 90418883 | Telefax +49 711 811-5052965 | Thomas.Mittelstaedt@de.bosch.com
Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart, HRB 14000; Aufsichtsratsvorsitzender: Prof. Dr. Stefan Asenkerschbaumer; Geschäftsführung: Dr. Stefan Hartung, Dr. Christian Fischer, Dr. Markus Forschner, Stefan Grosch, Dr. Markus Heyn, Dr. Tanja Rückert
-----Ursprüngliche Nachricht----- Von: Bin Meng bmeng.cn@gmail.com Gesendet: Freitag, 11. August 2023 17:18 An: Simon Glass sjg@chromium.org Cc: Mittelstaedt Thomas (XC-CT/EBV3) thomas.mittelstaedt@de.bosch.com; u-boot@lists.denx.de; Niel Armstrong neil.armstrong@linaro.org; Patrick Delaunay patrick.delaunay@foss.st.com; Ramon Fried rfried.dev@gmail.com; Marek Vasut marex@denx.de; Manuel Traut manuel.traut@mt.com; Heinrich Schuchardt xypron.glpk@gmx.de Betreff: Re: [PATCH v3 3/3] X86: pxeboot: bugfix: Set variable for size of initrd
Hi Thomas, Simon,
On Fri, Aug 11, 2023 at 8:26 PM Bin Meng bmeng.cn@gmail.com wrote:
Hi Simon,
On Fri, Aug 11, 2023 at 5:33 AM Simon Glass sjg@chromium.org wrote:
Hi Bin,
On Thu, 4 May 2023 at 18:40, Simon Glass sjg@chromium.org wrote:
On Thu, 4 May 2023 at 07:43, thomas.mittelstaedt@de.bosch.com wrote:
From: Thomas Mittelstaedt thomas.mittelstaedt@de.bosch.com
The problem was, that zboot() didn't work because of missing ramdisc size.
Signed-off-by: Thomas Mittelstaedt
thomas.mittelstaedt@de.bosch.com
boot/pxe_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Fixes: 085cbdafca9 ("pxe: simplify label_boot()") Reviewed-by: Simon Glass sjg@chromium.org
This patch and some others seem to have been lost. Can you please check
here?
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpa
tchwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D%26submitt
er%3D%26state%3D%26q%3D%26archive%3D%26delegate%3D56520&data=05 %7C01
%7Cthomas.mittelstaedt%40de.bosch.com%7C1dde215fe90f46abcc1008db9a7e
30a0%7C0ae51e1907c84e4bbb6d648ee58410f4%7C0%7C0%7C638273638986309 018
%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ BTiI
6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=b%2B9kLZEcwvj5U VSlAmQf
1JGhSP7EVOvnMezV4vUwqG8%3D&reserved=0
Indeed I missed these. Will take a look soon.
I have rebased this series on top of u-boot/master and pushed this to u-boot- x86/master.
Would you please post a patch to efi-payload doc to describe how to test this with Virtual Box? Thanks!
Regards, Bin

Hi Mittelstaedt,
On Wed, Aug 16, 2023 at 9:06 PM Mittelstaedt Thomas (XC-CT/EBV3) Thomas.Mittelstaedt@de.bosch.com wrote:
Hi Bin,
I have never done this. Can you give me some hints:
- Base version of U-boot
- Path and filename for "efi-payload doc"
- Some info about format of doc file and /or example to have a look for
It's doc/develop/uefi/u-boot_on_efi.rst of the u-boot/master.
The format is reST. You can add something in the example section.
Regards, Bin
participants (4)
-
Bin Meng
-
Mittelstaedt Thomas (XC-CT/EBV3)
-
Simon Glass
-
thomas.mittelstaedt@de.bosch.com