[SeaBIOS] [PATCH] boot.c: fix 'booting' text for USB devices

Paul Menzel posted 1 patch 29 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/95c1cdf5-c2c0-b4e2-20da-74101846f3ed@molgen.mpg.de
src/boot.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

[SeaBIOS] [PATCH] boot.c: fix 'booting' text for USB devices

Posted by Paul Menzel 29 weeks ago
From: Matt DeVillier <matt.devillier@gmail.com>
Date: Fri, 13 Jun 2014 17:21:57 -0500

Currently, booting from a USB device displays the same text as
booting from a hard disk ('Booting from Hard Disk').

Identify USB devices based on the description string and display
identifying text when booting.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
Upstream commit from https://github.com/MrChromebox/SeaBIOS

 src/boot.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/boot.c b/src/boot.c
index afeb36a..69c602f 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -487,6 +487,7 @@ static struct hlist_head BootList VARVERIFY32INIT;
 #define IPL_TYPE_FLOPPY      0x01
 #define IPL_TYPE_HARDDISK    0x02
 #define IPL_TYPE_CDROM       0x03
+#define IPL_TYPE_USB         0x04
 #define IPL_TYPE_CBFS        0x20
 #define IPL_TYPE_BEV         0x80
 #define IPL_TYPE_BCV         0x81
@@ -564,8 +565,17 @@ boot_add_floppy(struct drive_s *drive, const char *desc, int prio)
 void
 boot_add_hd(struct drive_s *drive, const char *desc, int prio)
 {
-    bootentry_add(IPL_TYPE_HARDDISK, defPrio(prio, DefaultHDPrio)
+    char *usb = "USB";
+    char short_desc[4];
+    memcpy(short_desc, desc, 3);
+    short_desc[3]='\0';
+    if (strcmp(short_desc, usb) == 0) {
+        bootentry_add(IPL_TYPE_USB, defPrio(prio, DefaultHDPrio)
                   , (u32)drive, desc);
+    } else {
+    	bootentry_add(IPL_TYPE_HARDDISK, defPrio(prio, DefaultHDPrio)
+                  , (u32)drive, desc);
+    }
 }
 
 void
@@ -764,7 +774,7 @@ static int HaveHDBoot, HaveFDBoot;
 static void
 add_bev(int type, u32 vector)
 {
-    if (type == IPL_TYPE_HARDDISK && HaveHDBoot++)
+    if ((type == IPL_TYPE_HARDDISK || type == IPL_TYPE_USB) && HaveHDBoot++)
         return;
     if (type == IPL_TYPE_FLOPPY && HaveFDBoot++)
         return;
@@ -802,6 +812,10 @@ bcv_prepboot(void)
             map_hd_drive(pos->drive);
             add_bev(IPL_TYPE_HARDDISK, 0);
             break;
+	case IPL_TYPE_USB:
+            map_hd_drive(pos->drive);
+            add_bev(IPL_TYPE_USB, 0);
+            break;
         case IPL_TYPE_CDROM:
             map_cd_drive(pos->drive);
             // NO BREAK
@@ -962,6 +976,10 @@ do_boot(int seq_nr)
         printf("Booting from Hard Disk...\n");
         boot_disk(0x80, 1);
         break;
+    case IPL_TYPE_USB:
+        printf("Booting from USB Device...\n");
+        boot_disk(0x80, 1);
+        break;
     case IPL_TYPE_CDROM:
         boot_cdrom((void*)ie->vector);
         break;
-- 
2.25.0
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org

[SeaBIOS] Re: [PATCH] boot.c: fix 'booting' text for USB devices

Posted by Kevin O'Connor 29 weeks ago
On Wed, Mar 04, 2020 at 03:02:59PM +0100, Paul Menzel wrote:
> From: Matt DeVillier <matt.devillier@gmail.com>
> Date: Fri, 13 Jun 2014 17:21:57 -0500
> 
> Currently, booting from a USB device displays the same text as
> booting from a hard disk ('Booting from Hard Disk').
> 
> Identify USB devices based on the description string and display
> identifying text when booting.
> 
> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
> ---
> Upstream commit from https://github.com/MrChromebox/SeaBIOS
> 
>  src/boot.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/src/boot.c b/src/boot.c
> index afeb36a..69c602f 100644
> --- a/src/boot.c
> +++ b/src/boot.c
> @@ -487,6 +487,7 @@ static struct hlist_head BootList VARVERIFY32INIT;
>  #define IPL_TYPE_FLOPPY      0x01
>  #define IPL_TYPE_HARDDISK    0x02
>  #define IPL_TYPE_CDROM       0x03
> +#define IPL_TYPE_USB         0x04
>  #define IPL_TYPE_CBFS        0x20
>  #define IPL_TYPE_BEV         0x80
>  #define IPL_TYPE_BCV         0x81

This doesn't look correct to me.  Each IPL ("Initial Program Load") is
a specific method the bios uses to load an initial image.  A USB boot
does not use a different boot method - it uses the harddrive method.
If you're looking for a different description to be printed, then I
recommend enhancing the IPL_TYPE_HARDDISK code so that it can print
the desired description.

-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org

[SeaBIOS] Re: [PATCH] boot.c: fix 'booting' text for USB devices

Posted by Gerd Hoffmann 29 weeks ago
  Hi,

> @@ -802,6 +812,10 @@ bcv_prepboot(void)
>              map_hd_drive(pos->drive);

How about printing pos->description instead?

cheers,
  Gerd
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org