Booting 64-bit kernel on Raspberry Pi 3
So now you should have a shiny 64-bit kernel if you followed the 64-bit kernel 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. All commands must be run as root, so either login as root or prefix commands with sudo.
Kernel, device overlays and kernel modules
Backup the 32-bit kernel device tree blob (DTB)
This is not needed anymore if using the device_tree setting in config.txt, but might still be a good idea.
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 and dtbs
make O=../kernel-out/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_install dtbs_install
Then copy the kernel image, DTB file and device overlay files to /boot (adjust kernel version string in the paths!)
cp ../kernel-out/arch/arm64/boot/Image /boot/kernel8.img cp -r ../kernel-out/arch/arm64/boot/dts/overlays /boot/
Edit /boot/config.txt and add (or modify if a kernel= setting already exists) the line, adjust dtbs kernel version to whatever version you are using:
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.51-v8+ #1 SMP PREEMPT Mon Oct 2 15:25:25 UTC 2017 aarch64 GNU/Linux
Go back to 32-bit kernel
If you would like to go back to using a default 32-bit kernel, just remove or comment out (with #) the lines added to config.txt, like so:
and rename/remove the kernel8.img to something else. Then reboot your Pi and you should be running the 32-bit kernel again.
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.