rename citadel-modules-image to citadel-kernel-image

...and add some metadata
This commit is contained in:
Bruce Leidl 2019-01-06 18:20:41 -05:00
parent 9ab4e957ca
commit ab98492061
6 changed files with 34 additions and 14 deletions

View File

@ -9,6 +9,10 @@ inherit image
CITADEL_IMAGE_CHANNEL ??= "dev" CITADEL_IMAGE_CHANNEL ??= "dev"
kernel_id() {
sha256sum ${DEPLOY_DIR_IMAGE}/bzImage-intel-corei7-64.bin | cut -d' ' -f1
}
do_citadel_mkimage() { do_citadel_mkimage() {
cat > ${B}/mkimage.conf << EOF cat > ${B}/mkimage.conf << EOF
image-type = "${CITADEL_IMAGE_TYPE}" image-type = "${CITADEL_IMAGE_TYPE}"
@ -19,9 +23,11 @@ EOF
ver=$(printf "%03d" ${CITADEL_IMAGE_VERSION}) ver=$(printf "%03d" ${CITADEL_IMAGE_VERSION})
if [ "${CITADEL_IMAGE_TYPE}" = "modules" ]; then if [ "${CITADEL_IMAGE_TYPE}" = "kernel" ]; then
KERNEL_ID=$(kernel_id)
echo "kernel-version = \"${CITADEL_KERNEL_VERSION}\"" >> ${B}/mkimage.conf echo "kernel-version = \"${CITADEL_KERNEL_VERSION}\"" >> ${B}/mkimage.conf
fname="citadel-modules-${CITADEL_KERNEL_VERSION}-${CITADEL_IMAGE_CHANNEL}-${ver}.img" echo "kernel-id = \"${KERNEL_ID}\"" >> ${B}/mkimage.conf
fname="citadel-kernel-${CITADEL_KERNEL_VERSION}-${CITADEL_IMAGE_CHANNEL}-${ver}.img"
else else
fname="citadel-${CITADEL_IMAGE_TYPE}-${CITADEL_IMAGE_CHANNEL}-${ver}.img" fname="citadel-${CITADEL_IMAGE_TYPE}-${CITADEL_IMAGE_CHANNEL}-${ver}.img"
fi fi
@ -30,3 +36,5 @@ EOF
} }
addtask do_citadel_mkimage after do_image_ext2 before do_image_complete addtask do_citadel_mkimage after do_image_ext2 before do_image_complete
do_citadel_mkimage[cleandirs] = "${B}"

View File

@ -3,6 +3,10 @@ CITADEL_IMAGE_CHANNEL = "dev"
CITADEL_IMAGE_VERSION_rootfs = "1" CITADEL_IMAGE_VERSION_rootfs = "1"
CITADEL_IMAGE_VERSION_extra = "1" CITADEL_IMAGE_VERSION_extra = "1"
CITADEL_IMAGE_VERSION_modules = "1" CITADEL_IMAGE_VERSION_kernel = "1"
CITADEL_KERNEL_VERSION = "4.9.65" CITADEL_KERNEL_VERSION = "4.9.65"
generate_kernel_id() {
sha256sum ${DEPLOY_DIR_IMAGE}/bzImage-intel-corei7-64.bin | cut -d' ' -f1
}

View File

