(8) Kernel - (Do Not Panic)

The boot loader will load the kernel from the SD-Card which incidentally has to be a FAT partition . . . We can set this latter by editing /etc/fstab.

The simple, sane, quick method is to simply re-use the Raspbian /boot partition, which is the method we will use.

The disadvantage, is that we have not installed the Kernel sources and sorted out /lib/modules. These are not needed at this stage, and its plausible you will never need them unless you are going to do something like compile X Windows. Post Install, its fairly easy to copy these across or download what you need from Git Hub.

Why make life hard ?

We do not need to do anything until we finish the install, what follows is information for latter. Do not type anything until the next page plz !!



(POST INSTALL) Install latest Kernel7.img & matching Source Code (POST INSTALL)


Really, you will want to do this POST INSTALL because then you will then have the gentoo tools installed, to handle things like unmasking.

What follows is information for latter, when you will want the correct source installed to compile things like X Windows - not for installing a minimal system.




To get the latest compiled version of the kernel, and it is updated constantly.. Note in the next example, you will probably need to edit adjust the path to your system

cd /tmp/
git clone --depth 1 git://github.com/raspberrypi/firmware/
cd firmware/boot
cp -r * /mnt/genoot/boot/
cp -r ../modules /mnt/genoot/lib/ 

Now have the latest version of the kernel installed. After a reboot, to find out which version of Linux Kernel is currently loaded and running :

uname -r


All we need to do is find the matching source code. sys-kernel/raspberrypi-sources-4.4.9999 These packages are always masked, we will have to authorize portage to unmask the package.

emerge --search raspberrypi

Before you run this, know that Portage will complain that it is "masked", do not panic, this is normal

emerge --ask =sys-kernel/raspberrypi-sources-4.4.9999

To keep Portage happy, use the tool etc-update to sort the mask accept stuff


Scanning Configuration files...
The following is the list of files which need updating, each
configuration file is followed by a list of possible replacement files.
1) /etc/portage/package.accept_keywords (1)
Please select a file to edit by entering the corresponding number.
              (don't use -3, -5, -7 or -9 if you're unsure what to do)
              (-1 to exit) (-3 to auto merge all files)
                           (-5 to auto-merge AND not use 'mv -i')
                           (-7 to discard all updates)
                           (-9 to discard all updates AND not use 'rm -i'): -3
Replacing /etc/portage/package.accept_keywords with /etc/portage/._cfg0000_package.accept_keywords
mv: overwrite '/etc/portage/package.accept_keywords'? yes
Exiting: Nothing left to do; exiting. :)

emerge --ask =sys-kernel/raspberrypi-sources-4.4.9999


Dedicated /boot Partition

A more complex alternative, is to create an extra /boot partition FAT c exclusively for Gentoo which would require hacking NOOBS internals. That method does give a pretty boot menu, but at the expense of precious space on the SD Card. It is impossible to successfully boot the kernel off the USB Drive using NOOBS . . .

Oh, and in case you are wondering if the kernel is either ARMv7 or ARMv6, the answer is it has both.. The firmware selects the correct kernel and firmware automatically by magic. It is possible to override precisely which kernel gets loaded in the config.txt, the version for the Raspberry Pi 2 /3 is called kernel7.img


Incidentally it takes about 10 hours to compile a kernel . . . .

Next : Add one line to make.conf