Commit 119e9af1 authored by Bernhard Reutner-Fischer's avatar Bernhard Reutner-Fischer
Browse files

- add a simple cpio target, to be used with an initramfs.

  Thanks to Goetz Bock
parent 77fc01bc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ source "target/ext2/Config.in"
source "target/jffs2/Config.in"
source "target/squashfs/Config.in"
source "target/tar/Config.in"
source "target/cpio/Config.in"
source "target/iso9660/Config.in"

comment "bootloader for target device"

target/cpio/Config.in

0 → 100644
+6 −0
Original line number Diff line number Diff line
config BR2_TARGET_ROOTFS_CPIO
       bool "cpio the root filesystem"
       default n
       help
         Build a cpio archive of the root filesystem
+45 −0
Original line number Diff line number Diff line
#############################################################
#
# 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