summaryrefslogtreecommitdiffstats
path: root/target/cpio/cpioroot.mk
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-11-22 19:10:59 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-11-22 19:10:59 +0000
commit119e9af1b5eca89a6961126193017ce4704c3940 (patch)
treea48c5cf30d7131645b983a8646d6f91627845163 /target/cpio/cpioroot.mk
parent77fc01bc5a9a2c3084c2d64ffe0f3d9b23b970af (diff)
downloadbuildroot-novena-119e9af1b5eca89a6961126193017ce4704c3940.tar.gz
buildroot-novena-119e9af1b5eca89a6961126193017ce4704c3940.zip
- add a simple cpio target, to be used with an initramfs.
Thanks to Goetz Bock
Diffstat (limited to 'target/cpio/cpioroot.mk')
-rw-r--r--target/cpio/cpioroot.mk45
1 files changed, 45 insertions, 0 deletions
diff --git a/target/cpio/cpioroot.mk b/target/cpio/cpioroot.mk
new file mode 100644
index 000000000..d85ee34e3
--- /dev/null
+++ b/target/cpio/cpioroot.mk
@@ -0,0 +1,45 @@
+#############################################################
+#
+# cpio to archive target filesystem
+#
+#############################################################
+
+CPIO_TARGET:=$(IMAGE).cpio
+
+cpioroot-init:
+ ln -s sbin/init $(TARGET_DIR)/init
+
+cpioroot: host-fakeroot makedevs cpioroot-init
+ -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true;
+ @rm -rf $(TARGET_DIR)/usr/man
+ @rm -rf $(TARGET_DIR)/usr/info
+ -/sbin/ldconfig -r $(TARGET_DIR) 2>/dev/null
+ # Use fakeroot to pretend all target binaries are owned by root
+ rm -f $(STAGING_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
+ touch $(STAGING_DIR)/.fakeroot.00000
+ cat $(STAGING_DIR)/.fakeroot* > $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ echo "chown -R root:root $(TARGET_DIR)" >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ # Use fakeroot to pretend to create all needed device nodes
+ echo "$(STAGING_DIR)/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
+ >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ # Use fakeroot so tar believes the previous fakery
+ echo "cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $(CPIO_TARGET)" \
+ >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ chmod a+x $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ $(STAGING_DIR)/usr/bin/fakeroot -- $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ #-@rm -f $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+
+cpioroot-source:
+
+cpioroot-clean:
+
+cpioroot-dirclean:
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_TARGET_ROOTFS_CPIO)),y)
+TARGETS+=cpioroot
+endif