diff --git a/README.md b/README.md index abdbdd8..3bc0da1 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,19 @@ carriers are very welcome. ## Flashing -Download `boot.img` and `fairphone-fp6.img` from the latest release and unlock -the bootloader ([Fairphone's official process](https://support.fairphone.com/hc/en-us/articles/10492476238737)). +Download `fp6-img.tar.xz` from the latest release and unlock the bootloader +([Fairphone's official process](https://support.fairphone.com/hc/en-us/articles/10492476238737)). **Install**: with the phone in fastboot mode, -run [`install.sh`](install.sh) (also attached to every release) from the -directory holding the two images. + +```sh +tar xf fp6-img.tar.xz +cd fp6-img +./install.sh +``` + +[`install.sh`](install.sh) and this README are attached to every release +uncompressed as well, so you can read them before committing to the download. It erases dtbo, flashes the rootfs, **RAM-boots** the kernel (`fastboot boot` — verified to write nothing), writes the boot partition from inside diff --git a/build.sh b/build.sh index 473e971..a596a3f 100755 --- a/build.sh +++ b/build.sh @@ -34,7 +34,8 @@ if [ "$(id -u)" = 0 ]; then # reads channels.cfg from origin/master (upstream pmaports moved to main). # multipath-tools: kpartx; util-linux: losetup with --json support # (pmbootstrap's host-tool checks + image mounting need both) - apk add -q git sudo openssl python3 py3-pip multipath-tools util-linux + apk add -q git sudo openssl python3 py3-pip multipath-tools util-linux \ + tar xz pip install -q --break-system-packages \ git+https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git@3.11.1 # The container cannot modprobe (no /lib/modules in here), but it doesn't @@ -175,8 +176,6 @@ pmbootstrap install --password 147147 EXPORT=/tmp/postmarketOS-export rm -rf "$EXPORT" pmbootstrap export "$EXPORT" -cp -L "$EXPORT/boot.img" dist/boot.img -cp -L "$EXPORT/fairphone-fp6.img" dist/fairphone-fp6.img { echo "kernel: $KERNEL_REPO $KERNEL_BRANCH @ $COMMIT" @@ -187,5 +186,24 @@ cp -L "$EXPORT/fairphone-fp6.img" dist/fairphone-fp6.img cp README.md dist/README.md cp install.sh dist/install.sh +# The images ship as one archive, not as loose files: the rootfs is 3.0 GiB +# raw and 812 MiB under xz -6 (gzip -6 stops at 1144 MiB), and a bundle makes +# it impossible to pair a boot.img with a rootfs from a different build. +# README/install.sh/build-info stay loose in dist too, so they can be read +# before committing to the download. +# +# pmbootstrap export writes symlinks into its work dir; tar -h resolves them, +# so the archive is built without a second 3 GiB copy on disk. +STAGE="$WORK/stage" +rm -rf "$STAGE" +mkdir -p "$STAGE/fp6-img" +ln -s "$EXPORT/boot.img" "$STAGE/fp6-img/boot.img" +ln -s "$EXPORT/fairphone-fp6.img" "$STAGE/fp6-img/fairphone-fp6.img" +cp dist/build-info.txt dist/README.md dist/install.sh "$STAGE/fp6-img/" +# sums of the extracted contents (the outer sha256sums.txt covers the archive) +(cd "$STAGE/fp6-img" && sha256sum -- * > sha256sums.txt) +tar -C "$STAGE" -chf - fp6-img | xz -T0 -6 > dist/fp6-img.tar.xz +rm -rf "$STAGE" + (cd dist && sha256sum -- * > sha256sums.txt) ls -la dist/ diff --git a/install.sh b/install.sh index add2e61..5df2328 100755 --- a/install.sh +++ b/install.sh @@ -17,7 +17,8 @@ # # Requirements on this machine: fastboot, ssh. Phone: bootloader unlocked, # in fastboot mode (Vol-down + Power), connected over USB. -# Run from a directory containing boot.img and fairphone-fp6.img. +# Run from the directory the release archive extracts to: +# tar xf fp6-img.tar.xz && cd fp6-img && ./install.sh PHONE=172.16.42.1 BOOT=${BOOT:-boot.img} @@ -29,8 +30,10 @@ die() { printf 'ERROR: %s\n' "$*" >&2; exit 1; } # --- preflight --------------------------------------------------------------- command -v fastboot >/dev/null || die "fastboot not found (install android-tools)" command -v ssh >/dev/null || die "ssh not found" -[ -f "$BOOT" ] || die "$BOOT not found (download it from the release)" -[ -f "$ROOTFS" ] || die "$ROOTFS not found (download it from the release)" +[ -f "$BOOT" ] || die "$BOOT not found - run this from the extracted fp6-img + directory (tar xf fp6-img.tar.xz && cd fp6-img)" +[ -f "$ROOTFS" ] || die "$ROOTFS not found - run this from the extracted fp6-img + directory (tar xf fp6-img.tar.xz && cd fp6-img)" # NEVER pipe fastboot into grep -q or anything that exits early: the reader # quitting mid-output SIGPIPEs fastboot to death mid-transaction and leaves # the bootloader's fastboot state machine wedged - the NEXT command then