Subject: [alpine-user] Replacing kernel with custom kernel on Raspberry Pi

From: Florian Frankenberger <[email-masked]>
Date: Sat, 27 Oct 2018 23:15:45 +0200

Hi everyone,

I'm trying to get wiringPi working on my RaspberryPi 3. The first 
problem I stumbled upon is that the wiringPi package is not on version 
2.46 as described here 
https://pkgs.alpinelinux.org/package/edge/community/armhf/wiringpi but 
rather uses a very old version from 2015 which unfortunately does not 
support the Pi3. This is due to the APKBUILD file for that module which 
is still using the old commit (5edd177).

I managed to upgrade the commit and build a more recent version (2.36). 
Now my problem is that wiringPi uses mmap to access the BCM's memory to 
directly control the GPIO ports. When I try to use the wiringPi library 
I get an "mmap (GPIO) failed: Operation not permitted" as the Kernel was 
compiled with the CONFIG_STRICT_DEVMEM set to yes (normally a good idea 
to not give the userspace direct access to memory, but in this case I 
need it).

So I tried to compile a custom Kernel with that flag set to "no" and 
managed (after some trial and error) to create an apk package. Now I 
thought I succeeded in my endeavor and entered "apk add  
linux-vanilla-4.14.78-r0.apk" but that did not work. I know now that the 
whole /lib/modules directory is on a squashFS filesystem and is read-only.

My question now is: how can I properly replace my kernel with my custom 
built one? Do I have to create my own squashFS file? But if so how do I 
get the content of my package into that file (and where is it)? Or is 
there an easier way to do that?

Any hint you can give me is very much appreciated. Thank you!

Best,
Florian