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 # Use fakeroot to pretend all target binaries are owned by root
44 rm -f
$(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
45 touch
$(PROJECT_BUILD_DIR
)/.fakeroot
.00000
46 cat
$(PROJECT_BUILD_DIR
)/.fakeroot
* > $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
47 echo
"chown -R 0:0 $(TARGET_DIR)" >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
48 ifneq ($(TARGET_DEVICE_TABLE
),)
49 # Use fakeroot to pretend to create all needed device nodes
50 echo
"$(HOST_DIR)/usr/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
51 >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
53 # Use fakeroot so tar believes the previous fakery
54 echo
"cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $(CPIO_BASE)" \
55 >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
56 chmod a
+x
$(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
57 $(HOST_DIR
)/usr
/bin
/fakeroot
-- $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(CPIO_BASE
))
58 #-@rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
59 ifeq ($(CPIO_ROOTFS_COMPRESSOR
),)
60 ifneq ($(ROOTFS_CPIO_COPYTO
),)
61 $(Q
)cp
-f
$(CPIO_BASE
) $(ROOTFS_CPIO_COPYTO
)
65 ifneq ($(CPIO_ROOTFS_COMPRESSOR
),)
66 $(CPIO_BASE
).
$(CPIO_ROOTFS_COMPRESSOR_EXT
): $(CPIO_ROOTFS_COMPRESSOR_PREREQ
) $(CPIO_BASE
)
67 $(CPIO_ROOTFS_COMPRESSOR
) $(CPIO_BASE
) > $(CPIO_TARGET
)
68 ifneq ($(ROOTFS_CPIO_COPYTO
),)
69 $(Q
)cp
-f
$(CPIO_BASE
).
$(CPIO_ROOTFS_COMPRESSOR_EXT
) $(ROOTFS_CPIO_COPYTO
).
$(CPIO_ROOTFS_COMPRESSOR_EXT
)
73 cpioroot
: $(CPIO_TARGET
)
81 #############################################################
83 # Toplevel Makefile options
85 #############################################################
86 ifeq ($(BR2_TARGET_ROOTFS_CPIO
),y
)