# building new kernel question.. (FreeBSD 8 stable)



## osx-addict (Mar 16, 2010)

I've tried following the docs here but when doing the "installkernel" step, it never installs any kernel modules.. My /boot/kernel directory looks like :


```
linking kernel.debug
   text	   data	    bss	    dec	    hex	filename
9182886	 917536	 670200	10770622	 a458be	kernel.debug
objcopy --only-keep-debug kernel.debug kernel.symbols
objcopy --strip-debug --add-gnu-debuglink=kernel.symbols kernel.debug kernel
--------------------------------------------------------------
>>> Kernel build for DL380G3 completed on Tue Mar 16 00:51:49 PDT 2010
--------------------------------------------------------------
srv1# make installkernel KERNCONF=DL380G3
--------------------------------------------------------------
>>> Installing kernel
--------------------------------------------------------------
cd /usr/obj/usr/src/sys/DL380G3;  MAKEOBJDIRPREFIX=/usr/obj  MACHINE_ARCH=i386  MACHINE=i386  CPUTYPE=  GROFF_BIN_PATH=/usr/obj/usr/src/tmp
/legacy/usr/bin  GROFF_FONT_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/groff_font  GROFF_TMAC_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/tmac 
PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/usr/obj/usr/src/tmp/usr
/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  make KERNEL=kernel instal
thiskernel=`sysctl -n kern.bootfile` ;  if [ ! "`dirname "$thiskernel"`" -ef /boot/kernel ] ; then  chflags -R noschg /boot/kernel ;  rm -rf 
/boot/kernel ;  else  if [ -d /boot/kernel.old ] ; then  chflags -R noschg /boot/kernel.old ;  rm -rf /boot/kernel.old ;  fi ;  mv 
/boot/kernel /boot/kernel.old ;  sysctl kern.bootfile=/boot/kernel.old/"`basename "$thiskernel"`" ;  fi
kern.bootfile: /boot/kernel/kernel -> /boot/kernel.old/kernel
mkdir -p /boot/kernel
install -p -m 555 -o root -g wheel kernel /boot/kernel
install -p -m 555 -o root -g wheel kernel.symbols /boot/kernel
srv1# ls -la /boot/kernel
total 48180
drwxr-xr-x  2 root  wheel       512 Mar 16 06:53 .
drwxr-xr-x  9 root  wheel      1024 Mar 16 06:53 ..
-r-xr-xr-x  1 root  wheel  11769117 Mar 16 00:51 kernel
-r-xr-xr-x  1 root  wheel  37476956 Mar 16 00:51 kernel.symbols
```

Am I missing a step, are the docs out of date, or ??  Thanks!


----------



## SirDice (Mar 16, 2010)

Is there anything in /etc/make.conf and/or /etc/src.conf?


----------



## osx-addict (Mar 16, 2010)

the stuff in /etc/make.conf is the vanilla installed version.. I don't recall whether I made any changes in /etc/src.conf though (I don't call).. I do know that it builds the kernel modules and takes a bit of time to do that but doesn't install them.. Unfortunately I can't check the machine until tonight as it's powered off for now..


----------



## SirDice (Mar 16, 2010)

osx-addict said:
			
		

> the stuff in /etc/make.conf is the vanilla installed version..


There shouldn't be any. The file /etc/make.conf doesn't exist by default.


----------



## osx-addict (Mar 16, 2010)

Ok.. Well, I've got one with about a screens worth of stuff.. I can post it later.. 

In the meantime, whats the best way to resurrect the GENERIC kernel and associated modules from the CDROM install media and get it loaded back on the machine?  Speaking of that, if I boot off the install CD and tell it I want to get out of the installer, it opens a virtual terminal but I see nothing.. Am I missing something?


----------



## rambetter (Mar 16, 2010)

Whoa, one thing at a time.

I saw you posted this:


```
make installkernel KERNCONF=DL380G3
```

You have a custom kernel here.  Your custom kernel config will be located here, or in some location that is similar, depending on your architecture (32 bit vs 64 bit, which CPU, etc):

