# Kernel exploration via FreeBSD Kernel Internals: An Intensive Code Walkthrough, by McKusick



## decuser (Jul 18, 2018)

I would like to set up a VM to work through the McKusick videos and material. Reading code and talking through it is great, but I really want to be able to tweak bits and see my changes in action. Since the release is available online, I know that I can download pretty much ISO or vm of the version 11 system. I downloaded the 11.0 release that was put out in September 2016 (the book is based on a version from June, but I'm not sure which and figure the release is close enough). I think I want to install the 11.0 as released (rather than 11.2) just to be sure that what I'm looking at hasn't drifted from what is presented in the video/book. My thinking is that if I have an unpatched 11.0 version running in a vm with the source, I can tweak and build and get expected results based on the video talks. My challenge is that pkg isn't installed and if I use pkg to install stuff, it will try to download stuff.

Is it reasonable to set up 11.0 on a vm without internet access and install stuff straight from the DVD?

Thanks,
Will


----------



## decuser (Jul 19, 2018)

Thought about this a bit more and decided that I was going about it in a convoluted manner. Solution:

Install 11.0 in VM and install src
pkg update && pkg upgrade as per usual (this doesn't update the src, doh)
cp -R /boot/kernel/kernel /boot/kernel/GENERIC
cd /usr/src
tweak kernel source as desired
make -j8 buildkernel
install kernel if you dare
boot GENERIC if stuff breaks
etc...


----------



## ShelLuser (Jul 19, 2018)

With these tasks it doesn't really matter what version you're going to use, what does matter is understanding the underlying mechanics.

As to your kernel issue: just copy your default GENERIC kernel into the /boot/kernel.gen directory. Then add this to /boot/loader.conf:

```
kernels="kernel kernel.old kernel.gen"
```
This will make sure that your boot menu will always provide you with 3 kernels to boot from. And since the normal installation process only uses /boot/kernel and /boot/kernel.old you'll always have a backup no matter how badly you mess up.


----------



## decuser (Jul 19, 2018)

I've gone through a few iterations and I have a much better understanding thanks to the comments y'all have provided. Crashed a kernel, booted from the backup version, restored a working copy, etc.


----------

