Editing the boot menu

Alex Zbyslaw xfb52 at dial.pipex.com
Wed Jun 8 20:54:58 GMT 2005

Paul Schmehl wrote:

> When you use FreeBSD's boot manager, you get a menu like this at bootup:
> F1 DOS
> F2 FreeBSD
> F3 Linux
> F4 ??
> F5 Drive 1
> Default: F2
> Is there a way to edit the list?  Or is that fixed when boot manager 
> is installed and not configurable?
You have to edit the source.  If you know the hex for the partition type 
then it's reasonably easy.  Below is a simple patch that adds 0x7 (my 
NTFS/Windows) and recognises it as DOS.  Done out of curiosity, more 
than anything.

(From memory...)

cd /usr/src
patch < {patchname}
cd sys/boot/i386/boot0/
make install
boot0cfg -B -o packet /dev/{your disk}

Be warned that the final boot0cfg has to be 512 bytes so if you add a 
string it may become longer.  I haven't tested my patch for the serial 
console boot.  The patch incorporates taking out the bell on 
non-serial-console boots as well (pinched from somewhere else, now 
forgotten) -- it was just annoying.  The patch comes with no warranties, 
but it's working for me.  (I don't promise either that including it here 
won't bu**er up the spaces/tabs).

Of course, once you applied and rebuilt you have to write it to your 
boot sector.  Man boot0cfg and don't forget -o packet if your partitions 
go past cylinder 1024.  And have a FreebSD boot CD handy so you can 
rewrite with a standard one if this doesn't work!

The final problem is that if you use cvsup it will trash all over any 
source changes you make when you next run it.  Doing anything about that 
seems more complicated than can be justified for a small number of 
patches so I just keep them in a separate dir an re-apply them whenever 
I need to.  In this case, it will be just after I reaslise that I've 
installed a beeping boot manager again :-)


PS just spotted the -m flag to boo0cfg for the first time.  Amazing what 
you find when you read the man pages :-)

-------------- next part --------------
--- sys/boot/i386/boot0/boot0.S.orig	Wed Jan 26 19:11:21 2005
+++ sys/boot/i386/boot0/boot0.S	Thu May 26 00:51:34 2005
@@ -29,7 +29,7 @@
 		.set PRT_OFF,0x1be		# Partition table
 		.set TBL0SZ,0x3 		# Table 0 size
-		.set TBL1SZ,0xb 		# Table 1 size
+		.set TBL1SZ,0xc 		# Table 1 size
 		.set MAGIC,0xaa55		# Magic: bootable
 		.set B0MAGIC,0xbb66		# Identification
@@ -201,9 +201,13 @@
  * Start of input loop.  Beep and take note of time
+#ifdef SIO
 main.10:	movb $ASCII_BEL,%al		# Signal
 		callw putchr			#  beep!
 		xorb %ah,%ah			# BIOS: Get
+main.10:	xorb %ah,%ah			# BIOS: Get
+#endif		/* SIO */
 		int $0x1a			#  system time
 		movw %dx,%di			# Ticks when
 		addw _TICKS(%bp),%di		#  timeout
@@ -409,7 +413,7 @@
  * These values indicate bootable types we know the names of.
-		.byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83
+		.byte 0x1, 0x4, 0x6, 0x7, 0xb, 0xc, 0xe, 0x83
 		.byte 0x9f, 0xa5, 0xa6, 0xa9
  * These are offsets that match the known names above and point to the strings
@@ -419,6 +423,7 @@
 		.byte os_dos-.			# DOS
 		.byte os_dos-.			# DOS
 		.byte os_dos-.			# DOS
+		.byte os_dos-.			# Windows
 		.byte os_dos-.			# Windows
 		.byte os_dos-.			# Windows
 		.byte os_dos-.			# Windows

More information about the freebsd-questions mailing list