uefi: support USB boot in distro boot
cover uefi: support USB boot in distro boot
I think that it will be nice if we can install a distro linux from, say, USB memory with ISO image, to a hard disk off the shelf. Even with the current u-boot, we can do this by having two *scsi* disks, but using an USB device looks more realistic, doesn't it?
This patch set give us a base for this; I was able to successfully start a familiar "install" screen on qemu, using an ubuntu server ISO image for arm64. CUI of course.
Thanks,
-Takahiro Akashi
AKASHI Takahiro (3):
efi_loader: support USB boot in distro boot script
ARM: qemu-arm: enable usb mass storage in default configuration
ARM: qemu-arm: enable USB boot in distro boot with UEFI
configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + include/config_distro_bootcmd.h | 7 ++++++- include/configs/qemu-arm.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.0
PATCH 1/3 efi_loader: support USB boot in distro boot script
With this patch, a removable USB mass storage device attached to the system will also be scanned to find and boot an EFI binary (that is BOOTEFI_NAME, see config_distro_bootcmd.h).
--- include/config_distro_bootcmd.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/config_distro_bootcmd.h +6 -1
@@ -26,7 +26,12 @@*/ #define BOOTENV_SHARED_BLKDEV_BODY (devtypel) \ - "if " #devtypel " dev ${devnum}; then " \ + "if test " #devtypel " = usb ; then " \ + "if " #devtypel " info ${devnum}; then " \ + "setenv devtype " #devtypel "; " \ + "run scan_dev_for_boot_part; " \ + "fi;" \ + "elif " #devtypel " dev ${devnum}; then " \ "setenv devtype " #devtypel "; " \ "run scan_dev_for_boot_part; " \ "fi\0"
Signature · 1 line
2.19.0
PATCH 1/3 efi_loader: support USB boot in distro boot script
Hi Takahiro,
Quoted 17 lines · On Fri, 12 Oct 2018 14:09:07 +0900 AKASHI Takahiro…
With this patch, a removable USB mass storage device attached to the system will also be scanned to find and boot an EFI binary (that is
BOOTEFI_NAME, seeconfig_distro_bootcmd.h).Signed-off-by AKASHI Takahiro <[email protected]>--- include/config_distro_bootcmd.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/include/config_distro_bootcmd.hindex76e12b7bf4ee..dd47e27d6835100644 ---a/include/config_distro_bootcmd.h
+++b/include/config_distro_bootcmd.hinclude/config_distro_bootcmd.h +0
-0@@ -26,7 +26,12 @@*/ #define BOOTENV_SHARED_BLKDEV_BODY (devtypel) \
include/config_distro_bootcmd.h line 37
Quoted 10 lines
include/config_distro_bootcmd.h +6
-1- "if " #devtypel " dev ${devnum}; then " \ + "if test " #devtypel " = usb ; then " \ + "if " #devtypel " info ${devnum}; then " \ + "setenv devtype " #devtypel "; " \ + "run scan_dev_for_boot_part; " \ + "fi;" \ + "elif " #devtypel " dev ${devnum}; then " \ "setenv devtype " #devtypel "; " \ "run scan_dev_for_boot_part; " \ "fi\0"
I can't see how this patch is needed - "usb dev" is a valid command (via do_usb() -> blk_common_cmd()) as long as CONFIG_USB_STORAGE is set.
PATCH 1/3 efi_loader: support USB boot in distro boot script
Quoted 21 lines · Tuomas Tynkkynen
Hi Takahiro,
Quoted 16 lines · On Fri, 12 Oct 2018 14:09:07 +0900 AKASHI Takahiro…
With this patch, a removable USB mass storage device attached to the system will also be scanned to find and boot an EFI binary (that is
BOOTEFI_NAME, seeconfig_distro_bootcmd.h).Signed-off-by AKASHI Takahiro <[email protected]>--- include/config_distro_bootcmd.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/include/config_distro_bootcmd.hindex76e12b7bf4ee..dd47e27d6835100644 ---a/include/config_distro_bootcmd.h
+++b/include/config_distro_bootcmd.h(quoted diff) +0
-0@@ -26,7 +26,12 @@ */
Quoted 14 lines
include/config_distro_bootcmd.h line 37
Quoted 11 lines
include/config_distro_bootcmd.h +6
-1#define BOOTENV_SHARED_BLKDEV_BODY (devtypel) \ - "if " #devtypel " dev ${devnum}; then " \ + "if test " #devtypel " = usb ; then " \ + "if " #devtypel " info ${devnum}; then " \ + "setenv devtype " #devtypel "; " \ + "run scan_dev_for_boot_part; " \ + "fi;" \ + "elif " #devtypel " dev ${devnum}; then " \ "setenv devtype " #devtypel "; " \ "run scan_dev_for_boot_part; " \ "fi\0"I can't see how this patch is needed - "usb dev" is a valid command (via
do_usb()->blk_common_cmd()) as long asCONFIG_USB_STORAGEis set.
Right.
I didn't notice this sub-command, dev, because I first consulted "help usb" with default qemu_arm64_defconfig which doesn't have CONFIG_USB_STORAGE. Since then I've believed it was not available.
Yet my patch #2 should work.
-Takahiro Akashi
PATCH 1/3 efi_loader: support USB boot in distro boot script
Quoted 37 lines · AKASHI Takahiro
Quoted 21 lines · Tuomas Tynkkynen
Hi Takahiro,
Quoted 16 lines · On Fri, 12 Oct 2018 14:09:07 +0900 AKASHI Takahiro…
With this patch, a removable USB mass storage device attached to the system will also be scanned to find and boot an EFI binary (that is
BOOTEFI_NAME, seeconfig_distro_bootcmd.h).Signed-off-by AKASHI Takahiro <[email protected]>--- include/config_distro_bootcmd.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/include/config_distro_bootcmd.hindex76e12b7bf4ee..dd47e27d6835100644 ---a/include/config_distro_bootcmd.h
+++b/include/config_distro_bootcmd.h(quoted diff) +0
-0@@ -26,7 +26,12 @@ */Quoted 14 lines
include/config_distro_bootcmd.h line 37
Quoted 11 lines
include/config_distro_bootcmd.h +6
-1#define BOOTENV_SHARED_BLKDEV_BODY (devtypel) \ - "if " #devtypel " dev ${devnum}; then " \ + "if test " #devtypel " = usb ; then " \ + "if " #devtypel " info ${devnum}; then " \ + "setenv devtype " #devtypel "; " \ + "run scan_dev_for_boot_part; " \ + "fi;" \ + "elif " #devtypel " dev ${devnum}; then " \ "setenv devtype " #devtypel "; " \ "run scan_dev_for_boot_part; " \ "fi\0"I can't see how this patch is needed - "usb dev" is a valid command (via
do_usb()->blk_common_cmd()) as long asCONFIG_USB_STORAGEis set.
Quoted 6 lines
Right.
I didn't notice this sub-command, dev, because I first consulted "help usb" with defaultqemu_arm64_defconfigwhich doesn't haveCONFIG_USB_STORAGE. Since then I've believed it was not available.Yet my patch #2 should work.
Yes, distro boot already supports USB booting just fine. All you need to do is what you did in patch 3 to enable it on a particular target board.
Alex
PATCH 2/3 ARM: qemu-arm: enable usb mass storage in default configuration
In reply to AKASHI TakahiroThis is a preparatory patch so that USB boot will be supported in distro boot script by default.
--- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/qemu_arm64_defconfig +1 -0
@@ -32,3 +32,4 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y +CONFIG_USB_STORAGE=y
configs/qemu_arm_defconfig +1 -0
@@ -32,3 +32,4 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y +CONFIG_USB_STORAGE=y
Signature · 1 line
2.19.0
PATCH 2/3 ARM: qemu-arm: enable usb mass storage in default configuration
Quoted 4 lines · AKASHI Takahiro
This is a preparatory patch so that USB boot will be supported in distro boot script by default.
Signed-off-by AKASHI Takahiro <[email protected]>
How about something like this instead?
Alex
Kconfig +1 -0
@@ -86,6 +86,7 @@ config DISTRO_DEFAULTS select SUPPORT_RAW_INITRD select SYS_LONGHELP imply CMD_MII if NET + imply USB_STORAGE if USB imply USE_BOOTCOMMAND help Select this to enable various options and commands which are suitable
PATCH 2/3 ARM: qemu-arm: enable usb mass storage in default configuration
Quoted 9 lines · Alexander Graf
Quoted 4 lines · AKASHI Takahiro
This is a preparatory patch so that USB boot will be supported in distro boot script by default.
Signed-off-by AKASHI Takahiro <[email protected]>How about something like this instead?
Looks smart.
Thanks,
-Takahiro Akashi
Quoted 15 lines
Alex
Kconfig +1
-0@@ -86,6 +86,7 @@ config DISTRO_DEFAULTS select SUPPORT_RAW_INITRD select SYS_LONGHELP imply CMD_MII if NET + imply USB_STORAGE if USB imply USE_BOOTCOMMAND help Select this to enable various options and commands which are suitable
PATCH 3/3 ARM: qemu-arm: enable USB boot in distro boot with UEFI
In reply to AKASHI TakahiroWith this patch which adds a removable USB mass storage to a list of bootable devices, USB boot is supported in distro boot if UEFI is configured.
--- include/configs/qemu-arm.h | 1 + 1 file changed, 1 insertion(+)
include/configs/qemu-arm.h +1 -0
@@ -45,6 +45,7 @@#define CONFIG_ENV_SECT_SIZE SZ_1M#define BOOT_TARGET_DEVICES (func) \ + func(USB, usb, 0) \ func(SCSI, scsi, 0) \ func(DHCP, dhcp, na)
Signature · 1 line
2.19.0
PATCH 3/3 ARM: qemu-arm: enable USB boot in distro boot with UEFI
Quoted 5 lines · AKASHI Takahiro
With this patch which adds a removable USB mass storage to a list of bootable devices, USB boot is supported in distro boot if UEFI is configured.
Signed-off-by AKASHI Takahiro <[email protected]>
Alex