From fad7c7ef8e4b47e054f6d571b451f310e12dbff4 Mon Sep 17 00:00:00 2001 From: Mighty Date: Fri, 24 Dec 2021 14:32:48 +0530 Subject: [PATCH] main/postmarketos-update-kernel use partlabel specified in deviceinfo (MR 2786) This is done as devices that use Heimdall flash to KERNEL instead of boot like in case of fastboot, plus devices with weird partitions can set the var in deviceinfo --- main/postmarketos-update-kernel/APKBUILD | 4 ++-- main/postmarketos-update-kernel/update-kernel.sh | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/main/postmarketos-update-kernel/APKBUILD b/main/postmarketos-update-kernel/APKBUILD index 125a50a51..a5a491af1 100644 --- a/main/postmarketos-update-kernel/APKBUILD +++ b/main/postmarketos-update-kernel/APKBUILD @@ -1,5 +1,5 @@ pkgname=postmarketos-update-kernel -pkgver=0.0.6 +pkgver=0.0.7 pkgrel=0 pkgdesc="kernel updater script for postmarketOS" url="https://postmarketos.org" @@ -14,5 +14,5 @@ package() { } sha512sums=" -e321b5bc601e87f9431140bdb89613cae105fe9e86a7ceab5444a378ab3397a717250a035b5389e227afb1f998f7a959af5009b83c9346d65f83a0e4d3cce114 update-kernel.sh +dae5ab226de812f3368d115a7906e3070929b58a90f428bb65bd60bde46a0802cb56189c4bbf7d686f4cbf3a78c667979080c9a5535244090118b7163362f9aa update-kernel.sh " diff --git a/main/postmarketos-update-kernel/update-kernel.sh b/main/postmarketos-update-kernel/update-kernel.sh index 8feb93239..5f84036e4 100644 --- a/main/postmarketos-update-kernel/update-kernel.sh +++ b/main/postmarketos-update-kernel/update-kernel.sh @@ -18,10 +18,11 @@ ab_get_slot() { echo "$ab_slot_suffix" } +# $1: partition to flash from deviceinfo update_android_fastboot() { BOOT_PART_SUFFIX=$(ab_get_slot) # Empty for non-A/B devices - BOOT_PARTITION=$(findfs PARTLABEL="boot${BOOT_PART_SUFFIX}") - echo "Flashing boot.img to 'boot${BOOT_PART_SUFFIX}'" + BOOT_PARTITION=$(findfs PARTLABEL="$1${BOOT_PART_SUFFIX}") + echo "Flashing boot.img to '$1${BOOT_PART_SUFFIX}'" dd if=/boot/boot.img of="$BOOT_PARTITION" bs=1M } @@ -43,8 +44,11 @@ update_android_split_kernel_initfs() { METHOD=${deviceinfo_flash_method:?} case $METHOD in - fastboot|heimdall-bootimg) - update_android_fastboot + fastboot) + update_android_fastboot "${flash_fastboot_partition_kernel:-boot}" + ;; + heimdall-bootimg) + update_android_fastboot "${flash_heimdall_partition_kernel:-KERNEL}" ;; heimdall-isorec) update_android_split_kernel_initfs