public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Yangwoo Byun <yw.byun@lge.com>
To: openembedded-core@lists.openembedded.org
Cc: Yangwoo Byun <yw.byun@lge.com>
Subject: [PATCH] Fix create_merged_usr_symlinks in populate_sdk_base.bbclass and image.bbclass
Date: Fri,  5 Dec 2025 13:45:53 +0900	[thread overview]
Message-ID: <20251205044553.397572-1-yw.byun@lge.com> (raw)

Modifying FILESYSTEM_PERMS_TABLES does not change the UID and GID of
/usr/bin

I modified create_merged_usr_symlinks and
moved its execution order back

Signed-off-by: Yangwoo Byun <yw.byun@lge.com>
---
 meta/classes-recipe/image.bbclass             |  2 +-
 meta/classes-recipe/populate_sdk_base.bbclass | 48 +++++++++++++++----
 2 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index 53f1a9dc45b..2d90b29c8c5 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -686,7 +686,7 @@ create_merged_usr_symlinks_rootfs() {
     create_merged_usr_symlinks ${IMAGE_ROOTFS}
 }
 
-ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_rootfs', '',d)}"
+ROOTFS_POSTPROCESS_COMMAND:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_rootfs', '',d)}"
 
 reproducible_final_image_task () {
     if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass
index 8e671cf28fa..cafd9a5698a 100644
--- a/meta/classes-recipe/populate_sdk_base.bbclass
+++ b/meta/classes-recipe/populate_sdk_base.bbclass
@@ -186,21 +186,51 @@ POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manif
 # Prepare the root links to point to the /usr counterparts.
 create_merged_usr_symlinks() {
     root="$1"
-    install -d $root${base_bindir} $root${base_sbindir} $root${base_libdir}
-    ln -rs $root${base_bindir} $root/bin
-    ln -rs $root${base_sbindir} $root/sbin
-    ln -rs $root${base_libdir} $root/${baselib}
+
+    if [ ! -d "$root${base_bindir}" ]; then
+        install -d "$root${base_bindir}"
+    fi
+
+    if [ ! -d "$root${base_sbindir}" ]; then
+        install -d "$root${base_sbindir}"
+    fi
+
+    if [ ! -d "$root${base_libdir}" ]; then
+        install -d "$root${base_libdir}"
+    fi
+
+    if [ ! -e "$root/bin" ]; then
+        ln -rs "$root${base_bindir}" "$root/bin"
+    fi
+
+    if [ ! -e "$root/sbin" ]; then
+        ln -rs "$root${base_sbindir}" "$root/sbin"
+    fi
+
+    if [ ! -e "$root/${baselib}" ]; then
+        ln -rs "$root${base_libdir}" "$root/${baselib}"
+    fi
 
     if [ "${nonarch_base_libdir}" != "${base_libdir}" ]; then
-       install -d $root${nonarch_base_libdir}
-       ln -rs $root${nonarch_base_libdir} $root/lib
+        if [ ! -d "$root${nonarch_base_libdir}" ]; then
+            install -d "$root${nonarch_base_libdir}"
+        fi
+
+        if [ ! -e "$root/lib" ]; then
+            ln -rs "$root${nonarch_base_libdir}" "$root/lib"
+        fi
     fi
 
     # create base links for multilibs
     multi_libdirs="${@d.getVar('MULTILIB_VARIANTS')}"
     for d in $multi_libdirs; do
-        install -d $root${exec_prefix}/$d
-        ln -rs $root${exec_prefix}/$d $root/$d
+        if [ ! -d "$root${exec_prefix}/$d" ]; then
+            install -d "$root${exec_prefix}/$d"
+        fi
+
+        if [ ! -e "$root/$d" ]; then
+            ln -rs "$root${exec_prefix}/$d" "$root/$d"
+        fi
     done
 }
 
@@ -208,7 +238,7 @@ create_merged_usr_symlinks_sdk() {
     create_merged_usr_symlinks ${SDK_OUTPUT}${SDKTARGETSYSROOT}
 }
 
-POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk', '',d)}"
+POPULATE_SDK_POST_TARGET_COMMAND:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk', '',d)}"
 
 SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC}' if '${SDK_PACKAGING_FUNC}' else ''}"
 SDK_POSTPROCESS_COMMAND = "create_sdk_files check_sdk_sysroots archive_sdk ${SDK_PACKAGING_COMMAND}"


             reply	other threads:[~2025-12-05  4:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05  4:45 Yangwoo Byun [this message]
2025-12-05  8:30 ` [OE-core] [PATCH] Fix create_merged_usr_symlinks in populate_sdk_base.bbclass and image.bbclass ChenQi
  -- strict thread matches above, loose matches on Subject: below --
2026-01-05  2:50 Yangwoo Byun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251205044553.397572-1-yw.byun@lge.com \
    --to=yw.byun@lge.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox