Makefile: check rootfs overlays with BR2_ROOTFS_MERGED_USR enabled
authorCarlos Santos <casantos@datacom.ind.br>
Mon, 7 May 2018 14:44:29 +0000 (11:44 -0300)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Wed, 6 Feb 2019 16:09:28 +0000 (17:09 +0100)
Add a step to target-finalize that checks each rootfs overlay, following
the criteria established for custom skeletons and using the same script
uesd by skeleton-custom.mk.

Add a paragraph to the documentation clarifying that rootfs overlays
don't need to contain /bin, /lib or /sbin and must not contain them when
BR2_ROOTFS_MERGED_USR is enabled.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Makefile
docs/manual/customize-rootfs.txt

index bba7d650ab928d0046e2f2089283ac401fc48ac8..752a850753c6e3c622ba5acdba9e6c0d78e00129 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -782,6 +782,22 @@ endif
        @$(call MESSAGE,"Sanitizing RPATH in target tree")
        $(TOPDIR)/support/scripts/fix-rpath target
 
+# For a merged /usr, ensure that /lib, /bin and /sbin and their /usr
+# counterparts are appropriately setup as symlinks ones to the others.
+ifeq ($(BR2_ROOTFS_MERGED_USR),y)
+
+       @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
+               $(call MESSAGE,"Sanity check in overlay $(d)"); \
+               not_merged_dirs="$$(support/scripts/check-merged-usr.sh $(d))"; \
+               test -n "$$not_merged_dirs" && { \
+                       echo "ERROR: The overlay in $(d) is not" \
+                               "using a merged /usr for the following directories:" \
+                               $$not_merged_dirs; \
+                       exit 1; \
+               } || true$(sep))
+
+endif # merged /usr
+
        @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
                $(call MESSAGE,"Copying overlay $(d)"); \
                rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \
index 9d3a62ddaf6fe60127feebef4763859fd1ce60f9..6b72a37b32979bbf29bd6fc5cf50e7beca71debb 100644 (file)
@@ -22,6 +22,12 @@ A filesystem overlay is a tree of files that is copied directly
   etc., files called +.empty+ and files ending in +~+ are excluded from
   the copy.
 +
+When +BR2_ROOTFS_MERGED_USR+ is enabled, then the overlay must not
+  contain the '/bin', '/lib' or '/sbin' directories, as Buildroot will
+  create them as symbolic links to the relevant folders in '/usr'.  In
+  such a situation, should the overlay have any programs or libraries,
+  they should be placed in '/usr/bin', '/usr/sbin' and '/usr/lib'.
++
 As shown in xref:customize-dir-structure[], the recommended path for
   this overlay is +board/<company>/<boardname>/rootfs-overlay+.