| Message ID | 20251205044553.397572-1-yw.byun@lge.com |
|---|---|
| State | New |
| Headers | show |
| Series | Fix create_merged_usr_symlinks in populate_sdk_base.bbclass and image.bbclass | expand |
I can guess why you're dong this. The 'install' command overrides your custom '/usr/bin' perms setting, right? Please add more details in the commit message. Another concern is about the ':append'. Could you please explain what problem would be without using ':append'? Regards, Qi On 12/5/25 12:45, Yangwoo Byun via lists.openembedded.org wrote: > 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}" > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#227331): https://lists.openembedded.org/g/openembedded-core/message/227331 > Mute This Topic: https://lists.openembedded.org/mt/116625831/7304865 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Qi.Chen@eng.windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
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}"
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(-)