summaryrefslogtreecommitdiff
path: root/target/cloop/cloop.mk
blob: ccdb2b49195924c4310454c98e4e37d4b40aa823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#############################################################
#
# Build the compressed loop root filesystem image
#
#############################################################

CLOOP_TARGET=$(IMAGE).cloop
CLOOP_FAKEROOT_SCRIPT=$(BUILD_DIR)/_fakeroot.$(notdir $(CLOOP_TARGET))

clooproot: host-cloop host-cdrkit host-fakeroot
	rm -f $(CLOOP_FAKEROOT_SCRIPT)
	touch $(BUILD_DIR)/.fakeroot.00000
	cat $(BUILD_DIR)/.fakeroot* > $(CLOOP_FAKEROOT_SCRIPT)
	# Use fakeroot to pretend all target binaries are owned by root
	echo "chown -R 0:0 $(TARGET_DIR)" >> $(CLOOP_FAKEROOT_SCRIPT)
ifneq ($(TARGET_DEVICE_TABLE),)
	# Use fakeroot to pretend to create all needed device nodes
	echo "$(HOST_DIR)/usr/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
		>> $(CLOOP_FAKEROOT_SCRIPT)
endif
	# Use fakeroot so genisoimage believes the previous fakery
	echo "$(HOST_DIR)/usr/bin/genisoimage -r $(TARGET_DIR) | $(HOST_DIR)/usr/bin/create_compressed_fs - 65536 > $(CLOOP_TARGET)" >> $(CLOOP_FAKEROOT_SCRIPT)
	chmod a+x $(CLOOP_FAKEROOT_SCRIPT)
	$(HOST_DIR)/usr/bin/fakeroot -- $(CLOOP_FAKEROOT_SCRIPT)
	-@rm -f $(CLOOP_FAKEROOT_SCRIPT)

ifeq ($(BR2_TARGET_ROOTFS_CLOOP),y)
TARGETS+=clooproot
endif