~martijnbraam/almobootstrap

Alpine Mobile bootstrap
Rename internals for Almo
Remove postmarketOS trust

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~martijnbraam/almobootstrap
read/write
git@git.sr.ht:~martijnbraam/almobootstrap

You can also use your local clone with git send-email.

#almobootstrap

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

#Development

almobootstrap is being developed on SourceHut (what):

https://git.sr.ht/~postmarketos/almobootstrap

Send patches via mail or web UI to almobootstrap-devel (subscribe):

~postmarketos/almobootstrap-devel@lists.sr.ht

You can set the default values for sending email in the git checkout

$ git config sendemail.to "~postmarketos/almobootstrap-devel@lists.sr.ht"
$ git config format.subjectPrefix "PATCH almobootstrap"

Run CI scripts locally with:

$ almobootstrap ci

Run a single test file:

$ pytest -vv ./test/test_keys.py

#Issues

Issues are being tracked here.

#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 (almobootstrap -h) has detailed usage instructions for every command. Read on for some generic examples of what can be done with almobootstrap.

#Installing almobootstrap

https://wiki.almolinux.org/wiki/Installing_almobootstrap

#Basics

Initial setup:

$ almobootstrap init

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

$ almobootstrap log

Quick health check and config overview:

$ almobootstrap status

#Packages

Build aports/main/hello-world:

$ almobootstrap build hello-world

Cross-compile to armhf:

$ almobootstrap build --arch=armhf hello-world

Build with source code from local folder:

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

Update checksums:

$ almobootstrap checksum hello-world

Generate a template for a new package:

$ almobootstrap newapkbuild "https://gitlab.com/postmarketOS/osk-sdl/-/archive/0.52/osk-sdl-0.52.tar.bz2"
#Default architecture

Packages will be compiled for the architecture of the device running almobootstrap by default. For example, if your x86_64 PC runs almobootstrap, it would build a package for x86_64 with this command:

$ almobootstrap build hello-world

If you would rather build for the target device selected in almobootstrap init by default, then use the build_default_device_arch option:

$ almobootstrap config build_default_device_arch True

If your target device is pine64-pinephone for example, almobootstrap will now build this package for aarch64:

$ almobootstrap build hello-world

#Chroots

Enter the armhf building chroot:

$ almobootstrap chroot -b armhf

Run a command inside a chroot:

$ almobootstrap chroot -- echo test

Safely delete all chroots:

$ almobootstrap zap

#Device Porting Assistance

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

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

Check kernel configs:

$ almobootstrap kconfig check

Edit a kernel config:

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

#Root File System

Build the rootfs:

$ almobootstrap install

Build the rootfs with full disk encryption:

$ almobootstrap install --fde

Update existing installation on SD card:

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

Run the image in QEMU:

$ almobootstrap qemu --image-size=1G

Flash to the device:

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

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

$ almobootstrap export

Extract the initramfs

$ almobootstrap initfs extract

Build and flash Android recovery zip:

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

#Repository Maintenance

List almoports that don't have a binary package:

$ almobootstrap repo_missing --arch=armhf --overview

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

$ almobootstrap pkgrel_bump --auto

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

$ almobootstrap aportgen binutils-armhf gcc-armhf

Manually rebuild package index:

$ almobootstrap index

Delete local binary packages without existing aport of same version:

$ almobootstrap zap -m

#Debugging

Use -v on any action to get verbose logging:

$ almobootstrap -v build hello-world

Parse a single deviceinfo and return it as JSON:

$ almobootstrap deviceinfo_parse pine64-pinephone

Parse a single APKBUILD and return it as JSON:

$ almobootstrap apkbuild_parse hello-world

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

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

ccache statistics:

$ almobootstrap stats --arch=armhf

distccd log:

$ almobootstrap log_distccd

#Use alternative sudo

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

#Select SSH keys to include and make authorized in new images

If the config file option ssh_keys is set to True (it defaults to False), then all files matching the glob ~/.ssh/id_*.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 almobootstrap config file to a string containing a glob that is to match the file or files you wish to include.

For example, a ~/.config/almobootstrap.cfg may contain:

[almobootstrap]
# ...
ssh_keys = True
ssh_key_glob = ~/.ssh/postmarketos-dev.pub
# ...

#License

GPLv3