summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorYanfei Xu <yanfei.xu@windriver.com>2020-07-03 21:55:15 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-05 15:04:00 +0100
commitbb946b8cdbd01408bfa0ba8e53f9e09931dfb29d (patch)
treed6203d0f4dac7c08cf888afc633df10d43bc1d0c /meta
parentc83a7aec59defbbc049d44ba34a7a409ada4fa19 (diff)
downloadopenembedded-core-contrib-bb946b8cdbd01408bfa0ba8e53f9e09931dfb29d.tar.gz
classes/kernel: Use a copy of image for kernel*.rpm if fs doesn't support symlinks
Some filesystems don't support symlink, then you will get failure when you install or update the kernel rpm package. Now we use a copy of image for these filesystems instead of symlink. Suggested-by: Bruce Ashfield <bruce.ashfield@gmail.com> Suggested-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/kernel.bbclass22
1 files changed, 19 insertions, 3 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index c9044befbe..c834aad033 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -95,6 +95,25 @@ python __anonymous () {
d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
+ d.setVar('pkg_postinst_%s-image-%s' % (kname,typelower), """set +e
+if [ -n "$D" ]; then
+ ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+else
+ ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
+ install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s
+ fi
+fi
+set -e
+""" % (type, type, type, type, type, type, type))
+ d.setVar('pkg_postrm_%s-image-%s' % (kname,typelower), """set +e
+if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then
+ rm -f ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+fi
+set -e
+""" % (type, type, type))
+
image = d.getVar('INITRAMFS_IMAGE')
# If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,
@@ -386,9 +405,6 @@ kernel_do_install() {
install -d ${D}/boot
for imageType in ${KERNEL_IMAGETYPES} ; do
install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}
- if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
- ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
- fi
done
install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}