1
0
forked from brl/citadel

generate kernel.id in a more reliable way

The kernel id is a sha256sum that is embedded in the kernel image header
and also in the initramfs (in /etc/initrd-release). It exists so that
when resource images are being located during boot, the compatibility of
the citadel kernel image can be matched with the currently booting
kernel. This ensures that the correct set of modules will be mounted.

The kernel id had previously been calculated from the sha256sum of the
kernel binary before attaching the initramfs, but the sequence of steps
performed by poky when building a kernel changed and caused this method
to fail.

Now the sha256sum is calculated from the 'defconfig' file in the recipe
directory instead. This should work equally as well to uniquely identify
a kernel instance.
This commit is contained in:
Bruce Leidl 2020-11-30 10:10:56 -05:00
parent 4fa5de8bf0
commit 5b8c330cb7
3 changed files with 7 additions and 6 deletions

View File

@ -24,7 +24,7 @@ EOF
ver=$(printf "%03d" ${CITADEL_IMAGE_VERSION})
if [ "${CITADEL_IMAGE_TYPE}" = "kernel" ]; then
KERNEL_ID=$(cat ${DEPLOY_DIR_IMAGE}/kernel.id)
KERNEL_ID=$(generate_kernel_id)
echo "kernel-version = \"${CITADEL_KERNEL_VERSION}\"" >> ${B}/mkimage.conf
echo "kernel-id = \"${KERNEL_ID}\"" >> ${B}/mkimage.conf
fname="citadel-kernel-${CITADEL_KERNEL_VERSION}-${CITADEL_IMAGE_CHANNEL}-${ver}.img"

View File

@ -6,3 +6,9 @@ CITADEL_IMAGE_VERSION_extra = "1"
CITADEL_IMAGE_VERSION_kernel = "1"
CITADEL_KERNEL_VERSION = "5.9.3"
CITADEL_KERNEL_CONFIG = "${COREBASE}/../meta-citadel/recipes-kernel/citadel-kernel/files/defconfig"
generate_kernel_id() {
sha256sum ${CITADEL_KERNEL_CONFIG} | cut -d' ' -f1
}

View File

@ -228,15 +228,10 @@ remove_systemd_units() {
}
generate_kernel_id() {
sha256sum ${DEPLOY_DIR_IMAGE}/bzImage-intel-corei7-64.bin | cut -d' ' -f1
}
append_initrd_release() {
KERNEL_ID=$(generate_kernel_id)
cat >> ${IMAGE_ROOTFS}/etc/initrd-release << EOF
CITADEL_KERNEL_VERSION="${CITADEL_KERNEL_VERSION}"
CITADEL_KERNEL_ID="${KERNEL_ID}"
EOF
echo "${KERNEL_ID}" > ${DEPLOY_DIR_IMAGE}/kernel.id
}