Slackware on Orange Pi Zero

580 words | 2019-8-21

Orange Pi Zero Orange Pi Zero is a small old single board computer from Shenzhen Xunlong Software CO. Limited.

Orange Pi Zero board

Slackware Install

Installation is described here in sufficient detail. Of course it not for this board exactly, but the differences are very few:

  • no video output, at least without an expansion board, so setenv slkconsole "console=ttyS0,115200n8" and setenv bootcmd_generic 'debug earlyprintk'
  • here we have another processor, so setenv DTB sun8i-h2-plus-orangepi-zero.dtb
  • the saveenv command does not work, so never do saveenv and reset
  • in section 4.1 (Booting the installer) we use the option ``Install manually’’ because there is no script for this board
  • use these two media. The USB flash drive will be the main drive, and the SDcard will serve as the boot device.

Two media

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1         2048     6143     4096    2M  1 FAT12
/dev/mmcblk0p2 *       6144  4200447  4194304    2G 83 Linux

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1          2048  4196351  4194304    2G 82 Linux swap
/dev/sda2       4196352 30375935 26179584 12.5G 83 Linux


  • /dev/mmcblk0p2 must be marked active and be formatted as ext4
  • /dev/sda2 is formatted as f2fs

I did not install any packages related to X11 and about 9G of flash drive were used. I should note that some packages had errors (dvd-rw and some part of GCC-9), I hope that this will not interfere with the operations.

We stop at paragraph 5.1 (Configuring U-Boot) of the instructions.

Configuring U-Boot

As I said with saveenv we are out of luck so we will use the U-Boot script. First, download the sources and prepare the directories:

WD=~/src/my-uboot # your work dir
mkdir -p ${WD}
cd $(WD}
git clone u-boot

Now the moment with the python version: due to the lack of compatibility between versions, you have to resort to virtual environment (I know that this is fear and horror, but what the creators of Python thought was unclear). In addition, it is desirable to set the path to the packages.

 virtualenv -p /usr/bin/python2.7 my_uboot
 source my_uboot/bin/activate
 export PKG_CONFIG_PATH=/usr/lib64/pkgconfig

In the same directory we download a very convenient u-boot.SlackBuild script for building U-Boot and a toolchain for crosscompiling — I used gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz (no need to unpack). Local copy of the script

We can start building the latest version of U-Boot:


After successful compilation, we write the U-Boot image to the SDcard, how to do this is described in the latest messages of the script:smile:.

Now prepare the boot disk /dev/mmcblk0p2. It is formatted as ext4 because today U-Boot cannot boot from f2fs. Here is the list of files that should be on this drive:

initrd-armv7 -> initrd-armv7-4.19.66
zImage-armv7 -> zImage-armv7-4.19.66

The file sun8i-h2-plus-orangepi-zero.dtb can be found somewhere in ${WD}/u-boot, boot.src we will do now, and the rest of the files need to be copied from /dev/sda2/boot.

Now write the boot script boot.txt:

setenv bootcmd_dtb 'ext4load mmc 0:2 ${fdt_addr_r} /${fdtfile} ; fdt addr ${fdt_addr_r} 0x40000' 
setenv bootcmd_slk 'run bootcmd_dtb ; ext4load mmc 0:2 ${kernel_addr_r} /zImage-armv7 ; ext4load mmc 0:2 ${ramdisk_addr_r} /initrd-armv7' 
setenv slkconsole "console=ttyS0,115200n8"
setenv bootcmd_generic 'debug earlyprintk TERM=screen-256color '
setenv bootargs "${slkconsole} ${bootcmd_generic} root=/dev/sda2 rootfstype=f2fs rw waitforroot=5 nodhcp"
setenv bootcmd 'run bootcmd_slk ; bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r} ; '
run bootcmd

Here mmc 0:2 is /dev/mmcblk0p2, root=/dev/sda2 rootfstype=f2fs because I have the root partition formatted in this way,nodhcp — I have no idea, maybe I don’t need it.

Compile the boot script and put the resulting file on /dev/mmcblk0p2

./u_boot-build/tools/mkimage -A arm -T script -d boot.txt boot.scr


Screenshot of running Slackware on Orange Pi Zero