Package: pmbootstrap
pmbootstrapSophisticated chroot/build/flash tool to develop and installpostmarketOS.Developmentpmbootstrap is being developed on SourceHut
(what):https://git.sr.ht/~postmarketos/pmbootstrapSend patches via mail or web UI topmbootstrap-devel(subscribe):~postmarketos/pmbootstrap-devel@lists.sr.htYou can set the default values for sending email in the git checkout$ git config sendemail.to "~postmarketos/pmbootstrap-devel@lists.sr.ht"
$ git config format.subjectPrefix "PATCH pmbootstrap"Run CI scripts locally with:$ pmbootstrap ciRun a single test file:$ pytest -vv ./test/test_keys.pyIssuesIssues are being trackedhere.RequirementsLinux distribution on the host system (x86,x86_64,aarch64orarmv7)Windows subsystem for Linux (WSL)doesnotwork! Please useVirtualBoxinstead.Linux kernel 3.17 or higherPython 3.7+OpenSSLgitpstarUsage ExamplesPlease refer to thepostmarketOS wikifor
in-depth coverage of topics such asporting to a new deviceorinstallation. The
help output (pmbootstrap -h) has detailed usage instructions for every
command. Read on for some generic examples of what can be done withpmbootstrap.Installing pmbootstraphttps://wiki.postmarketos.org/wiki/Installing_pmbootstrapBasicsInitial setup:$ pmbootstrap initRun this in a second window to see all shell commands that get executed:$ pmbootstrap logQuick health check and config overview:$ pmbootstrap statusPackagesBuildaports/main/hello-world:$ pmbootstrap build hello-worldCross-compile toarmhf:$ 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.com/postmarketOS/osk-sdl/-/archive/0.52/osk-sdl-0.52.tar.bz2"Default architecturePackages will be compiled for the architecture of the device running
pmbootstrap by default. For example, if yourx86_64PC runs pmbootstrap, it
would build a package forx86_64with this command:$ pmbootstrap build hello-worldIf you would rather build for the target device selected inpmbootstrap initby default, then use thebuild_default_device_archoption:$ pmbootstrap config build_default_device_arch TrueIf your target device ispine64-pinephonefor example, pmbootstrap will now
build this package foraarch64:$ pmbootstrap build hello-worldChrootsEnter thearmhfbuilding chroot:$ pmbootstrap chroot -b armhfRun a command inside a chroot:$ pmbootstrap chroot -- echo testSafely delete all chroots:$ pmbootstrap zapDevice Porting AssistanceAnalyze Androidboot.imgfiles (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-mainlineRoot File SystemBuild 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.imgetc.:$ pmbootstrap exportExtract the initramfs$ pmbootstrap initfs extractBuild and flash Android recovery zip:$ pmbootstrap install --android-recovery-zip
$ pmbootstrap flasher --method=adb sideloadRepository MaintenanceList pmaports that don't have a binary package:$ pmbootstrap repo_missing --arch=armhf --overviewIncrease thepkgrelfor 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 -mDebuggingUse-von any action to get verbose logging:$ pmbootstrap -v build hello-worldParse a single deviceinfo and return it as JSON:$ pmbootstrap deviceinfo_parse pine64-pinephoneParse 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-worldccachestatistics:$ pmbootstrap stats --arch=armhfUse alternative sudopmbootstrap supportsdoasandsudo.
If multiple sudo implementations are installed, pmbootstrap will usedoas.
You can set thePMB_SUDOenvironmental variable to define the sudo
implementation you want to use.Select SSH keys to include and make authorized in new imagesIf the config file optionssh_keysis set toTrue(it defaults toFalse),
then all files matching the glob~/.ssh/id_*.pubwill be placed in~/.ssh/authorized_keysin 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
thessh_key_globconfiguration 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.cfgmay contain:[pmbootstrap]
# ...
ssh_keys = True
ssh_key_glob = ~/.ssh/postmarketos-dev.pub
# ...LicenseGPLv3