# what are the restrictions for kernel names?



## mrjayviper (May 11, 2014)

Hello. I'm thinking of using "kernel.10" as the name for my custom kernel. Is this allowed? I've tried searching the net for restrictions on kernel names but I didn't find anything.

I don't intend to use symbols like hashes or asterisks etc. I'll limit my kernel names to combinations of alphanumeric characters, dots, underscores and hyphens.

Thanks a lot


----------



## fonz (May 11, 2014)

mrjayviper said:
			
		

> Hello. I'm thinking of using "kernel.10" as the name for my custom kernel. Is this allowed?


That's a good question  config(8) doesn't seem to mind and a quick test suggests that a kernel with such a name builds just fine. So I suggest you just try, it will probably work. Hint: keep a GENERIC or other known-to-be-working kernel around, just to be sure.

Edit: my educated guess is that the kernel itself really won't care much and accepts any valid C string but in practice you'll be subject to whatever restrictions the filesystem imposes on filenames.


----------



## mrjayviper (May 11, 2014)

*T*hanks. I never remove GENERIC from the conf folder!


----------



## fonz (May 11, 2014)

mrjayviper said:
			
		

> I never remove GENERIC from the conf folder!



You probably meant the conf _directory_. Folders are for storing e-mail and for communicating with Microsoft people 
More to the point: what I meant was to make sure you keep a GENERIC (or other working) kernel installed in /boot.


----------



## mrjayviper (May 11, 2014)

*O*h gotcha. I don't think I ever delete the GENERIC kernel unless of course `make installkernel` does it automatically?


----------



## fonz (May 11, 2014)

mrjayviper said:
			
		

> unless of course `make installkernel` does it automatically?


`make installworld` renames /boot/kernel to /boot/kernel.old, but at some point you might lose track of whether that is actually GENERIC or not. I usually recommend explicitly copying/installing the GENERIC kernel into /boot/GENERIC.


----------



## mrjayviper (May 11, 2014)

*T*hank you very much


----------



## phoenix (May 12, 2014)

mrjayviper said:
			
		

> Hello. I'm thinking of using "kernel.10" as the name for my custom kernel. Is this allowed? I've tried searching the net for restrictions on kernel names but I didn't find anything.
> 
> I don't intend to use symbols like hashes or asterisks etc. I'll limit my kernel names to combinations of alphanumeric characters, dots, underscores and hyphens.
> 
> Thanks a lot



Don't use punctuation of any kind, including periods.  Stick to just letters and numbers.  And numbers are really only safe on later versions of FreeBSD (there were issues with numbers on 7.x and 8.x; it should be safe on 9+).

When installing new kernels or upgrading the OS, I recommend the following process:

```
# cd /usr/src
# make cleanworld
# make buildworld
# make KERNCONF=MYKERNELNAME buildkernel
# make KERNCONF=MYKERNELNAME KODIR=/boot/MYKERNELNAME installkernel
# nextboot -k MYKERNELNAME
# shutdown -r now
<make sure the new kernel boots correctly>
<if the kernel boots correctly, then>
# rm -rf /boot/kernel
# cp -Rvp /boot/MYKERNELNAME /boot/kernel
# cd /usr/src
# make installworld
# mergemaster -iUF
# shutdown -r now
```
If the new kernel doesn't work, just reboot, and you will be back up and running with the old kernel.

nextboot configures the loader to boot a different kernel for the next boot only.  Wonderful for testing kernels, as you don't lose your working kernel.  And "reboot to get the old kernel back" is a lot easier than manually pointing the loader at /boot/kernel.old and manually loading the correct modules, etc. etc.


----------



## mrjayviper (May 13, 2014)

Thanks for the suggestions and tips.


----------

