Skip to contentSkip to conversation

Enable U-Boot at Virtualbox to boot images

PATCH In review [email protected] 4 participants 11 messages May 2, 2023

lore
Share & tools
lore
#0 lore raw

cover Enable U-Boot at Virtualbox to boot images

From: mtt2hi <[email protected]>

The changes are needed to get U-Boot to be started at VirtualBox images supporting distro boot capability.
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/[email protected]/)

mtt2hi (4):
X86: Add support for SCSI devices
X86: Change command prompt
X86: Add support for distro boot
X86: pxeboot: bugfix: Set variable for size of initrd

 boot/pxe_utils.c                    |  2 +-
 configs/efi-x86_payload64_defconfig | 12 ++++++++++--
 include/configs/efi-x86_payload.h   | 11 +++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/4 X86: Add support for SCSI devices

From: mtt2hi <[email protected]>

---
 configs/efi-x86_payload64_defconfig | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
configs/efi-x86_payload64_defconfig +8 -1
index 5cde04a5ac..f3423091ae 100644
@@ -22,7 +22,7 @@ CONFIG_CMD_IDE=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_USB=y
-# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SETEXPR=y
 CONFIG_CMD_DHCP=y
 CONFIG_BOOTP_BOOTFILESIZE=y
 # CONFIG_CMD_NFS is not set
@@ -32,6 +32,7 @@ CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
+CONFIG_CMD_SCSI=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ISO_PARTITION=y
@@ -58,3 +59,9 @@ CONFIG_SYS_NS16550_PORT_MAPPED=y
 CONFIG_EFI=y
 CONFIG_EFI_STUB=y
 CONFIG_EFI_STUB_64BIT=y
+CONFIG_FAT_WRITE=y
+CONFIG_ENV_FAT_INTERFACE="scsi"
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+CONFIG_ENV_FAT_FILE="uboot.env"
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_LEGACY_IMAGE_FORMAT=y
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH 1/4] X86: Add support for SCSI devices

Quoted 12 lines · On 5/2/23 11:49, [email protected] wrote:

From: mtt2hi <[email protected]>

---
  configs/efi-x86_payload64_defconfig | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
configs/efi-x86_payload64_defconfig +0 -0
index 5cde04a5ac..f3423091ae 100644

configs/efi-x86_payload64_defconfig CONFIG_CMD_IDE=y · line 25

Quoted 5 lines
configs/efi-x86_payload64_defconfig +1 -1
@@ -22,7 +22,7 @@ CONFIG_CMD_IDE=y
  CONFIG_CMD_MMC=y
  CONFIG_CMD_PART=y
  CONFIG_CMD_USB=y
-# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SETEXPR=y

This looks like an unrelated change.

Quoted 12 lines
configs/efi-x86_payload64_defconfig +1 -0
  CONFIG_CMD_DHCP=y
  CONFIG_BOOTP_BOOTFILESIZE=y
  # CONFIG_CMD_NFS is not set
@@ -32,6 +32,7 @@ CONFIG_CMD_EXT2=y
  CONFIG_CMD_EXT4=y
  CONFIG_CMD_EXT4_WRITE=y
  CONFIG_CMD_FAT=y
+CONFIG_CMD_SCSI=y
  CONFIG_CMD_FS_GENERIC=y
  CONFIG_MAC_PARTITION=y
  CONFIG_ISO_PARTITION=y

configs/efi-x86_payload64_defconfig CONFIG_SYS_NS16550_PORT_MAPPED=y · line 66

Quoted 8 lines
configs/efi-x86_payload64_defconfig +5 -0
@@ -58,3 +59,9 @@ CONFIG_SYS_NS16550_PORT_MAPPED=y
  CONFIG_EFI=y
  CONFIG_EFI_STUB=y
  CONFIG_EFI_STUB_64BIT=y
+CONFIG_FAT_WRITE=y
+CONFIG_ENV_FAT_INTERFACE="scsi"
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+CONFIG_ENV_FAT_FILE="uboot.env"
+CONFIG_ENV_IS_IN_FAT=y

When changing the defconfig, please, use

make savedefconfig
cp defconfig configs/efi-x86_payload64_defconfig git commit -s configs/efi-x86_payload64_defconfig

Best regards

Heinrich

Quoted 1 line
configs/efi-x86_payload64_defconfig +1 -0
+CONFIG_LEGACY_IMAGE_FORMAT=y
#3 lore raw

PATCH 2/4 X86: Change command prompt

In reply to [email protected]

From: mtt2hi <[email protected]>

---
 configs/efi-x86_payload64_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/efi-x86_payload64_defconfig +1 -0
