Skip to main content

A sophisticated chroot / build / flash tool to develop and install postmarketOS

Reason this release was yanked:

Installing pmbootstrap from pypi is deprecated, see: https://postmarketos.org/pmbootstrap

Project description

pmbootstrap

Introduction | Security Warning | Devices

Sophisticated chroot/build/flash tool to develop and install postmarketOS.

Package build scripts live in the pmaports repository now.

Requirements

Usage Examples

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.

Installing pmbootstrap

https://wiki.postmarketos.org/wiki/Installing_pmbootstrap

Basics

Initial setup:

$ pmbootstrap init

Run this in a second window to see all shell commands that get executed:

$ pmbootstrap log

Quick health check and config overview:

$ pmbootstrap status

Packages

Build aports/main/hello-world:

$ pmbootstrap build hello-world

Cross-compile to armhf:

$ pmbootstrap build --arch=armhf hello-world

Build with source code from local folder:

$ pmbootstrap build linux-postmarketos-mainline --src=~/code/linux

Update checksums:

$ pmbootstrap checksum hello-world

Generate a template for a new package:

$ pmbootstrap newapkbuild "https://gitlab.com/postmarketOS/osk-sdl/-/archive/0.52/osk-sdl-0.52.tar.bz2"

Chroots

Enter the armhf building chroot:

$ pmbootstrap chroot -b armhf

Run a command inside a chroot:

$ pmbootstrap chroot -- echo test

Safely delete all chroots:

$ pmbootstrap zap

Device Porting Assistance

Analyze Android boot.img files (also works with recovery OS images like TWRP):

$ pmbootstrap bootimg_analyze ~/Downloads/twrp-3.2.1-0-fp2.img

Check kernel configs:

$ pmbootstrap kconfig check

Edit a kernel config:

$ pmbootstrap kconfig edit --arch=armhf postmarketos-mainline

Root File System

Build the rootfs:

$ pmbootstrap install

Build the rootfs with full disk encryption:

$ pmbootstrap install --fde

Update existing installation on SD card:

$ pmbootstrap install --sdcard=/dev/mmcblk0 --rsync

Run the image in QEMU:

$ pmbootstrap qemu --image-size=1G

Flash to the device:

$ pmbootstrap flasher flash_kernel
$ pmbootstrap flasher flash_rootfs --partition=userdata

Export the rootfs, kernel, initramfs, boot.img etc.:

$ pmbootstrap export

Extract the initramfs

$ pmbootstrap initfs extract

Build and flash Android recovery zip:

$ pmbootstrap install --android-recovery-zip
$ pmbootstrap flasher --method=adb sideload

Repository Maintenance

List pmaports that don't have a binary package:

$ pmbootstrap repo_missing --arch=armhf --overview

Increase the pkgrel for each aport where the binary package has outdated dependencies (e.g. after soname bumps):

$ pmbootstrap pkgrel_bump --auto

Generate cross-compiler aports based on the latest version from Alpine's aports:

$ pmbootstrap aportgen binutils-armhf gcc-armhf

Manually rebuild package index:

$ pmbootstrap index

Delete local binary packages without existing aport of same version:

$ pmbootstrap zap -m

Debugging

Use -v on any action to get verbose logging:

$ pmbootstrap -v build hello-world

Parse a single deviceinfo and return it as JSON:

$ pmbootstrap deviceinfo_parse pine64-pinephone

Parse a single APKBUILD and return it as JSON:

$ pmbootstrap apkbuild_parse hello-world

Parse a package from an APKINDEX and return it as JSON:

$ pmbootstrap apkindex_parse $WORK/cache_apk_x86_64/APKINDEX.8b865e19.tar.gz hello-world

ccache statistics:

$ pmbootstrap stats --arch=armhf

distccd log:

$ pmbootstrap log_distccd

Use alternative sudo

pmbootstrap supports doas and sudo. If multiple sudo implementations are installed, pmbootstrap will use doas. You can set the PMB_SUDO environmental variable to define the sudo implementation you want to use.

Development

Requirements for running tests

You also need to install the following python packages (pip can be useful if you distribution hasn't got them packaged):

  • pytest
  • pytest-cov
  • flake8

On Alpine Linux it can be done with:

$ sudo apk add grep shellcheck py3-pytest py3-pytest-cov py3-flake8

Running linters

The easiest way is to run the same script CI runs:

$ ./test/static_code_analysis.sh

Running tests

You can now run pytest -vv inside the pmbootstrap folder to run all available tests.

CI runs slightly reduces set of tests (it skips tests that require running qemu) by this:

$ .ci/pytest.sh

This is the easiest way to do the same as CI.

Alternatively you can run a single test file if you wish:

$ pytest -vv ./test/test_keys.py

License

GPLv3

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pmbootstrap-1.40.0.tar.gz (219.6 kB view details)

Uploaded Source

Built Distribution

pmbootstrap-1.40.0-py3-none-any.whl (232.9 kB view details)

Uploaded Python 3

File details

Details for the file pmbootstrap-1.40.0.tar.gz.

File metadata

  • Download URL: pmbootstrap-1.40.0.tar.gz
  • Upload date:
  • Size: 219.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.9

File hashes

Hashes for pmbootstrap-1.40.0.tar.gz
Algorithm Hash digest
SHA256 6fff4d114469e3677f8ff164f0d512d19006f7dab9e9e834a4453fc64167beb3
MD5 0471c115f4641641cc72bbc83160a83f
BLAKE2b-256 eb9a61d52e244fc25763cbd3700fe5224d845330f5f3dc4702a70b2e3db5cf30

See more details on using hashes here.

Provenance

File details

Details for the file pmbootstrap-1.40.0-py3-none-any.whl.

File metadata

  • Download URL: pmbootstrap-1.40.0-py3-none-any.whl
  • Upload date:
  • Size: 232.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.9

File hashes

Hashes for pmbootstrap-1.40.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62944c5700220ac7139456c32cb69e7b28d0056f01ba8b3aa03877251210de26
MD5 d1da8c17429fa264463fe8ede92e2eb7
BLAKE2b-256 e851e2394169f4d5306dda340428a0f672657684c791453356174f5966175dc4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page