Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


While building and testing I've noticed the purism's build server very frequently (almost always) aborts download prematurely - perhaps they put some protection against abuse, dunno, so I've made the script to try to continue download if the file already exists. In addition to that, to be able to tinker with the image if you add anything after the script (eg. ./build_image 1) it will also preserve original pureos image archive so that you can re-extract and do whatever you want with it.

Also to pretend it's more complex than it really is the script runs in a verbose/debug/tracing/-x mode so you can see where it fails (if it does). Although because initial time consuming tasks (build and image download) are running as background tasks in parallel - it might be very tough to understand where it actually failed (eg download may fail while build is still running and you see error only after build finished).

  LD      spl/drivers/power/built-in.o
  LD      spl/drivers/power/pmic/built-in.o
  LD      spl/drivers/power/regulator/built-in.o
  CC      spl/drivers/serial/serial.o
  CC      spl/drivers/serial/serial_ns16550.o
  CC      spl/drivers/serial/ns16550.o
  LD      spl/drivers/serial/built-in.o
  LD      spl/drivers/soc/built-in.o
  LD      spl/drivers/built-in.o
  LD      spl/dts/built-in.o
  CC      spl/fs/fs_internal.o
  LD      spl/fs/built-in.o
  LDS     spl/
  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
  COPY    spl/u-boot-spl.bin
  MKSUNXI spl/sunxi-spl.bin
  MKIMAGE u-boot.img
  COPY    u-boot.dtb
  MKIMAGE u-boot-dtb.img
./"board/sunxi/" \
arch/arm/dts/sun50i-a64-pine64-lts.dtb > u-boot.its
  MKIMAGE u-boot.itb
  CAT     u-boot-sunxi-with-spl.bin
===================== WARNING ======================
This board uses CONFIG_SPL_FIT_GENERATOR. Please migrate
to binman instead, to avoid the proliferation of
arch-specific scripts with no tests.
  CFGCHK  u-boot.cfg
+ cp u-boot-sunxi-with-spl.bin ../
+ cd ..
+ wait -f
+ xzcat librem5r3.img.xz
xzcat: librem5r3.img.xz: Unerwartetes Ende der Eingabe

Here you can see build has finished, then script resumed sequential execution and failed at unpacking the image. After this kind of error you just need to re-execute the script and it will continue downloading the pureos image while partially rebuilding the u-boot.

$ ./ 
+ PINE_LINUX_BRANCH=pine64-kernel-5.5.y
+ LIBREM5_IMG=librem5r3
+ CI_FILTER='contains(description,%20%27librem5r3%27)%20and%20contains(result,\
+ SYS_IMG=librem5r3.img
+ fetch_system
++ curl -sg '
++ sed 's/<�<[^>]\+>//g'
+ fetch_kernel
+ curl\
	librem5r3.img.xz -O -C -
+ '[' x = x ']'
+ build_uboot
+ curl -O -C -
+ test -d atf
+ git -C atf pull
** Resuming transfer from byte position 220252415
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
** Resuming transfer from byte position 13343754
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   190  100   190    0     0    524      0 --:--:-- --:--:-- --:--:--   524
Bereits aktuell.
+ cd atf
+ make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_a64 DEBUG=1 bl31


+ wait -f
100  647M  100  647M    0     0  3038k      0  0:03:38  0:03:38 --:--:-- 3019k
+ xzcat librem5r3.img.xz
+ dd if=u-boot-sunxi-with-spl.bin of=librem5r3.img bs=8k seek=1 conv=notrunc
86+1 Datensätze ein
86+1 Datensätze aus
707804 Bytes (708 kB, 691 KiB) kopiert, 0,00577333 s, 123 MB/s
+ MNT=sd
+ test -d sd
+ mkdir sd
++ losetup -f
+ LO=/dev/loop1
+ sudo losetup -P /dev/loop1 librem5r3.img
[sudo] Passwort für ruff: 
+ sudo mount /dev/loop1p2 sd
+ sudo mount /dev/loop1p1 sd/boot
+ sudo tar xf pp.tar.gz -C sd/boot --strip-components=1 --exclude=modules \
+ sudo tar xf pp.tar.gz -C sd/lib/modules --strip-components=4 --wildcards \
+ sudo tar xf pp.tar.gz -C sd/usr/src/ --strip-components=1 --wildcards '*/headers/*'
+ echo 'setenv bootargs root=/dev/mmcblk0p2 rootwait console=ttyS0,115200 loglevel=7 \
load mmc 0:1 $kernel_addr_r Image
load mmc 0:1 $fdt_addr_r sun50i-a64-pinephone.dtb
#load mmc 0:1 $ramdisk_addr_r initrd.uimg &&
#booti $kernel_addr_r $ramdisk_addr_r $fdt_addr_r
booti $kernel_addr_r - $fdt_addr_r'
+ cd sd/boot
+ sudo mv boot.scr boot.scr.orig
+ sudo mkimage -A arm64 -T script -n pinephone -d ../../boot.txt boot.scr
Image Name:   pinephone
Created:      Thu Dec 10 21:17:56 2020
Image Type:   AArch64 Linux Script (gzip compressed)
Data Size:    308 Bytes = 0.30 KiB = 0.00 MiB
Load Address: 00000000
Entry Point:  00000000
   Image 0: 300 Bytes = 0.29 KiB = 0.00 MiB
+ sudo ln -s board-1.1.dtb sun50i-a64-pinephone.dtb
+ cd ../..
+ sudo umount -R sd
+ sudo losetup -d /dev/loop1
+ '[' x = x ']'
+ rm librem5r3.img.xz
+ rm u-boot-sunxi-with-spl.bin
+ rm boot.txt
+ rm -r sd
+ echo 'Copy image librem5r3.img to SD card with
dd if=librem5r3.img of=/dev/sdX bs=16k
Copy image librem5r3.img to SD card with
dd if=librem5r3.img of=/dev/sdX bs=16k

This is how script succeeds.


A script to convert L5-PureOS to PP-Pure-OS






No releases published


No packages published