Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] kernel: use absolute paths in the kernel-image scripts
@ 2026-09-14 18:21 WXbet
  2026-09-26 15:01 ` Paul Barker
  0 siblings, 1 reply; 3+ messages in thread
From: WXbet @ 2026-09-14 18:21 UTC (permalink / raw)
  To: openembedded-core

From: WXbet <57314510+WXbet@users.noreply.github.com>

On the target, the postinst of kernel-image-<type> creates the
${KERNEL_IMAGEDEST}/<type> link with a path relative to the current
directory, and the postrm removes it the same way. opkg runs package
scripts in the directory of its caller, so an upgrade started from any
directory other than / makes ln fail. The fallback then copies the image
with install, which the busybox defconfig does not enable:

  sh: install: command not found

and the postrm leaves the link behind.

Anchor the link location at / as the rootfs-time case anchors it at $D.
The link target stays relative to ${KERNEL_IMAGEDEST}.

Signed-off-by: WXbet <57314510+WXbet@users.noreply.github.com>
---

Notes:
    The relative path seems to date back to bb946b8cdb ("classes/kernel: Use
    a copy of image for kernel*.rpm if fs doesn't support symlinks"), which
    moved the link from do_install into the postinst. When $D is set at rootfs
    time, the link is still anchored at $D. If the on-target case is meant to
    be relative to the current directory, please let me know how package
    managers are expected to call it.

 meta/classes-recipe/kernel.bbclass | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 0a6d754108..8d8af113f7 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -136,17 +136,17 @@ python __anonymous () {
 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
+    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
+        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
+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))
-- 
2.47.1.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-30 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 18:21 [PATCH] kernel: use absolute paths in the kernel-image scripts WXbet
2026-09-26 15:01 ` Paul Barker
2026-09-30 17:54   ` WXbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox