From a2eb528b63b0c53daab31308a6afdcb605ac5f40 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 20 Dec 2021 13:58:22 -0800 Subject: classes/kernel*: allow disabling symlink creation Allow setting any of the *_LINK_NAME variables to empty string in order to disable creating symlinks for kernel artifacts, as you can already for filesystem images with IMAGE_LINK_NAME. Additionally, for the image type named symlinks, add a KERNEL_IMAGETYPE_SYMLINK boolean variable which you can set to 0 to disable those symlinks as well. (From OE-Core rev: d7341f1f22c32ff6cc95d7127f26f87d7fc9c6bd) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- meta/classes/kernel-artifact-names.bbclass | 1 + meta/classes/kernel-devicetree.bbclass | 20 ++++++++++++++------ meta/classes/kernel-fitimage.bbclass | 16 ++++++++++++---- meta/classes/kernel.bbclass | 16 ++++++++++++---- 4 files changed, 39 insertions(+), 14 deletions(-) (limited to 'meta/classes') diff --git a/meta/classes/kernel-artifact-names.bbclass b/meta/classes/kernel-artifact-names.bbclass index a65cdddb3e..e1d943b2d5 100644 --- a/meta/classes/kernel-artifact-names.bbclass +++ b/meta/classes/kernel-artifact-names.bbclass @@ -11,6 +11,7 @@ KERNEL_ARTIFACT_LINK_NAME ?= "${MACHINE}" KERNEL_IMAGE_NAME ?= "${KERNEL_ARTIFACT_NAME}" KERNEL_IMAGE_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}" +KERNEL_IMAGETYPE_SYMLINK ?= "1" KERNEL_DTB_NAME ?= "${KERNEL_ARTIFACT_NAME}" KERNEL_DTB_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}" diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass index a50ea4fb67..c8aaf7458f 100644 --- a/meta/classes/kernel-devicetree.bbclass +++ b/meta/classes/kernel-devicetree.bbclass @@ -83,21 +83,29 @@ do_deploy:append() { dtb_base_name=`basename $dtb .$dtb_ext` install -d $deployDir install -m 0644 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext - ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext - ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext + if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then + ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext + fi + if [ -n "${KERNEL_DTB_LINK_NAME}" ] ; then + ln -sf $dtb_base_name-${KERNEL_DTB_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" ]; then cat ${D}/${KERNEL_IMAGEDEST}/$type \ $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \ > $deployDir/$type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin - ln -sf $type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin \ - $deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext.bin + if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then + ln -sf $type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin \ + $deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext.bin + fi if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \ $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \ > $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin - ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin \ - $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext.bin + if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then + ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin \ + $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext.bin + fi fi fi done diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass index 8718ce7e16..11dce67400 100644 --- a/meta/classes/kernel-fitimage.bbclass +++ b/meta/classes/kernel-fitimage.bbclass @@ -722,22 +722,30 @@ kernel_do_deploy:append() { if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then echo "Copying fit-image.its source file..." install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its" - ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}" + if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then + ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}" + fi echo "Copying linux.bin file..." install -m 0644 ${B}/linux.bin $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}.bin - ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}" + if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then + ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}" + fi fi if [ -n "${INITRAMFS_IMAGE}" ]; then echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..." install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its" - ln -snf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}" + if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then + ln -snf 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 echo "Copying fitImage-${INITRAMFS_IMAGE} file..." install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin" - ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}" + if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then + ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}" + fi fi fi fi diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 0df24ac910..57990bd3b9 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -769,8 +769,12 @@ kernel_do_deploy() { for imageType in ${KERNEL_IMAGETYPES} ; do baseName=$imageType-${KERNEL_IMAGE_NAME} install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType $deployDir/$baseName.bin - ln -sf $baseName.bin $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}.bin - ln -sf $baseName.bin $deployDir/$imageType + if [ -n "${KERNEL_IMAGE_LINK_NAME}" ] ; then + ln -sf $baseName.bin $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}.bin + fi + if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then + ln -sf $baseName.bin $deployDir/$imageType + fi done if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then @@ -783,7 +787,9 @@ kernel_do_deploy() { TAR_ARGS="$TAR_ARGS --owner=0 --group=0" tar $TAR_ARGS -cv -C ${D}${root_prefix} lib | gzip -9n > $deployDir/modules-${MODULE_TARBALL_NAME}.tgz - ln -sf modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz + if [ -n "${MODULE_TARBALL_LINK_NAME}" ] ; then + ln -sf modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz + fi fi if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then @@ -793,7 +799,9 @@ kernel_do_deploy() { fi initramfsBaseName=$imageType-${INITRAMFS_NAME} install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType.initramfs $deployDir/$initramfsBaseName.bin - ln -sf $initramfsBaseName.bin $deployDir/$imageType-${INITRAMFS_LINK_NAME}.bin + if [ -n "${INITRAMFS_LINK_NAME}" ] ; then + ln -sf $initramfsBaseName.bin $deployDir/$imageType-${INITRAMFS_LINK_NAME}.bin + fi done fi } -- cgit v1.2.3-54-g00ecf