Nov 2021 - wip ====== Installing Slackware AArch64 on the RockPro64 ====== ^ ^ Target ^ | Platform | AArch64 | | Slackware Distribution|Slackware AArch64 Current | | Hardware Model |Rock Pro64 | ==== Video Tutorial ==== This tutorial is also available in video form. ==== Installation Lifecycle ==== The Installation consists of nine distinct stages: - Acquiring all required hardware - Setting up local environment to support the installation over the network - Downloading the Slackware assets - Writing the Initialisation Bootware to the Micro SD card - Setup of the RockPro64 hardware - Initialising the RockPro64 with the Bootware - Writing the Slackware Installer to the Micro SD card - Booting the Slackware Installer - Installing Slackware - Completing the installation - Booting the Slackware OS ===== Requirements ===== === Hardware === ^ Item ^ Specification ^ Notes ^ | [[https://www.pine64.org/rockpro64/|RockPro64]] | 4GB version | The RockPro64 (2GB version may work but hasn't been tested) | | [[https://pine64.com/product/rockpro64-12v-5a-eu-power-supply/|RockPro64 Power Supply ('PSU')]] | Pine64's own | There is a cheaper alternative, but this version is recommended. Note that the link here is for the EU version - a US version is also available in the Pine64 store | | Micro SD Card | 2GB **minimum**, fast speed, good quality make | Used as Slackware' /boot partition | | [[https://www.amazon.co.uk/UGREEN-Adapter-Windows-Surface-Chromebook/dp/B01EFPX9XA|USB Multi-Card Reader]] | Must accept Micro SD cards | Used to write the Bootware on your host Linux computer. This isn't required if your host computer has a Micro SD card reader. | | [[https://thepihut.com/products/usb-to-ttl-serial-cable|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! | A USB to Serial adapter is recommended, but optional.| | Jumper or Dupont cable | See images below | This is to bridge the pins required for initial firmware deployment and/or Hardware Model recovery| | [[https://www.amazon.co.uk/USB-SATA-Adapter-Cable-Drives-en-GB-SATA-USB-3-0-converter/dp/B01N2JIQR7|USB to SATA adapter]] | Many models will work, but this one has been tested. | For a simple installation you require either storage attached to a USB interface, or using the SATA PCI card (see below).| | [[https://pine64.com/product/pcie-to-dual-sata-iii-interface-card/|PCIe to Dual SATA-III Interface Card]] | PINE64's own| You can use this or the USB to SATA adapter (see row above)| | SATA storage | Any SSD or spinning hard disk should work | Will contain the Operating System. You can install to other storage, but this documentation covers this particular configuration only. | | [[https://pine64.com/product/rockpro64-1x1-dual-band-wifi-802-11ac-bluetooth-5-0-module/|Wifi and Bluetooth module]] | Pine64's own | Optional | | [[https://pine64.com/product/rockpro64-10mm-low-profile-heatsink-with-fan/|Heat sink and CPU fan]] | Pine64's own | Either a heat sink or fan are required. Some of the cases have built-in heat sinks, so check the options | | [[https://pine64.com/product/rockpro64-power-cable-for-dual-sata-drives/|SATA power cable]] | Pine64's own | Optional - depends if you use the SATA PCI card and choose to power the drives from the board (see notes below around stability) | | [[https://pine64.com/product/rtc-backup-battery-holder-2-x-aaa/|Real Time Clock ('RTC') battery holder | Pine64's own | An RTC is used to keep the time when the Hardware Model is powered down. This is recommended but optional. Time can also be set via NTP once the OS has booted. | === 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. However, powering spinning 3.5" SATA drives from the RockPro64 directly have resulted in instability of the hardware. This was resolved by powering the drives and CPU fan from an external power supply. The Slackware AArch64 primary build machines run with this power configuration and have proven stable over time. === 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, and serve the Pinebook Pro client to install Slackware over the LAN (Local Area Network). | ===== Hardware Setup ===== In this section we'll prepare the physical aspects of the Pinebook Pro to receive Slackware Linux. There are seven distinct parts to this phase: - Unscrew the case - Disable eMMC (and remove storage module) - Enable Sound (disabling Serial console) - Securely attach NVME to NVME adapter - Connect NVME adapter to the main board - Securely attach NVME adapter within the Pinebook Pro's case - Screw case back together === 1. Remove the base cover from the Pinebook Pro === == Turn the Pinebook Pro over, and remove all screws == {{:slackwarearm:pinebookpro-base.jpg?400|}} == Turn the Pinebook Pro back over to reveal the motherboard and interior == {{:slackwarearm:pinebookpro-factory-look-emmc-enabled.jpg?400|}} == Disable booting from eMMC and remove the eMMC storage module == The 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 === The '$' prefixes in the commands indicates the shell prompt - it's not to be typed/copied Open a shell on the Linux Host Computer. == Determine where you are within the Host Computer's Filesystem == $ cd $ pwd /home/mozes/slackware Note the directory location returned - you'll need this later == Prepare a directory to hold and serve the Slackware Distribution == We'll download the Slackware Linux distribution into a directory named 'slackware'. The contents of this directory will be served via an HTTP server to the LAN (Local Area Network), so only place the Slackware assets here. $ 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: :: $ SLKSRV=ftp.arm.slackware.com::slackwarearm == Download the Bootware == Note the period/full stop after the rsync commands - this instructs rsync to download to the current directory (it's not punctuation!) The U-Boot Boot Loader that will be installed onto the SPI flash: rsync -PavL $SLKSRV/platform/aarch64/bootware/recovery/rk3399/flash-spi-pinebookpro.img.xz . //The Bootware (recovery/initialisation) images are approximately 400KBytes in size.// The Slackware Linux installer for the RK3399 AArch64 platform: rsync -PavL $SLKSRV/platform/aarch64/bootware/installer/slackwareaarch64-${SLKVER}/rk3399_generic.sdimg_latest.img.xz . //The Slackware Installer images are approximately 300MBytes in size.// == Verify the assets == Verify the digital signature of the Slackware Installer: $ gpg2 --verify rk3399_generic-sdimg_*.img.xz.asc Verify the digital signature of the Boot Loader: $ gpg2 --verify flash-spi-pinebookpro.img.xz.asc The output will be similar to this. You are looking for 'Good signature from Slackware ARM...' gpg: assuming signed data in 'rk3399_generic-sdimg_5.14.14_1.img.xz' gpg: Signature made Mon 25 Oct 2021 06:07:44 PM BST gpg: using RSA key F7ABB8691623FC33 gpg: Good signature from "Slackware ARM (Slackware ARM Linux Project) " [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 == 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.// === Write the Initialisation Bootware to the SD Card === Slackware stores the U-Boot Boot Loader firmware within the SPI flash of the Hardware Models that use the RK3399 SoC (including the Pinebook Pro, RockPro64 et al). In this step, we'll write the Boot Loader firmware to the same Micro SD card that will later be used to contain the Slackware Installer, and subsequently the Slackware OS' /boot partition. If you have multiple Micro SD cards available, you may prefer to use separate SD cards; but this document assumes the availability of a single Micro SD card. == Elevate yourself to root == On your Host computer, obtain root: The # prefix indicates that you're using the **root** user $ 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 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 8G 0 part [SWAP] └─sda2 8:2 0 457.7G 0 part / 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 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 8G 0 part [SWAP] └─sda2 8:2 0 457.7G 0 part / 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 see them surfaced in this list also. You'll also observe the presence of //sdd// - often the USB adapter itself obtains a block device. You can ignore this as it's 0Bytes. == Write the Bootware Initialisation Image to the Micro SD Card == Still as the **root** user, we'll switch to the directory to which the the Slackware assets have been downloaded (see earlier steps): # cd /home/mozes/slackware/ Write the Bootware Initialisation Image to the device identified as our Micro SD card. You'll then exit the root shell, returning to your usual standard user environment: All data on this Micro SD Card will be erased! Ensure you have inserted the correct card! # xzcat flash-spi-pinebookpro.img.xz > /dev/sdc ## Replace /dev/sdc with the correct block device (presented above by the lsblk tool) on your Host Computer # sync # exit The Bootware Initialisation image is now ready to boot on the Pinebook Pro. You are ready to move into the Hardware Initialisation setup. ===== Installing the Boot Loader to SPI flash ===== You need to perform this one-time step to flash a Slackware version of the U-Boot Boot Loader to the SPI flash of the Pinebook Pro. If you reinstall Slackware you do **not** need to repeat this step, as long as the Slackware version of U-Boot remains within the SPI flash. - Connect the power to the Pinebook Pro - Disconnect any peripherals (including the Pinebook Pro docking station) from the Pinebook Pro. - Insert the Micro SD card into the Pinebook Pro's Micro SD slot (right hand side, below the 3.5" audio jack port) - Open the lid - Power on the Pinebook Pro: hold down the Power button (top right of keyboard) for 3 seconds {{:slackwarearm:pinebookpro-spi_flash_complete.png?400|}} After a few seconds, you should see a message appearing on the screen - instructing you that the process will begin in 10 seconds' time, and to release the SPI jumper. In most cases you can simply wait until the process begins. Once the process completes, **power off** the Pinebook Pro : //hold the power button for approximately **8 seconds**//. One-off step. Fresh from the Factory or for moving from another Linux distribution. Pin 23 is SPI_CLK_M2 Pin 25 is GND ===== Installation Method: Installing Slackware ===== Write the Slackware Installer to the Micro SD card. Start the HTTP server on the Linux Host Computer Power on the Pinebook Pro Ensure power is connected throughout the installation process. Connect the Pinebook Pro docking station (or USB Ethernet adapter if not using the docking station) Setting screen font for PineBook Pro in post installation screens *** COLD BOOT - hold down for about 8 seconds after installer Disconnect any USB devices that aren't required for the OS installation Start the HTTP server on the Linux Host Computer As your normal (not root) user on your Linux Host Computer, within the 'slackware' directory you created earlier: == Determine the Linux Host Computer's IP address == We will direct the Slackware Installer to download the packages from your Linux Host Computer, thus require its IP address. For most basic installations, the following command will provide the correct IP. If your Linux Host Computer has a more complex setup, you'll need to determine the IP address yourself using //ifconfig// or one of the other tools. $ hostname -I 192.168.1.15 In this example, the IP address of the Linux Host Computer is 192.168.1.15 == Start the HTTP server == On the Linux Host Computer, enter the Slackware distribution tree and start the HTTP web server. $ cd slackwareaarch64-*/ $ python3 -m http.server The HTTP server will remain in the foreground - you may now leave it. We will return to close it post installation. === Installing Slackware === The date on your system may be incorrect: ntpdate clock.akamai.com hwclock -w Pick option //'5 - Install from FTP/HTTP server'// URL: http://192.168.1.15:8000 Directory: / == Pre first boot tweaks == Updating the Operating System Initial RAM Disk. [[https://www.youtube.com/watch?v=t3wKXMENTXk|Video tutorial]]. USing os-initrd-mgr tool. chroot == Post installation tweaks == ===== Booting ===== Without serial adaptor, you have no visibility until a certain point in the boot process. Installer ships with network support.... so you need to wait if there's no network. screen -T screen-256color /dev/ttyUSB0 1500000,n Other adapter configs: screen -T screen-256color /dev/ttyUSB0 1500000,crtscts ===== Initial Setup ===== /boot - SD card. Resize later. screen font? Rockpro? ===== HTTP Installation ===== ===== Installation Finalisation ===== ====== Installing the Boot Loader to onboard ('SPI') flash ====== Note: This currently takes approximately 30 minutes from the installer, but only four minutes from within the OS. This needs some research. Resize /boot ====== Fan control ====== # Max setting: root@bladswede:/tmp# echo 255 > /sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1 # Happy medium - I can't hear it: echo 100 > /sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1 # Lowest setting (lower figures cause the fan to stop spinning): echo 50 > /sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1 # If the fan is stopped, it can be restarted by sending '100' to that # interface. === Using the Serial adapter ===