I recently purchased an
Orangepi Zero 512 with expansion board and case for a data logging project A Bananapi Pro with an SSD drive was a little too much for the job and I liked the idea of 3 USB ports.
While the Orangepi Zero is not supported it is possible to install Slackwarearm current on it. Hopefully what follows will be or use to someone else with an Orangepi Zero or some other unsupported board.
I had earlier built a bootable sdcard.img for the Zero using
buildroot on my x86 desktop so I had both the the u-boot-sunxi-with-spl.bin plus a known good dtb all file.
Here's a good tutorial on using buildroot. For the Orangepi Zero use
orangepi_zero_defconfig.
Code:
bash-5.0$ ls opi-buildroot/output/images
boot.scr rootfs.ext4 u-boot-sunxi-with-spl.bin
boot.vfat sdcard.img u-boot.bin
rootfs.ext2 sun8i-h2-plus-orangepi-zero.dtb zImage
To set up the sdcard I first wiped the sdcard partition table, then used dd to copy the u-boot-sunxi-with-spl.bin to the sdcard. I created created and formatted an ext4 partition on the card after which I copied sun8i-h2-plus-orangepi-zero.dtb, isolinux/initrd-armv7.img and kernels/armv7/zImage-armv7 to the sdcard.
Code:
dd if=/dev/zero of=/dev/sdx bs=1M count=1
dd if=u-boot-sunxi-with-spl.bin of=/dev/sdx bs=1024 seek=8
<snipped>
Device Boot Start End Sectors Size Id Type
/dev/sdd1 * 2048 411647 409600 200M 83 Linux
bash-5.0# ls
boot.cmd initrd-armv7.img zImage-armv7
boot.scr sun8i-h2-plus-orangepi-zero.dtb
I use a a boot.cmd file create a boot.scr (image) which tells u-boot what to do. U-boot will look for boot.scr in the first partion of the sdcard.
Code:
# boot.cmd to boot from first partition on an SD card
#
setenv fdt_addr 0x43000000
setenv kernel_addr_r 0x47000000
setenv ramdisk_addr_r 0x48000000
setenv bootargs console=ttyS0,115200n8 TERM=screen-256color root=/dev/mmcblk0p1 rw waitforroot=3 rootfstype=ext4
#
ext4load mmc 0:1 ${fdt_addr} sun8i-h2-plus-orangepi-zero.dtb
ext4load mmc 0:1 ${kernel_addr_r} zImage-armv7
ext4load mmc 0:1 ${ramdisk_addr_r} initrd-armv7.img
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}
#
# Create u-boot boot image named boot.scr with:
# mkimage -C none -A arm -T script -d boot.cmd boot.scr
After using this boot.cmd to create a boot.scr with the command on the last line of boot.cmd I was able to boot into the slackwarearm installer on the Orangepi Zero. Then I reformatted the sdcard inserted a usb stick with the slackwarearm source and installed slackwarearm. After the install I copied in a new boot.cmd and set it up to boot the zImage and initrd.img now installed in the /boot directory
Theres not much grunt in the Orangepi Zero. An install of the a, ap, d, k, l, n and tcl package groups took around 2 1/2 hours and I really didn't need everything installed so I decided to install the slackwarearm mini root filesystem and then install whatever else I needed when I needed it. I set up a boot, swap and root partion on my sdcard.
Code:
<snipped>
Device Boot Start End Sectors Size Id Type
/dev/sdd1 * 2048 309247 307200 150M 83 Linux
/dev/sdd2 309248 1382399 1073152 524M 82 Linux swap
/dev/sdd3 1382400 15523839 14141440 6.8G 83 Linux
Next I downloaded the mini root file system, installed the kernel and modules to the mini root filesystem,
Code:
ROOT=miniroot-01142020/ installpkg slackwarearm-current/slackware/a/kernel*.txz
bash-5.0# ls /mnt/sdd1
System.map-armv7 dtb sun8i-h2-plus-orangepi-zero.dtb
System.map-armv7-5.4.10 dtb-5.4.10 zImage-armv7
boot.cmd initrd-armv7 zImage-armv7-5.4.10
boot.scr initrd-armv7-5.4.10 config-armv7-5.4.10
copied the contents of the mini root boot directory to the first (/boot) partition and copied everything else, except /boot, to the third (/) partition. /etc/rc.d/rc.keymap had to be changed since I use a US keymap, I had to edit /etc/fstab and new boot.cmd was required.
Code:
<snipped>
/dev/mmcblk0p1 /boot ext4 errors=remount-ro 0 1
/dev/mmcblk0p2 none swap sw 0 0
/dev/mmcblk0p2 / ext4 errors=remount-ro 0 1
# boot.cmd to boot from /boot on first partition on an SD card
# withh root on the 3rd partition.
#
setenv fdt_addr 0x43000000
setenv kernel_addr_r 0x47000000
setenv ramdisk_addr_r 0x48000000
setenv bootargs console=ttyS0,115200n8 root=/dev/mmcblk0p3 rw waitforroot=3 rootfstype=ext4
#
ext4load mmc 0:1 ${fdt_addr} sun8i-h2-plus-orangepi-zero.dtb
ext4load mmc 0:1 ${kernel_addr_r} zImage-armv7
ext4load mmc 0:1 ${ramdisk_addr_r} initrd-armv7
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}
#
# Create u-boot boot image named boot.scr with:
# mkimage -C none -A arm -T script -d boot.cmd boot.scr
After booting into the new system I could then mount a USB stick with the Slackwarearm source and use installpkg to install anything else I need.
Interestingly changing one line of the boot.cmd directly above will allow me to boot this same system on this sdcard on one pf my Bananapi Pro's if I have the DTB directory installed in /boot.
Code:
ext4load mmc 0:1 ${fdt_addr} sun8i-h2-plus-orangepi-zero.dtb
# Change to:
ext4load mmc 0:1 ${fdt_addr} dtb/sun7i-a20-bananapro.dtb