pmbootstrap, with Synit changes
Go to file
Zhuowei Zhang 1efe288fe2
losetup: support building rootfs images with 4096 byte sector sizes (!1725)
Adds an optional deviceinfo variable, `deviceinfo_rootfs_image_sector_size`,
which specifies the logical sector size of the device's storage.

Some devices made after 2016 with UFS storage uses 4096 byte sectors
instead of the normal 512 bytes. The partition table in our rootfs
must match, otherwise the root filesystem won't mount on the device.

This change passes the sector size to `losetup` when creating the image
if the deviceinfo specifies it, so the image will have the correct
sector size.

If the deviceinfo doesn't specify the new option, the behaviour
is the same as previous versions of pmbootstrap.

Note that the sector size option only works on Linux 4.14 and above,
so pmbootstrap should be run on a >4.14 computer when installing to
devices with non-standard sector size.

To find if a device needs this parameter, run `fdisk -l` on the device.
If the output shows

`Note: sector size is 4096 (not 512)`

then add `deviceinfo_rootfs_image_sector_size="4096"` to the deviceinfo.

This is needed by the Pixel 3 XL (google-crosshatch) port.

See https://gitlab.com/postmarketOS/pmbootstrap/issues/1696.
2018-12-11 09:08:12 +01:00
.gitlab Move aports into own repository (pmaports) 2018-09-05 05:57:38 +00:00
helpers Make --gcc6 work with fish; add 'source' to usage 2018-10-11 07:22:09 +02:00
pmb losetup: support building rootfs images with 4096 byte sector sizes (!1725) 2018-12-11 09:08:12 +01:00
test new action: 'pmbootstrap repo_missing' 2018-12-01 21:30:59 +00:00
.gitignore Move aports into own repository (pmaports) 2018-09-05 05:57:38 +00:00
.gitlab-ci.yml Move aports into own repository (pmaports) 2018-09-05 05:57:38 +00:00
CONTRIBUTING.md Update CONTRIBUTING.md 2018-08-01 09:30:24 +00:00
LICENSE Initial commit 2017-05-26 19:25:48 +00:00
MANIFEST.in install apk keys and binfmt data with setup.py 2018-09-17 10:06:57 +00:00
README.md new action: 'pmbootstrap repo_missing' 2018-12-01 21:30:59 +00:00
pmbootstrap.py Implement bash tab completion 2018-08-27 21:35:05 +00:00
setup.cfg Close #327: Add initial setup.py (#443) 2017-09-02 19:30:40 +00:00
setup.py setup.py: description is written in markdown 2018-10-12 09:07:30 +02:00

README.md

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

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

Update existing installation on SD card (full disk encryption disabled):

$ pmbootstrap install --sdcard=/dev/mmcblk0 --no-fde --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 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

Development

Testing

Install pytest (via your package manager or pip) and run it inside the pmbootstrap folder.

License

GPLv3