From 9c17fb021db54a17f82ba304c7e80e9af0136607 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Wed, 14 Jul 2021 13:13:41 -0400 Subject: [PATCH] installer: Add v5.10 kernel compat Add compatibility with the newer v5.10-based kernel's packaging, which places %ghost files in /boot and places the original files in /lib/modules/. Story: 2008921 Task: 42916 Change-Id: Ic5cdc84043a8d5d253303d88959fdf22bda208e4 Signed-off-by: M. Vefa Bicakci --- build-tools/make-installer-images.sh | 44 ++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/build-tools/make-installer-images.sh b/build-tools/make-installer-images.sh index 2454b69c..6f6dd044 100755 --- a/build-tools/make-installer-images.sh +++ b/build-tools/make-installer-images.sh @@ -86,20 +86,40 @@ echo "--> extract files from new kernel and its modular rpms to initrd root" for kf in ${kernel_rpms_dir}/std/*.rpm ; do rpm2cpio $kf | cpio -idu; done # by now new kernel and its modules exist! -# find new kernel in /boot/ +# find new kernel in /boot/vmlinuz-* or /lib/modules/*/vmlinuz echo "--> get new kernel image: vmlinuz" -new_kernel="$(ls ./boot/vmlinuz-*)" -echo $new_kernel -if [ -f $new_kernel ];then - #copy out the new kernel +new_kernel="$(ls ./boot/vmlinuz-* 2>/dev/null || ls ./lib/modules/*/vmlinuz 2>/dev/null || true)" +echo "New kernel: \"${new_kernel}\"" +if [ -f "${new_kernel}" ];then + # copy out the new kernel if [ -f $output_dir/new-vmlinuz ]; then mv -f $output_dir/new-vmlinuz $output_dir/vmlinuz-backup-$timestamp fi cp -f $new_kernel $output_dir/new-vmlinuz - kernel_name=$(basename $new_kernel) - new_ver=$(echo $kernel_name | cut -d'-' -f2-) - echo $new_ver + if echo "${new_kernel}" | grep -q '^\./boot/vmlinuz'; then + kernel_name=$(basename $new_kernel) + new_ver=$(echo $kernel_name | cut -d'-' -f2-) + system_map="boot/System.map-${new_ver}" + elif echo "${new_kernel}" | grep -q '^\./lib/modules/'; then + new_ver="$(echo "${new_kernel}" | sed 's#^\./lib/modules/\([^/]\+\)/.*$#\1#')" + system_map="lib/modules/${new_ver}/System.map" + else + echo "Unrecognized new kernel path: ${new_kernel}" + exit -1 + fi + + if [ -z "${new_ver}" ]; then + echo "Could not determine new kernel version" + exit -1 + fi + + echo "New kernel version: ${new_ver}" + + if ! [ -f "${system_map}" ]; then + echo "Could not find System.map file at: ${system_map}" + exit -1 + fi else echo "ERROR: new kernel is NOT found!" exit -1 @@ -107,9 +127,9 @@ fi echo "-->check module dependencies in new initrd.img in chroot context" chroot $initrd_root /bin/bash -x <check module dependencies in new squashfs.img in chroot context" #we are using the same new kernel-xxx.rpm, so the $new_ver is the same chroot $squashfs_root /bin/bash -x <