Allow kernel images to be elsewhere - Ubuntu kernel is not at Raspbian location

This commit is contained in:
Hin-Tak Leung 2020-08-24 12:03:46 +01:00
parent 17944791bb
commit 89f8a76646
1 changed files with 1 additions and 0 deletions

View File

@ -66,6 +66,7 @@ function get_kernel_version() {
_VER_RUN="" _VER_RUN=""
[ -z "$_VER_RUN" ] && { [ -z "$_VER_RUN" ] && {
ZIMAGE=/boot/kernel.img ZIMAGE=/boot/kernel.img
[ -f /boot/firmware/vmlinuz ] && ZIMAGE=/boot/firmware/vmlinuz
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)) | zcat | grep -a -m1 "Linux version" | strings | awk '{ print $3; }')
} }