Add code to detect the boot loader to mdiskchk
authorhpa <hpa>
Wed, 29 Dec 2004 21:23:26 +0000 (21:23 +0000)
committerhpa <hpa>
Wed, 29 Dec 2004 21:23:26 +0000 (21:23 +0000)
extlinux.doc
sample/mdiskchk.c
sample/mdiskchk.com
syslinux.doc

index 4a6c3a9..34b84cb 100644 (file)
@@ -30,6 +30,10 @@ It works the same way as SYSLINUX, with a few slight modifications.
    limited to 255 characters.
 
 
+4. EXTLINUX currently doesn't support symlinks; it does, however,
+   support hard links.  This will be fixed in a future version.
+
+
 
 Note that EXTLINUX installs in the filesystem partition like a
 well-behaved bootloader :)  Thus, it needs a master boot record in the
index ebc030d..f48263b 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c -*- ------------------------------------------------------------- *
  *   
- *   Copyright 2003 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2003-2004 H. Peter Anvin - All Rights Reserved
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@
 #include <i86.h>               /* For MK_FP() */
 
 typedef unsigned long  uint32_t;
-typedef unsigned int   uint16_t;
+typedef unsigned short uint16_t;
+typedef unsigned char  uint8_t;
 
 struct memdiskinfo {
   uint16_t bytes;              /* Bytes from memdisk */
@@ -38,6 +39,9 @@ struct memdiskinfo {
   void far * oldint13;         /* Old INT 13h */
   void far * oldint15;         /* Old INT 15h */
   uint16_t olddosmem;
+  uint8_t  bootloaderid;
+
+  uint8_t _pad;
 
   /* We add our own fields at the end */
   int cylinders;
@@ -82,6 +86,32 @@ struct memdiskinfo * query_memdisk(int drive)
   return &mm;
 }
 
+const char *bootloadername(uint8_t id)
+{
+  static const struct {
+    uint8_t id, mask;
+    const char *name;
+  } *lp, list[] =
+    {
+      { 0x10, 0xf0, "LILO" },
+      { 0x20, 0xf0, "LOADLIN" },
+      { 0x31, 0xff, "SYSLINUX" },
+      { 0x32, 0xff, "PXELINUX" },
+      { 0x33, 0xff, "ISOLINUX" },
+      { 0x34, 0xff, "EXTLINUX" },
+      { 0x30, 0xf0, "SYSLINUX family" },
+      { 0x40, 0xf0, "Etherboot" },
+      { 0x50, 0xf0, "ELILO" },
+      { 0x70, 0xf0, "GRuB" },
+      { 0x80, 0xf0, "U-Boot" },
+      { 0x00, 0x00, "unknown" }
+    };
+
+  for ( lp = list ; ; lp++ ) {
+    if ( ((id ^ lp->id) & lp->mask) == 0 )
+      return lp->name;
+  }
+}
 
 int main(int argc, char *argv[])
 {
@@ -92,10 +122,12 @@ int main(int argc, char *argv[])
   for ( d = 0 ; d <= 0xff ; d++ ) {
     if ( (m = query_memdisk(d)) != NULL ) {
       printf("Drive %02X is MEMDISK %u.%02u:\n"
-            "\tAddress = 0x%08lx, len = %lu sectors, chs = %u/%u/%u\n"
+            "\tAddress = 0x%08lx, len = %lu sectors, chs = %u/%u/%u,\n"
+            "\tloader = 0x%02x (%s),\n"
             "\tCmdline = %Fs\n",
             d, m->version >> 8, m->version & 0xff,
             m->base, m->size, m->cylinders, m->heads, m->sectors,
+            m->bootloaderid, bootloadername(m->bootloaderid),
             m->cmdline);
       found++;
     }
index 0391f94..388217b 100755 (executable)
Binary files a/sample/mdiskchk.com and b/sample/mdiskchk.com differ
index 8d9f343..6373d67 100644 (file)
@@ -624,6 +624,18 @@ A list of problems, and workarounds (if known), is maintained at:
        http://syslinux.zytor.com/hardware.php
 
 
+   ++++ BOOT LOADER IDS USED ++++
+
+The Linux boot protocol supports a "boot loader ID", a single byte
+where the upper nybble specifies a boot loader family (3 = SYSLINUX)
+and the lower nybble is version or, in the case of SYSLINUX, media:
+
+       0x31 = SYSLINUX
+       0x32 = PXELINUX
+       0x33 = ISOLINUX
+       0x34 = EXTLINUX
+
+
    ++++ BUG REPORTS ++++
 
 I would appreciate hearing of any problems you have with SYSLINUX.  I