From a3bd9765f85aab9193e75734649eb09bcfec13ff Mon Sep 17 00:00:00 2001 From: hpa Date: Wed, 29 Dec 2004 21:23:26 +0000 Subject: [PATCH] Add code to detect the boot loader to mdiskchk --- extlinux.doc | 4 ++++ sample/mdiskchk.c | 38 +++++++++++++++++++++++++++++++++++--- sample/mdiskchk.com | Bin 10946 -> 9648 bytes syslinux.doc | 12 ++++++++++++ 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/extlinux.doc b/extlinux.doc index 4a6c3a9..34b84cb 100644 --- a/extlinux.doc +++ b/extlinux.doc @@ -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 diff --git a/sample/mdiskchk.c b/sample/mdiskchk.c index ebc030d..f48263b 100644 --- a/sample/mdiskchk.c +++ b/sample/mdiskchk.c @@ -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 /* 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++; } diff --git a/sample/mdiskchk.com b/sample/mdiskchk.com index 0391f94d422cdab3e838bf0b9943251fea4ba5a1..388217b96b822e8244416a911060e31008da47c2 100755 GIT binary patch delta 4429 zcmZ`c4OkOrn%_*4NeI6xL{Y@hNk+h*64!cX)l@MiwrWMtfPdk1)zz!jeP9CJJ4#}6 z-10GjQ>S~6?X%r2;$HXM-Jb2beWG+rWO_t&y#wibtae!sshx2wrNALV%-lP{*1g^x zL*{$G_xs-8?|tWezxHkCHXLVtWAg(-s{hUqgR@W3OfdT-%`{)6S0O{CCWH)xFtys$ zjX#AQZ_@Z?_r0ly@!S8AM&4Ci3WH#`aUR{leIMd)qlC@8LN#ayDQ;4cg5L zC1_es)4`N8bjv@%@N>H5EDXP-ZC`{8nwEC~K1YWXBrYMvUP89oKdj2-yNSHC-DKJM zjn{IDf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wvy9ObyjPG&FXN1x^(WdhSq?M0?O{_IuUHonJIiZ&EgH zQj4O0f~k9R9~5@4?W2+K1`^&y!apIg+DxWVCyM&(j{{(F1LM(|$qL$xS2IAGtdfe8 z>xxLzSbLDH8aFFe@C8{l1|6C-MPb=YB?FvUUTp|7)AJEPFQqHgHy^5!J~#a!k$pj2tX2_ z@%2)aE9(E8f*odjrx{O+OaAjI$)^NglL3&ZU@~nK?5N z;-uRwGv2hI1d2*z)EbS3R>=nKJVr;!6t{ie+Ufd)Wxv_{d^OP*iF ingSYx5H-fYf73^R8JRL?D>MHR@0$~#pZ>r+g#H4QqfD3p diff --git a/syslinux.doc b/syslinux.doc index 8d9f343..6373d67 100644 --- a/syslinux.doc +++ b/syslinux.doc @@ -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 -- 2.7.4