Some quirky things about building the kernel

Hello.

I created the config file as a non-privileged user and then as a root user, soft linked this file into /usr/src/sys/amd64/conf. Later on, I compiled the kernel with make buildkernel KERNCONF='name-of-new-conf-file'. It went straight ahead without flagging any error or anything.

As usual, I didn't suspect anything amiss since I could see a lot of source files being compiled. Later on when I tried to install the kernel using make installkernel KERNCONF='name-of-new-conf-file', it failed saying there is no directory for the new configuration under /usr/obj/usr/src/sys/ and indeed there was none.

Then as root, I copied the same conf file as before into the root user's HOME directory and modified the above soft link to point to this newly copied file instead of it's original location and then everything seemed to work perfectly. This time around I was able to install the kernel and I could also see a new folder under /usr/obj/usr/src/sys/ corresponding to this new configuration.

I am at my wit's end to understand if this is by design or if I am doing something wrong here. Keen to hear what you folks have to say about this
 
One thing to test is if it's caused by the /home symlink that points to the real home directory at /usr/home. Lot's of the ports(7) and build(7) infrastructure isn't quite symlink safe unfortunately.
 
One thing to test is if it's caused by the /home symlink that points to the real home directory at /usr/home. Lot's of the ports(7) and build(7) infrastructure isn't quite symlink safe unfortunately.
I am of the opinion that is more of a permissions issue rather than a symlink issue since my current config file is also a symlink however this time around it is symlinked from the root user's HOME directory. Previously it was symlinked from a regular user's HOME directory. May be I am wrong. Or perhaps if I had used that regular user account to build the kernel (with a sudo of course) this would not have been the case. I am not sure :rolleyes:
 
Did you link the file to, for example, ~/kernels/mykernel or did you specifically used the full path? I.e. /usr/home/myuser/kernels/mykernel.

The first will 'translate' ~ to the user's home directory. But it will depend on which user is looking at it.
 
Sometimes a -> ../../../b/c/d is good, you can move the tree and moved a refers to moved d. And sometimes a -> /e/b/c/d is more appropriate.

Don't know it that is related, but the system does like to make deep copies of directories.

Juha
 
Did you link the file to, for example, ~/kernels/mykernel or did you specifically used the full path? I.e. /usr/home/myuser/kernels/mykernel.

The first will 'translate' ~ to the user's home directory. But it will depend on which user is looking at it.
Ah that makes a lot of sense. Will have to check it out.
 
I've made forward progress with the compilation and have managed to install a custom kernel with CAM debug logs. Now those logs are proving to be just too much. So I've removed those options from the kernel configuration file (I'll probably start another thread about storage/io stack later).

I've learned the hard way that one always needs to keep his/her GENERIC kernel handy, just in case the custom kernel doesn't boot or so. Hence I renamed /boot/kernel.old/ to /boot/kernel.GENERIC. However what I'd like to know is, where are the modules for a given kernel loaded from? And the dependencies.

Secondly, after moving /boot/kernel.old/ to /boot/kernel.GENERIC, I've noticed that /boot/kernel.old never gets created automatically after building a new kernel. Do I have to create the /boot/kernel.old directory myself?
 
Modules are loaded from /boot/kernel or /boot/kernel.GENERIC or /boot/<whatever your kernel name is>. Those are directories which have the kernel itself and all the modules with it. For me, it is kind of a waste of space to have duplicates of all the modules with each kernel. There is a /boot/modules directory, but I don't know how to get the system to use that instead. As for dependencies, modules that are used by other modules are also in the associated kernel directory. As for the last one, I am not sure.
 
I have worked on projects where storage is a concern, primarily in the embedded arena. My understanding is that all the modules that are built with the kernel are the same across all kernels for a given platform. At least that has been my experience with working for FreeBSD. I have yet to encounter a situation where they would be different. Don't get me wrong, I'm sure they exist, just that I haven't seen it.
 
Back
Top