SARPi Project - Slackware ARM on a Raspberry Pi


SARPi Project Software Sources

This page highlights the source(s) from which the SARPi Project creates the available software it distributes. Information on this page contains details and guides on how to build and create the software yourself. It is intended for those who may have an interest in learning how things are done, or who prefer to do things at their own pace, without autonomy.

The following sections will describe how to:
Download the Slackware ARM on the Raspberry Pi build scripts.
Create an initrd.gz from the official Slackware ARM initial RAM disk.
Build a Raspberry Pi Linux kernel from source.
Download the Raspberry Pi boot-firmware.
Extract wireless and Bluetooth firmwares from [Debian] packages.

Additional sources:
Slackware ARM gcc-10.2 AArch64 cross-compiler for building ARMv8 64-bit software. Also available on GitHub.

SARPi Project software is free software, "free as in speech, not free as in beer". SARPi installers and packages are distributed in the hope that they will be helpful towards installing and maintaining Slackware ARM on a Raspberry Pi single board computer. Some people may be interested to know how to build, reproduce, and create their own software for installing and running Slackware ARM on the Raspberry Pi. The details below will show you how to achieve this.

Slackware ARM on the Raspberry Pi build scripts...

The original and unmodified build scripts, initially used by the SARPi Project to create the Slackware ARM installer and system packages for the Raspberry Pi (1), are copyright © 2012 Dave Spencer and can be downloaded from The Daves Collective (reloaded) - Slackware ARM on the Raspberry Pi - System packages [SlackBuilds section] or from the idlemoor GitHub raspi-slackbuild repository. These scripts can easily be modified in order to build for any Raspberry Pi version. Or other ARM-based single board computer devices.

Creating an initrd.gz from the official Slackware ARM initial RAM disk

Slackware ARM initial RAM disk image can be downloaded from:
http://ftp.arm.slackware.com/slackwarearm/slackwarearm-[VERSION]/isolinux

* [VERSION] is the release version of Slackware ARM - i.e. 14.2 | 15.0 | current

For example, downloading the Slackware ARM 15.0 initial RAM disk image is done like this:

root@slackware:~# wget http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/isolinux/uinitrd-armv7.img

Extracting the Slackware ARM initial RAM disk image in order to add or delete files, or modify existing files, is done like this:

root@slackware:~# mkdir -p /tmp/Q
root@slackware:~# cd /tmp/
root@slackware:/tmp # wget http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/isolinux/uinitrd-armv7.img
root@slackware:/tmp# cd Q
root@slackware:/tmp/Q# dd if=../uinitrd-armv7.img bs=64 skip=1 | gzip -dc | cpio -div

Any files that need to be added, or modified, or deleted, should be done at this point. Such as modules, firmwares, etc.

When the files are ready to be re-packed into an initrd.gz (gzip compressed RAM disk) it's done like this:

root@slackware:/tmp/Q# find . | cpio -o -v -H newc | gzip -9 -c > ../initrd.gz
root@slackware:/tmp/Q# cd ..
root@slackware:/tmp# ls -lah initrd.gz
-rw-r--r-- 1 root root 87M Mar 30 17:56 initrd.gz

The 'initrd.gz' file is now prepared and can be used in a Raspberry Pi /boot partition as an initial RAM disk. The 'initrd.gz' can be used for many purposes and reasons - e.g. emergency recovery. It also includes the Slackware ARM installer with which you can install the operating system!

Copy the 'initrd.gz' to the /boot partition (or to the SD card that will be used to boot the system) like this:

root@slackware:/tmp cp -av /boot

Edit the 'config.txt' with a command to load the 'initrd.gz' RAM disk, using any text editor or pipe an echo into the end of the file, entering the following line into the end of this file like this:

initramfs initrd.gz followkernel
# e.g. adding the above line to the end of the config.txt file...
root@slackware:/tmp# echo "initramfs initrd.gz followkernel" >> /boot/config.txt

