9960caba0c50ed7025447e896a053aece6ae0758
[openwrt/openwrt.git] / include / image-legacy.mk
1 ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),)
2 define Image/mkfs/ubifs/generate
3 $(CP) ./ubinize$(1).cfg $(KDIR)
4 ( cd $(KDIR); \
5 $(STAGING_DIR_HOST)/bin/ubinize \
6 $(if $($(PROFILE)_UBI_OPTS),$($(PROFILE)_UBI_OPTS),$(shell echo $(UBI_OPTS))) \
7 -o $(KDIR)/root$(1).ubi \
8 ubinize$(1).cfg \
9 )
10 endef
11
12 define Image/mkfs/ubifs/legacy
13
14 $(if $($(PROFILE)_UBIFS_OPTS)$(UBIFS_OPTS),
15 $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
16 $(if $($(PROFILE)_UBIFS_OPTS),$($(PROFILE)_UBIFS_OPTS),$(UBIFS_OPTS)) \
17 $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \
18 $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \
19 $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \
20 $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \
21 $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \
22 --squash-uids \
23 -o $(KDIR)/root.ubifs \
24 -d $(TARGET_DIR)
25 )
26 $(call Image/Build,ubifs)
27
28 $(if $($(PROFILE)_UBI_OPTS)$(UBI_OPTS),
29 $(if $(wildcard ./ubinize.cfg),$(call Image/mkfs/ubifs/generate,))
30 $(if $(wildcard ./ubinize-overlay.cfg),$(call Image/mkfs/ubifs/generate,-overlay))
31 )
32 $(if $(wildcard ./ubinize.cfg),$(call Image/Build,ubi))
33 endef
34 endif
35
36 LegacyDevice/Dump = $(Device/Dump)
37
38 define LegacyDevice/Check
39 $(Device/Check/Common)
40 _TARGET_PREPARE := $$(if $$(_PROFILE_SET),legacy-images-prepare,prepare-disabled)
41 _TARGET := $$(if $$(_PROFILE_SET),legacy-images,install-disabled)
42 $$(if $$(_PROFILE_SET),install: legacy-images-make)
43 ifndef IB
44 $$(if $$(_PROFILE_SET),mkfs_prepare: legacy-images-prepare-make)
45 endif
46 endef
47
48 ifdef TARGET_PER_DEVICE_ROOTFS
49 define Image/Build/Profile/Filesystem
50 cp $(KDIR)/root.$(2)+pkg=$(3) $(KDIR)/root.$(2)
51 $(call Image/Build/Profile,$(1),$(2))
52 endef
53 else
54 Image/Build/Profile/Filesystem = $(Image/Build/Profile)
55 endif
56
57 define LegacyDevice/Build
58 $$(_TARGET): legacy-image-$(1)
59 $$(_TARGET_PREPARE): legacy-image-prepare-$(1)
60 .PHONY: legacy-image-prepare-$(1) legacy-image-$(1)
61
62 legacy-image-prepare-$(1):
63 $$(call Image/Prepare/Profile,$(1))
64
65 ifndef IB
66 ifdef CONFIG_TARGET_PER_DEVICE_ROOTFS
67 ROOTFS/$(1) := $(foreach fs,$(TARGET_FILESYSTEMS), \
68 $(KDIR)/root.$(fs)$$(strip $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),+pkg=$$(ROOTFS_ID/$(1)))) \
69 )
70
71 $$(ROOTFS/$(1)): target-dir-$$(ROOTFS_ID/$(1))
72 legacy-images-make: $$(if $$(_PROFILE_SET),$$(ROOTFS/$(1)))
73 endif
74 endif
75
76 legacy-image-$(1):
77 $$(call Image/BuildKernel/Profile,$(1))
78 $(foreach fs,$(TARGET_FILESYSTEMS),
79 $$(call Image/Build/Profile/Filesystem,$(1),$(fs),$$(ROOTFS_ID/$(1)))
80 )
81
82 endef
83
84 define LegacyDevice
85 $(call Device/InitProfile,$(1))
86 $(call Device/Default,$(1))
87 $(call LegacyDevice/Default,$(1))
88 $(call LegacyDevice/$(1),$(1))
89 $(call LegacyDevice/Check,$(1))
90 $(call LegacyDevice/$(if $(DUMP),Dump,Build),$(1))
91
92 endef
93
94