Raspberry Pi4 64 Bit Install

Overview
The Raspberry Pi 4 has been 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
Everything.

Whats Fixed
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.

All 4G RAM are available in 64 bit mode with the 4.19.y kernel from 14 Aug on.

That's most things fixed

Not Tested (by me)
Analogue Video Output Analogue Audio Output Camera Screen

I don't have hardware to test the camera or screen.

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.

Kernel Tweaks
The Pi 4 USB 3 appears to support USB Attached SCSI. Unlike bulk mode, it allows commands to USB storage devices to be overlapped. Enable USB Attached SCSI in the kernel if a USB3 storage device will be used.

The default CPU governor is powersave. This runs the CRU at 600MHz all he time. CPU governors can be controlled in /proc or the default CPU governor can be changed to be ondemand.

Power Over Ethernet requires a .dto file to be loaded as well as kernel support.

Build and Install 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

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

microSD trim/discard
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

USB Attached SCSI
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

WiFi
WiFi needs three firmware files in /lib/firmware/brcm/ brcmfmac43455-sdio.bin brcmfmac43455-sdio.clm_blob brcmfmac43455-sdio.txt Which is almost but not quite the same as the Pi3. The catch is in where  produces different resulds for the Pi3 and Pi4 files. The Pi4 version returns boardflags3=0x44200100 The Pi3 version returns boardflags3=0x48200100 With the wrong brcmfmac43455-sdio.txt file, bluetooth works but not WiFi.

Power Over Ethernet
The Pi3b PoE HAT will power the P4 and a USB SSD.

Fan control works.

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