From d1345f067e18a2967638eb888c7ff5010d523acf Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 4 Aug 2005 06:32:52 +0000 Subject: Allow packages to use fakeroot. To accomodate this, convert all target filesystem creation tools to also use fakeroot. --- Makefile | 1 + package/ltp-testsuite/ltp-testsuite.mk | 6 ++++-- target/cramfs/cramfs.mk | 20 ++++++++++++++++++-- target/ext2/ext2root.mk | 21 +++++++++++++++++++-- target/jffs2/jffs2root.mk | 25 ++++++++++++++++++++----- target/squashfs/squashfsroot.mk | 7 ++----- target/tar/tarroot.mk | 7 ++----- 7 files changed, 66 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 04dd92ffe..dd384e9e8 100644 --- a/Makefile +++ b/Makefile @@ -115,6 +115,7 @@ $(TARGET_DIR): if [ -d "$(TARGET_SKEL_DIR)" ] ; then \ cp -a $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \ fi; + touch $(STAGING_DIR)/fakeroot.env -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf diff --git a/package/ltp-testsuite/ltp-testsuite.mk b/package/ltp-testsuite/ltp-testsuite.mk index 74707f294..edf2ffdde 100644 --- a/package/ltp-testsuite/ltp-testsuite.mk +++ b/package/ltp-testsuite/ltp-testsuite.mk @@ -28,8 +28,10 @@ $(LTP_TESTSUITE_DIR)/testcases/kernel/syscalls/write/write01: $(LTP_TESTSUITE_DI $(LTP_TESTSUITE_DIR)/testcases/bin/1K_file: $(LTP_TESTSUITE_DIR)/testcases/kernel/syscalls/write/write01 # Use fakeroot to pretend to do 'make install' as root $(STAGING_DIR)/usr/bin/fakeroot \ - $(MAKE) $(TARGET_CONFIGURE_OPTS) CROSS_COMPILER=$(TARGET_CROSS) \ - -C $(LTP_TESTSUITE_DIR) install + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + $(MAKE) $(TARGET_CONFIGURE_OPTS) CROSS_COMPILER=$(TARGET_CROSS) \ + -C $(LTP_TESTSUITE_DIR) install touch -c $(LTP_TESTSUITE_DIR)/testcases/bin/1K_file ltp-testsuite: uclibc host-fakeroot $(LTP_TESTSUITE_DIR)/testcases/bin/1K_file diff --git a/target/cramfs/cramfs.mk b/target/cramfs/cramfs.mk index a53cbff4f..2964dddd3 100644 --- a/target/cramfs/cramfs.mk +++ b/target/cramfs/cramfs.mk @@ -64,8 +64,24 @@ cramfsroot: cramfs @rm -rf $(TARGET_DIR)/usr/man @rm -rf $(TARGET_DIR)/usr/info /sbin/ldconfig -r $(TARGET_DIR) - $(CRAMFS_DIR)/mkcramfs -q $(CRAMFS_ENDIANNESS) -D \ - target/generic/device_table.txt $(TARGET_DIR) $(IMAGE).cramfs + # Use fakeroot to pretend all target binaries are owned by root + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + chown -R root:root $(TARGET_DIR) + # Use fakeroot to pretend to create all needed device nodes + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + $(STAGING_DIR)/bin/makedevs \ + -d $(TARGET_DEVICE_TABLE) \ + $(TARGET_DIR) + # Use fakeroot so mkcramfs believes the previous fakery + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + $(CRAMFS_DIR)/mkcramfs -q $(CRAMFS_ENDIANNESS) \ + $(TARGET_DIR) $(IMAGE).cramfs cramfsroot-source: cramfs-source diff --git a/target/ext2/ext2root.mk b/target/ext2/ext2root.mk index 8056fafcd..a934c5a5a 100644 --- a/target/ext2/ext2root.mk +++ b/target/ext2/ext2root.mk @@ -71,6 +71,19 @@ $(EXT2_BASE): genext2fs @rm -rf $(TARGET_DIR)/usr/share/man @rm -rf $(TARGET_DIR)/usr/info /sbin/ldconfig -r $(TARGET_DIR) + # Use fakeroot to pretend all target binaries are owned by root + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + chown -R root:root $(TARGET_DIR) + # Use fakeroot to pretend to create all needed device nodes + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + $(STAGING_DIR)/bin/makedevs \ + -d $(TARGET_DEVICE_TABLE) \ + $(TARGET_DIR) + # Use fakeroot so genext2fs believes the previous fakery ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0) GENEXT2_REALSIZE=`LANG=C du -l -s -c -k $(TARGET_DIR) | grep total | sed -e "s/total//"`; \ GENEXT2_ADDTOROOTSIZE=`if [ $$GENEXT2_REALSIZE -ge 20000 ] ; then echo 16384; else echo 2400; fi`; \ @@ -78,16 +91,20 @@ ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0) GENEXT2_ADDTOINODESIZE=`find $(TARGET_DIR) | wc -l`; \ GENEXT2_INODES=`expr $$GENEXT2_ADDTOINODESIZE + 400`; \ set -x; \ + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ $(GENEXT2_DIR)/genext2fs \ -b $$GENEXT2_SIZE \ -i $$GENEXT2_INODES \ -d $(TARGET_DIR) \ - -D $(TARGET_DEVICE_TABLE) \ $(EXT2_OPTS) $(EXT2_BASE) else + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ $(GENEXT2_DIR)/genext2fs \ -d $(TARGET_DIR) \ - -D $(TARGET_DEVICE_TABLE) \ $(EXT2_OPTS) \ $(EXT2_BASE) endif diff --git a/target/jffs2/jffs2root.mk b/target/jffs2/jffs2root.mk index 83cdeb63a..04922aaf2 100644 --- a/target/jffs2/jffs2root.mk +++ b/target/jffs2/jffs2root.mk @@ -44,11 +44,26 @@ $(JFFS2_TARGET): mtd-host @rm -rf $(TARGET_DIR)/usr/share/man @rm -rf $(TARGET_DIR)/usr/info /sbin/ldconfig -r $(TARGET_DIR) - $(MKFS_JFFS2) \ - $(JFFS2_OPTS) \ - -d $(BUILD_DIR)/root \ - -o $(JFFS2_TARGET) \ - -D $(TARGET_DEVICE_TABLE) + # Use fakeroot to pretend all target binaries are owned by root + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + chown -R root:root $(TARGET_DIR) + # Use fakeroot to pretend to create all needed device nodes + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + $(STAGING_DIR)/bin/makedevs \ + -d $(TARGET_DEVICE_TABLE) \ + $(TARGET_DIR) + # Use fakeroot so mkfs.jffs2 believes the previous fakery + $(STAGING_DIR)/usr/bin/fakeroot \ + -i $(STAGING_DIR)/fakeroot.env \ + -s $(STAGING_DIR)/fakeroot.env -- \ + $(MKFS_JFFS2) \ + $(JFFS2_OPTS) \ + -d $(BUILD_DIR)/root \ + -o $(JFFS2_TARGET) @ls -l $(JFFS2_TARGET) JFFS2_COPYTO := $(strip $(subst ",,$(BR2_TARGET_ROOTFS_JFFS2_COPYTO))) diff --git a/target/squashfs/squashfsroot.mk b/target/squashfs/squashfsroot.mk index abbd61848..d64380d21 100644 --- a/target/squashfs/squashfsroot.mk +++ b/target/squashfs/squashfsroot.mk @@ -58,9 +58,6 @@ squashfsroot: squashfs host-fakeroot makedevs @rm -rf $(TARGET_DIR)/usr/man @rm -rf $(TARGET_DIR)/usr/info /sbin/ldconfig -r $(TARGET_DIR) - # Use fakeroot to munge permissions and do root-like things - rm -f $(STAGING_DIR)/fakeroot.env - touch $(STAGING_DIR)/fakeroot.env # Use fakeroot to pretend all target binaries are owned by root $(STAGING_DIR)/usr/bin/fakeroot \ -i $(STAGING_DIR)/fakeroot.env \ @@ -71,9 +68,9 @@ squashfsroot: squashfs host-fakeroot makedevs -i $(STAGING_DIR)/fakeroot.env \ -s $(STAGING_DIR)/fakeroot.env -- \ $(STAGING_DIR)/bin/makedevs \ - -d target/generic/device_table.txt \ + -d $(TARGET_DEVICE_TABLE) \ $(TARGET_DIR) - # Use fakeroot to fake out mksquashfs per the previous fakery + # Use fakeroot so mksquashfs believes the previous fakery $(STAGING_DIR)/usr/bin/fakeroot \ -i $(STAGING_DIR)/fakeroot.env \ -s $(STAGING_DIR)/fakeroot.env -- \ diff --git a/target/tar/tarroot.mk b/target/tar/tarroot.mk index d5837442b..2ac07cddc 100644 --- a/target/tar/tarroot.mk +++ b/target/tar/tarroot.mk @@ -11,9 +11,6 @@ tarroot: host-fakeroot makedevs @rm -rf $(TARGET_DIR)/usr/man @rm -rf $(TARGET_DIR)/usr/info /sbin/ldconfig -r $(TARGET_DIR) - # Use fakeroot to munge permissions and do root-like things - rm -f $(STAGING_DIR)/fakeroot.env - touch $(STAGING_DIR)/fakeroot.env # Use fakeroot to pretend all target binaries are owned by root $(STAGING_DIR)/usr/bin/fakeroot \ -i $(STAGING_DIR)/fakeroot.env \ @@ -24,9 +21,9 @@ tarroot: host-fakeroot makedevs -i $(STAGING_DIR)/fakeroot.env \ -s $(STAGING_DIR)/fakeroot.env -- \ $(STAGING_DIR)/bin/makedevs \ - -d target/generic/device_table.txt \ + -d $(TARGET_DEVICE_TABLE) \ $(TARGET_DIR) - # Use fakeroot to fake out tar per the previous fakery + # Use fakeroot so tar believes the previous fakery $(STAGING_DIR)/usr/bin/fakeroot \ -i $(STAGING_DIR)/fakeroot.env \ -s $(STAGING_DIR)/fakeroot.env -- \ -- cgit v1.2.3