diff options
author | Yanfei Xu <yanfei.xu@windriver.com> | 2020-07-03 21:55:15 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-07-05 15:04:40 +0100 |
commit | 8b6b95106a5d4f1f6d34209ec5c475c900270ecd (patch) | |
tree | 78b7806c88ded7c5a4fc6134dede36a8eacf4a93 | |
parent | cd96439c580a64a218f219e7aeeb67e0bbd68d5b (diff) | |
download | poky-8b6b95106a5d4f1f6d34209ec5c475c900270ecd.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>
(From OE-Core rev: bb946b8cdbd01408bfa0ba8e53f9e09931dfb29d)
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/kernel.bbclass | 22 |
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 () { | |||
95 | d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower)) | 95 | d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower)) |
96 | d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower)) | 96 | d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower)) |
97 | d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1') | 97 | d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1') |
98 | d.setVar('pkg_postinst_%s-image-%s' % (kname,typelower), """set +e | ||
99 | if [ -n "$D" ]; then | ||
100 | ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 | ||
101 | else | ||
102 | ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 | ||
103 | if [ $? -ne 0 ]; then | ||
104 | echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)." | ||
105 | install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s | ||
106 | fi | ||
107 | fi | ||
108 | set -e | ||
109 | """ % (type, type, type, type, type, type, type)) | ||
110 | d.setVar('pkg_postrm_%s-image-%s' % (kname,typelower), """set +e | ||
111 | if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then | ||
112 | rm -f ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 | ||
113 | fi | ||
114 | set -e | ||
115 | """ % (type, type, type)) | ||
116 | |||
98 | 117 | ||
99 | image = d.getVar('INITRAMFS_IMAGE') | 118 | image = d.getVar('INITRAMFS_IMAGE') |
100 | # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0, | 119 | # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0, |
@@ -386,9 +405,6 @@ kernel_do_install() { | |||
386 | install -d ${D}/boot | 405 | install -d ${D}/boot |
387 | for imageType in ${KERNEL_IMAGETYPES} ; do | 406 | for imageType in ${KERNEL_IMAGETYPES} ; do |
388 | install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION} | 407 | install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION} |
389 | if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then | ||
390 | ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType} | ||
391 | fi | ||
392 | done | 408 | done |
393 | install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} | 409 | install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} |
394 | install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} | 410 | install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} |