1 #############################################################
3 # cpio to archive target filesystem
5 #############################################################
7 CPIO_BASE
:=$(IMAGE
).cpio
9 CPIO_ROOTFS_COMPRESSOR
:=
10 CPIO_ROOTFS_COMPRESSOR_EXT
:=
11 CPIO_ROOTFS_COMPRESSOR_PREREQ
:=
12 ifeq ($(BR2_TARGET_ROOTFS_CPIO_GZIP
),y
)
13 CPIO_ROOTFS_COMPRESSOR
:=gzip
-9 -c
14 CPIO_ROOTFS_COMPRESSOR_EXT
:=gz
15 #CPIO_ROOTFS_COMPRESSOR_PREREQ:= gzip-host
17 ifeq ($(BR2_TARGET_ROOTFS_CPIO_BZIP2
),y
)
18 CPIO_ROOTFS_COMPRESSOR
:=bzip2
-9 -c
19 CPIO_ROOTFS_COMPRESSOR_EXT
:=bz2
20 #CPIO_ROOTFS_COMPRESSOR_PREREQ:= bzip2-host
22 ifeq ($(BR2_TARGET_ROOTFS_CPIO_LZMA
),y
)
23 CPIO_ROOTFS_COMPRESSOR
:=lzma
-9 -c
24 CPIO_ROOTFS_COMPRESSOR_EXT
:=lzma
25 CPIO_ROOTFS_COMPRESSOR_PREREQ
:= lzma-host
28 ifneq ($(CPIO_ROOTFS_COMPRESSOR
),)
29 CPIO_TARGET
:= $(CPIO_BASE
).
$(CPIO_ROOTFS_COMPRESSOR_EXT
)
31 CPIO_TARGET
:= $(CPIO_BASE
)
34 ROOTFS_CPIO_COPYTO
:=$(strip $(subst ",,$(BR2_TARGET_ROOTFS_CPIO_COPYTO)))
39 rm -f
$(TARGET_DIR
)/init
40 ln
-s sbin
/init
$(TARGET_DIR
)/init
42 $(CPIO_BASE
): host-fakeroot makedevs cpioroot-init
43 -@find
$(TARGET_DIR
) -type f
-perm
+111 | xargs
$(STRIPCMD
) 2>/dev
/null || true
44 ifneq ($(BR2_HAVE_MANPAGES
),y
)
45 @
rm -rf
$(TARGET_DIR
)/usr
/share
/man
47 ifneq ($(BR2_HAVE_INFOPAGES
),y
)
48 @
rm -rf
$(TARGET_DIR
)/usr
/share
/info
50 $(if
$(TARGET_LDCONFIG
),test ! -x
$(TARGET_LDCONFIG
) && true ||
$(TARGET_LDCONFIG
) -r
$(TARGET_DIR
) 2>/dev
/null
)
51 # Use fakeroot to pretend all target binaries are owned by root
52 rm -f
$(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(TAR_TARGET
))
53 touch
$(PROJECT_BUILD_DIR
)/.fakeroot
.00000
54 cat
$(PROJECT_BUILD_DIR
)/.fakeroot
* > $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
55 echo
"chown -R 0:0 $(TARGET_DIR)" >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
56 ifneq ($(TARGET_DEVICE_TABLE
),)
57 # Use fakeroot to pretend to create all needed device nodes
58 echo
"$(STAGING_DIR)/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
59 >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
61 # Use fakeroot so tar believes the previous fakery
62 echo
"cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $(CPIO_BASE)" \
63 >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
64 chmod a
+x
$(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
65 $(STAGING_DIR
)/usr
/bin
/fakeroot
-- $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
66 #-@rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
67 ifeq ($(CPIO_ROOTFS_COMPRESSOR
),)
68 ifneq ($(ROOTFS_CPIO_COPYTO
),)
69 $(Q
)cp
-f
$(CPIO_BASE
) $(ROOTFS_CPIO_COPYTO
)
73 ifneq ($(CPIO_ROOTFS_COMPRESSOR
),)
74 $(CPIO_BASE
).
$(CPIO_ROOTFS_COMPRESSOR_EXT
): $(CPIO_ROOTFS_COMPRESSOR_PREREQ
) $(CPIO_BASE
)
75 $(CPIO_ROOTFS_COMPRESSOR
) $(CPIO_BASE
) > $(CPIO_TARGET
)
76 ifneq ($(ROOTFS_CPIO_COPYTO
),)
77 $(Q
)cp
-f
$(CPIO_BASE
).
$(CPIO_ROOTFS_COMPRESSOR_EXT
) $(ROOTFS_CPIO_COPYTO
).
$(CPIO_ROOTFS_COMPRESSOR_EXT
)
81 cpioroot
: $(CPIO_TARGET
)
89 #############################################################
91 # Toplevel Makefile options
93 #############################################################
94 ifeq ($(BR2_TARGET_ROOTFS_CPIO
),y
)