Auto Custom Kernel Compile

HomeTurf

New Member


Messages: 2

Hello, was showing a friend how to make a custom kernel when I thought of something...

I was wondering anyone knew of a script that creates a custom kernel configuration file for the machine its currently on.

Yes you can do it by checking out your hardware and creating a new MYKERNEL file and compiling it just as the handbook tells you too.
I was thinking more of a script that goes through dmesg and pulls out all the devices and options that the kernel actually used to boot the system. Actually come to think of it, is there a list like this that the system creates and stores somewhere on the file system by chance?
In Summary: say you got computers of all types sizes, shapes, colors, and personalities,
(yes that was a joke) does anyone know of a script that creates a new GENERIC file for each computer.
I just thought it would be cool to make a script that has the bare minimum requirement to get the current configuration of the computer up and running. That way people who dont understand the build your custom kernel part of the handbook can still get their own custom kernel.
In the meantime i think ill start writing a script to do just this... but why reinvent the wheel if its already out there

thanks guys
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,318
Messages: 38,835

HomeTurf said:
does anyone know of a script that creates a new GENERIC file for each computer.
You should NOT edit GENERIC. Make a copy of it, with another name.
 
OP
H

HomeTurf

New Member


Messages: 2

SirDice said:
You should NOT edit GENERIC. Make a copy of it, with another name.

Oops, should of bothered to proof read :r
in-case it was not obvious i meant MYKERNEL
thank you
 

trasz@

Active Member
Developer

Reaction score: 74
Messages: 228

Just for the record, there is a tool in NetBSD called "adjustkernel" that does what you describe - only for NetBSD, of course, not FreeBSD.
 

Zirias

Son of Beastie

Reaction score: 1,537
Messages: 2,663

In general, there's just no point to do so. Leaving stuff out of GENERIC doesn't buy much, neither in disk usage nor in compile time. It also doesn't buy anything regarding security (drivers not used are code never called, and for modules, the "bad guys" will bring their own, so better have a look at kern.securelevel sysctl).

Side note: IF you customize your kernel for whatever reason, don't copy and edit GENERIC. Instead create a new file and include it, like this:
Code:
include GENERIC
ident MYKERNEL

device <some added driver>
nodevice <some removed driver>
nooptions <some removed option>
[...]
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,318
Messages: 38,835

Yeah, unless you're building for some small installation like an embedded system, don't bother with a custom kernel. Just use GENERIC, it'll make updating with freebsd-update(8) easier too.
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,588

Exactly. The only time I do custom kernel is my NanBSD builds and they are tailored to only a single piece of hardware.
I did add VNET to my 11.x Kernel. So trying out new experimental features is another use case for me.
Every once and a while I like to rant about floppy disk support in kernel. I can honestly saw I have not used a floppy in over 10 years.
 

Zirias

Son of Beastie

Reaction score: 1,537
Messages: 2,663

Every once and a while I like to rant about floppy disk support in kernel. I can honestly saw I have not used a floppy in over 10 years.
I wouldn't drop the code if there's no pressing need, but having it enabled in GENERIC might be a bit useless indeed ;)
 

neilulrich

New Member

Reaction score: 1
Messages: 12

Previous versions of FreeBSD I would "make lint" to see all of the options available for kernel building.
 
Top