index f3423091ae..12b5e58374 100644
@@ -65,3 +65,4 @@ CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_ENV_FAT_FILE="uboot.env"
 CONFIG_ENV_IS_IN_FAT=y
 CONFIG_LEGACY_IMAGE_FORMAT=y
+CONFIG_SYS_PROMPT="U-Boot> "
Signature · 1 line
2.30.2
#4 lore raw

Re: [PATCH 2/4] X86: Change command prompt

Quoted 1 line · On 5/2/23 11:49, [email protected] wrote:

From: mtt2hi <[email protected]>

The commit message should provide a justification for the cahnge.

Quoted 11 lines
---
  configs/efi-x86_payload64_defconfig | 1 +
  1 file changed, 1 insertion(+)
configs/efi-x86_payload64_defconfig +0 -0
index f3423091ae..12b5e58374 100644

configs/efi-x86_payload64_defconfig CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" · line 68

Quoted 4 lines
configs/efi-x86_payload64_defconfig +1 -0
@@ -65,3 +65,4 @@ CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
  CONFIG_ENV_FAT_FILE="uboot.env"
  CONFIG_ENV_IS_IN_FAT=y
  CONFIG_LEGACY_IMAGE_FORMAT=y
+CONFIG_SYS_PROMPT="U-Boot> "

Please, keep the default prompt.

Best regards

Heinrich

#5 lore raw

PATCH 3/4 X86: Add support for distro boot

In reply to [email protected]

From: mtt2hi <[email protected]>

---
 configs/efi-x86_payload64_defconfig |  2 +-
 include/configs/efi-x86_payload.h   | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
configs/efi-x86_payload64_defconfig +1 -1
index 12b5e58374..e6047e5fb4 100644
@@ -11,7 +11,6 @@ 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
@@ -59,6 +58,7 @@ CONFIG_SYS_NS16550_PORT_MAPPED=y
 CONFIG_EFI=y
 CONFIG_EFI_STUB=y
 CONFIG_EFI_STUB_64BIT=y
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FAT_WRITE=y
 CONFIG_ENV_FAT_INTERFACE="scsi"
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
include/configs/efi-x86_payload.h +11 -0
index c72b067c36..e1cd8eb316 100644
@@ -6,6 +6,17 @@
 /*
  * board/config.h - configuration options, board specific
  */
+#ifndef CONFIG_SPL_BUILD
+
+#define BOOT_TARGET_SCSI(func) \
+		func(SCSI, scsi, 0)
+
+#define BOOT_TARGET_DEVICES(func) \
+	BOOT_TARGET_SCSI(func)
+
+#include <config_distro_bootcmd.h>
+
+#endif
 
 #ifndef __CONFIG_H
 #define __CONFIG_H
Signature · 1 line
2.30.2
#6 lore raw

Re: [PATCH 3/4] X86: Add support for distro boot

Quoted 1 line · On 5/2/23 11:49, [email protected] wrote:

From: mtt2hi <[email protected]>

Patches without commit messages cannot be accepted.

Best regards

Heinrich

Quoted 49 lines
---
  configs/efi-x86_payload64_defconfig |  2 +-
  include/configs/efi-x86_payload.h   | 11 +++++++++++
  2 files changed, 12 insertions(+), 1 deletion(-)
configs/efi-x86_payload64_defconfig +1 -1
index 12b5e58374..e6047e5fb4 100644
@@ -11,7 +11,6 @@ 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
@@ -59,6 +58,7 @@ CONFIG_SYS_NS16550_PORT_MAPPED=y
  CONFIG_EFI=y
  CONFIG_EFI_STUB=y
  CONFIG_EFI_STUB_64BIT=y
+CONFIG_DISTRO_DEFAULTS=y
  CONFIG_FAT_WRITE=y
  CONFIG_ENV_FAT_INTERFACE="scsi"
  CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
include/configs/efi-x86_payload.h +11 -0
index c72b067c36..e1cd8eb316 100644
@@ -6,6 +6,17 @@
  /*
   * board/config.h - configuration options, board specific
   */
+#ifndef CONFIG_SPL_BUILD
+
+#define BOOT_TARGET_SCSI(func) \
+		func(SCSI, scsi, 0)
+
+#define BOOT_TARGET_DEVICES(func) \
+	BOOT_TARGET_SCSI(func)
+
+#include <config_distro_bootcmd.h>
+
+#endif
 
  #ifndef __CONFIG_H
  #define __CONFIG_H
#7 lore raw

Re: [PATCH 3/4] X86: Add support for distro boot

Hi,

Quoted 57 lines · Heinrich Schuchardt
Quoted 1 line · On 5/2/23 11:49, [email protected] wrote:

From: mtt2hi <[email protected]>