@ -24,7 +24,7 @@ do_rootfs[umask] = "022"
do_rootfs[depends] += "\ do_rootfs[depends] += "\
citadel-rootfs-image:do_image_complete \ citadel-rootfs-image:do_image_complete \
citadel-extra-image:do_image_complete \ citadel-extra-image:do_image_complete \
citadel-modules-image:do_image_complete \ citadel-kernel-image:do_image_complete \
citadel-kernel:do_deploy \ citadel-kernel:do_deploy \
systemd-boot:do_deploy \ systemd-boot:do_deploy \
" "
@ -58,7 +58,7 @@ install_image_files() {
install -d ${IMAGE_ROOTFS}/images install -d ${IMAGE_ROOTFS}/images
install_resource_image "rootfs" ${CITADEL_IMAGE_VERSION_rootfs} install_resource_image "rootfs" ${CITADEL_IMAGE_VERSION_rootfs}
install_resource_image "extra" ${CITADEL_IMAGE_VERSION_extra} install_resource_image "extra" ${CITADEL_IMAGE_VERSION_extra}
install_resource_image "modules" ${CITADEL_IMAGE_VERSION_modules} install_resource_image "kernel" ${CITADEL_IMAGE_VERSION_kernel}
install ${TOPDIR}/appimg/appimg-rootfs.tar.xz ${IMAGE_ROOTFS}/images/ install ${TOPDIR}/appimg/appimg-rootfs.tar.xz ${IMAGE_ROOTFS}/images/
} }
@ -105,10 +105,10 @@ EOF
install_resource_image() { install_resource_image() {
version=$(printf "%03d" ${2}) version=$(printf "%03d" ${2})
if [ "${1}" = "modules" ]; then if [ "${1}" = "kernel" ]; then
kversion=$(cat ${DEPLOY_DIR_IMAGE}/kernel.version) kversion=$(cat ${DEPLOY_DIR_IMAGE}/kernel.version)
src_fname="citadel-modules-${kversion}-${CITADEL_IMAGE_CHANNEL}-${version}.img" src_fname="citadel-kernel-${kversion}-${CITADEL_IMAGE_CHANNEL}-${version}.img"
dst_fname="citadel-modules-${kversion}.img" dst_fname="citadel-kernel-${kversion}.img"
else else
src_fname="citadel-${1}-${CITADEL_IMAGE_CHANNEL}-${version}.img" src_fname="citadel-${1}-${CITADEL_IMAGE_CHANNEL}-${version}.img"
dst_fname="citadel-${1}.img" dst_fname="citadel-${1}.img"

View File

@ -1,11 +1,10 @@
DESCRIPTION = "Resource image containing citadel kernel and kernel modules"
DESCRIPTION = "Kernel modules"
LICENSE = "MIT" LICENSE = "MIT"
PACKAGE_INSTALL = "kernel-modules" PACKAGE_INSTALL = "kernel-modules"
CITADEL_IMAGE_VERSION = "${CITADEL_IMAGE_VERSION_modules}" CITADEL_IMAGE_VERSION = "${CITADEL_IMAGE_VERSION_kernel}"
CITADEL_IMAGE_TYPE = "modules" CITADEL_IMAGE_TYPE = "kernel"
require citadel-image.inc require citadel-image.inc
inherit citadel-image inherit citadel-image

View File

@ -10,7 +10,7 @@ ConditionPathExists=/dev/mapper/citadel-rootfsB
ConditionPathExists=/dev/mapper/citadel-storage ConditionPathExists=/dev/mapper/citadel-storage
# #
# Pull in the unit that mounts 'extra' and 'modules' images # Pull in the unit that mounts 'extra' and 'kernel' images
# #
Wants=citadel-rootfs-setup.service Wants=citadel-rootfs-setup.service

View File

@ -109,12 +109,21 @@ INITRAMFS_MAXSIZE = "512000"
INITRAMFS_FSTYPES = "cpio.lz4" INITRAMFS_FSTYPES = "cpio.lz4"
IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
inherit core-image inherit core-image
require ${THISDIR}/../../recipes-citadel/images/citadel-image.inc
IMAGE_ROOTFS_SIZE = "8192" IMAGE_ROOTFS_SIZE = "8192"
IMAGE_ROOTFS_EXTRA_SPACE = "0" IMAGE_ROOTFS_EXTRA_SPACE = "0"
ROOTFS_POSTPROCESS_COMMAND += "remove_blk_availability; " ROOTFS_POSTPROCESS_COMMAND += "remove_blk_availability; append_initrd_release; "
remove_blk_availability() { remove_blk_availability() {
rm ${IMAGE_ROOTFS}${systemd_system_unitdir}/blk-availability.service rm ${IMAGE_ROOTFS}${systemd_system_unitdir}/blk-availability.service
} }
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
}