Sophisticated chroot/build/flash tool to develop and install postmarketOS.
Find the location of the upstream repository for pmbootstrap on the postmarketOS homepage.
Run CI scripts locally with:
pmbootstrap ciRun a single test file:
pytest -vv ./test/test_keys.pyIssues are being tracked in the GitLab issue tracker.
- Linux distribution on the host system (
x86,x86_64,aarch64orarmv7)- Windows subsystem for Linux (WSL) does not work! Please use VirtualBox instead.
- Linux kernel 3.17 or higher
- Note: kernel versions between 5.8.8 and 6.0 might have issues with parted.
- Python 3.10+
- For python3 < 3.11: tomli
- OpenSSL
- git
- kpartx (from multipath-tools)
- losetup (with --json support, e.g. util-linux version)
- ps
- tar
For pmbootstrap to be useful, it needs to maintain a local copy of the
pmaports repository
where postmarketOS-specific packages are maintained. This is set up
automatically, but the local copy of pmaports does not automatically get
updated. To update it, you can run $ pmbootstrap pull.
The latest pmbootstrap version works with currently active postmarketOS
releases. Attempting to use
pmboostrap with old postmarketOS versions (old pmaports branches) may result in
failures and is not supported. See pmbootstrap_min_version in
pmaports.cfg for
the oldest supported pmbootstrap version for a given pmaports revision. The
upper bound is not documented.
Please refer to the postmarketOS wiki for
in-depth coverage of topics such as porting to a new
device or
installation. The help
output (pmbootstrap -h) has detailed usage instructions for every command.
Read on for some generic examples of what can be done with pmbootstrap.
https://wiki.postmarketos.org/wiki/Installing_pmbootstrap
Initial setup:
pmbootstrap initRun this in a second window to see all shell commands that get executed:
pmbootstrap logQuick health check and config overview:
pmbootstrap statusBuild aports/main/hello-world:
pmbootstrap build hello-worldCross-compile to armhf:
pmbootstrap build --arch=armhf hello-worldBuild with source code from local folder:
pmbootstrap build linux-postmarketos-mainline --src=~/code/linuxUpdate checksums:
pmbootstrap checksum hello-worldGenerate a template for a new package:
pmbootstrap newapkbuild "https://gitlab.postmarketos.org/postmarketOS/tinydm/-/archive/1.2.0/tinydm-1.2.0.tar.gz"Packages will be compiled for the architecture of the device running pmbootstrap
by default. For example, if your x86_64 PC runs pmbootstrap, it would build a
package for x86_64 with this command:
pmbootstrap build hello-worldIf you would rather build for the target device selected in pmbootstrap init
by default, then use the build_default_device_arch option:
pmbootstrap config build_default_device_arch TrueIf your target device is pine64-pinephone for example, pmbootstrap will now
build this package for aarch64:
pmbootstrap build hello-worldEnter the armhf building chroot:
pmbootstrap chroot -b armhfRun a command inside a chroot:
pmbootstrap chroot -- echo testSafely delete all chroots:
pmbootstrap zapAnalyze Android
boot.img files (also
works with recovery OS images like TWRP):
pmbootstrap bootimg_analyze ~/Downloads/twrp-3.2.1-0-fp2.imgCheck kernel configs:
pmbootstrap kconfig checkEdit a kernel config:
pmbootstrap kconfig edit --arch=armhf postmarketos-mainlineBuild the rootfs:
pmbootstrap installBuild the rootfs with full disk encryption:
pmbootstrap install --fdeUpdate existing installation on SD card:
pmbootstrap install --disk=/dev/mmcblk0 --rsyncRun the image in QEMU:
pmbootstrap qemu --image-size=1GFlash to the device:
pmbootstrap flasher flash_kernel
pmbootstrap flasher flash_rootfs --partition=userdataExport the rootfs, kernel, initramfs, boot.img etc.:
pmbootstrap exportExtract the initramfs
pmbootstrap initfs extractBuild and flash Android recovery zip:
pmbootstrap install --android-recovery-zip
pmbootstrap flasher --method=adb sideloadList pmaports that don't have a binary package:
pmbootstrap repo_missing --arch=armhf --overviewIncrease the pkgrel for each aport where the binary package has outdated
dependencies (e.g. after soname bumps):
pmbootstrap pkgrel_bump --autoGenerate cross-compiler aports based on the latest version from Alpine's aports:
pmbootstrap aportgen gcc-armhfManually rebuild package index:
pmbootstrap indexDelete local binary packages without existing aport of same version:
pmbootstrap zap -mUse -v on any action to get verbose logging:
pmbootstrap -v build hello-worldParse a single APKBUILD and return it as JSON:
pmbootstrap apkbuild_parse hello-worldParse a package from an APKINDEX and return it as JSON:
pmbootstrap apkindex_parse $WORK/cache_apk_x86_64/APKINDEX.8b865e19.tar.gz hello-worldccache statistics:
pmbootstrap stats --arch=armhfSee PMB_SUDO in docs/environment_variables.md.
If the config file option ssh_keys is set to True (it defaults to False),
then all files matching the glob ~/.ssh/*.pub will be placed in
~/.ssh/authorized_keys in the user's home directory in newly-built images.
Sometimes, for example if you have a large number of SSH keys, you may wish to
select a different set of public keys to include in an image. To do this, set
the ssh_key_glob configuration parameter in the pmbootstrap config file to a
string containing a glob that is to match the file or files you wish to include.
For example, a ~/.config/pmbootstrap_v3.cfg may contain:
[pmbootstrap]
# ...
ssh_keys = True
ssh_key_glob = ~/.ssh/postmarketos-dev.pub
# ...