The next time the Raspberry Pi device is (re)booted it should load the initrd instead of booting into the operating system. If you're creating a bootable SD card then obviously copy the 'initrd.gz' file to that location instead.

Building the Linux kernel from source

The Raspberry Pi Linux kernel source is available from the Raspberry Pi Github [linux] repository and can be downloaded via 'git' like this:

root@slackware:~# cd /tmp
root@slackware:/tmp# git clone --depth=1 git://github.com/raspberrypi/linux.git linux_src

The '--depth=1 ' will download only the latest commit and not the full repository content - omit this as required. The 'linux_src' at the end is the name of the directory the 'git clone' will save into. So you can name it to suit or omit it to use the default directory name.

root@slackware:/tmp# cd linux_src

To build the Linux kernel and modules for the Raspberry Pi (1), create a 'bcmrpi_defconfig' first and then use it to compile like this:

root@slackware:/tmp/linux_src# make bcmrpi_defconfig
root@slackware:/tmp/linux_src# make Image && make modules && make modules_install

To build the Linux kernel and modules for the Raspberry Pi 2 or 3, create a 'bcm2709_defconfig' first and then use it to compile like this:

root@slackware:/tmp/linux_src# make bcm2709_defconfig
root@slackware:/tmp/linux_src# make Image && make dtbs && make modules && make modules_install

To build the Linux kernel and modules for the Raspberry Pi 4, create a 'bcm2711_defconfig' first and then use it to compile like this:

root@slackware:/tmp/linux_src# make bcm2711_defconfig
root@slackware:/tmp/linux_src# make Image && make modules && make modules_install

The above command(s) will install the kernel modules but not the kernel itself, or any device tree blobs. The kernel Image and device tree blobs needs to be located in the /boot partition.

Installing is the appropriate phraseology, but "copying" is more accurate. What's required here is to copy over the /boot files from the compiled binaries you've created from the Linux source code, which includes the kernel, System.map, and device-tree blobs [dtbs]. NB: If you have any existing files that you'll be over-writing, be sure to back them up BEFORE copying any files over!

IMPORTANT! There is a different filename for the kernel depending on which Raspberry Pi version you are building for. These kernel filenames are;
• Raspberry Pi (1) kernel file name: kernel.img
• Raspberry Pi 2/3 kernel file name: kernel7.img
• Raspberry Pi 4 kernel file name: kernel7l.img

So, when you copy the kernel image make sure to name it according to your Raspberry Pi version. The "l" in 'kernel7l.img' is a small "L", as in large. It's actually an indicator for "Large Physical Address Extension (LPAE)". The Rasberry Pi 400 uses the same kernel filename as the Raspberry pi 4.

So, (for example) if you are compiling for a Raspberry Pi 400 you would use the following commands to copy the files:

root@slackware:/tmp/linux_src# cp arch/arm/boot/Image /boot/kernel7l.img
root@slackware:/tmp/linux_src# cp System.map /boot/System.map
root@slackware:/tmp/linux_src# cp arch/arm/boot/dts/*.dtb /boot/

That's basically all that's required to successfully compile the kernel, kernel modules, and device tree blobs.

Now the system should have the new kernel and modules, and device-tree blobs, in place for the next (re)boot. If you're creating a bootable SD card then obviously copy these files to that location instead.

Raspberry Pi boot-firmware source

The Raspberry Pi boot-firmware source (NB: this software is propietary and closed-source) is available from the Raspberry Pi Github [firmware] repository and can be downloaded via 'git' like this:

root@slackware:~# cd /tmp
root@slackware:/tmp# git clone --depth=1 git://github.com/raspberrypi/firmware.git boot-fw

The '--depth=1 ' will download only the latest commit and not the full repository content - omit this as required. The 'boot-fw' at the end is the name of the directory the 'git clone' will save into. So you can name it to suit or omit it to use the default directory name.

NB: The Raspberry Pi boot-firmware is closed source and cannot be compiled. The only files that can generally be modified are the plain text files therein.

