From: Matt DeVillier <matt.devill...@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.devill...@gmail.com>
Signed-off-by: Paul Menzel <pmen...@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-le...@seabios.org

Reply via email to