Modularize kernel

Howard Su howard0su at gmail.com
Thu Sep 7 05:47:47 UTC 2006


Modularize kernel


In today's FreeBSD, KERNEL image is still the big image that contains
a lot core components.
Although we support module, however most of users are still using
customize big kernel image.
advantage:
1. Don't ask user to rebuild the kernel when they want new
feature/module/driver. This make it easy to do binary update to
improve the supportability and security.
2. Every piece in kernel is regarded as a module except rtld.
3. the kernel options can be centralized
4. enable other enhances in kernel like auto load device driver,
on-daemon kernel dependency, binary update for kernel, quick boot
5. We don't need files/files.{ARCH} anymore. the Makefile under the
module will be used for this purpose
6. Load different kernel based on different settings. For example, we
can provide two kernels (UP and SMP) like Windows do.
7. No more GENERIC. Not all user need rebuild kernel anymore. More
productivity due to the fact all the files are pre-compiled in most
user
machines.
8. Easily maintain the code. Naturally, the code is separated into the modules.

disadvantage:
1. Bring complex into the boot procedure.
2. Kernel become a kernel module. We need some way to verify all
symbols can be resolved in the compile stage.
3. config(8) need some sorts of changes.

implementation details:
1. kernel image still exists. It only contains rtld and it's dependency.
2. a new 'unix' image contains the basic stuffs in today's freebsd.
like MM, scheduler, etc.
3. other preload modules can be set in loader.conf
   acpi, atadisk/scsidisk/nfsclient (the core driver that are
depended by boot process.)
4. mapping table from deviceid->devicedriver? (that can offer us new
feature to auto load drivers.)
5. loader.conf can be automatically regen after system suecessful
reboot. The utility can check the root device driver to decide what is
required during boot.

New Kenrel Build Process
Kernel Config File
   |
   | config(1)
   |
Kernel Global Opt file (opt_all.h)
Make file contains the module defines only
   |
   | below is exact same as current implementations
   |
run make
   |
   |
make install

New Kernel Boot Process
Boot0
  |
Boot1
  |
Boot2
  |
rtld startup and try to load kernel and its dependencies
  |
kernel start. Initialize other part by SYSINIT order
I am writing this email to get some advice on the direction and implementation.

--
-Howard


More information about the freebsd-arch mailing list