Remove garbage before "Linux version"
Kernel 6.1 onwards seems to have strings re-arranged so that a newline no long happens right before the "Linux version" string. Tested with: 4650945eaabe1297985759ef8e3d4153 archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230306-1_armhf.deb 93830b458685feabf2262f474be4a0e0 archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230317-1_armhf.deb 5449f3dd337c594491f3e73b6ee97cbf archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230405-1_armhf.deb 29384 5.15.84+ 28712 6.1.19+ 6.1.21+
This commit is contained in:
parent
19ca5aeb50
commit
280bb390a2
1 changed files with 1 additions and 1 deletions
|
@ -42,7 +42,7 @@ function get_kernel_version() {
|
||||||
[ -z "$_VER_RUN" ] && {
|
[ -z "$_VER_RUN" ] && {
|
||||||
ZIMAGE=/boot/kernel.img
|
ZIMAGE=/boot/kernel.img
|
||||||
IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1)
|
IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1)
|
||||||
_VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) | zcat | grep -a -m1 "Linux version" | strings | awk '{ print $3; }')
|
_VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | LC_ALL=C sed -e 's/^.*Linux/Linux/' | strings | awk '{ print $3; }')
|
||||||
}
|
}
|
||||||
echo "$_VER_RUN"
|
echo "$_VER_RUN"
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in a new issue