i386/70531: [patch] boot0 hides Lilo in extended slice

Hanspeter Roth hampi at rootshell.be
Mon Aug 16 03:40:23 PDT 2004


>Number:         70531
>Category:       i386
>Synopsis:       [patch] boot0 hides Lilo in extended slice
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 16 10:40:22 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hanspeter Roth
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD goofy.here 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Sat Aug 14 16:52:51 CEST 2004 user at goofy.here:/usr/src/sys/i386/compile/F5 i386


	
>Description:
	Boot0 considers extended slices (partitions) 0x5 and 0xf as 
	`invalid' (nonbootable). This is not true. Lilo and Grub do work
	for extended (logical) partitions if installed in the extended
	partition. If an extended partition should be hidden `boot0cfg
	-m mask' should be used.
	On a laptop it makes sense using the FreeBSD boot loader in order
	to boot *BSD. Grub is very heavy and wastes battery charge useless.
	If Linux in an extended partition is to be booted Lilo can take
	care of the rest.
>How-To-Repeat:
	
>Fix:

	These patches remove the 0x5 and 0xf codes from the `invalid'
	partitions table but add two other bytes and thus keeping the
	original size of the boot block.

	The current boot0cfg cannot be used with `-o packet' (#70525).

diff -ru sys.orig/boot/i386/boot0/boot0.S sys/boot/i386/boot0/boot0.S
--- sys.orig/boot/i386/boot0/boot0.S	Thu Jun 17 14:02:25 2004
+++ sys/boot/i386/boot0/boot0.S	Mon Aug 16 12:02:28 2004
@@ -28,8 +28,8 @@
 
 		.set PRT_OFF,0x1be		# Partition table
 
-		.set TBL0SZ,0x3 		# Table 0 size
-		.set TBL1SZ,0xb 		# Table 1 size
+		.set TBL0SZ,0x1 		# Table 0 size
+		.set TBL1SZ,0xc 		# Table 1 size
 
 		.set MAGIC,0xaa55		# Magic: bootable
 		.set B0MAGIC,0xbb66		# Identification
@@ -414,12 +414,20 @@
 /*
  * These entries identify invalid or NON BOOT types and partitions.
  */
-		.byte 0x0, 0x5, 0xf
+		.byte 0x0
+/*
+ * 0x5 and 0xf are extended partitions. They may contain another boot loader
+ * such as Lilo.
+ * It is up to the user whether there is a boot loader.
+ * If it should be hidden `boot0cfg -m mask' should be used.
+ */
+
 /*
  * These values indicate bootable types we know the names of
  */
 		.byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83
 		.byte 0x9f, 0xa5, 0xa6, 0xa9
+		.byte 0xf
 /*
  * These are offsets that match the known names above and point to the strings
  * that will be printed.
@@ -436,6 +444,7 @@
 		.byte os_freebsd-.		# FreeBSD
 		.byte os_bsd-.			# OpenBSD
 		.byte os_bsd-.			# NetBSD
+		.byte os_misc+1-.		# extended partition with Lilo?
 /*
  * And here are the strings themselves. 0x80 or'd into a byte indicates
  * the end of the string. (not so great for Russians but...)
diff -ru sys.orig/boot/i386/boot0/boot0ext.S sys/boot/i386/boot0/boot0ext.S
--- sys.orig/boot/i386/boot0/boot0ext.S	Thu Apr 29 20:58:38 2004
+++ sys/boot/i386/boot0/boot0ext.S	Mon Aug 16 12:06:57 2004
@@ -448,13 +448,21 @@
 /*
  * These entries identify invalid or NON BOOT types and partitions.
  */
-table0:		.byte 0x0, 0x5, 0xf
+table0:		.byte 0x0
 table0_end:
 /*
+ * 0x5 and 0xf are extended partitions. They may contain another boot loader
+ * such as Lilo.
+ * It is up to the user whether there is a boot loader.
+ * If it should be hidden `boot0cfg -m mask' should be used.
+ */
+
+/*
  * These values indicate bootable types we know the names of
  */
 table1:		.byte 0x1, 0x4, 0x6, 0x7, 0xb, 0xc, 0xe, 0x42, 0x63, 0x83
 		.byte 0x9f, 0xa5, 0xa6, 0xa9
+		.byte 0xf
 table1_end:
 /*
  * These are offsets that match the known names above and point to the strings
@@ -475,6 +483,7 @@
 		.byte os_freebsd-.		# FreeBSD
 		.byte os_openbsd-.		# OpenBSD
 		.byte os_netbsd-.		# NetBSD
+		.byte os_misc-.			# extended partition with Lilo?
 /*
  * And here are the strings themselves. 0x80 or'd into a byte indicates
  * the end of the string. (not so great for Russians but...)
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list