This is an old revision of the document!
Table of Contents
Installing Slackware AArch64 on the Raspberry Pi 4
Target | |
---|---|
Platform | AArch64 |
Hardware Model | Raspberry Pi 4 model B |
Document Version | 1.00, Dec 2021 |
Author | Stuart Winter <mozes@slackware> |
Contributors | Brenton Earl (R&D for the RPI4 Hardware Model) |
Video Tutorial
This tutorial is also available in video form.
Help / Support
Please post questions to the Slackware ARM forum.
Installation Lifecycle
The Installation consists of a number of distinct stages:
- Acquiring all required hardware
- Setting up local environment to support the installation over the network
- Downloading and verifying the Slackware assets
- Setup of the Raspberry Pi hardware
- Writing the Slackware Installer to the Micro SD card
- Booting the Slackware Installer
- Installing Slackware
- Completing the installation
- Booting the Slackware OS
- Post installation configuration and tweaks
Requirements
Hardware
Item | Specification/Type | Required? | Notes | |
---|---|---|---|---|
Raspberry Pi 4 Model B | 4GB and 8GB RAM models have been tested | Yes | This is the bare board | |
CPU heat sink & cooling fan | A heat sink or CPU is required | This has been recommended as a suitable fan for high-CPU workloads. | ||
Power supply | Official Raspberry Pi PSU | Yes | It's best to use the official PSU as others can cause instability over time. | |
Inline power switch | - | Optional but recommended | The Raspberry Pi 4 does not have reset nor power buttons on the board. Reports from the Slackware community suggest that the power socket on the Rpi will become damaged over time from wear. This inline power switch prevents damage to the RPi. | |
Micro to full-size HDMI adapter | - | Optional | Depends on your local setup and whether you wish to connect an HDMI monitor to the RPi. | |
Real Time Clock (RTC) | Adafruit PiRTC - Precise DS3231 | Optional | This RTC been recommended by the Slackware community. | |
Battery for RTC | Lithium 3volt CR1220 | Optional | Depends on whether you use the RTC module. This enables the RTC to maintain the time whilst the RPi is powered down. | |
Dupont wires | Female to male | Optional | This is to wire in the RTC module, as the large sized CPU heat sink prevents the RTC module from connecting directly to the GPIO. These wires are also useful for connecting other peripherals to the RPi's GPIO. | |
USB to SATA adapter | - | Optional (see row below) | Many models will work, but this one has been tested on many of this author's ARM hardware. | |
USB to NVME M.2 adapter & enclosure | - | Optional (see row above) | If you prefer to use NVME rather than SSD, choose this | |
USB to Serial adapter | PL2303 chip. Other models may work, but this one has been tested. If your model has the option to set voltages, ensure 3volts is set! | Optional | A USB to Serial/UART adapter is recommended if you want to access the console remotely, but is unnecessary if you only plan on using an HDMI monitor. This document covers installing using an HDMI monitor - you can find information about connecting the Serial/UART adapter at the foot of this document |
* need to add in * USB peripherals * SSD / NVME storage * Micro SD card - min 8GB * USB stick - min 8Gb capacity
Notes on storage setup
The setup documented here (2.5“ SSD connected to a USB-to-Serial adapter for power and data) has proven stable for this author.
It is possible to create a 3rd partition on the Micro SD card ('MMC') which can house the Slackware OS. However, this is not recommended due to the longevity of this type of storage - particularly if it has high I/O. Additionally it's been observed that the block device entry for the MMC card may alternate between 0 and 1 during boots, so your system may fail to boot. This is not by design though and should be addressed at some point.
Computing / Network Environment
Item | Specification | Notes |
---|---|---|
Host Computer: an Internet-connected computer running an existing Linux distribution | Preferably a full installation of Slackware x86/64, but any distribution that can provide the required Python environment and HTTP server module. The Host Computer needs approximately 5GB free storage to download the required software assets. You must be able to obtain root access to this Host computer. | This will be used to download the Slackware distribution from the Internet. |
Network DHCP server | Provide an IP address and routing information for the Linux Host Computer (to download the Slackware tree) | DHCP is not required for the Raspberry Pi to install Slackware, as in this Installation Guide will cover installing where the Slackware Installation Media is contained on a USB stick. |
Hardware Setup
In this section we'll prepare the physical aspects of the Raspberry Pi4 to receive Slackware Linux.
Attach the base board
Attach the base board to the RPi4 using the brass spacers. Ensure that each brass spacer is screwed into the base board, as shown.
Screw four spacers to the top to secure the board to the platform
Attach the thermal tape to the CPU
Attach the heat sink brackets
Secure the board to the platform
Attach CPU fan power wires
RTC (Real Time Clock): Insert battery
RTC (Real Time Clock): Wiring
RTC (Real Time Clock): Attach to Raspberry Pi
Add all other peripherals required to install Slackware
- Connect the storage - ensure that it's connected to a blue USB 3.0 port
- Connect the Ethernet cable (optional - required if you want to set the date via NTP before commencing installation)
- Connect the HDMI cable
- Connect the USB keyboard and mouse
The basic hardware setup is complete.
Software and Network Environment Setup
In this section, we'll prepare the Linux Host Computer to receive and download the Slackware assets required for the installation.
1. Downloading the Slackware Linux AArch64 Distribution and Installation Assets
Open a shell on the Linux Host Computer.
Determine where you are within the Host Computer's Filesystem
$ cd $ pwd /home/mozes/slackware
Prepare a directory to hold and serve the Slackware Distribution
We'll download the Slackware Linux distribution into a directory named 'slackware'.
$ mkdir slackware $ cd slackware
Installing the Slackware ARM GPG key
The Slackware ARM GPG key will be used to verify the Bootware and Slackware Installation images.
$ curl -sSL https://www.slackware.com/infra/keys/arm/GPG-KEY | gpg --import -
Set the version of Slackware AArch64 to download
At the time of writing, the only version available is 'current'.
$ SLKVER=current
Set the distribution server
If you are using a mirror server rather than the master Slackware ARM server, set it here. The format is: <hostname>::<rsync module name>
$ SLKSRV=ftp.arm.slackware.com::slackwarearm
Download the Slackware Linux installer for the BCM2711 AArch64 platform
rsync -PavL $SLKSRV/platform/aarch64/bootware/installer/slackwareaarch64-${SLKVER}/bcm2711_rpi4.sdimg_latest.img.xz . rsync -PavL $SLKSRV/platform/aarch64/bootware/installer/slackwareaarch64-${SLKVER}/bcm2711_rpi4.sdimg_latest.img.xz.asc .
The Slackware Installer images are approximately 300MBytes in size.
Download the Slackware tree verficiation tool
rsync -PavL $SLKSRV/platform/all/scripts .
Download the Slackware AArch64 tree
You will now download the Slackware distribution. This contains all of the software included within Slackware.
rsync \ --exclude '*/source/*' \ --delete -Prlvv \ $SLKSRV/slackwareaarch64-${SLKVER} .
The Slackware distribution is approximately 4.5GBytes in size.
Verify the assets
Verify the digital signature of the verification tool:
gpg --verify-files scripts/slacksigchk.sh.asc
The output will be similar to this. You are looking for 'Good signature from Slackware ARM…'
gpg: assuming signed data in 'scripts/slacksigchk.sh' gpg: Signature made Wed 24 Nov 2021 06:07:44 PM BST gpg: using RSA key F7ABB8691623FC33 gpg: Good signature from "Slackware ARM (Slackware ARM Linux Project) <mozes@slackware.com>" [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 36D3 7609 2F12 9B6B 3D59 A517 F7AB B869 1623 FC33
Verify the Bootware and Slackware tree:
chmod 755 scripts/slacksigchk.sh ./scripts/slacksigchk.sh slackwareaarch64-${SLKVER}
Elevate yourself to root
On your Host Computer, obtain root:
$ su - ## Note the hyphen - it's required
Check what block devices are present
Prior to inserting the Micro SD Card into the USB adapter, we need to see what's already present within the OS so that we can easily locate our Micro SD card:
# lsblk -d NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 465.8G 0 disk
As you can see, this Host Computer there is a single storage device - sda.
Now insert the Micro SD card into your USB Card Reader and connect the adapter to a free USB port on the Host Computer.
Run lsblk again:
# lsblk -d NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 465.8G 0 disk sdc 8:32 1 58G 0 disk sdd 8:48 1 0B 0 disk
As you can see, sdc is 58GBytes in size. This is the Micro SD card (in this example, it's labeled as '64GB' on the exterior of Micro SD card).
If your Micro SD card has existing partitions, you will not see them surfaced in this list - use lsblk -b to view them.
Writing the Slackware assets to the Micro SD and USB stick
Elevate yourself to root
On your Host Computer, obtain root:
$ su - ## Note the hyphen - it's required
Write the Slackware Installer to the Micro SD card
Follow the instructions in the previous section to determine which block device name it occupies.
Enter the directory into which the Slackware assets were downloaded previously:
# cd /home/mozes/slackware # xzcat bcm2711_rpi4.sdimg_latest.img.xz > /dev/sdc ## Replace /dev/sdc with the correct block device # sync
Remove the MicroSD card from the Host Computer
You may now disconnect the USB adapter from the Host Computer and remove the MicroSD card.
Write the Slackware Installation Media to the USB stick
Now that the Micro SD card (and adapter) has been removed from your Linux Host Computer, we can begin setting up the USB stick to receive the Slackware Installation Media.
- Insert the USB stick into the Linux Host Computer
Still as root, type lsblk -d
# lsblk -d NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 465.8G 0 disk sdb 8:16 1 28.6G 0 disk
As you can see, the USB stick has appeared as sdb and is 28GB in size.
- Create an ext4 file system on the USB stick
# mkfs.ext4 -FL SLKins /dev/sdb mke2fs 1.46.4 (18-Aug-2021) [..] Writing superblocks and filesystem accounting information: done
- Mount the USB stick
# mount /dev/sdb /mnt/hd
- Copy the Slackware Installation Media to the USB stick
# rsync -Pav slackwareaarch64-* /mnt/hd/
- Umount the USB stick
# umount /mnt/hd
- Logout from the root user
# logout
Installing Slackware
To proceed, you must have:
- Connected the storage to the Raspberry Pi 4
- Connected the HDMI monitor
- Connected the keyboard (and optionally, mouse)
- Optionally connected the Ethernet cable to set the date via NTP from the Internet
- Inserted the Micro SD card containing the Slackware Installer
Begin installation
Power on the Raspberry Pi 4
Press the Power Button for aproximately two seconds
After a few seconds, the you will see the following on screen:
It takes several seconds to load and boot the installer, and it may take several seconds more for any further output to appear on the HDMI monitor. The process of obtaining an IP address via DHCP can also delay the ability to interact with the Installer.
Once an IP address has been obtained, you will be presented with a prompt. Press ENTER
Set the keymap
Set the date/time
Even if you have a battery pack for the RTC (Real Time Clock), the date on your system may be incorrect. We will sync the date from a highly-available NTP server:
ntpdate clock.akamai.com hwclock -w
Setup disk partitions
For this installation a basic partitioning scheme will be created.
Partition
Partition number | Device name | Size | Purpose |
---|---|---|---|
1 | /dev/sda1 | 4GB | Swap |
2 | /dev/sda2 | Rest of storage | OS root ('/') partition |
Open fdisk against the /dev/sda partition (which will be your primary storage, and in these instructions is the SDD connected to the USB adapter).
fdisk /dev/sda
Clear an existing partition table: Press 'o' to clear the partition table
Create the Swap partition:
Type 'n' for new partition:
Type 'p' for primary partition type:
Press ENTER for the 'First sector'
Type '+4G' for the 'Last Sector'/size:
Change the partition type to 'Swap'. Type 't' then hex code '82':
Create the partition for the root filesystem ('/'):
Type 'n' for new partition. Press ENTER to accept the defaults - this will create partition 2 as the maximum size available.
Type 'a' to mark the root partition (number 2) as bootable Type '2' to select partition 2.
Type 'p' to print to view the partition table.
Type 'w' to write the partition table:
fdisk will now exit.
Load the Setup menu
Setup Swap partition
Select and format the partition for the OS' root file system
Resize /boot partition to full extent
The Micro SD card that contains the /boot partition presently occupies approximately 1GB. Most MicroSD cards are several GBs in size. This option will resize the partition to its full capacity to avoid wasting storage. If you plan on manually adding parttions to this later, you will want to choose 'No' here.
Boot Loader Configuration
The Installer will configure the Boot Loader and the OS' /etc/fstab automatically:
The rationale behind this divergence is that on x86 the root file system is typically on a storage bus (SCSI, SATA, ATA), where the physical configuration (which port the storage is connected to) of the storage rarely changes. This can be the case on ARM, but it's generally to a lesser extent and the root file system may be connected to a hot-plug bus such as USB. This lends itself to the risk of device re-ordering across boot cycles (e.g. /dev/sda becomes /dev/sdb), causing boot failure.
Please be aware that the Slackware Installer only labels the swap and root file system. Therefore you are advised to manually label the file systems and modify the OS /etc/fstab accordingly. If you have only a single storage device and don't plan on adding more, you can use the settings that the Slackware Installer configures.
Select Source Media
- Insert the USB stick into one of the blue USB3 ports of the Raspberry Pi.
Pick option '2 - Install from a Slackware USB stick'
Package Series Selection
You can now choose the package sets to install. The recommendation is to install everything. A full Slackware installation will occupy approximately 15GB.
Pick the 'terse' option:
The packages will begin installing:
Configure the Console Settings
If you plan on using the UART/'Serial' console, you should select 'No' here. If you plan on exclusively using an HDMI monitor, you should pick 'Yes'.
Remove the Slackware Installer from the SD card
The Micro SD card is transformed from being the Slackware Installer into the Slackware OS's /boot partition. At this stage, if the installation has worked for you (at certain points in the Slackware installer you are past the point of no return) you can delete the Installer. However, if something has gone wrong you can reset the Raspberry Pi and reboot the installer without having to re-deploy the Slackware Installer image from your Linux Host Computer.
Generally you should say 'Yes' here.
Post Installation Configuration
The Slackware Installer will walk you through the standard Slackware setup. The on-screen instructions will suffice.
Select a Console Font
It's recommended for the Raspberry Pi that a larger console font is configured for the virtual console.
The recommended font is 'ter-732b.psf'. This is the font used within the Installer.
Continue Post Installation Configuration
Configure GUI Window Manager
Continue Post Installation Configuration
Slackware Setup Complete
Disconnect the USB stick
Reboot into the Slackware OS
Generally you'll want to reboot into the OS.
However, if you are planning on setting up RAID or need to customise the Operating System Initial RAM Disk, you should select 'Shell'.
The Slackware OS will be found within '/mnt'. You can use the 'os-initrd-mgr' tool (Video tutorial).
Booting the Slackware OS
Login to the Slackware OS
Post Installation Configuration
There are a few post-installation configuration tasks to complete.
Add a plebeian user
You should add a plebeian (non-root) user using the 'adduser' tool.
This is documented here.
NTP (Network Time Protocol) setup
If your Raspberry Pi does not have an RTC battery backup, you may wish to configure it to set time from an NTP Server.
Keeping the Slackware OS up to date
One of the preferred tools to keep your system up to date is slackpkg.
Loading Kernel modules at boot time
There are a number of peripherals that may require Kernel modules loading early on in the boot sequence. An example of this would be RTCs (Real Time Clocks).
To load Kernel modules during the early boot sequence, read:
/boot/local/README.txt
As root, the easiest way is to create
mv /boot/local/load_kernel_modules.post.sample /boot/local/load_kernel_modules.post
Then add the appropriate module loading commands to: /boot/local/load_kernel_modules.post You can also add shell code here to initialise a perhiperal - writing something to the peripheral's Kernel interface, for example.
Managing the Raspberry Pi Boot Firmware
The Raspberry Pi Firmware is supplied and managed by the Slackware package a/hwm-bw-raspberrypi
Managing the Raspberry Pi SoC/Hardware Model Peripherals Firmware
The firmware for the peripherals on the Raspberry Pi Hardware Models is contained within the Slackware 'a/kernel-firmware' package.
Using the Raspberry Pi's Native Boot Loader
Slackware ARM/AArch64 uses the industry standard Boot Loader 'U-Boot', as this provides a consistent experience and provides scalability from a tool set and OS management perspective - the same set of tools can be used to configure and manage the Boot Loader across the range of Hardware Models. The Raspberry Pi's Boot Loader is non-standard and it's recommended to remain with U-Boot.
Slackware AArch64 is configured to chain load U-Boot from the Raspberry Pi's native Boot Loader in order to maintain consistency.
However, U-Boot does not presently support 'Device Tree Overlays' which help configure some of the peripherals. DTOs are unnecessary since there are other ways to light up peripherals, but some users may prefer the DTO approach. As such, the RPi's native Boot Loader can also be used to boot Slackware once the OS has been installed.
/boot/platform/hwm_bw is where the RPi's native Boot Loader assets are stored, which is mounted within the Slackware OS.
How to migrate to the RPi's native Boot Loader
Configure the RPi's Boot Loader:
cd /boot/platform/hwm_bw vi config.txt
Follow the instructions within.
Configure the Linux Kernel Command Line settings
mv slkcmdline.txt cmdline.txt
Now edit cmdline.txt - instructions are contained within.
Supporting the Slackware ARM project
Maintenance of the Slackware ARM port takes not only a lot of time, but also has financial costs such as the on-going use of electricity, Internet hosting and purchasing and maintenance of ARM hardware.
Once you find yourself enjoying using the ARM port of Slackware, please take a few moments to show your appreciation through sponsorship.
Contributing to the Slackware ARM project
There are a plethora of ARM devices on the market which requires initial R&D and continuous testing. If you'd like to help Slackware support more ARM boards, please check out the documentation explaining how to get involved.
Using the Serial/UART adapter
This documentation discusses using the Raspberry Pi without the UART/Serial console. If you'd like to use one, the image below shows the recommended adapter connected to the Raspberry Pi
You can then connect the USB end of the adapter into your Linux Host Computer, and use the following command to connect to the adapter:
screen -T screen-256color /dev/ttyUSB0 115200,-crtscts
Known Limitations / Bugs
Issue | Work around | Notes |
---|---|---|
Poor X11 performance | None presently | Presently the required drivers ('VC4') is not in the mainline Linux Kernel. Will keep track upstream. |
X11 hangs under heavy load | None presently | When the system is under high load (for example when playing video), it will freeze the screen and the USB keyboard will become inoperative. We believe that this is memory related, but will not look further into it until the VC4 driver is available. If the system is left idle, this author's Raspberry Pi has been stable running KDE for over a week. |
No Device Tree Overlay (DTO) support | None presently | U-Boot does support DTO but it requires additional R&D to integrate into the /boot/extlinux/extlinux.conf. DTOs could be loaded by migrating to booting Linux directly from the RPi's Native Boot Loader, but presently it cannot boot the Slackware Linux Kernel so cannot be used. |
No support for the RPi's Native Boot loader | None presently | Slackware is set up to enable easy migration from booting using the U-Boot Boot Loader, but presently the RPi Native Boot Loader cannot boot a Slackware Linux (mainline) Kernel. This needs some more work, as it's supposed to work! |