summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2023-05-11 09:35:34 +0200
committerMartin Jansa <martin.jansa@gmail.com>2024-01-31 11:07:05 +0100
commitd3938b382695115c2983923540dc1c803a312f7b (patch)
tree466db20cfbc3c7676848c433358d85bf64498f90
parent80b002aadb71f046f1db5f3692c6f8ef9f8598f8 (diff)
downloadopenembedded-core-contrib-d3938b382695115c2983923540dc1c803a312f7b.tar.gz
image, kernel: allow to disable creating the hardlinks by setting *LINK_NAME variables to empty
* they can be disabled individually by setting *_LINK_NAME to empty or disable them all by setting IMAGE_VERSION_SUFFIX to empty (making them equal to *_NAME variables) There are couple *_LINK_NAME variables: IMAGE_LINK_NAME = "" KERNEL_IMAGE_LINK_NAME = "" KERNEL_DTB_LINK_NAME = "" KERNEL_FIT_LINK_NAME = "" MODULE_TARBALL_LINK_NAME = "" INITRAMFS_LINK_NAME = "" or IMAGE_MACHINE_SUFFIX = "" IMAGE_NAME_SUFFIX = "" IMAGE_VERSION_SUFFIX = "" to have really the minimal filenames: $ ls tmp/deploy/images/qemux86-64/ bzImage core-image-minimal.manifest core-image-minimal.tar.bz2 bzImage-qemux86-64.bin core-image-minimal.qemuboot.conf core-image-minimal.testdata.json core-image-minimal.ext4 core-image-minimal.spdx.tar.zst modules-qemux86-64.tgz and to remove MACHINE name from kernel artifacts as well (if you prefer the MACHINE name in directory only), you can set: KERNEL_ARTIFACT_NAME = "" [YOCTO #12937] Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
-rw-r--r--meta/classes-recipe/image.bbclass3
-rw-r--r--meta/classes-recipe/kernel-devicetree.bbclass32
-rw-r--r--meta/classes-recipe/kernel-fitimage.bbclass17
-rw-r--r--meta/classes-recipe/kernel.bbclass36
4 files changed, 49 insertions, 39 deletions
diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index d863dc9652..45fad253ce 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -596,7 +596,8 @@ python create_symlinks() {
taskname = d.getVar("BB_CURRENTTASK")
subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
- if not link_name:
+ if not link_name or link_name == img_name:
+ bb.note("Not creating versioned hardlinks, because IMAGE_LINK_NAME is empty or identical to IMAGE_NAME")
return
for type in subimages:
dst = os.path.join(deploy_dir, link_name + "." + type)
diff --git a/meta/classes-recipe/kernel-devicetree.bbclass b/meta/classes-recipe/kernel-devicetree.bbclass
index cbfaa5c183..1fde90f023 100644
--- a/meta/classes-recipe/kernel-devicetree.bbclass
+++ b/meta/classes-recipe/kernel-devicetree.bbclass
@@ -127,22 +127,24 @@ kernel_do_deploy:append() {
done
}
kernel_do_deploy_links:append() {
- for dtbf in ${KERNEL_DEVICETREE}; do
- dtb=`normalize_dtb "$dtbf"`
- dtb_ext=${dtb##*.}
- dtb_base_name=`basename $dtb .$dtb_ext`
- if [ -n "${KERNEL_DTB_LINK_NAME}" ] ; then
+ if [ -z "${KERNEL_DTB_LINK_NAME}" -o "${KERNEL_DTB_LINK_NAME}" = "${KERNEL_DTB_NAME}" ] ; then
+ bbnote "Not creating versioned hardlinks, because KERNEL_DTB_LINK_NAME is empty or identical to KERNEL_DTB_NAME"
+ else
+ for dtbf in ${KERNEL_DEVICETREE}; do
+ dtb=`normalize_dtb "$dtbf"`
+ dtb_ext=${dtb##*.}
+ dtb_base_name=`basename $dtb .$dtb_ext`
ln -vf $deployDir/$dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext
- fi
- for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
- if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ] && [ -n "${KERNEL_DTB_LINK_NAME}" ]; then
- ln -vf $deployDir/$type-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
- $deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
- if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
- ln -vf $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
- $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+ if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ] ; then
+ ln -vf $deployDir/$type-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
+ $deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
+ if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
+ ln -vf $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
+ $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
+ fi
fi
- fi
+ done
done
- done
+ fi
}
diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
index 0ad200d9db..50d89a4383 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -860,22 +860,17 @@ kernel_do_deploy:append() {
}
kernel_do_deploy_links:append() {
if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
- if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
+ if [ -z "${KERNEL_FIT_LINK_NAME}" -o "${KERNEL_FIT_LINK_NAME}" = "${KERNEL_FIT_NAME}" ] ; then
+ bbnote "Not creating versioned hardlinks, because KERNEL_FIT_LINK_NAME is empty or identical to KERNEL_FIT_NAME"
+ else
+ if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
ln -vf $deployDir/fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}"
- fi
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
ln -vf $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}"
fi
- fi
- if [ -n "${INITRAMFS_IMAGE}" ]; then
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
+ if [ -n "${INITRAMFS_IMAGE}" ]; then
ln -vf $deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
- fi
-
- if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
+ if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
ln -vf $deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
fi
fi
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 2b74028dd8..5bca887378 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -855,21 +855,33 @@ kernel_do_deploy_links() {
mkdir "$deployDir"
fi
- for imageType in ${KERNEL_IMAGETYPES} ; do
- ln -vf $deployDir/$imageType-${KERNEL_IMAGE_NAME}.bin $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
- done
+ if [ -z "${KERNEL_IMAGE_LINK_NAME}" -o "${KERNEL_IMAGE_LINK_NAME}" = "${KERNEL_IMAGE_NAME}" ] ; then
+ bbnote "Not creating versioned hardlinks for kernel images, because KERNEL_IMAGE_LINK_NAME is empty or identical to KERNEL_IMAGE_NAME"
+ else
+ for imageType in ${KERNEL_IMAGETYPES} ; do
+ ln -vf $deployDir/$imageType-${KERNEL_IMAGE_NAME}.bin $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
+ done
+ fi
- if [ ${MODULE_TARBALL_DEPLOY} = "1" -a -f $deployDir/modules-${MODULE_TARBALL_NAME}.tgz ] ; then
- ln -vf $deployDir/modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz
+ if [ -z "${MODULE_TARBALL_LINK_NAME}" -o "${MODULE_TARBALL_LINK_NAME}" = "${MODULE_TARBALL_NAME}" ] ; then
+ bbnote "Not creating versioned hardlinks for module tarball, because MODULE_TARBALL_LINK_NAME is empty or identical to MODULE_TARBALL_NAME"
+ else
+ if [ ${MODULE_TARBALL_DEPLOY} = "1" -a -f $deployDir/modules-${MODULE_TARBALL_NAME}.tgz ] ; then
+ ln -vf $deployDir/modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz
+ fi
fi
- if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
- for imageType in ${KERNEL_IMAGETYPES} ; do
- if [ "$imageType" = "fitImage" ] ; then
- continue
- fi
- ln -vf $deployDir/$imageType-${INITRAMFS_NAME}.bin $deployDir/$imageType-${INITRAMFS_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
- done
+ if [ -z "${INITRAMFS_LINK_NAME}" -o "${INITRAMFS_LINK_NAME}" = "${INITRAMFS_NAME}" ] ; then
+ bbnote "Not creating versioned hardlinks for initramfs image, because INITRAMFS_LINK_NAME is empty"
+ else
+ if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
+ for imageType in ${KERNEL_IMAGETYPES} ; do
+ if [ "$imageType" = "fitImage" ] ; then
+ continue
+ fi
+ ln -vf $deployDir/$imageType-${INITRAMFS_NAME}.bin $deployDir/$imageType-${INITRAMFS_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
+ done
+ fi
fi
}
do_deploy_links[prefuncs] += "read_subpackage_metadata"