Patches without commit messages cannot be accepted.

Best regards

Heinrich

Quoted 47 lines
---
  configs/efi-x86_payload64_defconfig |  2 +-
  include/configs/efi-x86_payload.h   | 11 +++++++++++
  2 files changed, 12 insertions(+), 1 deletion(-)
configs/efi-x86_payload64_defconfig +1 -1
index 12b5e58374..e6047e5fb4 100644
@@ -11,7 +11,6 @@ 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
@@ -59,6 +58,7 @@ CONFIG_SYS_NS16550_PORT_MAPPED=y
  CONFIG_EFI=y
  CONFIG_EFI_STUB=y
  CONFIG_EFI_STUB_64BIT=y
+CONFIG_DISTRO_DEFAULTS=y
  CONFIG_FAT_WRITE=y
  CONFIG_ENV_FAT_INTERFACE="scsi"
  CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
include/configs/efi-x86_payload.h +11 -0
index c72b067c36..e1cd8eb316 100644
@@ -6,6 +6,17 @@
  /*
   * board/config.h - configuration options, board specific
   */
+#ifndef CONFIG_SPL_BUILD
+
+#define BOOT_TARGET_SCSI(func) \
+             func(SCSI, scsi, 0)
+
+#define BOOT_TARGET_DEVICES(func) \
+     BOOT_TARGET_SCSI(func)
+
+#include <config_distro_bootcmd.h>
+
+#endif
 
Quoted 3 lines

include/configs/efi-x86_payload.h line 22

Quoted 2 lines
include/configs/efi-x86_payload.h +0 -0
  #ifndef __CONFIG_H
  #define __CONFIG_H

Can you use bootstd instead?

Regards,
Simon

#8 lore raw

PATCH 4/4 X86: pxeboot: bugfix: Set variable for size of initrd

In reply to [email protected]

From: mtt2hi <[email protected]>

The problem was, that zboot() didn't work because of missing ramdisc size.

---
 boot/pxe_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boot/pxe_utils.c +1 -1
index 3a1e50f2b1..87c32b6e62 100644
@@ -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);
Signature · 1 line
2.30.2
#9 lore raw

Re: [PATCH 4/4] X86: pxeboot: bugfix: Set variable for size of initrd

Quoted 4 lines · On 5/2/23 11:49, [email protected] wrote:

From: mtt2hi <[email protected]>

The problem was, that zboot() didn't work because of missing ramdisc size.

Can we create a test for this?

Best regards

Heirnich

Quoted 19 lines
---
  boot/pxe_utils.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
boot/pxe_utils.c +1 -1
index 3a1e50f2b1..87c32b6e62 100644
@@ -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);
#10 lore raw

AW: [PATCH 4/4] X86: pxeboot: bugfix: Set variable for size of initrd

Quoted 11 lines

-----Ursprüngliche Nachricht-----
Von: Heinrich Schuchardt <[email protected]>
Gesendet: Dienstag, 2. Mai 2023 12:15
An: Mittelstaedt Thomas (XC-CT/EBV3) <[email protected]>; u- [email protected]
Cc: Simon Glass <[email protected]>; Niel Armstrong <[email protected]>; Patrick Delaunay <[email protected]>; Ramon Fried <[email protected]>; Marek Vasut <[email protected]>; Manuel Traut <[email protected]>; Bin Meng <[email protected]>
Betreff: Re: [PATCH 4/4] X86: pxeboot: bugfix: Set variable for size of initrd

Quoted 7 lines
Quoted 4 lines · On 5/2/23 11:49, [email protected] wrote:

From: mtt2hi <[email protected]>

The problem was, that zboot() didn't work because of missing ramdisc size.

Can we create a test for this?

We could test it, if all would be fine.
Atm this function seems only to be called by distroboot implementation. And this is not activated yet.

But for the first time a code walk trough seems to be more appropriate.

At line 551/552 the initrd is loaded to memory and the size is saved to variable size. My correction at 557 stores a string representing the size to variable initrd_filesize At line 725 initrd_filesize is set to parameters of function zboot().
So it must fail without the correction.

Quoted 25 lines

Best regards

Heirnich

boot/pxe_utils.c static int label_boot(struct pxe_context *ctx, struct

Quoted 11 lines
---
  boot/pxe_utils.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
boot/pxe_utils.c index renamed from boot/pxe_utils.c +0 -0

3a1e50f2b1..87c32b6e62 100644

boot/pxe_utils.c +0 -0
@@ -554,7 +554,7 @@ static int label_boot(struct pxe_context *ctx, struct

pxe_label *label)

Quoted 8 lines
boot/pxe_utils.c +1 -1
  			       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);