Booting 64-bit kernel on Raspberry Pi 3

So now you should have a shiny 64-bit kernel if you followed the build tutorial, and if not, do it first.

Now that you have the kernel and modules built, the next step is to install configure your Raspberry Pi to boot it.

Kernel, device overlays and kernel modules

Backup the 32-bit kernel device tree blob (DTB)

Unfortunately the 32-bit and 64-bit kernels use the exact same name for the DTB file. And they are not compatible so in case you need to go back to the 32-bit kernel, first take a backup of the 32-bit DTB.

cp /boot/bcm2710-rpi-3-b.dtb /boot/bcm2710-rpi-3-b.dtb-32bit

Install kernel, DTB, device overlays and kernel modules

First, install the kernel modules

make O=../kernel-out/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_install

Then copy the kernel image, DTB file and device overlay files to /boot

cp ../kernel-out/arch/arm64/boot/Image /boot/kernel8.img
cp ../kernel-out/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb /boot/
cp -r ../kernel-out/arch/arm64/boot/dts/overlays /boot/

Setup config.txt

Edit /boot/config.txt and add (or modify if a kernel= setting already exists) the line:

kernel=kernel8.img

Reboot

Reboot your Pi. If all goes well and you did the above steps you should be running a 64-bit kernel on your Pi 3 now.

To confirm that you are on a 64-bit kernel, you can check with arch or uname, they should respons like this:

pi@raspberrypi:~ $ arch
aarch64

Or uname -a

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.13-v8+ #1 SMP PREEMPT Mon Mar 6 15:25:25 UTC 2017 aarch64 GNU/Linux

Problems and issues with 64-bit

The 64-bit Raspberry Pi kernel is not yet complete. There are some issues with device support, mainly camera afaik.

Silence kernel warnings about deprecated instructions

The 64-bit ARM ABI deprecates some instructions that are still used on the 32-bit userlands. The kernel log will be flooded with messages about this, to silence them run:

echo 2 >/proc/sys/abi/setend
echo 2 >/proc/sys/abi/cp15_barrier

These settings can be put in /etc/sysctl.conf like so:

abi.cp15_barrier = 2
abi.setend = 2

Unfortunately there seems to be race condition or timing issue in the kernel with disabling emulation and enabling instructon support as booting will stall so right now this is not a good optioin.

Rating: 
Average: 4 (2 votes)
Keywords: 
aarch64, Linux, Raspberry Pi, kernel
03/05/2017 - 16:14