core/mkinitcpio: fix for rpi

This commit is contained in:
Kevin Mihelich 2023-03-22 22:03:20 +00:00
parent e480c1ce58
commit 2a4e369894
2 changed files with 24 additions and 14 deletions

View file

@ -1,25 +1,35 @@
From ed70b30b59325835b8ae418c17f0d11631bd5de0 Mon Sep 17 00:00:00 2001
From 5800829444f1b6d3cb4949c8a7a82f9b8fd22e3c Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Tue, 21 Mar 2023 17:56:32 -0600
Subject: [PATCH 3/3] check for ALARM kernels in run_post_hooks
---
functions | 15 ++++++++++-----
functions | 25 ++++++++++++++++++++-----
mkinitcpio | 11 +++++++++++
2 files changed, 21 insertions(+), 5 deletions(-)
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/functions b/functions
index c4cc536..b978c2e 100644
index c4cc536..e6b21e6 100644
--- a/functions
+++ b/functions
@@ -219,13 +219,18 @@ kver_generic() {
@@ -219,13 +219,28 @@ kver_generic() {
# https://elixir.bootlin.com/linux/v5.7.2/source/init/version.c#L46
local kver='' reader='cat'
- [[ "$(detect_compression "$1")" == 'gzip' ]] && reader='zcat'
+ if [[ $1 =~ "/zImage" || $1 =~ /kernel.*\.img ]]; then
+ # Check for xz zImage
+ if [[ $1 =~ "/zImage" ]]; then
+ read -r _ _ kver _ < <(dd if=$1 iflag=skip_bytes skip=$(LC_ALL=C grep -a -b -o $'\xFD\x37\x7A\x58\x5A\x00' $1 | tail -n 1 | cut -d ':' -f 1) | xzcat | grep -m1 -aoE 'Linux version .(\.[-[:alnum:]+]+)+')
+ skip=$(LC_ALL=C grep -a -b -o $'\xFD\x37\x7A\x58\x5A\x00' $1 | tail -n 1 | cut -d ':' -f 1)
+ if [[ ! -z $skip ]]; then
+ read -r _ _ kver _ < <(dd if=$1 iflag=skip_bytes skip=$skip | xzcat | grep -m1 -aoE 'Linux version .(\.[-[:alnum:]+]+)+')
+ fi
+ if [[ -z "$kver" ]]; then
+ # Check for gzip zImage
+ skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' $1 | head -n 1 | cut -d ':' -f 1)
+ if [[ ! -z $skip ]]; then
+ read -r _ _ kver _ < <(dd if=$1 iflag=skip_bytes skip=$skip | zcat | grep -m1 -aoE 'Linux version .(\.[-[:alnum:]+]+)+')
+ fi
+ fi
+ else
+ [[ "$(detect_compression "$1")" == 'gzip' ]] && reader='zcat'
@ -37,7 +47,7 @@ index c4cc536..b978c2e 100644
printf '%s' "$kver"
diff --git a/mkinitcpio b/mkinitcpio
index f68d70c..7789ddf 100755
index f68d70c..2ca3636 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -801,6 +801,17 @@ if [[ "$KERNELVERSION" != 'none' ]]; then
@ -46,8 +56,8 @@ index f68d70c..7789ddf 100755
+ if [[ -z "$KERNELIMAGE" ]]; then
+ # check version of ALARM kernels in /boot
+ for img in /boot/*Image*; do
+ if [[ "$(kver "$img")" == "$KERNELVERSION" ]]; then
+ for img in /boot/*Image* /boot/kernel*.img; do
+ if [[ -f $img && "$(kver "$img")" == "$KERNELVERSION" ]]; then
+ KERNELIMAGE="$img"
+ quiet "located kernel image: '%s'" "$KERNELIMAGE"
+ break

View file

@ -10,7 +10,7 @@
pkgname=mkinitcpio
pkgver=35.1
pkgrel=1
pkgrel=1.1
pkgdesc="Modular initramfs image creation utility"
arch=('any')
url='https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio'
@ -35,12 +35,12 @@ sha512sums=('71dd4bcad75c60178e8f152568fbb70b37a983641d4953035aabcbff5bd49571182
'SKIP'
'4205c5977d58728f6cdec22b553e000091e19b28e07c6099c14882842f964f66abf7b1b0a341e9b061e04c3c3ed1275647caf51d3770a61b60271712a8ecf74d'
'693bddd2d3e3760479c6615085a6d7426cf2a6f92a42925192658eae1bcd66ae1bc46027321a2a5538abbb21025467c42d07569024f338b7bb6d4416e9922406'
'bc801badec17abc54ba6e65727ee0facbc9da5b5b8bd2bd69ae8eef41b7c96bcbc4931378ba7bc78522f3fe4cb67b20707989a671789314b5ba09b07d58e6d60')
'4a89522a5350372ee189409529b3e5306a54520ce393eda511230c498ab6d56977e37c528904dcf01a667fa0602e5158bfe4834fd4205c835061cc8844e59b2d')
b2sums=('50783c27d7fad38ca3e02e1d8f15e42062b32e640ea26bc235ccd603659be5a2c218869fbd9e8491b3e0b027fa4613a599c7ce9768cd17c47e68053215a97f66'
'SKIP'
'ae8e25ab7e8d4cac52dcee7176bf132ea7cefeab67c3af69cecdf4871f50e42753dbe0c09a6fd20ef69c10a5b56bf6bc8f0614df1fd593d7a1ad3a5043f5c7b5'
'8ca2d8902ae18402c18b3874c3977953a16f3ffaad760f21aafa7f15421a034bdd10fb58962ea5e15ace7407fa1f36343ddfcdca1bcd58ef12aded22ae2cabca'
'ec9dabe43a405f4f3bf0172ac6a03568a49e342305626c2cd35cb0815ed3e74398efb34a9fea2427033a83b631afac5dc3b214e110686856a4fd4b366580dd4b')
'20e32564bb0fafc2f742be0866f731e0a0fa0a4b009623564491d5248348e29c7d7864f97747d62298debfc341e72ba73f7393d449515db8d1630ecb36640b58')
validpgpkeys=('ECCAC84C1BA08A6CC8E63FBBF22FB1D78A77AEAB' # Giancarlo Razzolini
'C100346676634E80C940FB9E9C02FF419FECBE16') # Morten Linderud