Custom Kernel for FreeBSD Installation

Devin Teske devin.teske at fisglobal.com
Tue Dec 11 22:30:48 UTC 2012


I built this thing called the "Druid" to handle this (and other) problems.

Here's the idea…

(a) need a custom kernel to install
(b) you need to install said custom kernel to the new distribution else first-boot fails

Enter Druid.

Here's how it works:

===

Step 1. Download the source code to the FreeBSD Druid so you can build a custom ISO with your custom kernel/kernel-distribution

$ cvs -d:pserver:anonymous at druidbsd.cvs.sourceforge.net:/cvsroot/druidbsd login
# Simply press ENTER at the "CVS password:" prompt

If you want the FreeBSD-9 based sources:

$ cvs -z3 -d:pserver:anonymous at druidbsd.cvs.sourceforge.net:/cvsroot/druidbsd co -P druidbsd/druid

or, if you want the FreeBSD-8 based sources:

$ cvs -z3 -d:pserver:anonymous at druidbsd.cvs.sourceforge.net:/cvsroot/druidbsd co -P druidbsd/druid83

# Either of these will take approximately 15 minutes to download (so please be patient)

# Simply try again if you get the following error:
# 	cvs [checkout aborted]: read lock failed - giving up

===

Step 2: Add your custom kernel

$ cd druidbsd/druid/
# or: cd druidbsd/druid83/

$ cp ~/YOURKERNEL mdroot/kernels/YOURKERNEL

$ vi mdroot/boot/menu.rc

# Find the below lines

\ Set kernel paths (see menu_caption[2] below)
set kernel_prefix="kernels/"
set kernel[0]="GENERIC-i386-9.0"
set kernel_suffix=""

# Change to (making YOURKERNEL the first kernel and GENERIC the second)

\ Set kernel paths (see menu_caption[2] below)
set kernel_prefix="kernels/"
set kernel[0]="YOURKERNEL"
set kernel[1]="GENERIC-i386-9.0"
set kernel_suffix=""

# Save the file and exit

# NOTE: At this point, you *could* say "gmake freebsd" and you have FreeBSD-9 installation media that will use your custom kernel (YOURKERNEL) to boot and perform the installation. However, you may have to on to step 3 if that kernel is required to boot your newly installed OS

# NOTE: For the 8.x based media, you'll notice that the "kernel_suffix" is ".kgz" (you will have to kgzip your kernel and make sure it has this suffix else you can modify the suffix; all kernels must have the same suffix, whatever it is).

===

Step 3: Have the custom kernel installed as part of the OS

$ cd src/freebsd/repos/9.0-RELEASE/kernels/
# rest performed as root
$ mkdir distroot
$ cat generic.?? | tar zxf - -C distroot
$ cd distroot
$ cp YOURKERNEL GENERIC/kernel
# Optional: copy in any "*.symbols" files for debug or extra "*.ko" kernel modules into GENERIC/
$ ../../../../tools/distmtree > ../generic.mtree
$ tar czfo ../generic.tgz .
$ cd ..
$ rm -f generic.??
$ split -b 1425408 generic.tgz generic.
$ rm -Rf generic.tgz distroot
# rest performed as you (non-root)
$ ../../../tools/distsum
# This regenerates CHECKSUM.* and *.inf

===

Last, make the custom ISO…

# in the druidbsd/druid or druidbsd/druid83 directory…

./configure && gmake freebsd

# NOTE: GNU make is required. mkisofs is required. And, if you want the ISO to work as-intended and support both burning to CD/DVD _and_ writing to USB thumb drive, you'll need Perl (which usually comes with the required Bytes.pm module -- otherwise, you can do ./configure --disable-isohybrid).

# NOTE: Don't forget that the DRUID installer has both i386 _and_ amd64 architectures (so if you have a custom kernel for both, you'll need to do both repositories in the above-described manner).
-- 
Devin



On Dec 11, 2012, at 6:26 AM, xenophon+freebsd wrote:

> How do I go about replacing the kernel on the FreeBSD installation CDs?
> I assume it's as simple as replacing the relevant files in the ISO
> image, and that if I look at "make release", I can figure out how the CD
> image gets generated. 
> 
> I'm trying to install FreeBSD onto a HP ProLiant DL380 G3 with a Smart
> Array 5i controller, for use as a file server.  Rather than use Smart
> Array's RAID features, I want to use ZFS's RAID-Z1/Z2, so I have
> configured 18 RAID-0 volumes, each consisting of a single drive attached
> to the Smart Array controller.  This totals 18 drives, so at boot time,
> the ciss(4) driver logs the following error:
> 
> 	ciss0: <Compaq Smart Array 5i> port 0x3000-0x30ff mem
> 0xf05c0000-0xf05fffff,0xf04f0000-0xf04f3fff irq 10 at device 3.0 on pci1
> 	ciss0: PERFORMANT Transport
> 	ciss0: adapter claims to report absurd number of logical drives
> (18 > 15)
> 	device_attach: ciss0 attach returned 6	
> 
> According to Paul Saab
> (http://lserinol.blogspot.com/2012/03/freebsd-ciss-driver-logical-drive-
> limit.html), the constant CISS_MAX_LOGICAL limits the amount of memory
> used by the driver for DMA by default.
> 
> Best wishes,
> Matthew
> 
> -- 
> I FIGHT FOR THE USERS
> 
> _______________________________________________
> freebsd-stable at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org"

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.


More information about the freebsd-stable mailing list