-This article describes the way to build a kernel right after installation, before the very first reboot. This has been performed on the request of the project leader, Matthew Dillon.\r
-\r
-I used a dual PIII-450MHz machine, and I have built an SMP kernel with pf, vlan and ALTQ features compiled-in. I used the latest PREVIEW ISO to date (20061228). No additional tools are needed. I performed a fresh installation. Prerequisities: you have to know how to create a custom kernel config and build a kernel.\r
-\r
-## Part 1: Mounting the necessary filesystems, copying kernel sources, chroot-ing. \r
-First, boot the machine with the CD and perform a regular installation, but after configuring the system, do not reboot, just leave the installer and log in as root. Then you should mount the root filesystem to the ***/mnt*** mount point:\r
-\r
- \r
-# mount /dev/ad0s1a /mnt\r
-In ***/mnt***, you will have the root of your HD installation mounted. If you have enough space, you can copy ***/usr/src-sys.tar.bz2*** to ***/mnt***, or you can mount additional 'partitions'. Try this:\r
-\r
- \r
- # cat /mnt/etc/fstab\r
-\r
-You'll get an output like this:\r
-\r
- \r
- # Device Mountpoint FStype Options Dump Pass#\r
- /dev/ad0s1a / ufs rw 1 1\r
- /dev/ad0s1b none swap sw 0 0\r
- /dev/ad0s1d /var ufs rw 2 2\r
- /dev/ad0s1e /tmp ufs rw 2 2\r
- /dev/ad0s1f /usr ufs rw 2 2\r
- /dev/ad0s1g /home ufs rw 2 2\r
-proc /proc procfs rw 0 0\r
-To mount the new home directory into ***/mnt/home***:\r
-\r
- \r
-# mount /dev/ad0s1g /mnt/home\r
-Then copy the kernel source tarball to the HDD:\r
-\r
- \r
-# cp /usr/src-sys.tar.bz2 /mnt/\r
-There we go. But now the root is the CD's top-level filesystem and it does confuse the kernel installation (FIXME). Luckily, we can tell the operating system to use another mountpoint (or even a folder) as root. We just tell the system to use /mnt as root.\r
-\r
- \r
-# chroot /mnt\r
-Now your ***/*** is the root of your new installation. Then mount all the remaining partitions:\r
-\r
- \r
-# mount -a\r
-We are done with the first part. Let's just build the new kernel!\r
-\r
-## Part 2: Unpacking the kernel source, building and installing the new kernel \r
-Go into ***/usr*** and unpack the kernel source tarball located in /:\r
-\r
- \r
-# cd /usr && tar xyfv /src-sys.tar.bz2\r
-Then your kernel sources will be in ***/usr/src***. Now create a custom kernel config, I named it SMP and placed it into ***/root'. After you are done with configuring, comes the trickier part. To make sure the kernel and userland are in sync from a developmental point of view, you usually have to ***make buildworld*** before trying to ***make buildkernel***, and the tools from the freshly built world (# userland) are used to build the new kernel. But now you don't have the necessary source files to do the buildworld and if you are on a slower connection, it can take ages to fetch, let alone the build time (takes 4x or 5x of the kernel build time). Luckily you can build a kernel with the toolchain of your current system - the kernel and userland from the CD are in sync, aren't they? :)\r
-\r
- \r
- # cd /usr/src && make nativekernel KERNCONFDIR#/root KERNCONFSMP\r
- <kernel build message flood>\r
-# make installkernel KERNCONFDIR#/root KERNCONFSMP\r
-Note: the ***nativekernel ***target can of course be used anytime, but the kernel and userland have to be in sync, otherwise if you make a kernel on top of an older userland, your system may become unusable.\r
-Done. Now get outta the chroot:\r
-\r
- \r
-# exit\r
-and reboot. Make sure to remove the install CD.\r
-\r
-Hint: you can perform this on a faster machine and place the HDD into the original machine afterwards if you are in a hurry. Be aware of the fact that SMP kernels won't boot on UP machines, though.\r
-----\r
-CategoryHowTo\r
+This article describes the way to build a kernel right after installation, before the very first reboot. This has been performed on the request of the project leader, Matthew Dillon.
+
+
+
+I used a dual PIII-450MHz machine, and I have built an SMP kernel with pf, vlan and ALTQ features compiled-in. I used the latest PREVIEW ISO to date (20061228). No additional tools are needed. I performed a fresh installation. Prerequisities: you have to know how to create a custom kernel config and build a kernel.
+
+
+
+## Part 1: Mounting the necessary filesystems, copying kernel sources, chroot-ing.
+
+First, boot the machine with the CD and perform a regular installation, but after configuring the system, do not reboot, just leave the installer and log in as root. Then you should mount the root filesystem to the ***/mnt*** mount point:
+
+ # mount /dev/ad0s1a /mnt
+
+In ***/mnt***, you will have the root of your HD installation mounted. If you have enough space, you can copy ***/usr/src-sys.tar.bz2*** to ***/mnt***, or you can mount additional 'partitions'. Try this:
+
+ # cat /mnt/etc/fstab
+
+You'll get an output like this:
+
+ # Device Mountpoint FStype Options Dump Pass#
+ /dev/ad0s1a / ufs rw 1 1
+ /dev/ad0s1b none swap sw 0 0
+ /dev/ad0s1d /var ufs rw 2 2
+ /dev/ad0s1e /tmp ufs rw 2 2
+ /dev/ad0s1f /usr ufs rw 2 2
+ /dev/ad0s1g /home ufs rw 2 2
+ proc /proc procfs rw 0 0
+
+To mount the new home directory into ***/mnt/home***:
+
+ # mount /dev/ad0s1g /mnt/home
+
+Then copy the kernel source tarball to the HDD:
+
+ # cp /usr/src-sys.tar.bz2 /mnt/
+
+There we go. But now the root is the CD's top-level filesystem and it does confuse the kernel installation (FIXME). Luckily, we can tell the operating system to use another mountpoint (or even a folder) as root. We just tell the system to use /mnt as root.
+
+
+
+
+
+ # chroot /mnt
+
+Now your ***/*** is the root of your new installation. Then mount all the remaining partitions:
+
+
+
+
+
+ # mount -a
+
+We are done with the first part. Let's just build the new kernel!
+
+
+
+## Part 2: Unpacking the kernel source, building and installing the new kernel
+
+Go into ***/usr*** and unpack the kernel source tarball located in /:
+
+
+
+
+
+ # cd /usr && tar xyfv /src-sys.tar.bz2
+
+Then your kernel sources will be in ***/usr/src***. Now create a custom kernel config, I named it SMP and placed it into ***/root'. After you are done with configuring, comes the trickier part. To make sure the kernel and userland are in sync from a developmental point of view, you usually have to ***make buildworld*** before trying to ***make buildkernel***, and the tools from the freshly built world (# userland) are used to build the new kernel. But now you don't have the necessary source files to do the buildworld and if you are on a slower connection, it can take ages to fetch, let alone the build time (takes 4x or 5x of the kernel build time). Luckily you can build a kernel with the toolchain of your current system - the kernel and userland from the CD are in sync, aren't they? :)
+
+
+
+
+
+ # cd /usr/src && make nativekernel KERNCONFDIR#/root KERNCONFSMP
+
+ <kernel build message flood>
+
+ # make installkernel KERNCONFDIR#/root KERNCONFSMP
+
+Note: the ***nativekernel*** target can of course be used anytime, but the kernel and userland have to be in sync, otherwise if you make a kernel on top of an older userland, your system may become unusable.
+
+Done. Now get outta the chroot:
+
+
+
+
+
+ # exit
+
+and reboot. Make sure to remove the install CD.
+
+
+
+Hint: you can perform this on a faster machine and place the HDD into the original machine afterward if you are in a hurry. Be aware of the fact that SMP kernels won't boot on UP machines, though.
+
+