From hampi@rootshell.be  Mon Aug 16 10:32:22 2004
Return-Path: <hampi@rootshell.be>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8C40316A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Aug 2004 10:32:22 +0000 (GMT)
Received: from smtp.hispeed.ch (mxout.hispeed.ch [62.2.95.247])
	by mx1.FreeBSD.org (Postfix) with ESMTP id EF65F43D3F
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Aug 2004 10:32:21 +0000 (GMT)
	(envelope-from hampi@rootshell.be)
Received: from gicco.homeip.net (80-218-73-163.dclient.hispeed.ch [80.218.73.163])
	by smtp.hispeed.ch (8.12.6/8.12.6/tornado-1.0) with ESMTP id i7GAWKuM001980
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Aug 2004 12:32:20 +0200
Received: from goofy.here (localhost.here [127.0.0.1])
	by gicco.homeip.net (8.13.1/8.13.1) with ESMTP id i7GAWDoN001006
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Aug 2004 12:32:14 +0200 (CEST)
	(envelope-from idefix@goofy.here)
Received: (from idefix@localhost)
	by goofy.here (8.13.1/8.13.1/Submit) id i7GAWDjq001005;
	Mon, 16 Aug 2004 12:32:13 +0200 (CEST)
	(envelope-from idefix)
Message-Id: <200408161032.i7GAWDjq001005@goofy.here>
Date: Mon, 16 Aug 2004 12:32:13 +0200 (CEST)
From: Hanspeter Roth <hampi@rootshell.be>
Reply-To: hampi@rootshell.be
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] boot0 hides Lilo in extended slice
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         70531
>Category:       i386
>Synopsis:       [boot0] [patch] boot0 hides Lilo in extended slice
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-i386
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 16 10:40:22 GMT 2004
>Closed-Date:    Wed Oct 12 06:13:59 UTC 2011
>Last-Modified:  Wed Oct 12 06:13:59 UTC 2011
>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@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:
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Wed Jul 14 10:00:31 UTC 2010 
State-Changed-Why:  
Hello, can you confirm that this is still relevant? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70531 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Wed Oct 12 06:13:58 UTC 2011 
State-Changed-Why:  
I Dont recall seeing a reply on this at all. Closing PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70531 
>Unformatted:
