aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--classes/usr-merge.bbclass42
-rw-r--r--recipes-yocto-ivi/images/discovery-image.bb5
2 files changed, 46 insertions, 1 deletions
diff --git a/classes/usr-merge.bbclass b/classes/usr-merge.bbclass
new file mode 100644
index 0000000..17deaee
--- /dev/null
+++ b/classes/usr-merge.bbclass
@@ -0,0 +1,42 @@
+#
+# Copyright (c) 2012 Wind River Systems, Inc.
+#
+# The right to copy, distribute, modify, or otherwise make use
+# of this software may be licensed only pursuant to the terms
+# of an applicable Wind River license agreement.
+#
+
+# http://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge
+# /bin → /usr/bin
+# /sbin → /usr/sbin
+# /lib → /usr/lib
+# /lib64 → /usr/lib64
+
+usr_merge() {
+ echo /usr merge stage ...
+ if [ -d $INSTALL_ROOTFS_RPM/sbin -a -d $INSTALL_ROOTFS_RPM/usr/sbin ]; then
+ echo "Moving /sbin and /usr/sbin ..."
+ cp -r $INSTALL_ROOTFS_RPM/sbin/* $INSTALL_ROOTFS_RPM/usr/sbin/
+ rm -rf $INSTALL_ROOTFS_RPM/sbin
+ ln -sf ./usr/sbin $INSTALL_ROOTFS_RPM/sbin
+ fi
+ if [ -d $INSTALL_ROOTFS_RPM/bin -a -d $INSTALL_ROOTFS_RPM/usr/bin ]; then
+ echo "Moving /bin and /usr/bin ..."
+ cp -r $INSTALL_ROOTFS_RPM/bin/* $INSTALL_ROOTFS_RPM/usr/bin/
+ rm -rf $INSTALL_ROOTFS_RPM/bin
+ ln -sf ./usr/bin $INSTALL_ROOTFS_RPM/bin
+ fi
+ if [ -d $INSTALL_ROOTFS_RPM/lib -a -d $INSTALL_ROOTFS_RPM/usr/lib ]; then
+ echo "Moving /lib and /usr/lib ..."
+ cp -r $INSTALL_ROOTFS_RPM/lib/* $INSTALL_ROOTFS_RPM/usr/lib/
+ rm -rf $INSTALL_ROOTFS_RPM/lib
+ ln -sf ./usr/lib $INSTALL_ROOTFS_RPM/lib
+ fi
+ if [ -d $INSTALL_ROOTFS_RPM/lib64 -a -d $INSTALL_ROOTFS_RPM/usr/lib64 ]; then
+ echo "Moving /lib64 and /usr/lib64 ..."
+ cp -r $INSTALL_ROOTFS_RPM/lib64/* $INSTALL_ROOTFS_RPM/usr/lib64/
+ rm -rf $INSTALL_ROOTFS_RPM/lib64
+ ln -sf ./usr/lib64 $INSTALL_ROOTFS_RPM/lib64
+ fi
+}
+
diff --git a/recipes-yocto-ivi/images/discovery-image.bb b/recipes-yocto-ivi/images/discovery-image.bb
index 4585567..878a3e4 100644
--- a/recipes-yocto-ivi/images/discovery-image.bb
+++ b/recipes-yocto-ivi/images/discovery-image.bb
@@ -9,7 +9,7 @@ LICENSE = "MIT"
# Check if image should be created
IMAGE_SD = '${@base_contains("IMAGE_FSTYPES", "sdimg", "sd", "core", d)}'
-inherit ${IMAGE_SD}-image
+inherit ${IMAGE_SD}-image usr-merge
IMAGE_ROOTFS_SIZE = "8192"
@@ -18,3 +18,6 @@ ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
# Create SD image symlink currectly
IMAGE_POSTPROCESS_COMMAND_imx53qsb += "rename_symlink ; "
+
+# /usr Merge
+ROOTFS_POSTPROCESS_COMMAND += "usr_merge ; "