From 8b8fc8358d734867e1e10d3099cf6f7ccc47fd42 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Fri, 1 Oct 2021 00:53:10 +0200 Subject: pcr: Add abootimg 0.6 from Aur MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Aur package is based on the abootimg-git, Guix and Debian packages. While abootimg only supports old Android images format and its git repository[1] doesn't have new commits since 2012, the abootimg program is used by diffoscope to produce more fine grained diffs between two Android boot images. Without it you end up with a hexdump based diff which isn't very useful. With abootimg you can really debug and fix reproducibility issues when creating Android boot images. Here's what you get between two boot images whose only difference is due to the timestamps in the gzip command used to build the images[2]: --- tests/recovery-i9300-with-root.img +++ tests/recovery-i9300-with-root.img.1 ├── abootimg -i {} │ @@ -13,9 +13,9 @@ │ * load addresses: │ kernel: 0x40008000 │ ramdisk: 0x41000000 │ tags: 0x40000100 │ │ * cmdline = console=ttySAC2,115200 │ │ -* id = 0xa1891d8e 0xdfc327bf 0xe9dc0add 0xb1b7ba27 0x4c251f7d 0x00000000 0x00000000 0x00000000 │ +* id = 0xbd8bda50 0x69a5cbc5 0x9f4e7867 0x3853557e 0x888ff90a 0x00000000 0x00000000 0x00000000 ├── initrd.img │ ├── filetype from file(1) │ │ @@ -1 +1 @@ │ │ -gzip compressed data, was "ramdisk.cpio", last modified: Thu Sep 30 23:04:41 2021, from Unix │ │ +gzip compressed data, was "ramdisk.cpio", last modified: Thu Sep 30 23:02:44 2021, from Unix And without abootimg you have the following instead: --- tests/recovery-i9300-with-root.img +++ tests/recovery-i9300-with-root.img.1 │┄ 'abootimg' not available in path. Falling back to binary comparison. @@ -30,16 +30,16 @@ 000001d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000001e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000001f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000200: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000210: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000220: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000230: 0000 0000 0000 0000 0000 0000 0000 0000 ................ -00000240: 8e1d 89a1 bf27 c3df dd0a dce9 27ba b7b1 .....'......'... -00000250: 7d1f 254c 0000 0000 0000 0000 0000 0000 }.%L............ +00000240: 50da 8bbd c5cb a569 6778 4e9f 7e55 5338 P......igxN.~US8 +00000250: 0af9 8f88 0000 0000 0000 0000 0000 0000 ................ 00000260: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000270: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000280: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000290: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000002a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000002b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000002c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ @@ -212218,15 +212218,15 @@ 0033cf90: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0033cfa0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0033cfb0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0033cfc0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0033cfd0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0033cfe0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0033cff0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ -0033d000: 1f8b 0808 8942 5661 0003 7261 6d64 6973 .....BVa..ramdis +0033d000: 1f8b 0808 1442 5661 0003 7261 6d64 6973 .....BVa..ramdis 0033d010: 6b2e 6370 696f 00b4 5b7b 77db b692 cfbf k.cpio..[{w..... 0033d020: d6a7 c0b1 7dea 3c4c 5292 653b 76cb b6b9 ....}............ And the issue here is not hypothetical as the above show a real bug preventing tests from working in a tool meant to add root access by default in Replicant boot and recovery images. And that bug was really fixed thanks to abootimg. [1]https://github.com/ggrandou/abootimg [2]The ID takes into account the hash of the initrd image. Signed-off-by: Denis 'GNUtoo' Carikli --- pcr/abootimg/PKGBUILD | 46 ++++++++++++++++++++++++++++++++++++++++++++ pcr/abootimg/no-initrd.patch | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 pcr/abootimg/PKGBUILD create mode 100644 pcr/abootimg/no-initrd.patch (limited to 'pcr/abootimg') diff --git a/pcr/abootimg/PKGBUILD b/pcr/abootimg/PKGBUILD new file mode 100644 index 000000000..22f46210b --- /dev/null +++ b/pcr/abootimg/PKGBUILD @@ -0,0 +1,46 @@ +# Contributor: Bailey Fox +# Contributor: ajs124 < aur AT ajs124 DOT de > +# Contributor: Benoit Favre +# Contributor: Thomas Hebb +# Contributor: Denis 'GNUtoo' Carikli + +pkgname=abootimg +pkgver=0.6 +pkgrel=1 +pkgdesc="A tool to read/write/update old android boot images" +arch=('i686' 'x86_64' 'arm' 'armv7h') +url="https://github.com/ggrandou/abootimg" +license=('GPL') +depends=('util-linux' 'cpio') +makedepends=('git') +provides=('abootimg') +source=("http://http.debian.net/debian/pool/main/a/abootimg/abootimg_${pkgver}.orig.tar.gz" + "http://http.debian.net/debian/pool/main/a/abootimg/abootimg_${pkgver}-1.diff.gz" + 'no-initrd.patch') +sha512sums=('b96be8abe9bccfb7694c1d8f30b3a5dcc0e411b73fc78eb15f1488207032aa4737286be776b78e41bc14216e8d78ec768bbb2f91f0fe53192f08df8b6497d28f' + '66884cf42c7c2121065cec6e974f3c6d301e058231b910db8e4816ed5274d7e6eb6045d1649b059c468e6760b16046ae7ef58756c810967e47e6214e0fc0612f' + 'SKIP') + +prepare() { + cd "${srcdir}/abootimg-${pkgver}" + patch -p0 --binary < ../no-initrd.patch + patch -p1 --binary < ../abootimg_0.6-1.diff +} + +build() { + cd "${srcdir}/abootimg-${pkgver}" + + make + gzip -f debian/abootimg.1 +} + +package() { + cd "${srcdir}/abootimg-${pkgver}" + + install -d "${pkgdir}/usr/bin" + install -d "${pkgdir}/usr/share/man/man1/" + install abootimg -t "${pkgdir}/usr/bin" + install pack-initrd "${pkgdir}/usr/bin/abootimg-pack-initrd" + install unpack-initrd "${pkgdir}/usr/bin/abootimg-unpack-initrd" + install debian/abootimg.1.gz -t "${pkgdir}/usr/share/man/man1/" +} diff --git a/pcr/abootimg/no-initrd.patch b/pcr/abootimg/no-initrd.patch new file mode 100644 index 000000000..a523845fb --- /dev/null +++ b/pcr/abootimg/no-initrd.patch @@ -0,0 +1,35 @@ +This patch incorporates a patch made by John Stultz to allow abootimg to +work with newer Android aboots that do not include an initrd +--- abootimg.c 2019-03-12 03:16:42.335616885 -0500 ++++ abootimg.c.1 2019-03-12 03:18:01.550892862 -0500 +@@ -163,7 +163,7 @@ + "\n" + " bootimg has to be valid Android Boot Image, or the update will abort.\n" + "\n" +- " abootimg --create [-c \"param=value\"] [-f ] -k -r [-s ]\n" ++ " abootimg --create [-c \"param=value\"] [-f ] -k [-r ] [-s ]\n" + "\n" + " create a new image from scratch.\n" + " if the boot image file is a block device, sanity check will be performed to avoid overwriting a existing\n" +@@ -291,7 +291,11 @@ + + if (!(img->header.ramdisk_size)) { + fprintf(stderr, "%s: ramdisk size is null\n", img->fname); +- return 1; ++ /* ++ * On newer AOSP devices, system can be used as rootfs, ++ * resulting in no initrd being used. Thus this case should ++ * not be fatal. ++ */ + } + + unsigned page_size = img->header.page_size; +@@ -932,7 +936,7 @@ + break; + + case create: +- if (!bootimg->kernel_fname || !bootimg->ramdisk_fname) { ++ if (!bootimg->kernel_fname) { + print_usage(); + break; + } -- cgit v1.2.3