Once the firmware repository has been cloned, all the files required are located in the 'boot' directory within the dowloaded folder. The easiest way to copy these to the '/boot' directory is by using 'rsync', and exlcuding any kernel*.img files, like this:

root@slackware:/tmp/# rsync -av --exclude='kernel*.img' boot-fw/boot/ /boot/

This will copy everything (except kernel*.img files) from the Raspberry Pi firmware's 'boot' directory into the '/boot' directory on your system. If you're creating a bootable SD card then obviously copy these files to that location instead.

Raspberry Pi wireless & Bluetooth firmware sources

The raspberry Pi wireless and Bluetooth firmwares is downloaded and extracted from the Raspberry Pi main archive repository.

NB: It's always prudent to check for any updates to these repository files before downloading!

Downloading the Raspberry Pi wireless firmware [Debian package] is done like this:

root@slackware:~# cd /tmp
root@slackware:/tmp# wget \
https://archive.raspberrypi.org/debian/pool/main/f/firmware-nonfree/firmware-brcm80211_20190114-1+rpt11_all.deb

Downloading the Raspberry Pi wireless firmware [Debian package] is done like this:

root@slackware:~# cd /tmp
root@slackware:/tmp# wget \
https://archive.raspberrypi.org/debian/pool/main/b/bluez-firmware/bluez-firmware_1.2-4+rpt8_all.deb

Once both paackages have been downloaded, now to extract the contents like this:

root@slackware:/tmp# mkdir -p wireless-fw bluetooth-fw
root@slackware:/tmp# cd wireless-fw
root@slackware:/tmp/wireless-fw# ar -x ../firmware-brcm80211_20190114-1+rpt11_all.deb
root@slackware:/tmp/wireless-fw# tar -xvJf data.tar.xz
root@slackware:/tmp/wireless-fw# cd ../bluetooth-fw
root@slackware:/tmp/bluetooth-fw# ar -x ../bluez-firmware_1.2-4+rpt8_all.deb
root@slackware:/tmp/wireless-fw# tar -xvJf data.tar.xz
root@slackware:/tmp/bluetooth-fw# cd ..

This will extract the required files from the 'data.tar.xz' compressed archives and unpack them into the two directories you have created for this purpose.

Now, to copy these wireless and Bluetooth firmwares into the correct place on the system, it's done like this:

root@slackware:/tmp# cp -ar bluetooth-fw/lib/* wireless-fw/lib/* /lib/

This will copy all the required STL*, BCM*, bcm*, and brcmfmac* firmware files into the '/lib/firmware' directory (which includes the 'brcm' firmware folder) on the system. If you're working on another location (e.g. to build a Slackware ARM package, or for testing purposes, etc.) then obviously copy these files to that location instead.

Once you're done, remove the [Debian] *.deb packages and folders created during the process in the '/tmp' directory.

root@slackware:/tmp# rm -rf bluetooth-fw wireless-fw firmware*.deb bluez*.deb

You will now have successfully installed (i.e. downloaded, extracted, and copied) new Raspberry Pi wireless and Bluetooth firmwares onto your system.


Back to Top


Updated: 2021-04-12 20:14:00 UTC

Disclaimer: The SARPi Project website is for non-commercial and general information purposes only. The content is provided by Penthux.NET and while we endeavour to keep information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or any information, software, products, services, or related graphics which is available on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. In no event will Penthux.NET be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website or any of its contents. Through this website you are able to visit other websites which are not under our control. Penthux.NET has no influence over the nature, content or availability of any external URLs. The inclusion of any URLs does not necessarily imply a recommendation or endorsement of any content therein. Every effort is made to ensure the SARPi Project website remains accessible. However, Penthux.NET takes no responsibility for, and will not be liable for, the SARPi Project website being temporarily unavailable due to technical issues beyond our control. Penthux.NET is in no way affiliated with Slackware Linux, Inc, or the Linux Foundation, or the Raspberry Pi Foundation, or any of their members, trustees, partners, or associates.


Accept!
SARPi Project uses cookies for website traffic & data analysis. [ Cookie Policy ]