Operating the Raspberry Pi 3 in 64-bit mode

Lead Image © studiostoks, 123RF.com

Double Action

,

The Raspberry Pi 3 usually has a 32-bit Linux system running, in spite of the 64-bit CPU that is built into the little computer. We decided to see how the RPi3 runs with a real 64-bit system.

In February 2016, the Raspberry Pi Foundation introduced Model 3 of its very successful small board computer. At the time, with its fast 64-bit ARMv8 CPU, the Raspberry Pi 3 (RPi3) seemed to indicate a changeover from a 32-bit to a 64-bit operating system and corresponding applications. Imagine the astonishment when it became clear to Rasp Pi fans and developers that the new 64-bit hardware did not fully utilize its capabilities. Instead, it runs like a pure 32-bit system. (See the box entitled "The CPU in the RPi3.")

The CPU in the RPi3

The system on a chip (SoC) sitting on the RPi3 consists of a Broadcom BCM2837 from the BCM2710 family. The chip represents the ongoing development of the BCM2736 (BCM2709) from the Raspberry Pi 2, where the ARMv7 CPU was replaced by a Cortex-A53 quadcore ARMv8 CPU. It can run in both 32 (AArch32) and 64-bit mode (AArch64). By default, the RPi3 chooses the 32-bit variation.

The RPi3 boasts a Bluetooth and WiFi module. However, it links the Bluetooth component with the first serial port. This causes it to have compatibility problems when the serial interface is used, for example, as a console.

The CPU uses a modernized set of commands and has 31 registers, each of which has a 64-bit width. This contrasts with the predecessor CPU, which offered just 15 counterparts that were half the size. The register 31 (program counter) always delivers a zero when reading. Floating-point operations in the 64-bit version occur with a 128-bit width (data type long double).

Moreover, the CPU comes with standard features for supporting Neon, ARM's multimedia and signal processing extension as well as a 128-bit single instruction, multiple data (SIMD) architecture. (SIMD offers fast execution of similar computing operations on parallel, incoming data streams; it is primarily used for processing multimedia data.) Further, the processor processes various encryption algorithms in silico. These include AES, SHA-1, and SHA-256.

The RPi3 constrains itself so much that it acts as if the provided 32-bit mode is based on ARMv7 architecture rather than the built-in ARMv8 (Figure 1). The kernel and operating system identify themselves as part of the BCM2709 family in boot messages and also in the output from cat /proc/cpuinfo. In reality though, they actually belong to the BCM2710 ecosystem.

Figure 1: The RPi3 denies its modern architecture and packages itself as a 32-bit SoC.

If you take some time to objectively examine the technological hesitation that is displayed by the Raspberry Pi Foundation with this computer, it turns out that the unexpected approach makes sense for the following reasons:

  • The RPi3 is equipped with a mere 1GB of RAM, which is not enough to profit from the ARMv8's expanded address.
  • You shouldn't expect to have a noticeable improvement in performance with 64-bit instructions.
  • Even in 32-bit mode, the new CPU proves to be significantly superior to the ARMv7 architecture in the old Rasp Pi.
  • The new architecture's preparation process makes it possible to achieve higher clock rates.

The biggest advantage to 32-bit operation is that the user with unmodified drives can continue to use their current Raspbian userland environment.

Technology Needs to Inspire

Even if the 64 bits ideally generates a marginal increase in speed for the RPi3, this is not enough to satisfy a developer who is enthusiastic about technology for very long. Instead, the hardware messages make it seem like the user is managing a wolf in sheep's clothing, plus boring a 64-bit controller to death with 32 bits. Given this kind of mediocre experience, developers began working to make 64-bit operation possible soon after the release of RPi3. In doing so, they have focused their efforts on the firmware, the kernel, and the userland environment.

The firmware takes over the task of immediately switching the controller for the RPi3 into 64-bit mode after boot. The onboard firmware can already accomplish this if given some help. Therefore you should set the arm-control variable in the config.txt file on the boot partition to 0x200. By all accounts, some new firmware that can load a 64-bit kernel all on its own has become available. However, we did not test this.

The recommended alternative consists of using the high-performance boot software U-Boot, which loads the standard firmware instead of a Linux kernel. To utilize this approach, you will need the 64-bit version of U-Boot, which knows the new boot command booti. The command helps with loading a 64-bit ARM kernel that is labeled with a specific header. You can read up on the details in the kernel documentation Documentation/arm64/booting.txt [1]. The bootloader should be able to adequately deal with this header and some of the other conditions set by Linux.

The Variety Overwhelms

Naturally, the kernel itself also has to be compiled for the 64-bit ARMv8 architecture. In turn, it needs a suitable device tree [2], meaning a file that describes all of the hardware details. The ARM hardware menagerie comes in many more variations than the x86 world and uses different address layers for peripherals.

During the early days of ARM Linux, the developers had to program and compile a kernel with suitable addresses for each piece of supported hardware. The kernels currently in use today read in the device tree that is found in the main memory live during boot. When activated, drivers find the address layers via the kernel. Meantime, support for device trees is considered to be mature and also obligatory for ARM architectures. The only thing missing is the root filesystem with the userland environment. For this situation, Debian offers an ARM64 system that can, by way of example, be installed with debootstrap [3].

But before you go try to generate and assemble all of the pieces of the puzzle yourself, you should take the first steps with ARM64 by using a pre-tested, preconfigured 64-bit system from the Internet. Figure 2 shows the source for the artifact we use here.

Figure 2: By mid April 2016, the user xylnao had already published a 64-bit image for the Rasp Pi.

Therefore, for the first steps, we recommend downloading the corresponding file image [4], decompressing it, and then using dd to write it under Linux to a microSD card. It is important to make sure that the card is not mounted during the read process. Now you can insert the prepared SD card into the Rasp Pi and start the system. A login will appear on the connected monitor after just a few seconds. Log in as root with the password raspberry.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content