Building kernels for the Beaglebone Black
Published: 2014-10-26Updated: 2016-05-06
The Beagleboard project maintains its own kernel for the Beaglebone Black, so you can build your own kernels without too much effort. Their git tree tracks the upstream kernel releases though, so as time progresses, their kernels will be more and more recent than the 3.16 kernel Debian settled with for their Jessie release.
3.16 and LTS status
The Debian and Ubuntu kernel teams will keep maintaining the 3.16 codebase (originally intended to be a long term support kernel), so you can stick with Debian's armmp
kernel, which runs fine on the Beaglebone. However, the usb0
network device did not show up for me with this kernel, which I find very handy. It sticks around with Robert C. Nelson's kernel, so I stick with that.
Robert C. Nelson's kernels track the main kernel releases, which means as time progresses, they'll be more and more recent than the version Debian's chosen.
If you've built kernels (or other bigger projects) before, you'll probably be familiar with ccache
. Robert's scripts will use it if available, so you might want to install it.
Preparation
Grab Robert's git tree. By default the git tree looks empty, you need to check out a specific kernel branch.
$ mkdir ~/bb-kernel/ && cd ~/bb-kernel/
$ git clone https://github.com/RobertCNelson/bb-kernel.git
$ git checkout am33x-v3.16
If the build_kernel.sh
script complains about a system.sh.sample
missing, grab it separately:
$ wget https://raw.githubusercontent.com/RobertCNelson/bb-kernel/am33x-v3.16/system.sh.sample
To make sure the build script downloads the right kernel version, we edit the KERNEL_TAG
line in version.sh
so it looks like this:
KERNEL_TAG=${KERNEL_REL}.7
BUILD=bone0
And a bit further:
DISTRO=jessie
Name BUILD
whatever you like. DISTRO
defaults to 'cross', I've named it 'jessie' like Robert's builds. The branch may receive updates as long as the kernel is current (ie updated upstream), so if you want your changes to stick you better create your own branch and rebase when needed.
Building the kernel
To build just a kernel and modules (but no Debian packages), you can run the build_kernel.sh
script. This will drop tarballs in the deploy
subdir. You'll probably want Debian packages for ease of use though, so use the build_deb.sh
script:
$ ./build_deb.sh
Both scripts will automatically grab the cross-compiler toolchain and mainline kernel tree.
If you have the fakeroot package installed, the package building script might spit out tons of errors about libfakeroot.so
being the wrong architecture (ie AMD64). You may ignore those safely (yes, they're annoying as hell).
Like the tarballs, the Debian packages will be in the deploy/
subdir. Copy them over to your Beaglebone and install them with dpkg like any regular package. The package contains code to automatically update the /boot/uEnv.txt
file as well.
LTS kernels
The kernel developers upstream have christened 3.18 an LTS version, which means it is a stable kernel to settle upon. You can grab my latest 3.18 kernel package here, if you don't want to bother with building one yourself.
Update 2016-02-26: I decided to trim the kernel configuration to save some extra space, grab the configuration file for the 4.4 kernel if you're interested. 4.4 is said to be the next LTS after 4.1 and 3.18.
I have stripped SCSI support amongst others, so you will only be able to use the onboard storage and microSD cards. File system support is limited to ext4 and some flash specific filesystems.