SARPi Project - Slacking 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 [initramfs] 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-13.x AArch64 cross-compiler for building ARMv8 64-bit software. Also available on GitHub.

SARPi Project muse views ... 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 running Slackware Linux 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 on the Raspberry Pi. The information on this page will hopefully show you how to achieve this, or at least give you some indication of what's involved.

* All SARPi Project website file download timestamps are based on the UTC timezone.

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 idlemoor raspi-slackbuild GitHub 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 [initramfs] from the official Slackware ARM initial RAM disk

Slackware ARM initial RAM disk images can be downloaded from:
https://slackware.uk/slackwarearm/slackwarearm-[VERSION]/isolinux

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

Slackware AArch64 initial RAM disk images can be downloaded from:
https://slackware.uk/slackwarearm/slackwareaarch64-current/installer/

SARPi Project muse views ... NB: There can be two variants of the Slackware ARM Initial RAM disk; 'initrd' and 'uinitrd' versions.

The 'initrd' version is a standard gzip compressed data file archive.

The 'uinitrd' version is a specially formatted u-boot legacy uImage [bootable image] file archive that contains a special header with defining properties for use with Das U-Boot -- the Universal Boot Loader. This special header is marked by a special Magic Number, and both the header and the data portions of the image are secured against corruption by CRC32 checksums.

Downloading the Slackware ARM current initrd-armv7.img initial RAM disk image is done like this:

root@slackware:~# wget https://slackware.uk/slackwarearm/slackwarearm-15.0/isolinux/initrd-armv7.img

Or, downloading the Slackware ARM 14.2 uinitrd-armv7.img [u-boot formatted] initial RAM disk image is done like this:

root@slackware:~# wget https://slackware.uk/slackwarearm/slackwarearm-14.2/isolinux/uinitrd-armv7.img

Extracting the Slackware ARM current initrd-armv7.img 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 https://slackware.uk/slackwarearm/slackwarearm-15.0/isolinux/initrd-armv7.img
root@slackware:/tmp# cd Q
root@slackware:/tmp/Q# zcat ../initrd-armv7.img | cpio -dimv

Extracting the Slackware ARM 14.2 uinitrd-armv7.img [u-boot formatted] initial RAM disk image is done like this:

root@slackware:~# mkdir -p /tmp/Q
root@slackware:~# cd /tmp/
root@slackware:/tmp # wget https://slackware.uk/slackwarearm/slackwarearm-14.2/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 . 2>/dev/null | cpio -o -v -H newc | gzip -9fcv > ../initrd.gz
root@slackware:/tmp/Q# cd ..
root@slackware:/tmp# ls -lah initrd.gz
-rw-r--r-- 1 root root 87M May 09 20:50 initrd.gz

Or, to re-pack into an initrd.xz (xz compressed RAM disk) it's done like this:

root@slackware:/tmp/Q# find . 2>/dev/null | cpio -o -v -H newc | xz -9fcv -C crc32 > ../initrd.xz
root@slackware:/tmp/Q# cd ..
root@slackware:/tmp# ls -lah initrd.xz
-rw-r--r-- 1 root root 65M May 09 21:09 initrd.xz

SARPi Project muse views ... The difference between the gzip and xz data compression tools is the compression ratio for the resulting file size and time it takes to complete. In most cases gzip will be faster to decompress and xz will generally offer the best compression ratio and save more space but is slower to decompress. Basically, it boils down to time versus compression ratio and finding an agreeable balance.

NB: When using xz compression for the initrd make sure to include the '-C crc32' parameter or it won't be accepted by the kernel!

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

Copy the 'initrd.gz' (gzip compressed initial RAM disk) to the /boot partition, or to the SD card that will be used to boot the system, like this:

root@slackware:/tmp cp -av initrd.gz /boot/

Or for the 'initrd.xz' (xz compressed initial RAM disk) do it in exactly the same way but change the filename extension:

root@slackware:/tmp cp -av initrd.xz /boot/

In order the load the 'initrd' an instruction needs to be added to the '/boot/config.txt' file. This can be achieved using any text editor, such as 'vim', 'elvis' or 'nano'. The instruction to load the 'initrd' needs to be on a line on its own but can appear anywhere within the '/boot/config.txt' file.

The '/boot/config.txt' instruction to load the 'initrd.gz' (gzip compressed RAM disk) should look like this:

initramfs initrd.gz followkernel

The '/boot/config.txt' instruction to load the 'initrd.xz' (xz compressed RAM disk) should look like this:

initramfs initrd.xz followkernel

For example, appending the above line to the end of the config.txt file for the 'initrd.gz' could be done by redirecting an echo output like this:

root@slackware:/tmp# echo "initramfs initrd.gz followkernel" >> /boot/config.txt

Or, for the 'initrd.xz' it could be added like this:

root@slackware:/tmp# echo "initramfs initrd.xz followkernel" >> /boot/config.txt

Once the line to load the 'initrd' has been added to the '/boot/config.txt' file, the next time the Raspberry Pi device is (re)booted, it should load the initial RAM disk instead of booting into the operating system. If you're creating a bootable SD card then obviously copy the 'initrd' file to that location and edit the '/boot/config.txt' for it, so it loads in the same way.

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 --branch=rpi-6.6.y git://github.com/raspberrypi/linux.git linux_src

SARPi Project muse views ... The '--depth=1' parameter will download only the latest commit and not the full repository content - omit this as required. The '--branch=rpi-6.6.y' parameter specifies the specific branch to download - omit or modify this as required. The 'linux_src' at the end is the name of the directory the 'git clone' will save into - (re)name it to suit or omit it to use a default 'linux' 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
• Raspberry Pi 3 or Raspberry Pi 4 ARM64 AArch64 [64-bit] kernel file name: kernel8.img

So, when you copy the kernel image make sure to name it according to your Raspberry Pi device and operating system version that it's intended to run on. The "l" in 'kernel7l.img' is a lower case "L", as in large. It's actually an indicator for "Large Physical Address Extension (LPAE)". The Raspberry Pi 400 uses the same kernel filename as the Raspberry Pi 4.

SARPi Project muse views ... By default, the kernel image filename is preset for the Raspberry Pi version, but it's possible to use a custom filename for the kernel by setting it in the /boot/config.txt file. For example:

# Uncomment to load a specific kernel
kernel=mycustomkernel.img

If you want to use a custom kernel image filename rather than the default then just specify this parameter in the /boot/config.txt file using the appropriate filename.

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

SARPi Project muse views ... 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.

SARPi Project muse views ... 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_20230210-5+rpt3_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-9+rpt2_all.deb

Once both packages 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_20230210-5+rpt3_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-9+rpt2_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.

Support for Slackware Linux

SARPi Project muse views ...It's always worth bearing in mind that the Slackware Linux project is funded entirely through donations. If you'd like to show your appreciation, and/or to support the development of Slackware, you're able to do so directly via Patrick Volkerding's PayPal.Me link, or Slackware Linux on Patreon.

If you're in need of help, or have something to contribute, one of the best places to get (and offer) support for Slackware Linux is on the Linux Questions Forum. Another valuable resource is the Slackware Documentation Project.

Slackware Documentation Project


Back to Top


Updated: 2024-03-06 13:51:49 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. SARPi Project is in no way affiliated with Slackware Linux, Inc, or the Linux Foundation, or Raspberry Pi Ltd., or any of their respective members, trustees, partners, or associates.


Accept!

SARPi Project uses cookies for website traffic data analytics purposes only. Cookies from this website do not collect or store any of your personal data.

Please read the SARPi Project website [ Cookie Policy ] for more details.