diff mbox series

[1/3] efi_loader: support USB boot in distro boot script

Message ID 20181012050909.7009-2-takahiro.akashi@linaro.org
State New
Headers show
Series uefi: support USB boot in distro boot | expand

Commit Message

AKASHI Takahiro Oct. 12, 2018, 5:09 a.m. UTC
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).

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 include/config_distro_bootcmd.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Tuomas Tynkkynen Oct. 13, 2018, 11:21 p.m. UTC | #1
Hi Takahiro,

On Fri, 12 Oct 2018 14:09:07 +0900
AKASHI Takahiro <takahiro.akashi@linaro.org> wrote:

> 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).
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  include/config_distro_bootcmd.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/config_distro_bootcmd.h
> b/include/config_distro_bootcmd.h index 76e12b7bf4ee..dd47e27d6835
> 100644 --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -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"

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.
AKASHI Takahiro Oct. 15, 2018, 4:53 a.m. UTC | #2
On Sun, Oct 14, 2018 at 02:21:11AM +0300, Tuomas Tynkkynen wrote:
> Hi Takahiro,
> 
> On Fri, 12 Oct 2018 14:09:07 +0900
> AKASHI Takahiro <takahiro.akashi@linaro.org> wrote:
> 
> > 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).
> > 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  include/config_distro_bootcmd.h | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/config_distro_bootcmd.h
> > b/include/config_distro_bootcmd.h index 76e12b7bf4ee..dd47e27d6835
> > 100644 --- a/include/config_distro_bootcmd.h
> > +++ b/include/config_distro_bootcmd.h
> > @@ -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"
> 
> 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.

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&#3 should work.

-Takahiro Akashi
Alexander Graf Oct. 16, 2018, 1:18 p.m. UTC | #3
On 15.10.18 06:53, AKASHI Takahiro wrote:
> On Sun, Oct 14, 2018 at 02:21:11AM +0300, Tuomas Tynkkynen wrote:
>> Hi Takahiro,
>>
>> On Fri, 12 Oct 2018 14:09:07 +0900
>> AKASHI Takahiro <takahiro.akashi@linaro.org> wrote:
>>
>>> 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).
>>>
>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>> ---
>>>  include/config_distro_bootcmd.h | 7 ++++++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/config_distro_bootcmd.h
>>> b/include/config_distro_bootcmd.h index 76e12b7bf4ee..dd47e27d6835
>>> 100644 --- a/include/config_distro_bootcmd.h
>>> +++ b/include/config_distro_bootcmd.h
>>> @@ -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"
>>
>> 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.
> 
> 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&#3 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
diff mbox series

Patch

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 76e12b7bf4ee..dd47e27d6835 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -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"