Ubuntu 18.04 64-bit for Raspberry Pi 4

Jarret B

Active Member
Staff member
Anyone who may have a new Raspberry Pi 4 (RPi4) will love its improvements over the Raspberry Pi 3 (RPi3). The only issue is at the time of this writing there wasn’t a 64-bit Operating System (OS) for it.

In the next few months many distros will probably release a 64-bit version for it. For now there aren’t any official versions available.

Let’s look at what we can do to remedy this.

NOTE: The procedure is not officially supported and should not be used in any type of non-testing environment. This is definitely a work in progress but shows the ability of the RPi4 with a 64-bit command-line OS.

There are two initial downloads you need to get before proceeding:

https://cloudkernels.net/ubuntu-18.04.2-preinstalled-server-arm64+raspi4+kvm.img.xz

If the second one is not available then you may have to go to the initial website and download the newest update at:


Once you have these two files you are ready to continue.

To start you will of course need an SD card, preferably one which is USB 3.0 which will give you better speed. Be sure the SD card is supported by the RPi4. You will also need Balena Etcher or another program to place the image on the SD card.

From the downloaded file you will need to extract ‘ubuntu-18.04.2-preinstalled-server-arm64+raspi4+kvm.img.xz’ and have the image (img) file ready.

Balena Etcher

Go to the website https://www.balena.io/etcher/. Unless you are using a ‘User-Agent Switcher’ the website should detect your OS and offer you a download of the needed installation file. If you need a different file than the one listed then click on the down arrow located on the right of the oval.

Unzip the download and make the extracted file executable. Double-click on the AppImage file to start Etcher.

Click on ‘Select Image’ then find the image file you extracted from before and select it. The option for ‘Select target’ should allow you to click it. Once clicked you can select the SD card you are using to boot the RPi4. Once everything looks proper you can click on the ‘Flash!’ button. You should be prompted for the password to allow Root privileges for the Etcher program and the image should be copied to the SD card. Once the flashing is completed the program should verify it as well.

Boot Files

An ARM system will not use GRUB or anything similar like an Intel or AMD system. An ARM system requires special boot files which in turn load the Linux kernel.

Basically, after the hardware has initialized itself it will pass control to the boot partition. The boot partition holds the ‘drivers’ for the CPU as well as configuration files. If you mount the SD card and look at it there will be two partitions. One partition will be the ‘system-boot’ and the second is the ‘writable’ partition. The ‘writable’ partition contains the Linux system such as Ubuntu in this case.

The image used with Etcher to restore to the SD card is a modified OS to include some of the RPi4 files. The problem is that the boot files included in the image do not work and need to be added to and modified.

Mount the SD card and open the ‘bcm2711-kernel-4.19.66.20190816.tar.xz’ file. There are two folders in it. The first folder is the ‘boot’ folder. You need to copy all of the files from the ‘boot’ folder and paste them into the ‘system-boot’ partition. Merge files into the appropriate folders. Nothing should be overwritten or replaced.

The second folder is called ‘lib’. You will need to copy the folder ‘modules’ and paste it into the ‘lib’ folder on the ‘writable’ partition.

The last thing is to modify the contents of the ‘config.txt’ file. If you scroll towards the bottom of the file you need to find a section labeled ‘[all]’. Right above the line ‘[all]’ you need to paste the following:

Code:
[pi4]
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
arm_64bit=1
enable_gic=1
kernel=kernel8-p4.img
Before you close and save it you need to also comment a line under ‘[all]’ or delete the line if you prefer:

Code:
total_mem=1024
If you do not add the hashtag (#) in front of the line then the system will be limited to 1024 MB of RAM. Once this line is commented out the system will boot and have 3906 MB of RAM. Some of it is shared with the Graphical Processor Unit (GPU).

Next you need to copy the files from the ‘bcm2711-kernel-4.19.66.20190816.tar.xz’ file. Extract the files from the compressed file. Copy the files from the ‘boot’ folder to the ‘system-boot’ partition. You should have to replace one file. Next you need to copy the ‘modules’ folder from the ‘lib’ folder and copy it to the ‘lib’ folder on the ‘writable’ partition.

Once this is done then you can eject the SD card and place it in the RPi4. Power up the RPi4 and it may take as long as 30-60 seconds to boot. At one point it appears to lock up but be patient with it.

NOTE: There will be no support for Wi-Fi so you need to wire the connection into the RJ-45 port. Adding a Wi-Fi dongle will not work since Ubuntu does not recognize any USB devices attached.

Once the system is booted you will be presented with a command-line prompt to login. The username is ‘ubuntu’ and the password is ‘ubuntu’. After entering the password you will be forced to change it. A prompt should ask you to re-enter the current password and then to type in and verify a new password.

Once you get to the command-line prompt after this you can perform and update:

Code:
sudo apt update
sudo apt upgrade -y
If you are curious about whether the system is running as 32-bit or 64-bit you can type the command and see that it is ‘aarch64’:

Code:
uname -r
You can also verify the RAM size with the command:

Code:
free -m
The memory is not the full 4GB but this is because the system is reserving some of it as shown in the ‘dmesg’:

Memory: 3636556K/4050944K available (8188K kernel code, 968K rwdata, 2560K rodata, 960K init, 918K bss, 152244K reserved, 262144K cma-reserved)

Keep in mind that this OS is not fully operational. The Wi-Fi drivers, as well as the GPU drivers, are not available for 64-bit at the time of this being written.

Since I cannot get a Graphical User Interface running I cannot run HardInfo as I did on the previous article on RPi4 to test it with a 64-bit OS.
 

Members online


Top