2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(INCLUDE_DIR)/prereq.mk
10 include $(INCLUDE_DIR)/kernel.mk
11 include $(INCLUDE_DIR)/host.mk
12 include $(INCLUDE_DIR)/version.mk
14 override MAKE:=$(_SINGLE)$(SUBMAKE)
15 override NO_TRACE_MAKE:=$(_SINGLE)$(NO_TRACE_MAKE)
17 KDIR=$(KERNEL_BUILD_DIR)
19 DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts
21 sanitize = $(call tolower,$(subst _,-,$(1)))
23 DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
24 EXTRA_NAME_SANITIZED=$(call sanitize,$(EXTRA_IMAGE_NAME))
26 IMG_PREFIX:=$(DIST_SANITIZED)-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(if $(EXTRA_NAME_SANITIZED),$(EXTRA_NAME_SANITIZED)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
28 MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
30 ifneq ($(CONFIG_BIG_ENDIAN),)
31 JFFS2OPTS := --big-endian --squash-uids -v
33 JFFS2OPTS := --little-endian --squash-uids -v
36 ifeq ($(CONFIG_JFFS2_RTIME),y)
39 ifeq ($(CONFIG_JFFS2_ZLIB),y)
42 ifeq ($(CONFIG_JFFS2_LZMA),y)
43 JFFS2OPTS += -X lzma --compression-mode=size
45 ifneq ($(CONFIG_JFFS2_RTIME),y)
48 ifneq ($(CONFIG_JFFS2_ZLIB),y)
51 ifneq ($(CONFIG_JFFS2_LZMA),y)
55 JFFS2OPTS += $(MKFS_DEVTABLE_OPT)
57 SQUASHFS_BLOCKSIZE := $(CONFIG_TARGET_SQUASHFS_BLOCK_SIZE)k
58 SQUASHFSOPT := -b $(SQUASHFS_BLOCKSIZE)
59 SQUASHFSOPT += -p '/dev d 755 0 0' -p '/dev/console c 600 0 0 5 1'
61 LZMA_XZ_OPTIONS := -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2
62 ifeq ($(CONFIG_SQUASHFS_LZMA),y)
63 SQUASHFSCOMP := lzma $(LZMA_XZ_OPTIONS)
65 ifeq ($(CONFIG_SQUASHFS_XZ),y)
66 ifneq ($(filter arm x86 powerpc sparc,$(LINUX_KARCH)),)
67 BCJ_FILTER:=-Xbcj $(LINUX_KARCH)
69 SQUASHFSCOMP := xz $(LZMA_XZ_OPTIONS) $(BCJ_FILTER)
72 JFFS2_BLOCKSIZE ?= 64k 128k
74 fs-types-$(CONFIG_TARGET_ROOTFS_SQUASHFS) += squashfs
75 fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addprefix jffs2-,$(JFFS2_BLOCKSIZE))
76 fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_BLOCKSIZE))
77 fs-types-$(CONFIG_TARGET_ROOTFS_EXT4FS) += ext4
78 fs-types-$(CONFIG_TARGET_ROOTFS_ISO) += iso
79 fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE)))
80 fs-subtypes-$(CONFIG_TARGET_ROOTFS_CPIOGZ) += cpiogz
81 fs-subtypes-$(CONFIG_TARGET_ROOTFS_TARGZ) += targz
83 TARGET_FILESYSTEMS := $(fs-types-y)
85 FS_64K := $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-64k
86 FS_128K := $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-128k
87 FS_256K := $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-256k
90 echo -ne '\xde\xad\xc0\xde' >> $(1)
93 PROFILE_SANITIZED := $(call sanitize,$(PROFILE))
98 $(subst $(space),^,$(1))), \
99 $(call $(2),$(strip $(subst ^,$(space),$(data)))))
103 $(if $(Build/$(word 1,$(1))),,$(error Missing Build/$(word 1,$(1))))
104 $(call Build/$(word 1,$(1)),$(wordlist 2,$(words $(1)),$(1)))
109 $(call split_args,$(1),build_cmd)
112 # pad to 4k, 8k, 16k, 64k, 128k, 256k and add jffs2 end-of-filesystem mark
113 define prepare_generic_squashfs
114 $(STAGING_DIR_HOST)/bin/padjffs2 $(1) 4 8 16 64 128 256
117 define Image/BuildKernel/Initramfs
118 $(call Image/Build/Initramfs)
121 define Image/BuildKernel/MkuImage
122 mkimage -A $(ARCH) -O linux -T kernel -C $(1) -a $(2) -e $(3) \
123 -n '$(call toupper,$(ARCH)) LEDE Linux-$(LINUX_VERSION)' -d $(4) $(5)
126 define Image/BuildKernel/MkFIT
127 $(TOPDIR)/scripts/mkits.sh \
128 -D $(1) -o $(KDIR)/fit-$(1).its -k $(2) $(if $(3),-d $(3)) -C $(4) -a $(5) -e $(6) \
129 -A $(ARCH) -v $(LINUX_VERSION)
130 PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb
133 # $(1) source dts file
134 # $(2) target dtb file
135 # $(3) extra CPP flags
136 # $(4) extra DTC flags
137 define Image/BuildDTB
138 $(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \
140 -I$(DTS_DIR)/include \
141 -undef -D__DTS__ $(3) \
143 $(LINUX_DIR)/scripts/dtc/dtc -O dtb \
149 define Image/mkfs/jffs2/sub
150 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 $(3) --pad -e $(patsubst %k,%KiB,$(1)) -o $(KDIR)/root.jffs2-$(2) -d $(TARGET_DIR) -v 2>&1 1>/dev/null | awk '/^.+$$$$/'
151 $(call add_jffs2_mark,$(KDIR)/root.jffs2-$(2))
154 define Image/mkfs/jffs2/sub-raw
155 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 $(3) -e $(patsubst %k,%KiB,$(1)) -o $(KDIR)/root.jffs2-$(2)-raw -d $(TARGET_DIR) -v 2>&1 1>/dev/null | awk '/^.+$$$$/'
158 define Image/mkfs/jffs2/template
159 Image/mkfs/jffs2-$(1) = $$(call Image/mkfs/jffs2/sub,$(1),$(1),$(JFFS2OPTS))
160 Image/mkfs/jffs2-$(1)-raw = $$(call Image/mkfs/jffs2/sub-raw,$(1),$(1),$(JFFS2OPTS))
164 define Image/mkfs/jffs2-nand/template
165 Image/mkfs/jffs2-nand-$(1) = \
166 $$(call Image/mkfs/jffs2/sub, \
167 $(word 2,$(subst -, ,$(1))),nand-$(1), \
168 $(JFFS2OPTS) --no-cleanmarkers --pagesize=$(word 1,$(subst -, ,$(1))))
172 $(eval $(foreach S,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/template,$(S))))
173 $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))))
175 define Image/mkfs/squashfs
176 $(STAGING_DIR_HOST)/bin/mksquashfs4 $(TARGET_DIR) $(KDIR)/root.squashfs -nopad -noappend -root-owned -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) -processors $(if $(CONFIG_PKG_BUILD_JOBS),$(CONFIG_PKG_BUILD_JOBS),1) $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
182 ifneq ($(CONFIG_NAND_SUPPORT),)
183 define Image/Build/SysupgradeNAND
184 mkdir -p "$(KDIR_TMP)/sysupgrade-$(1)/"
185 echo "BOARD=$(1)" > "$(KDIR_TMP)/sysupgrade-$(1)/CONTROL"
186 [ -z "$(2)" ] || $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(1)/root"
187 [ -z "$(3)" ] || $(CP) "$(3)" "$(KDIR_TMP)/sysupgrade-$(1)/kernel"
188 (cd "$(KDIR_TMP)"; $(TAR) cvf \
189 "$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar" sysupgrade-$(1) \
190 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
195 # $(2) ubinize-image options (e.g. --uboot-env and/or --kernel kernelimage)
196 # $(3) rootfstype (e.g. squashfs or ubifs)
197 # $(4) options to pass-through to ubinize (i.e. $($(PROFILE)_UBI_OPTS)))
198 define Image/Build/UbinizeImage
199 sh $(TOPDIR)/scripts/ubinize-image.sh $(2) \
200 "$(KDIR)/root.$(3)" \
201 "$(KDIR)/$(IMG_PREFIX)-$(1)-$(3)-ubinized.bin" \
207 ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),)
208 define Image/mkfs/ubifs/generate
209 $(CP) ./ubinize$(1).cfg $(KDIR)
211 $(STAGING_DIR_HOST)/bin/ubinize \
212 $(if $($(PROFILE)_UBI_OPTS), \
213 $(shell echo $($(PROFILE)_UBI_OPTS)), \
214 $(shell echo $(UBI_OPTS)) \
216 -o $(KDIR)/root$(1).ubi \
221 define Image/mkfs/ubifs
223 ifneq ($($(PROFILE)_UBIFS_OPTS)$(UBIFS_OPTS),)
224 $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
225 $(if $($(PROFILE)_UBIFS_OPTS), \
226 $(shell echo $($(PROFILE)_UBIFS_OPTS)), \
227 $(shell echo $(UBIFS_OPTS)) \
229 $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \
230 $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \
231 $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \
232 $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \
233 $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \
235 -o $(KDIR)/root.ubifs \
238 $(call Image/Build,ubifs)
240 ifneq ($($(PROFILE)_UBI_OPTS)$(UBI_OPTS),)
241 $(if $(wildcard ./ubinize.cfg),$(call Image/mkfs/ubifs/generate,))
242 $(if $(wildcard ./ubinize-overlay.cfg),$(call Image/mkfs/ubifs/generate,-overlay))
244 $(if $(wildcard ./ubinize.cfg),$(call Image/Build,ubi))
248 define Image/mkfs/cpiogz
249 ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9n >$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
252 define Image/mkfs/targz
253 $(TAR) -cp --numeric-owner --owner=0 --group=0 --sort=name \
254 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
255 -C $(TARGET_DIR)/ . | gzip -9n > $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-rootfs.tar.gz
258 E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024)))
260 define Image/mkfs/ext4
261 $(STAGING_DIR_HOST)/bin/make_ext4fs \
262 -l $(E2SIZE) -b $(CONFIG_TARGET_EXT4_BLOCKSIZE) \
263 -i $(CONFIG_TARGET_EXT4_MAXINODE) \
264 -m $(CONFIG_TARGET_EXT4_RESERVED_PCT) \
265 $(if $(CONFIG_TARGET_EXT4_JOURNAL),,-J) \
266 $(if $(SOURCE_DATE_EPOCH),-T $(SOURCE_DATE_EPOCH)) \
267 $(KDIR)/root.ext4 $(TARGET_DIR)/
270 define Image/mkfs/prepare/default
271 # Use symbolic permissions to avoid clobbering SUID/SGID/sticky bits
272 - $(FIND) $(TARGET_DIR) -type f -not -perm /0100 -not -name 'ssh_host*' -not -name 'shadow' -print0 | $(XARGS) -0 chmod u+rw,g+r,o+r
273 - $(FIND) $(TARGET_DIR) -type f -perm /0100 -print0 | $(XARGS) -0 chmod u+rwx,g+rx,o+rx
274 - $(FIND) $(TARGET_DIR) -type d -print0 | $(XARGS) -0 chmod u+rwx,g+rx,o+rx
275 $(INSTALL_DIR) $(TARGET_DIR)/tmp $(TARGET_DIR)/overlay
276 chmod 1777 $(TARGET_DIR)/tmp
279 define Image/mkfs/prepare
280 $(call Image/mkfs/prepare/default)
284 define Image/Checksum
286 $(FIND) -maxdepth 1 -type f \! -name 'md5sums' -printf "%P\n" | sort | xargs $1 > $2 \
290 define BuildImage/mkfs
293 mkfs-$(1): kernel_prepare
295 $(call Build/mkfs/default,$(1))
296 $(call Build/mkfs/$(1),$(1))
297 $(KDIR)/root.$(1): mkfs-$(1)
301 # Build commands that can be called from Device/* templates
303 mkimage -A $(LINUX_KARCH) \
305 -C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
306 -n '$(call toupper,$(LINUX_KARCH)) LEDE Linux-$(LINUX_VERSION)' -d $@ $@.new
310 define Build/netgear-chk
311 $(STAGING_DIR_HOST)/bin/mkchkimg \
314 -b $(NETGEAR_BOARD_ID) \
319 define Build/netgear-dni
320 $(STAGING_DIR_HOST)/bin/mkdniimg \
321 -B $(NETGEAR_BOARD_ID) -v LEDE.$(REVISION) \
322 $(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \
329 $(TOPDIR)/scripts/mkits.sh \
330 -D $(DEVICE_NAME) -o $@.its -k $@ \
331 $(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \
332 -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
333 -A $(ARCH) -v $(LINUX_VERSION)
334 PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
339 $(call Build/lzma-no-dict,-lc1 -lp2 -pb2 $(1))
342 define Build/lzma-no-dict
343 $(STAGING_DIR_HOST)/bin/lzma e $@ $(1) $@.new
348 gzip -9n -c $@ $(1) > $@.new
353 rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
354 mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
355 cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(1) && \
356 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad \
357 $(if $(CONFIG_BIG_ENDIAN),--big-endian,--little-endian) \
358 --squash-uids -v -e $(patsubst %k,%KiB,$(BLOCKSIZE)) \
360 -d $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 \
361 2>&1 1>/dev/null | awk '/^.+$$$$/' && \
362 $(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J $(patsubst %k,,$(BLOCKSIZE))
363 -rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/
367 define Build/kernel-bin
372 define Build/patch-cmdline
373 $(STAGING_DIR_HOST)/bin/patch-cmdline $@ '$(CMDLINE)'
376 define Build/append-kernel
377 dd if=$(word 1,$^) $(if $(1),bs=$(1) conv=sync) >> $@
380 define Build/append-rootfs
381 dd if=$(word 2,$^) $(if $(1),bs=$(1) conv=sync) >> $@
384 define Build/append-ubi
385 sh $(TOPDIR)/scripts/ubinize-image.sh \
386 $(if $(UBOOTENV_IN_UBI),--uboot-env) \
387 $(if $(KERNEL_IN_UBI),--kernel $(word 1,$^)) \
390 -p $(BLOCKSIZE) -m $(PAGESIZE) -E 5 \
391 $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE))
397 dd if=$@ of=$@.new bs=$(1) conv=sync
401 define Build/pad-rootfs
402 $(call prepare_generic_squashfs,$@ $(1))
405 define Build/pad-offset
407 size="$$(stat -c%s $@)" \
408 pad="$(word 1, $(1))" \
409 offset="$(word 2, $(1))" \
410 pad="(pad - ((size + offset) % pad)) % pad" \
411 newsize='size + pad'; \
412 dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync
416 define Build/check-size
417 @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $@)" ] || { \
418 echo "WARNING: Image file $@ is too big" >&2; \
423 define Build/combined-image
424 -sh $(TOPDIR)/scripts/combined-image.sh \
431 define Build/sysupgrade-nand
432 sh $(TOPDIR)/scripts/sysupgrade-nand.sh \
433 --board $(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)) \
434 --kernel $(word 1,$^) \
435 --rootfs $(word 2,$^) \
440 PROFILES := $(PROFILE)
444 DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE)
446 KERNEL_INITRAMFS = $$(KERNEL)
450 IMAGE_PREFIX := $(IMG_PREFIX)-$(1)
451 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
453 KERNEL_SUFFIX := -kernel.bin
454 KERNEL_IMAGE = $$(KERNEL_PREFIX)$$(KERNEL_SUFFIX)
455 KERNEL_INITRAMFS_PREFIX = $$(IMAGE_PREFIX)-initramfs
456 KERNEL_INITRAMFS_IMAGE = $$(KERNEL_INITRAMFS_PREFIX)$$(KERNEL_SUFFIX)
457 KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs
459 KERNEL_NAME := vmlinux
463 FILESYSTEMS := $(TARGET_FILESYSTEMS)
466 define Device/ExportVar
467 $(1) : $(2):=$$($(2))
471 $(foreach var,$(DEVICE_VARS) DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE,$(call Device/ExportVar,$(1),$(var)))
472 $(1) : FILESYSTEM:=$(2)
476 _TARGET = $$(if $$(filter $(PROFILE),$$(PROFILES)),install,install-disabled)
477 _COMPILE_TARGET = $$(if $(if $(IB),,$(CONFIG_IB)$$(filter $(PROFILE),$$(PROFILES))),compile,compile-disabled)
481 define Device/Build/initramfs
482 $(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1))
483 $$(_TARGET): $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
485 $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
486 $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
489 $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS)
491 $$(call concat_cmd,$$(KERNEL_INITRAMFS))
495 define Device/Build/check_size
496 @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $@)" ] || { \
497 echo "WARNING: Image file $@ is too big" >&2; \
502 define Device/Build/compile
503 $$(_COMPILE_TARGET): $(KDIR)/$(1)
504 $(eval $(call Device/Export,$(KDIR)/$(1)))
506 $$(call concat_cmd,$(COMPILE/$(1)))
510 define Device/Build/kernel
511 _KERNEL_IMAGES += $(KDIR)/$$(KERNEL_NAME)
512 $(KDIR)/$$(KERNEL_NAME):: image_prepare
513 $$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
514 $(call Device/Export,$(KDIR)/$$(KERNEL_IMAGE),$(1))
515 $(BIN_DIR)/$$(KERNEL_IMAGE): $(KDIR)/$$(KERNEL_IMAGE)
519 install: $(KDIR)/$$(KERNEL_IMAGE)
521 $(KDIR)/$$(KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS)
523 $$(call concat_cmd,$$(KERNEL))
524 $$(if $$(KERNEL_SIZE),$$(call Device/Build/check_size,$$(KERNEL_SIZE)))
528 define Device/Build/image
529 $$(_TARGET): $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2))
530 $(eval $(call Device/Export,$(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)),$(1)))
531 $(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)): $(KDIR)/$$(KERNEL_IMAGE) $(KDIR)/root.$(1)
533 [ -f $$(word 1,$$^) -a -f $$(word 2,$$^) ]
534 $$(call concat_cmd,$(if $(IMAGE/$(2)/$(1)),$(IMAGE/$(2)/$(1)),$(IMAGE/$(2))))
536 .IGNORE: $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2))
537 $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2)): $(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2))
543 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
544 $(call Device/Build/kernel,$(1))
546 $$(eval $$(foreach compile,$$(COMPILE), \
547 $$(call Device/Build/compile,$$(compile),$(1))))
549 $$(eval $$(foreach image,$$(IMAGES), \
550 $$(foreach fs,$$(filter $(TARGET_FILESYSTEMS),$$(FILESYSTEMS)), \
551 $$(call Device/Build/image,$$(fs),$$(image),$(1)))))
554 define Device/DumpInfo
555 Target-Profile: DEVICE_$(1)
556 Target-Profile-Name: $(DEVICE_TITLE)
557 Target-Profile-Packages: $(DEVICE_PACKAGES)
558 Target-Profile-Description:
559 $(DEVICE_DESCRIPTION)
565 $$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1)))))
569 $(call Device/Init,$(1))
570 $(call Device/Default,$(1))
571 $(call Device/Check,$(1))
572 $(call Device/$(1),$(1))
573 $(call Device/$(if $(DUMP),Dump,Build),$(1))
592 .PHONY: download prepare compile clean image_prepare mkfs_prepare kernel_prepare install
594 $(call Build/Compile)
599 image_prepare: compile
600 mkdir -p $(BIN_DIR) $(KDIR)/tmp
601 $(call Image/Prepare)
604 mkdir -p $(BIN_DIR) $(KDIR)/tmp
607 mkfs_prepare: image_prepare
608 $(call Image/mkfs/prepare)
610 kernel_prepare: mkfs_prepare
611 $(call Image/BuildKernel)
612 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(if $(IB),,$(call Image/BuildKernel/Initramfs)))
613 $(call Image/InstallKernel)
615 $(foreach device,$(TARGET_DEVICES),$(call Device,$(device)))
616 $(foreach fs,$(TARGET_FILESYSTEMS) $(fs-subtypes-y),$(call BuildImage/mkfs,$(fs)))
618 install: kernel_prepare
619 $(foreach fs,$(TARGET_FILESYSTEMS),
620 $(call Image/Build,$(fs))
622 $(call Image/mkfs/ubifs)
623 $(call Image/Checksum,md5sum --binary,md5sums)
624 $(call Image/Checksum,openssl dgst -sha256,sha256sums)