/usr/src/sys/i386/conf/DL380G3

I have a custom kernel too, and custom kernel config file has lines such as the following:


```
# To make a PAE kernel, the next option is needed
options         PAE                     # Physical Address Extensions Kernel

# Don't build modules with the PAE kernel config, since they are not built with
# the correct options headers.
makeoptions     NO_MODULES=yes
```

In my example, you don't want to build or install kernel modules with the PAE kernel because they will be borken.  So maybe you have something similar in your kernel config?

Anyhow, if you want to install the plain vanilla GENERIC kernel, they way I'd do it is as follows:

1. Check out a fresh copy of /usr/src (you can delete /usr/src/ entirely after making sure you save any modified files such as your custom kernel config file, then ``cvsup'' or ``csup'' from the standard supfile, see /usr/share/examples/cvsup/standard-supfile )

2. Remove /usr/obj/src/ .  (See http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html at the very bottom, instructions on getting everything nice and clean.)

3. Follow instructions for building kernel.  You can either omit KERNCONF or specify ``KERNCONF=GENERIC''.

If you want to build everything (userland) as well as the kernel, just follow these instructions: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html


----------



## osx-addict (Mar 16, 2010)

> I saw you posted this:
> 
> 
> ```
> ...



Correct.. I copied /usr/src/sys/i386/conf/GENERIC and initially made some tweaks to remove drivers I knew I didn't have but that kernel wasn't happy so I reverted back to GENERIC with no mods (other than the 'ident' change).


> I have a custom kernel too, and custom kernel config file has lines such as the following:
> 
> 
> ```
> ...


I'll check when I get home this evening...I hadn't noticed this.. 



> Anyhow, if you want to install the plain vanilla GENERIC kernel, they way I'd do it is as follows:
> 
> 1. Check out a fresh copy of /usr/src (you can delete /usr/src/ entirely after making sure you save any modified files such as your custom kernel config file, then ``cvsup'' or ``csup'' from the standard supfile, see /usr/share/examples/cvsup/standard-supfile )
> 
> ...



Thanks.. I'll give it a fresh shot this evening.. Now I just need to solve my SCSI LUN issue.. Ugg..


----------



## osx-addict (Mar 17, 2010)

You were right.. My /etc/make.conf had something listed in it to not make the modules.. However, nothing was in my GENERIC replacement like yours with the options line.. I was able to pull the GENERIC kernel and modules from the installation media and and got my machine running -- easy peasy!  Now I've got yet another kernel building.. Thanks for the help!


----------



## DutchDaemon (Mar 17, 2010)

It wasn't suggested that NO_MODULES=yes is in the GENERIC kernel, just that a custom kernel might contain entries like that (put in once, and forgotten since), and that you should check for them.


----------



## osx-addict (Mar 17, 2010)

Agreed.. At least this time I remembered to squirrel away my generic kernel and it's modules to ensure I didn't lose them like I did the other day resulting in an unusable system.. Luckily the LiveFS/Fixit scheme worked like a charm and I was able to copy over the LiveFS kernel and files back onto my machine and off it went.. :e


----------



## brilthor (Mar 24, 2010)

I'm actually having a similar issue.  When I perform the buildkernel step with my custom config it does not build any modules.

my make.conf is as follows:


```
# added by use.perl 2010-03-18 12:28:58
PERL_VERSION=5.10.1
CFLAGS=-march=nocona -O2 -pipe
```
the per line was already there, the second line I put in myself, more info below

and there is no /etc/src.conf

this is a vm that I installed 8.0 release on for the purpose of compiling a kernel for a remote headless server (yay usb boot race condition).  As such the system is clean with the exception of having installed bash, nano, etc from ports to make life a bit easier

the custom config is fresh, was made by copying GENERIC and adding a couple things, removing others, there is no mention of modules in the file (except a couple comments)

I can compile modules manually by going to the directory and performing some make steps, but from my previous experience (FBSD 5-7) they should just be compiled when I build the kernel

Ideas?

additionally, is it known if zfs can be compiled directly into the kernel instead of being a module


----------

