# Make build kernel crashes - 9.3-RELEASE



## dougs (Feb 15, 2015)

I'm trying to upgrade FreeBSD 9.3-RELEASE to the latest svn version (p9 or revision 278791) as follows:

http://pastebin.com/dAUd87pZ

I've done the above steps three times and it always crashes at the same place. What exactly is it trying to compile and what files are missing? I have absolutely no interest in Xen so don't quite understand what it's going on here. I've checked /usr/src/UPDATING and haven't identified anything that I may have overlooked.

This is my custom kernel config file:

http://pastebin.com/RDS5ysVc

As you might tell, I've stripped out any unneeded drivers and options. Are there any options that may not be needed in order to successfully compile a working kernel?

If anyone could shed some light on this issue, I'd be grateful!

~Doug

P.S. I've been warned I'm over the 12,500 characters limit so am resorting to pastebin to store necessary info. If there are better ways to share info other than pastebin, please do let me know!


----------



## dougs (Feb 15, 2015)

Oh, /etc/make.conf has the following values:

```
#turn off graphic for server
WITHOUT_X11=YES
OPTIONS_UNSET=X11
WITHOUT_FONTCONFIG=YES
OPTIONS_UNSET=FONTCONFIG

WITH_PKGNG=yes

# Line for custom kernel configuration
KERNCONF=ARIES

DEFAULT_VERSIONS+=apache=2.2
```
There isn't any /etc/src.conf. /etc/sysctl.conf has:

```
kern.maxfiles=16384
kern.maxfilesperproc=16384
```
Anything else?

~Doug


----------



## youngunix (Feb 15, 2015)

You need to build kernel with the following command:
`# make <[I]OPTIONS[/I]> buildkernel KERNCONF=<[I]custom kernel configuration file[/I]>`


----------



## diizzy (Feb 15, 2015)

I would try building GENERIC first before messing around with custom kernel configurations that doesn't compile. That said, I don't think -jX is recommended on kernel builds.

So in short, start with `make buildkernel KERNCONF=GENERIC` and remove the KERNCONF line from /etc/make.conf

Does that compile? If that's the case copy the GENERIC config and modify it as you wish.
//Danne


----------



## gkontos (Feb 15, 2015)

Yes, build a GENERIC kernel first and then use this way to start removing options that you don't need.


----------



## wblock@ (Feb 15, 2015)

diizzy said:


> I don't think -jX is recommended on kernel builds.


-j is fine for buildworld, buildkernel, and installkernel (or just kernel, which combines both).  It should not be used for installworld, though.

For the original problem, people often cause problems by creating and having too many things removed in src.conf(5).


----------



## diizzy (Feb 15, 2015)

Good to know, never seen it being mentioned in the documentation along with buildkernel so that was the reason for me mentioning it.


----------



## dougs (Feb 15, 2015)

Yeah, I used Warren Block's custom kernel information to create the custom kernel config file. I'm trying to make the kernel as small as possible because of the memory constraints on this older machine (4GB). ZFS is used.

I am now building using GENERIC and will report back. It's just that this is the first time I've run into this issue on this particular machine. I've rebuilt this custom kernel without any difficulty in the last two-three years. I looked at GENERIC and am unable to detect any significant changes.

~Doug


----------



## diizzy (Feb 15, 2015)

You're not going to save a lot, just a few mbytes tops. ZFS really wants more memory than 4Gb, 8Gb is minimum if you want to work somewhat smoothly.
//Danne


----------



## gkontos (Feb 15, 2015)

dougs said:


> Yeah, I used Warren Block's custom kernel information to create the custom kernel config file. I'm trying to make the kernel as small as possible because of the memory constraints on this older machine (4GB). ZFS is used.



Don't expect to save more than a few MB's.....


----------



## junovitch@ (Feb 16, 2015)

A good place to start:
https://svnweb.freebsd.org/base/head/sys/amd64/conf/MINIMAL?view=log

So there's already work to have a smaller kernel above, but as said above don't expect to save more than a couple MB.  Most of of is disk usage in the form of kernel modules and that only matter much if you don't load them.  With regards to the errors compiling Xen related things, see the note in GENERIC (this is from 10.1-STABLE's config)



> NOTE: XENHVM depends on xenpci.  They must be added or removed together.


----------



## Terry_Kennedy (Feb 16, 2015)

wblock@ said:


> -j is fine for buildworld, buildkernel, and installkernel (or just kernel, which combines both).  It should not be used for installworld, though.


This _does_ get broken, sometimes - usually when there has been a change to one of the files where the error crops up. I normally build with reasonably large -j values (8 to 16), but I've learned that if I get a weird build error, empty /usr/obj and build without -j. Once you get a clean build / install, that particular error shouldn't appear again.

There can also be a similar condition where the kernel build depends on something not present in the existing world, and a buildworld / installworld / mergemaster sometimes needs to be done before building the kernel. That's a lot less common than -j breakage, however.


----------



## dougs (Feb 17, 2015)

Here's what I discovered.

There were five options that appeared to have been added to the GENERIC config file as follows:

```
options  AHC_REG_PRETTY_PRINT  # Print register bitfields in debug
  # output.  Adds ~128k to driver.

options  AHD_REG_PRETTY_PRINT  # Print register bitfields in debug
  # output.  Adds ~215k to driver.

options  IEEE80211_DEBUG # enable debug msgs
options  IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
options  IEEE80211_SUPPORT_MESH  # enable 802.11s draft support
```
Those options were for devices that I had stripped out in my custom kernel file. Once I declared these as 'nooptions', I was able to build with no errors.

Go figure.

~Doug


----------



## gkontos (Feb 17, 2015)

I usually modify my KERNEL only if I need to add something. For example IPSEC......


----------

