Raspberry Pi4 64 Bit Install

Overview
The Raspberry Pi 4 has ben out for a few weeks and already the community has been able to boot it in 64 bit mode.

Its not ready for prime time but that will change over the coming months.

Curious users need to be familiar with the use of a cross toolchain or have access to another armv8a system to build a 64 bit kernel for the Pi 4.

What Works
This will be out of date as soon as its written /boot on the SD card / on USB. The kernel cannot see the microSD card. ethernet USB2 USB3 WiFi A Pi3 64 bit userland Only the first 1GB RAM.

With the 4.19.57-v8+ kernel from git on 5 Jul 2019, the SD card appeared, so all the dire warnings about / on USB are no longer correct.

The Installation Method
Follow the method described in Raspberry Pi 3 64 bit Install

The Pi 4 differs in the kernel build, the /boot/config.txt content and the requirement for some code from raspberrypi/tools

The Pi 4 Kernel
Get the aarch64-unknown-linux-gnu cross toolchain.

To cross compile the kernel, start with

Check the other kernel configuration settings given in configure the kernel.

Build and install the kernel, device tree and kernel modules an described in install the kernel binary, install the device tree, now named and install the kernel modules.

/boot/config.txt
The following is a bare minimum /boot/config.txt total_mem=1024 arm_64bit=1 enable_gic=1 armstub=armstub8-gic.bin
 * 1) Only 1G RAM for now too!
 * 2) Kernel needs more work
 * 1) set 64 bit mode

The usual disable_overscan=1 hdmi_drive=2 dtparam=audio=on may or may not be useful and are unchanged from earlier versions of the Raspberry Pi.
 * 1) have a properly sized image
 * 1) for sound over HDMI
 * 1) Enable audio (loads snd_bcm2835)

rasberrypi/tools
Rasberrypi/tools provides which must be copied to /boot

Naturally, its in a git repo. Clone it beside the Pi Sources and Pi Firmware repos.

build the contents of

Odds and Ends
Edit /boot/cmdline.txt to point to the USB root partition.

The microSD interface supports the trim command. Pi4_~arm64 ~ # fstrim -av /boot: 7.7 GiB (8250073088 bytes) trimmed on /dev/mmcblk0p1 If you have a suitable microSD card, consider using the discard option in /etc/fstab

The USB3 interface appears to support the kernels UAS (USB Attached SCSI) option. Its harmless to enable. Unfortunately, my USB3 to SATA cable does not work with UAS. Enable it in the kernel as its harmless. Search for USB_UAS <*>  USB Attached SCSI

Acknowledgements
sakakis topic on the [//www.raspberrypi.org/forums/viewtopic.php?p=1491136 Raspberry Pi forums]

All the contributors to [//github.com/raspberrypi/linux/issues/3032 issue 3032] on the Raspberry Pi github repo