Home > FreeBSD > So You Want A New FreeBSD Boot Loader Option…

So You Want A New FreeBSD Boot Loader Option…

Creating A New FreeBSD Boot Loader Option

The Use Case

There are multiple kernels installed on the FreeBSD host and an option to boot to this kernel is necessary.

Prerequisites

The Patch

This is the patch. Copy/paste it to /boot/beastie.patch for use in the procedure below.

Index: beastie.4th
===================================================================
--- beastie.4th
+++ beastie.4th
@@ -41,6 +41,7 @@
 variable bootkey
 variable bootacpikey
 variable bootsafekey
+variable bootdebugkey
 variable bootverbosekey
 variable bootsinglekey
 variable escapekey
@@ -194,6 +195,7 @@
 	printmenuitem ."  Boot FreeBSD in Safe Mode" bootsafekey !
 	printmenuitem ."  Boot FreeBSD in single user mode" bootsinglekey !
 	printmenuitem ."  Boot FreeBSD with verbose logging" bootverbosekey !
+	printmenuitem ."  Boot FreeBSD with debug kernel" bootdebugkey !
 	printmenuitem ."  Escape to loader prompt" escapekey !
 	printmenuitem ."  Reboot" rebootkey !
 	menuX @ 20 at-xy
@@ -286,6 +288,9 @@
 			s" YES" s" boot_single" setenv
 			0 boot
 		then
+		dup bootdebugkey @ = if
+			s" /boot/DEBUG/kernel" 1 boot
+		then
 		dup escapekey @ = if
 			2drop
 			s" NO" s" autoboot_delay" setenv

Applying The Patch

Follow these steps to apply the patch to your target hosts:

# cd /boot
# cp beastie.4th beastie.4th.orig
# patch -p0 < beastie.patch

The new option will be loaded when loader called beastie.4th.

Advertisements
Categories: FreeBSD
  1. UGG ムートンブーツ
    October 19, 2012 at 11:09 AM

    Wow that was unusual. I just wrote an incredibly long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that
    over again. Anyway, just wanted to say great blog!

  1. October 11, 2012 at 2:18 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: