Implement sparse system images (fix #299) (#303)

* Packaged libsparse

libsparse from the Android project provides multiple tools like img2simg
and simg2img.
These are used to split a large image for the system partition into
separate smaller chunks with sparse headers

This is required for several devices (at least bullhead, fp2 and titan)
because it fixes the "Invalid sparse file format at header magi" error

https://github.com/postmarketOS/pmbootstrap/issues/299

* Added new variable deviceinfo_flash_sparse (fixes #299)

Right after the system image is generated, pmbootstrap checks this
variable. In case it is true, run img2simg on it

* motorola-titan: enable deviceinfo_flash_sparse

* libsparse: use source from github: anestisb/android-simg2img

It is not that easy to use the upstream archive because everytime
you download it, the files have the current date as creation date
and that makes the file have a different checksum every download
https://github.com/postmarketOS/pmbootstrap/pull/303#issuecomment-319017197
This commit is contained in:
Pablo Castellano 2017-08-02 18:21:50 +02:00 committed by Oliver Smith
parent 13eac29c0c
commit ff968a751e
3 changed files with 32 additions and 2 deletions

View file

@ -1,6 +1,6 @@
pkgname=device-motorola-titan pkgname=device-motorola-titan
pkgver=1 pkgver=1
pkgrel=9 pkgrel=10
pkgdesc="Motorola Moto G 2014" pkgdesc="Motorola Moto G 2014"
url="https://github.com/postmarketOS" url="https://github.com/postmarketOS"
arch="noarch" arch="noarch"
@ -27,7 +27,7 @@ package() {
"$pkgdir"/etc/profile.d/00-$pkgname.sh "$pkgdir"/etc/profile.d/00-$pkgname.sh
} }
sha512sums="e090f4cb7ef2641c6c89ba4ed4f9d4be95eee716c7a3e8690f069bdbe2a88155fd19b63e849cebc501846ef6f58d7cfa63d331c43b4aded964f1261f6083cd95 deviceinfo sha512sums="09abd5f4681d9479650cfa64fcbc58528827017757539c3faf142ca92e8537691f9fb88f5d84ece086af7f23be2ac03e196f49ae708a832f1331f40cc96bab29 deviceinfo
f37e6324abf0b0fc8a3d360d6d11bb0648090a438a55ca7f04a9d494719e687ce445ae107ace642edf293afb6ca82615bcb5d0ddb6c46c1a7f8ee3c213b7c5c4 90-android-touch-dev.rules f37e6324abf0b0fc8a3d360d6d11bb0648090a438a55ca7f04a9d494719e687ce445ae107ace642edf293afb6ca82615bcb5d0ddb6c46c1a7f8ee3c213b7c5c4 90-android-touch-dev.rules
8590967fa10388a890fdfafdb1070b9ab22dc89e06a3a8834806c772191e3b67de7b914b0d68e5ddf581cee715cb90f3f24abcb8762c415ff328c6da23e55d52 initfs-hook.sh 8590967fa10388a890fdfafdb1070b9ab22dc89e06a3a8834806c772191e3b67de7b914b0d68e5ddf581cee715cb90f3f24abcb8762c415ff328c6da23e55d52 initfs-hook.sh
2f7cdf558a6bff56fd343d29a1ca6c27e75715bedfad661700dfcfb01acd1bdfcfecdfccf619f1e56c1e6331be146f8882a14d3a2cd33830e9d00bb6118971a3 profile.sh" 2f7cdf558a6bff56fd343d29a1ca6c27e75715bedfad661700dfcfb01acd1bdfcfecdfccf619f1e56c1e6331be146f8882a14d3a2cd33830e9d00bb6118971a3 profile.sh"

View file

@ -26,6 +26,7 @@ deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048" deviceinfo_flash_pagesize="2048"
deviceinfo_kernel_cmdline="androidboot.bootdevice=msm_sdcc.1 androidboot.hardware=qcom vmalloc=400M utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags buildvariant=userdebug" deviceinfo_kernel_cmdline="androidboot.bootdevice=msm_sdcc.1 androidboot.hardware=qcom vmalloc=400M utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags buildvariant=userdebug"
deviceinfo_generate_bootimg="true" deviceinfo_generate_bootimg="true"
deviceinfo_flash_sparse="true"
# Weston red screen workaround (see issue #54) # Weston red screen workaround (see issue #54)
deviceinfo_weston_pixman_type="2" deviceinfo_weston_pixman_type="2"

29
main/libsparse/APKBUILD Normal file
View file

@ -0,0 +1,29 @@
pkgname=libsparse
pkgver="1.0.0"
pkgrel=1
pkgdesc="Android Sparse library"
url="https://android.googlesource.com"
arch="all"
license="APACHE2"
depends="python3"
makedepends="zlib-dev"
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/anestisb/android-simg2img/archive/${pkgver}.tar.gz"
options="!check"
build() {
cd "$srcdir"/android-simg2img-"$pkgver"
sed -i -e 's./usr/bin/env python./usr/bin/env python3.' simg_dump.py
make sparse
make
}
package() {
cd "$srcdir"/android-simg2img-"$pkgver"
for i in append2simg img2simg simg2img simg2simg simg_dump.py; do
install -D -m755 "$i" "$pkgdir"/usr/bin/"$i" || return 1
done
}
sha512sums="e43ad20760243ee88441d3016dea776224373377a5f0d367fca2da8b44f4dcc17c779ad2aed79b2f04861f4e56ec3472c0f2dc5c8fc12dc87f57d608cfc8faf6 libsparse-1.0.0.tar.gz"