# lean kernel of 9.1 p3



## tommyhp2 (May 17, 2013)

Hi,

I'm having problems booting to a lean 9.1-p3 kernel My /etc/make.conf consists of

```
KERNCONF=custom
CPUTYPE=?opteron
```
and my /etc/src.conf has

```
WITHOUT_GAMES
WITHOUT_LIB32
```

With the above, I can `make buildworld` and `make buildkernel installkernel` of the GENERIC kernel and the system boots without any issue.  But my custom kernel which is a copy of GENERIC with the following removed via comment:

RAID and SCSI controllers
All NICs, including wireless, except `em`
Bluetooth
USB
Video display devices and options except `vga`
cannot boot past the menu even though the `make buildkernel installkernel` is OK.  Has anyone attempt a minimalist kernel similar to above and was successful?

Thanks,
Tommy


----------



## SirDice (May 17, 2013)

There's most likely something missing from your kernel configuration. Just because it builds fine that doesn't mean it will run fine.

Post your kernel configuration so we can have a look.


----------



## jozze (May 17, 2013)

I am using 9.1-STABLE, but my configuration file is almost the same since 9.0 and it works quite well. You can have a look:

My kernel configuration file, my /etc/make.conf, and my /etc/src.conf.

Be sure you have all the necessary options, so the kernel can recognize your hard drive. I remember I had some trouble there: my hard drive device name has the format /dev/adaXpY, and I think I had to enable some SCSI or RAID things.

Unlike you, I basically kept only the wireless and all USB ports 

You can compare it with yours and hopefully find the root of your troubles.


----------



## kpa (May 17, 2013)

You definitely can strip most of the drivers out of the kernel but if you remove a driver that is needed to boot you'll have to remember to load it as a module in loader.conf(5). Figuring out if a driver is needed to boot can be tricky but in general the disk drivers and the various drivers that interface cam(3) with the disk drivers are among those.


----------



## tommyhp2 (Jun 6, 2013)

Thanks everyone for the replies.  I got back from vacation last week and didn't have time to twink with it until now.  I was comparing my kernel with @jozze's and decided to remove additional (older FreeBSD version compatibilities) options and it booted OK.  Hopefully I won't need any ports that depends on those older versions.  If I run into problems later, I'll revisit this again.


----------



## SirDice (Jun 6, 2013)

tommyhp2 said:
			
		

> I was comparing my kernel with @jozze's and decided to remove additional (older FreeBSD version compatibilities) options and it booted OK.  Hopefully I won't need any ports that depends on those older versions.


You mean the COMPAT_FREEBSD8 for example? You only need those if you want to run binaries that are compiled for an older version on a new version. If you build from ports or use the official package repository you shouldn't need them and they can safely be removed.

One notable exception are some Java ports. They require a bootstrap to build as you need Java to be able to build Java (kind of a chicken and egg problem).


----------



## jozze (Jun 6, 2013)

tommyhp2 said:
			
		

> Thanks everyone for the replies.  I got back from vacation last week and didn't have time to twink with it until now.  I was comparing my kernel with @jozze's and decided to remove additional (older FreeBSD version compatibilities) options and it booted OK.  Hopefully I won't need any ports that depends on those older versions.  If I run into problems later, I'll revisit this again.



About that version of my kernel configuration: that week I discovered I had to enable another option in it, in order to be able to boot into the single user mode. If you have the same trouble, enable this in your kernel configuration file:


```
device           kbdmux           #keyboard multiplexer
```

or just check out my fixed version of the kernel on github (I think I had to enable another USB device, so just in case). You need to do this, if you use a USB keyboard.


----------



## tommyhp2 (Jun 9, 2013)

SirDice said:
			
		

> You mean the COMPAT_FREEBSD8 for example? You only need those if you want to run binaries that are compiled for an older version on a new version. If you build from ports or use the official package repository you shouldn't need them and they can safely be removed.
> 
> One notable exception are some Java ports. They require a bootstrap to build as you need Java to be able to build Java (kind of a chicken and egg problem).


Yes, I removed those.  Thanks for that info.  I do remember having that problem with java when I was compiling Diablo-JDK for the older version of FreeBSD.  But I'm planning on using OpenJDK now though.



			
				jozze said:
			
		

> About that version of my kernel configuration: that week I discovered I had to enable another option in it, in order to be able to boot into the single user mode. If you have the same trouble, enable this in your kernel configuration file:
> 
> 
> ```
> ...


I left all the legacy keyboard and mouse in place since these systems are VM guests in KVM so I didn't have any other problems.  Thanks for the heads up though.


----------



## SirDice (Jun 10, 2013)

tommyhp2 said:
			
		

> But I'm planning on using OpenJDK now though.


_Building_ java/openjdk7 on FreeBSD 9.x requires COMPAT_FREEBSD8. It's needed for java/bootstrap-openjdk. You don't need it once it is built or if you install from packages.


----------

