Building a Kernel

If config ran successfully, you will have a kernel compilation directory including a makefile and a whole slew of header files. The traditional place for the compile directory is under the platform directory, which is /usr/src/sys/arch/amd64 for amd64 hardware.

The compile directory contains a subdirectory for each kernel configuration processed by config. My amd64 kernel called TREBLE is in the /usr/src/sys/arch/amd64/compile/TREBLE directory, which contains a makefile, as well as all the header files for all included devices and options.

# cd ../compile/TREBLE
# make

Now it’s time to wait. A successful compilation will create a kernel file bsd without generating any error messages.

Kernel Build Errors

If your kernel fails to build, you probably have a perfectly explicable error. First, read the error message given by the compilation. Most of the time, the error message will explain what the kernel is missing. Generally, you will need to change your kernel configuration in some manner because of an error that config could not catch. A broken kernel compilation will end something like this:

  ../../../../arch/amd64/pci/pci_machdep.c: In function 1'pci_intr_map':
  ../../../../arch/amd64/pci/pci_machdep.c:641: error: 2'PCI_INT_VIA_ISA' undeclared (first use in this function)
  ../../../../arch/amd64/pci/pci_machdep.c:641: error: (Each undeclared identifier is reported only once
3 ../../../../arch/amd64/pci/pci_machdep.c:641: error: for each function it
  appears in.)
  *** Error code 1
4 Stop in /usr/src/sys/arch/amd64/compile/ENVY (line 89 of /usr/share/mk/sys.mk).

This kernel cannot be built because something is missing. When a build fails with statements that something “is undeclared” (as shown in bold), that’s a hint that the kernel is missing a necessary entry.

The name of where it failed might offer you a hint as to what’s missing. In this case, at 1, I have a function name where the compilation failed, and then a specific undeclared variable 2 that caused the compilation to fail.

I would start by figuring out where the pci_intr_map function comes from and what it’s supposed to do. Search the source code and man pages for references to the missing function. Failing that, try the mailing list archives. Be sure to include the function and variable names in any web search. Generic output that says that “there was an error” 3 or “the compile has stopped” 4 is less unique, and hence it could be useful. If all else fails, fall back to the GENERIC configuration.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.61.30