temp/android-tools: fork from alpine with flash boot fix (MR 2142)

This patch fixes:
  fastboot: error: Couldn't parse partition size '0x'.

I don't get the bug myself, but it was reported that this works as
expected. Let's merge it to pmaports temporarily while it's getting
upstreamed.

Related: https://github.com/nmeum/android-tools/pull/27
Related: pmbootstrap issue 2007
[ci:skip-build]: already built successfully in CI
This commit is contained in:
Oliver Smith 2021-04-29 00:01:52 +02:00
parent 9371b11f57
commit 9bc3f5a161
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,43 @@
From ee81c8aff8276d489c4271a89d44c62ff0b516d5 Mon Sep 17 00:00:00 2001
From: Oliver Smith <ollieparanoid@postmarketos.org>
Date: Wed, 28 Apr 2021 23:37:46 +0200
Subject: [PATCH] fastboot: don't die if can't parse boot part size
Don't crash in copy_boot_avb_footer() if bootloaders do not properly
expose the size of the boot partition.
This makes "fastboot flasher boot" usable again on lots of
non-avb-devices, where it has been broken since
I5a5e25fb54dc9d6a2930fda63434968808ffa1f0.
Related: https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2007
Change-Id: I0825bdad0f541ec0b073900b02d2cf7966aa9ce7
---
vendor/core/fastboot/fastboot.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vendor/core/fastboot/fastboot.cpp b/vendor/core/fastboot/fastboot.cpp
index 679aec8..38a0e3b 100644
--- a/vendor/core/fastboot/fastboot.cpp
+++ b/vendor/core/fastboot/fastboot.cpp
@@ -1017,13 +1017,15 @@ static void copy_boot_avb_footer(const std::string& partition, struct fastboot_b
std::string partition_size_str;
if (fb->GetVar("partition-size:" + partition, &partition_size_str) != fastboot::SUCCESS) {
- die("cannot get boot partition size");
+ verbose("cannot get boot partition size, assuming non-avb device");
+ return;
}
partition_size_str = fb_fix_numeric_var(partition_size_str);
int64_t partition_size;
if (!android::base::ParseInt(partition_size_str, &partition_size)) {
- die("Couldn't parse partition size '%s'.", partition_size_str.c_str());
+ verbose("Couldn't parse partition size '%s', assuming non-avb device", partition_size_str.c_str());
+ return;
}
if (partition_size == buf->sz) {
return;
--
2.20.1

View file

@ -0,0 +1,53 @@
# Forked from Alpine to fix pmbootstrap#2007
# Upstreaming here (further upstreaming to google requires google acc with
# phone number, no thanks): https://github.com/nmeum/android-tools/pull/27
pkgname=android-tools
pkgver=9999
_pkgver=31.0.0p1
pkgrel=0
pkgdesc="[$_pkgver] Android platform tools"
url="https://sites.google.com/a/android.com/tools/"
arch="!x86 x86_64 aarch64 armv7 armhf"
license="Apache-2.0 MIT"
options="net !check" # upstream doesn't have a test suite
makedepends="pcre2-dev linux-headers libusb-dev gtest-dev go perl cmake
protobuf-dev brotli-dev zstd-dev lz4-dev"
subpackages="$pkgname-completion:comp:noarch
$pkgname-zsh-completion:zshcomp:noarch
$pkgname-bash-completion:bashcomp:noarch"
source="https://github.com/nmeum/$pkgname/releases/download/$_pkgver/$pkgname-$_pkgver.tar.xz
0001-fastboot-don-t-die-if-can-t-parse-boot-part-size.patch"
builddir="$srcdir/$pkgname-$_pkgver"
build() {
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=None
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
comp() {
depends=""
pkgdesc="Common completion files for $pkgname"
amove usr/share/android-tools/completions
}
bashcomp() {
default_bashcomp
depends="$pkgname-completion"
}
zshcomp() {
default_zshcomp
depends="$pkgname-completion"
}
sha512sums="40bded59614a6d0543e5011038b7f1c6abcb64f0daa71a13175ecb75fe42cb9985ed3a6301d73ee8d4ea20e2c98e3ed8130824ee74dcebe75bc0d7f3052c9d3b android-tools-31.0.0p1.tar.xz
71fdc774cf1b1de0eefd23a6c5ad6f09b6a06ad61fc2370f452a7d16dc3a3d605270f3bdb531588095ad07e45706ca7fb67c92b5a217c0f9238f5103382bcd35 0001-fastboot-don-t-die-if-can-t-parse-boot-part-size.patch"