I recently received my
Pine64 Pinephone PostmarketOS Community Edition phone. And while Phosh environment was nice, I wanted to explore other possibilities, and perhaps change to something a bit more lightweight and customizable. Alpine Linux is the foundation of PostmarketOS and is not something I am experienced with, but the Pinephone will boot from a Micro-SD card, so it is easy to try things out and decide what I like before committing it to the eMMC card in the device.
Pmbootstrap seems the tool for building images and flashing, ans the following are my notes from building and booting an alternative image, specifically Simple X Mobile(SXmo). pmbootstrap
Pm bootstrap is a ‘Sophisticated chroot/build/flash tool to develop and install
2 GB of RAM for compiling
Linux environment on the pmbootstrap host system. Windows subsystem for Linux (WSL) does not work!
Kernel 3.17 or higher, I used 5.8.10 without issue.
Python 3.6+, I used 3.8.5.
I downloaded the tool and put it to a directory in my projects folder using the following command.
$ git clone https://gitlab.com/postmarketOS/pmbootstrap.git Install
There are several different ways to install pmbootstrap on the build host, bit I opted for for directly running the code from my git tree clone of the project.
Create a link
Create a symbolic link in ~/.local/bin named pmbootstrap:
$ ln -s " $PWD /pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap Test installation
Test pmbootstrap is installed correctly. Open a new terminal and run:
$ pmbootstrap --version
$ Setup and Build
Update current version of pmbootstrap.
$ pmbootstrap pull # Update the build system
[06:48:27] pmaports (branch: master ): git pull --ff-only
kde/plasma-bigscreen/APKBUILD | 17 +++++++++++++++--
1 file changed, 15 insertions (+ ), 2 deletions (- )
Set up the configuration for the build.
$ pmbootstrap init # Setup desired build configuration
[06:53:06] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs ) will be created in there.
[06:53:06] Work path [/home/chuck/.local/var/pmbootstrap]:
[06:53:27] NOTE: pmaports path: /home/chuck/y/cache_git/pmaports
[06:53:27] Choose the postmarketOS release channel.
[06:53:27] Available (2 ):
[06:53:27] * edge: Rolling release channel
[06:53:27] * stable: Stable release channel (first beta v20.05, does not have many devices yet )
[06:53:27] Channel [edge]:
[06:53:33] Choose your target device vendor (either an existing one, or a new one for porting ) .
[06:53:33] Available vendors (53 ): acer, alcatel, amazon, arrow, asus, bq, chuwi, essential, fairphone, finepower, fly, fujitsu, google, gp, hisense, htc, huawei, infocus, jolla, leeco, lenovo, lg, medion, meizu, motorola, nextbit, nobby, nokia, oneplus, oppo, ouya, pine64, planet, purism, qemu, raspberry, samsung, semc, sharp, sony, surftab, t2m, tablet, teclast, tokio, vernee, wiko, wileyfox, wingtech, xiaomi, yu, zte, zuk
[06:53:33] Vendor [pine64]:
[06:53:41] Available codenames (6 ): a64lts, dontbeevil, pinebookpro, pinephone, pinetab, rockpro64
[06:53:41] Device codename [pinephone]:
[06:53:42] This device has proprietary components, which trade some of your freedom with making more peripherals work.
[06:53:42] We would like to offer full functionality without hurting your freedom, but this is currently not possible for your device.
[06:53:42] device-pine64-pinephone-nonfree-firmware: Wifi and Bluetooth firmware
[06:53:42] Enable this package? (y/n ) [y]:
[06:54:02] Username [user]:
[06:54:08] Available user interfaces (14 ):
[06:54:08] * none: No graphical environment
[06:54:08] * fbkeyboard: Plain framebuffer console with touchscreen keyboard support
[06:54:08] * gnome: (Wayland ) Gnome Shell
[06:54:08] * i3wm: (X11 ) Tiling WM (keyboard required )
[06:54:08] * kodi: (Wayland ) 10-foot UI useful on TVs
[06:54:08] * mate: (X11 ) MATE Desktop Environment, fork of GNOME2 (stylus recommended )
[06:54:08] * phosh: (Wayland ) Mobile UI developed for the Librem 5 (works only with numeric passwords! )
[06:54:08] * plasma-bigscreen: (Wayland ) 10-feet variant of Plasma, made for big screen TVs
[06:54:08] * plasma-desktop: (X11/Wayland ) KDE Desktop Environment (works well with tablets )
[06:54:08] * plasma-mobile: (Wayland ) Mobile variant of KDE Plasma (does not run without hardware acceleration, allows only numeric passwords! )
[06:54:08] * shelli: Plain console with touchscreen gesture support
[06:54:08] * sway: (Wayland ) Tiling WM, drop-in replacement for i3wm (DOES NOT RUN WITHOUT HW ACCELERATION! )
[06:54:08] * sxmo: (X11 ) Simple X Mobile: Mobile environment based on simple & suckless software (best compatibility on pinephone )
[06:54:08] * weston: (Wayland ) Reference compositor (demo, not a phone interface )
[06:54:08] * xfce4: (X11 ) Lightweight desktop (stylus recommended )
[06:54:08] User interface [sxmo]:
[06:54:46] Additional options: boot partition size: 128 MB, parallel jobs: 9, ccache per arch: 5G
[06:54:46] Change them? (y/n ) [n]:
[06:54:50] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file ) or "none"
[06:54:50] Extra packages [none]:
[06:55:02] Your host timezone: US/Central
[06:55:02] Use this timezone instead of GMT? (y/n ) [y]:
[06:55:06] Device hostname (short form, e.g. 'foo' ) [coleco-adam]:
[06:58:10] Would you like to copy your SSH public keys to the device? (y/n ) [n]: y
[06:58:21] After pmaports are changed, the binary packages may be outdated. If you want to install postmarketOS without changes, reply 'n' for a faster installation.
[06:58:21] Build outdated packages during 'pmbootstrap install'? (y/n ) [y]:
[06:58:41] Zap existing chroots to apply configuration? (y/n ) [y]:
[06:58:45] % rm -rf /home/chuck/.local/var/pmbootstrap/chroot_native
[06:58:45] % rm -rf /home/chuck/.local/var/pmbootstrap/chroot_rootfs_pine64-pinephone
[06:58:46] Cleared up ~822 MB of space
[06:58:46] WARNING: The chroots and git repositories in the work dir do not get updated automatically.
[06:58:46] Run 'pmbootstrap status' once a day before working with pmbootstrap to make sure that everything is up-to-date.
$ time pmbootstrap install --fde --sdcard =/dev/sdc
[07:24:40] *** (1/5 ) PREPARE NATIVE CHROOT ***
[07:24:41] Update package index for x86_64 (4 file (s ))
[07:24:47] (native ) install alpine-base
[07:24:54] (native ) install cryptsetup util-linux e2fsprogs parted dosfstools
[07:24:56] *** (2/5 ) CREATE DEVICE ROOTFS ( "pine64-pinephone" ) ***
[07:24:56] Update package index for aarch64 (4 file (s ))
[07:25:00] (native ) install qemu-aarch64
[07:25:00] Register qemu binfmt (aarch64 )
[07:25:01] (rootfs_pine64-pinephone ) install alpine-base
[07:25:09] (rootfs_pine64-pinephone ) install postmarketos-base device-pine64-pinephone device-pine64-pinephone-nonfree-firmware firefox-esr foxtrotgps gnome-icon-theme htop mobile-config-firefox netsurf sacc xcalc postmarketos-ui-sxmo
[07:27:10] (rootfs_pine64-pinephone ) write /etc/os-release
[07:27:11] (rootfs_pine64-pinephone ) mkinitfs postmarketos-allwinner
[07:27:49] *** SET LOGIN PASSWORD FOR: 'user' ***
Retype new password:
passwd: password updated successfully
[07:29:08] NOTE: No valid keymap specified for device
[07:29:12] *** (3/5 ) PREPARE INSTALL BLOCKDEVICE ***
[07:29:12] (native ) mount /dev/install (host: /dev/sdc )
[07:29:12] EVERYTHING ON /dev/sdc WILL BE ERASED! CONTINUE? (y/n ) [n]: y
[07:29:19] (native ) partition /dev/install (boot: 128M, reserved: 0M, root: the rest )
[07:29:19] (native ) format /dev/installp2 (root, luks ), mount to /dev/mapper/pm_crypt
[07:29:19] *** TYPE IN THE FULL DISK ENCRYPTION PASSWORD (TWICE! ) ***
Enter passphrase for /dev/installp2:
WARNING: Locking directory /run/cryptsetup is missing!
Enter passphrase for /dev/installp2:
[07:30:07] (native ) format /dev/mapper/pm_crypt
[07:30:53] (native ) mount /dev/mapper/pm_crypt to /mnt/install
[07:30:53] (native ) format /dev/installp1 (boot, ext2 ), mount to /mnt/install/boot
[07:30:53] *** (4/5 ) FILL INSTALL BLOCKDEVICE ***
[07:30:53] (native ) copy rootfs_pine64-pinephone to /mnt/install/
[07:31:00] Embed firmware u-boot/pine64-pinephone/u-boot-sunxi-with-spl.bin in the SD card image at offset 8 with step size 1024
[07:31:59] *** (5/5 ) FLASHING TO DEVICE ***
[07:31:59] Run the following to flash your installation to the target device:
[07:31:59] * If the above steps do not work, you can also create symlinks to the generated files with 'pmbootstrap export' and flash outside of pmbootstrap.
[07:31:59] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary )
Additional pmbootstrap commands I have found useful so far.
$ pmbootstrap log # Display pmbootstrap log entries
(1365057 ) [07:36:55] % sudo umount /home/chuck/.local/var/pmbootstrap/chroot_native/dev/install
(1365057 ) [07:36:55] % sudo umount /home/chuck/.local/var/pmbootstrap/chroot_native/dev
(1365057 ) [07:36:55] Unregister qemu binfmt (aarch64 )
(1365057 ) [07:36:55] % sudo sh -c echo -1 > /proc/sys/fs/binfmt_misc/qemu-aarch64
(1365057 ) [07:36:55] Shutdown complete
(1365057 ) [07:36:55] Done
(1369096 ) [07:42:19] % tail -f /home/chuck/.local/var/pmbootstrap/log.txt -n 60
(1369096 ) [07:42:19] *** output passed to pmbootstrap stdout, not to this log ***
$ pmbootstrap status # Make sure environment is healthy
[07:44:10] *** CONFIG ***
[07:44:10] Device: pine64-pinephone (aarch64, "PINE64 PinePhone" )
[07:44:10] User Interface: sxmo
[07:44:10] *** GIT REPOS ***
[07:44:10] Path: /home/chuck/.local/var/pmbootstrap/cache_git
[07:44:10] - pmaports (master )
[07:44:10] *** CHECKS ***
[07:44:10] All checks passed! \o/
$ pmbootstrap zap # Kill chroots to make sure packages are rebuilt
[07:45:48] Remove /home/chuck/.local/var/pmbootstrap/chroot_native? (y/n ) [n]: y
[07:45:51] % rm -rf /home/chuck/.local/var/pmbootstrap/chroot_native
[07:45:51] Remove /home/chuck/.local/var/pmbootstrap/chroot_rootfs_pine64-pinephone? (y/n ) [n]: y
[07:45:58] % rm -rf /home/chuck/.local/var/pmbootstrap/chroot_rootfs_pine64-pinephone
[07:45:58] Cleared up ~822 MB of space
$ pmbootstrap shutdown # Deactivatte chroots used for build
[07:36:55] Unregister qemu binfmt (aarch64 )
$ The freshly booted phone.
Now I just need to get up to speed on using SXmo, but so far things all appear well.
/ \ ----------------
/ \ OS: postmarketOS 1.22.2 aarch64
/ \ Host: Pine64 PinePhone (1.2 )
/ \ Kernel: 5.8.0
/ \ Uptime: 2 mins
\ \ Packages: 455 (apk )
/ \ \____ \ Shell: ash
/ \____ \ \ Resolution: 720x1440
/ / \ \ Terminal: /dev/pts/0
/ / \ ___ \ CPU: (4 ) @ 1.152GHz
/ / \ / ____ Memory: 196MiB / 2931MiB
/ / \/ / \
/ / __________/ \
/ \ \ \
/ \ \ \
/ / / \
/___________/ /____________________ \