Building A Debian Style Kernel For Your Raspberry Pi. 03-29-2021
I'm sure this is mere child's play for many people, however, even though I've hacked my way building kernels for the Raspberry Pi, I've finally found out where the kernel's repositories lie. It's always the same with ARM devices, one size does not fit all and all kernels built for these remarkable devices, must be tailor made. Even though I've had a bit of luck building kernels for the pine phone, I decided to risk making an unnecessary kernel build for my Raspberry Pi 4b, 8GB. I used the same commands that I used for the pine phone, with some important differences. In the past, I would go into these endeavors blindly and with crossed fingers and it was usually hit or miss.
Only with the ARM kernels, mind you, as I've said there just isn't any homogenized way to build kernels for the varied ARM processors out in the wild. Frankly, I was damn happy and surprised to see it boot up. I'm actually running real Debian on my Raspberry Pi, I mention this only, because when this new custom kernel that I built, kernel 5.10.25, booted up, there were a host of raspberries, at the top of the screen during the kernel boot process. Yes, just like how it does with Raspbian and Raspberry OS. It was really gratifying to see that I had done the configuration and compilation correctly and that it booted with no issues.
There are unofficial Debian images for the Raspberry Pi, which I'll post the links to. I think that the Raspberry Pi and the pinephone make a very lovely couple. They're both very compact and in their current configurations very powerful indeed. Admittedly, there are phones with bigger more powerful CPU's, GPU's and RAM that dwarf both the Pi and the phone but the two Linux machines are running native Linux at lightening speeds without all the bloat of Android and Android Apps. I'll argue that both the Pi and the pinephone are ultimately more useful devices than any Android phone.
Now I don't want to confuse anyone into thing that the kernel compilation for the pine phone and the Raspberry Pi are identical because they are not. The pinephone uses an Allwinner Chip and the Pi uses a Broadcom. The procedure is similar with the obvious variance when one views the commands. For simplicity's sake, I'll refer to the Pine Phone as PP from this point forth.
The commands to configure, customize and compile the kernel for the PP can be found here
The procedure to build a Raspberry Pi kernel is similar and the instructions to build a suitable kernel for your particular Raspberry Pi version is here Although, if you're planning on using dpkg to install that kernel then one might wish to modify the compilation stage somewhat by including the bindeb-pkg. Please note, that the kernel compilation stage of both the PP and the Pi can be identical in this case. In my case I did something exactly like this: ARCH=arm64 CROSSCOMPILE=aarch64-linux-gnu- make -j4 bindeb-pkg KERNELRELEASE=“5.10.25” KDEBPKGVERSION=“25” NB: that my writefreely blog, for some odd reason refuses to render CROSS_COMPILE with the separation hash, it shows up fine while I edit but joins the two Words making it look like CROSSCOMPILE so that's why I used two of them to illustrate my point. I think I've found a bug. In any case dismiss just one of those hashes and it'll be fine. Thanks. ARCH=arm64 CROSSCOMPILE=aarch64-linux-gnu- make pine64_defconfig