[Share] How to install a 64-bit operating system on Raspberry Pi 4?
[Copy link]
This article will help you install the Raspberry Pi 64-bit OS on a Raspberry Pi 4. Although the guide was written for the Raspberry Pi 4, it will work on the Raspberry Pi 3 without any modifications. The Raspberry Pi 2 and 1 are 32-bit CPUs and therefore cannot run a 64-bit OS.
Why not use Ubuntu?
Ubuntu is OK. Raspberry Imager even has the option to install different Ubuntu versions. However, Ubuntu is a full-fledged OS for a wide range of processors and is not what you would call lightweight. For example, you need at least 4 GB of RAM for the Ubuntu desktop. The new 64-bit Raspberry OS systematically outperforms Ubuntu in terms of speed. Especially in our deep learning application. This is why we chose to run the 64-bit Raspberry OS.
Raspberry Pi Zero 2
For the Raspberry Pi Zero 2, we have written a separate guide. Use this guide if you want to install a 64-bit operating system on this board. The guide presented here will address issues when working with the Raspberry Pi Zero 2.
Bullseye
On January 22, 2022, the Raspberry Foundation released the first official 64-bit Bullseye operating system. You can read all about it in this article.
One of the most important changes is a new camera driver. Bullseye uses the standard Linux libcamera API and has abandoned the previous Userland video engine. This means that any camera software written for the "old" Raspberry Pi Buster OS will most likely stop working. To ease the pain, on December 2, the Raspberry Foundation restored some of the "old" camera features with an older version of the Raspberry Pi Buster OS. This version is frozen and unsupported. You can install this plugin using the raspi-config tool. Find more information here. In due time, most software will be ported to libcamera.
Another important thing to know is the complete removal of Python 2. The transition from Python 2 to Python 3 has been going on for a while. But now Raspberry Pi, like Ubuntu 20.04, has also removed Pyhton2. This means that, for example, you can no longer do pip installations. From now on, you must use pip3 installations. However, if you have a lot of software written specifically in Python 2, you may still want to use the Buster version.
Finally, Python 3 was upgraded to version 3.9. Keep this in mind when choosing the right installation for TensorFlow or PyTorch.
If you want to use the Debian 10 version, you can find the old Buster.zip file here.
Burn the image
The first step to install a 64-bit operating system on a Raspberry Pi 4 is to download a new Raspberry Pi image from this website. The imaging tool can write the operating system of your choice on an SD card. At the same time, it will format the card to the correct ext4 for use on a Raspberry Pi, even for 64, 128 or 256 GB cards. Support for different image formats makes this tool a better alternative to balena Etcher.
The second step is to download the correct 64-bit operating system for the Raspberry Pi 4. Currently, the latest version is the 2022-01-28-raspios-bullseye-arm64 version. This version can be selected in the image tool. The slideshow below shows the entire image writing process1
. Select the operating system dialog box.
2. Select the Other Raspberry Pi option in the drop-down list.
3. Select Raspberry Pi OS (64-bit).
4. Select the SD card.
5. Here, we use a 64 GB SD card.
6. Start the one-time erase, format, and write activity.
7. You can track the progress.
8. Success.
Memory swap
The last operation before using a 64-bit operating system on the Raspberry Pi is to change the memory swap. Memory swap increases your working memory by placing infrequently used temporary files in a file on the SD card. In this way, memory is freed up. When the task is completed, the original content is replaced from the file into the memory, hence the name "swap".
There are two minor issues with switching memory to an SD card. First, it is not a very fast mechanism, as transferring data to the flash memory is slow. Second, since the flash memory is limited in the number of write operations it can sustain, it can quickly wear out your SD card.
When you occasionally switch between web pages in Chromium, the data is only transferred once. This does not have any impact on the lifespan of the flash memory. On the other hand, when you compile large software packages such as TensorFlow, there may be a lot of data constantly transferred between flash memory and RAM, causing the SD card to wear out quickly. See the Protecting the Raspberry Pi 4 SD Card page for more internal information on this topic. To solve the problem of memory swapping, we use zram. Instead of writing these parts of memory to the flash card, zram compresses these parts into a zip file and saves the result back to RAM. The difference in the size of the compressed data and the original size is the amount of memory freed up.
This may sound cumbersome, but in practice it is a much faster mechanism than writing to flash memory. When there is no more space to store larger compressed files, the only limitation is the size of the RAM. On the other hand, the original Raspberry Pi dphys-swap file is limited to 2 GB flash memory.
Another discussion is whether we need memory swap in the first place. If you have 8 GB of onboard RAM, there is hardly any reason to swap memory. You can try to work without. You will probably never have a problem. If you have 2 or 4 GB, you are better off installing zram.
Follow the next steps to install zram on a 64-bit operating system. Please note the symbol on the last line. Do not forget this character, otherwise the boot will not continue.
The last action is to set the usage limit in zram, which will be completed after the next command
After the reboot, all actions will be executed and the Raspberry Pi 64-bit operating system will be up and running
Overclocking
Overclocking a 64-bit operating system can be done the same way as a 32-bit version. For more information, see: Safely Overclocking a Raspberry Pi 4 to 2 GHz. Keep in mind that you now do not have the easy-to-use recovery menu of NOOBS. If the system freezes or crashes due to overclocking, the only way to change the frequency is to use another computer that can modify the /boot/config.txt file on the SD card.
Final note:
The Raspberry Pi 64-bit operating system is still under development, and there are certainly many planned improvements. You can use the following command to check for updates every week
Reposted from: https://qengineering.eu/install-raspberry-64-os.html
|