0

I'm trying to build a read only version of raspbian using overlayfs, the kernel version my raspberry pi is running apparently doesn't include it i'm wondering how i can recompile my own kernel with overlayfs.

  • The current kernel used by Raspbian should have overlay FS available as a module; try sudo modprobe overlay. – goldilocks Dec 22 '16 at 12:41
  • that's exactly my problem i thought it was part of the kernel since 3.18 but modprobe reports it missing – TheBrash Dec 22 '16 at 14:20
1

According to this Source:

Kernel version 3.18 and later, have the OverlayFS already on it.

However if you want to compile the kernel on your own following the aforementioned Source link.

The steps tend to be quite tedious, so it is good to perform it on a new SD card or make sure to back up the data from the old one.

For building a Read-Only version follow the steps on this Source:2

  • 1
    apparently it's not in the kernel which is weird, i check the source you mentioned at the end looks interesting i might go that way if i fail at this. – TheBrash Dec 22 '16 at 14:21
1

You can find the Pi kernel source here:

https://github.com/raspberrypi/linux

Note that's by default set to the 4.4 branch, but the latest is actually 4.9.

It will take a long time to compile on the Pi, although that may not be necessary if you can find the build tree for your current kernel...which as far as I am aware is not available via Raspbian, unfortunately. Cross-compiling is probably a better option...

However...

The kernel I'm using definitely has overlay.ko. It comes from the "firmware" repo:

https://github.com/raspberrypi/firmware

The kernel is in boot, you also need the directories from modules in /lib/modules.

rpi-update pulls from a slightly different repo, but that one has overlay.ko as well. This would be the easiest method (apt install rpi-update first).

Beware if you use any of these methods (building your own or pulling from a repo) then subsequent apt upgrades will overwrite /boot. My solution to this is to mount /dev/mmcblk0p1 somewhere else, then the stuff that's written into /boot is just a few wasted MB. However, that approach will be awkward with rpi-update; you may be able to set $BOOT_PATH first, or you could just mount it on /boot temporarily. That partition isn't needed during runtime, it is just mounted for updates and so you can edit config.txt easily, etc.

There are some caveats around about the latest kernel (as pulled by rpi-update) being a bleeding edge (the Raspbian kernel lags behind a bit), but I have never suffered any grief from it. I am pretty sure most of the time the Raspbian kernel isn't any different, i.e., what's "bleeding edge" today will be used unchanged as the default kernel next month. Although that makes your missing module a bit odd...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.