1 # Build commands that can be called from Device/* templates
3 IMAGE_KERNEL
= $(word 1,$^
)
4 IMAGE_ROOTFS
= $(word 2,$^
)
6 define ModelNameLimit16
7 $(shell printf
%.16s
"$(word 2, $(subst _, ,$(1)))")
11 $(patsubst %-256k
,0x40000,$(patsubst %-128k
,0x20000,$(patsubst %-64k
,0x10000,$(patsubst squashfs
%,0x4,$(patsubst root.
%,%,$(1))))))
15 define Build
/append-dtb
16 cat
$(KDIR
)/image-
$(firstword $(DEVICE_DTS
)).dtb
>> $@
19 define Build
/append-dtb-elf
20 $(TARGET_CROSS
)objcopy \
21 --set-section-flags
=.appended_dtb
=alloc
,contents \
23 .appended_dtb
=$(KDIR
)/image-
$(firstword $(DEVICE_DTS
)).dtb
$@
26 define Build
/append-kernel
27 dd if
=$(IMAGE_KERNEL
) >> $@
30 define Build
/package-kernel-ubifs
32 cp
$@
$@.kernelubifs
/kernel
33 $(STAGING_DIR_HOST
)/bin
/mkfs.ubifs \
34 $(KERNEL_UBIFS_OPTS
) \
39 define Build
/append-image
40 cp
"$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
41 fwtool
-s
/dev
/null
-t
"$@.stripmeta" ||
:
42 fwtool
-i
/dev
/null
-t
"$@.stripmeta" ||
:
43 dd if
="$@.stripmeta" >> "$@"
48 define Build
/append-image-stage
49 dd if
=$(STAGING_DIR_IMAGE
)/$(BOARD
)$(if
$(SUBTARGET
),-$(SUBTARGET
))-$(DEVICE_NAME
)-$(1) >> $@
52 define Build
/append-image-stage
53 cp
"$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
54 fwtool
-s
/dev
/null
-t
"$@.stripmeta" ||
:
55 fwtool
-i
/dev
/null
-t
"$@.stripmeta" ||
:
56 mkdir
-p
"$(STAGING_DIR_IMAGE)"
57 dd if
="$@.stripmeta" of
="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)"
58 dd if
="$@.stripmeta" >> "$@"
64 compat_version
=$(if
$(DEVICE_COMPAT_VERSION
),$(DEVICE_COMPAT_VERSION
),1.0)
65 json_quote
=$(subst ','\'',$(subst ",\",$(1)))
68 legacy_supported_message
=$(SUPPORTED_DEVICES
) - Image version mismatch
: image
$(compat_version
), \
69 device
1.0. Please wipe config during upgrade
(force required
) or reinstall. \
70 $(if
$(DEVICE_COMPAT_MESSAGE
),Reason
: $(DEVICE_COMPAT_MESSAGE
),Please
check documentation ...
)
72 metadata_devices
=$(if
$(1),$(subst "$(space)","$(comma)",$(strip $(foreach v
,$(1),"$(call json_quote,$(v))"))))
74 '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
75 "metadata_version": "1.1", \
76 "compat_version": "$(call json_quote,$(compat_version))", \
77 $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
78 $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
79 [$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \
80 "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
81 $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \
83 "dist": "$(call json_quote,$(VERSION_DIST))", \
84 "version": "$(call json_quote,$(VERSION_NUMBER))", \
85 "revision": "$(call json_quote,$(REVISION))", \
86 "target": "$(call json_quote,$(TARGETID))", \
87 "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
91 define Build
/append-metadata
92 $(if
$(SUPPORTED_DEVICES
),-echo
$(call metadata_json
) | fwtool
-I
- $@
)
93 sha256sum
"$@" | cut
-d
" " -f1
> "$@.sha256sum"
94 [ ! -s
"$(BUILD_KEY)" -o
! -s
"$(BUILD_KEY).ucert" -o
! -s
"$@" ] ||
{ \
95 cp
"$(BUILD_KEY).ucert" "$@.ucert" ;\
96 usign
-S
-m
"$@" -s
"$(BUILD_KEY)" -x
"$@.sig" ;\
97 ucert
-A
-c
"$@.ucert" -x
"$@.sig" ;\
98 fwtool
-S
"$@.ucert" "$@" ;\
102 define Build
/append-rootfs
103 dd if
=$(IMAGE_ROOTFS
) >> $@
106 define Build
/append-squashfs-fakeroot-be
107 rm -rf
$@.fakefs
$@.fakesquashfs
109 $(STAGING_DIR_HOST
)/bin
/mksquashfs-lzma \
110 $@.fakefs
$@.fakesquashfs \
111 -noappend
-root-owned
-be
-nopad
-b
65536 \
112 $(if
$(SOURCE_DATE_EPOCH
),-fixed-time
$(SOURCE_DATE_EPOCH
))
113 cat
$@.fakesquashfs
>> $@
116 define Build
/append-squashfs4-fakeroot
117 rm -rf
$@.fakefs
$@.fakesquashfs
119 $(STAGING_DIR_HOST
)/bin
/mksquashfs4 \
120 $@.fakefs
$@.fakesquashfs \
121 -nopad
-noappend
-root-owned
122 cat
$@.fakesquashfs
>> $@
125 define Build
/append-string
129 define Build
/append-ubi
130 sh
$(TOPDIR
)/scripts
/ubinize-image.sh \
131 $(if
$(UBOOTENV_IN_UBI
),--uboot-env
) \
132 $(if
$(KERNEL_IN_UBI
),--kernel
$(IMAGE_KERNEL
)) \
133 $(foreach part
,$(UBINIZE_PARTS
),--part
$(part
)) \
134 --rootfs
$(IMAGE_ROOTFS
) \
136 -p
$(BLOCKSIZE
:%k
=%KiB
) -m
$(PAGESIZE
) \
137 $(if
$(SUBPAGESIZE
),-s
$(SUBPAGESIZE
)) \
138 $(if
$(VID_HDR_OFFSET
),-O
$(VID_HDR_OFFSET
)) \
144 define Build
/ubinize-kernel
146 sh
$(TOPDIR
)/scripts
/ubinize-image.sh \
149 -p
$(BLOCKSIZE
:%k
=%KiB
) -m
$(PAGESIZE
) \
150 $(if
$(SUBPAGESIZE
),-s
$(SUBPAGESIZE
)) \
151 $(if
$(VID_HDR_OFFSET
),-O
$(VID_HDR_OFFSET
)) \
156 define Build
/append-uboot
157 dd if
=$(UBOOT_PATH
) >> $@
160 # append a fake/empty uImage header, to fool bootloaders rootfs integrity check
162 define Build
/append-uImage-fakehdr
163 $(eval type
=$(word 1,$(1)))
164 $(eval magic
=$(word 2,$(1)))
166 $(STAGING_DIR_HOST
)/bin
/mkimage \
167 -A
$(LINUX_KARCH
) -O linux
-T
$(type
) -C none \
168 -n
'$(VERSION_DIST) fake $(type)' \
169 $(if
$(magic
),-M
$(magic
)) \
176 define Build
/buffalo-dhp-image
177 $(STAGING_DIR_HOST
)/bin
/mkdhpimg
$@
$@.new
181 define Build
/buffalo-enc
182 $(eval product
=$(word 1,$(1)))
183 $(eval version
=$(word 2,$(1)))
184 $(eval args
=$(wordlist
3,$(words $(1)),$(1)))
185 $(STAGING_DIR_HOST
)/bin
/buffalo-enc \
186 -p
$(product
) -v
$(version
) $(args
) \
191 define Build
/buffalo-enc-tag
192 $(call Build
/buffalo-enc
,'' '' -S
152 $(1))
195 define Build
/buffalo-tag-dhp
196 $(eval product
=$(word 1,$(1)))
197 $(eval region
=$(word 2,$(1)))
198 $(eval language
=$(word 3,$(1)))
199 $(STAGING_DIR_HOST
)/bin
/buffalo-tag \
201 -a
$(BUFFALO_TAG_PLATFORM
) \
202 -v
$(BUFFALO_TAG_VERSION
) -m
$(BUFFALO_TAG_MINOR
) \
203 -b
$(product
) -p
$(product
) \
204 -r
$(region
) -r
$(region
) -l
$(language
) \
209 define Build
/check-size
210 @imagesize
="$$(stat -c%s $@)"; \
211 limitsize
="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \
212 [ $$limitsize -ge
$$imagesize ] ||
{ \
213 $(call ERROR_MESSAGE
, WARNING
: Image file
$@ is too big
: $$imagesize > $$limitsize); \
218 define Build
/copy-file
222 define Build
/edimax-header
223 $(STAGING_DIR_HOST
)/bin
/mkedimaximg
-i
$@
-o
$@.new
$(1)
227 define Build
/elecom-product-header
228 $(eval product
=$(word 1,$(1)))
229 $(eval fw
=$(if
$(word 2,$(1)),$(word 2,$(1)),$@
))
232 echo
-n
-e
"ELECOM\x00\x00$(product)" | dd bs
=40 count
=1 conv
=sync
; \
233 echo
-n
"0.00" | dd bs
=16 count
=1 conv
=sync
; \
239 define Build
/elecom-wrc-gs-factory
240 $(eval product
=$(word 1,$(1)))
241 $(eval version
=$(word 2,$(1)))
242 $(eval hash_opt
=$(word 3,$(1)))
243 $(MKHASH
) md5
$(hash_opt
) $@
>> $@
245 echo
-n
"ELECOM $(product) v$(version)" | \
246 dd bs
=32 count
=1 conv
=sync
; \
252 define Build
/elx-header
253 $(eval hw_id
=$(word 1,$(1)))
254 $(eval xor_pattern
=$(word 2,$(1)))
256 echo
-ne
"\x00\x00\x00\x00\x00\x00\x00\x03" | \
257 dd bs
=42 count
=1 conv
=sync
; \
259 echo
-ne
"\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \
260 dd bs
=20 count
=1 conv
=sync
; \
261 echo
-ne
"$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
262 dd bs
=8 count
=1 conv
=sync
; \
263 echo
-ne
"$$($(MKHASH) md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
264 dd bs
=58 count
=1 conv
=sync
; \
265 ) > $(KDIR
)/tmp
/$(DEVICE_NAME
).header
266 $(call Build
/xor-image
,-p
$(xor_pattern
) -x
)
267 cat
$(KDIR
)/tmp
/$(DEVICE_NAME
).header
$@
> $@.new
269 rm -rf
$(KDIR
)/tmp
/$(DEVICE_NAME
).header
272 define Build
/eva-image
273 $(STAGING_DIR_HOST
)/bin
/lzma2eva
$(KERNEL_LOADADDR
) $(KERNEL_LOADADDR
) $@
$@.new
277 define Build
/initrd_compression
278 $(if
$(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2
),.bzip2
) \
279 $(if
$(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP
),.gzip
) \
280 $(if
$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA
),.lzma
) \
281 $(if
$(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ
),.xz
) \
282 $(if
$(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD
),.zstd
)
286 $(TOPDIR
)/scripts
/mkits.sh \
287 -D
$(DEVICE_NAME
) -o
$@.its
-k
$@ \
289 $(if
$(word 2,$(1)),\
290 $(if
$(findstring 11,$(if
$(DEVICE_DTS_OVERLAY
),1)$(if
$(findstring $(KERNEL_BUILD_DIR
)/image-
,$(word 2,$(1))),,1)), \
291 -d
$(KERNEL_BUILD_DIR
)/image-
$$(basename $(word 2,$(1))), \
292 -d
$(word 2,$(1)))) \
293 $(if
$(findstring with-rootfs
,$(word 3,$(1))),-r
$(IMAGE_ROOTFS
)) \
294 $(if
$(findstring with-initrd
,$(word 3,$(1))), \
295 $(if
$(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE
), \
296 -i
$(KERNEL_BUILD_DIR
)/initrd.cpio
$(strip $(call Build
/initrd_compression
)))) \
297 -a
$(KERNEL_LOADADDR
) -e
$(if
$(KERNEL_ENTRY
),$(KERNEL_ENTRY
),$(KERNEL_LOADADDR
)) \
298 $(if
$(DEVICE_FDT_NUM
),-n
$(DEVICE_FDT_NUM
)) \
299 $(if
$(DEVICE_DTS_DELIMITER
),-l
$(DEVICE_DTS_DELIMITER
)) \
300 $(if
$(DEVICE_DTS_LOADADDR
),-s
$(DEVICE_DTS_LOADADDR
)) \
301 $(if
$(DEVICE_DTS_OVERLAY
),$(foreach dtso
,$(DEVICE_DTS_OVERLAY
), -O
$(dtso
):$(KERNEL_BUILD_DIR
)/image-
$(dtso
).dtb
)) \
302 -c
$(if
$(DEVICE_DTS_CONFIG
),$(DEVICE_DTS_CONFIG
),"config-1") \
303 -A
$(LINUX_KARCH
) -v
$(LINUX_VERSION
)
304 PATH
=$(LINUX_DIR
)/scripts
/dtc
:$(PATH
) mkimage
$(if
$(findstring external
,$(word 3,$(1))),\
305 -E
-B
0x1000 $(if
$(findstring static
,$(word 3,$(1))),-p
0x1000)) -f
$@.its
$@.new
309 define Build
/libdeflate-gzip
310 $(STAGING_DIR_HOST
)/bin
/libdeflate-gzip
-f
-12 -c
$@
$(1) > $@.new
315 $(STAGING_DIR_HOST
)/bin
/gzip
-f
-9n
-c
$@
$(1) > $@.new
319 define Build
/gzip-filename
321 @cp
$@
$@.tmp
/$(word 1,$(1))
322 $(if
$(SOURCE_DATE_EPOCH
),touch
-hcd
"@$(SOURCE_DATE_EPOCH)" $@.tmp
/$(word 1,$(1)) $(word 2,$(1)))
323 $(STAGING_DIR_HOST
)/bin
/gzip
-f
-9 -N
-c
$@.tmp
/$(word 1,$(1)) $(word 2,$(1)) > $@.new
328 define Build
/install-dtb
330 $(foreach dts
,$(DEVICE_DTS
), \
332 $(DTS_DIR
)/$(dts
).dtb \
333 $(BIN_DIR
)/$(IMG_PREFIX
)-$(dts
).dtb
; \
335 install-dtb-
$(IMG_PREFIX
) \
339 define Build
/iptime-crc32
340 $(STAGING_DIR_HOST
)/bin
/iptime-crc32
$(1) $@
$@.new
344 define Build
/iptime-naspkg
345 $(STAGING_DIR_HOST
)/bin
/iptime-naspkg
$(1) $@
$@.new
350 rm -rf
$(KDIR_TMP
)/$(DEVICE_NAME
)/jffs2
&& \
351 mkdir
-p
$(KDIR_TMP
)/$(DEVICE_NAME
)/jffs2
/$$(dirname
$(1)) && \
352 cp
$@
$(KDIR_TMP
)/$(DEVICE_NAME
)/jffs2
/$(1) && \
353 $(STAGING_DIR_HOST
)/bin
/mkfs.jffs2
--pad \
354 $(if
$(CONFIG_BIG_ENDIAN
),--big-endian
,--little-endian
) \
355 --squash-uids
-v
-e
$(patsubst %k
,%KiB
,$(BLOCKSIZE
)) \
357 -d
$(KDIR_TMP
)/$(DEVICE_NAME
)/jffs2 \
358 2>&1 1>/dev
/null | awk
'/^.+$$$$/' && \
359 $(STAGING_DIR_HOST
)/bin
/padjffs2
$@.new
-J
$(patsubst %k
,,$(BLOCKSIZE
))
360 -rm -rf
$(KDIR_TMP
)/$(DEVICE_NAME
)/jffs2
/
364 define Build
/kernel2minor
365 $(eval temp_file
:= $(shell mktemp
))
367 kernel2minor
-k
$(temp_file
) -r
$(temp_file
).new
$(1)
368 mv
$(temp_file
).new
$@
372 define Build
/kernel-bin
377 define Build
/linksys-image
378 $(TOPDIR
)/scripts
/linksys-image.sh \
379 "$(call param_get_default,type,$(1),$(DEVICE_NAME))" \
385 $(call Build
/lzma-no-dict
,-lc1
-lp2
-pb2
$(1))
388 define Build
/lzma-no-dict
389 $(STAGING_DIR_HOST
)/bin
/lzma e
$@
$(1) $@.new
393 define Build
/netgear-chk
394 $(STAGING_DIR_HOST
)/bin
/mkchkimg \
397 -b
$(NETGEAR_BOARD_ID
) \
398 $(if
$(NETGEAR_REGION
),-r
$(NETGEAR_REGION
),)
402 define Build
/netgear-dni
403 $(STAGING_DIR_HOST
)/bin
/mkdniimg \
404 -B
$(NETGEAR_BOARD_ID
) -v
$(VERSION_DIST
).
$(firstword $(subst -, ,$(REVISION
))) \
405 $(if
$(NETGEAR_HW_ID
),-H
$(NETGEAR_HW_ID
)) \
411 define Build
/netgear-encrypted-factory
412 $(TOPDIR
)/scripts
/netgear-encrypted-factory.py \
415 --model
$(NETGEAR_ENC_MODEL
) \
416 --region
$(NETGEAR_ENC_REGION
) \
417 --version V1.0
.0.0.
$(VERSION_DIST
).
$(firstword $(subst -, ,$(REVISION
))) \
418 --encryption-block-size
0x20000 \
419 --openssl-bin
"$(STAGING_DIR_HOST)/bin/openssl" \
420 --key
6865392d342b4d212964363d6d7e7765312c7132613364316e26322a5a5e2538 \
421 --iv
4a253169516c38243d6c6d2d3b384145
424 define Build
/openmesh-image
425 $(TOPDIR
)/scripts
/om-fwupgradecfg-gen.sh \
426 "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
428 "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" \
429 "$(call param_get_default,rootfs,$(1),$@)"
430 $(TOPDIR
)/scripts
/combined-ext-image.sh \
431 "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" "$@" \
432 "$@-fwupgrade.cfg" "fwupgrade.cfg" \
433 "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" "kernel" \
434 "$(call param_get_default,rootfs,$(1),$@)" "rootfs"
437 define Build
/pad-extra
438 dd if
=/dev
/zero bs
=$(1) count
=1 >> $@
441 define Build
/pad-offset
443 size
="$$(stat -c%s $@)" \
444 pad
="$(subst k,* 1024,$(word 1, $(1)))" \
445 offset
="$(subst k,* 1024,$(word 2, $(1)))" \
446 pad
="(pad - ((size + offset) % pad)) % pad" \
447 newsize
='size + pad'; \
448 dd if
=$@ of
=$@.new bs
=$$newsize count
=1 conv
=sync
452 define Build
/pad-rootfs
453 $(STAGING_DIR_HOST
)/bin
/padjffs2
$@
$(1) \
454 $(if
$(BLOCKSIZE
),$(BLOCKSIZE
:%k
=%),4 8 16 64 128 256)
458 $(call Image
/pad-to
,$@
,$(1))
461 define Build
/patch-cmdline
462 $(STAGING_DIR_HOST
)/bin
/patch-cmdline
$@
'$(CMDLINE)'
465 # Convert a raw image into a $1 type image.
466 # E.g. | qemu-image vdi <optional extra arguments to qemu-img binary>
467 define Build
/qemu-image
468 if command
-v qemu-img
; then \
469 qemu-img convert
-f raw
-O
$1 $@
$@.new
; \
472 echo
"WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit
1; \
476 define Build
/qsdk-ipq-factory-nand
477 $(TOPDIR
)/scripts
/mkits-qsdk-ipq-image.sh \
479 PATH
=$(LINUX_DIR
)/scripts
/dtc
:$(PATH
) mkimage
-f
$@.its
$@.new
483 define Build
/qsdk-ipq-factory-nor
484 $(TOPDIR
)/scripts
/mkits-qsdk-ipq-image.sh \
485 $@.its hlos
$(IMAGE_KERNEL
) rootfs
$(IMAGE_ROOTFS
)
486 PATH
=$(LINUX_DIR
)/scripts
/dtc
:$(PATH
) mkimage
-f
$@.its
$@.new
491 $(STAGING_DIR_HOST
)/bin
/seama
-i
$@ \
492 -m
"dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m
"type=firmware"
496 define Build
/seama-seal
497 $(STAGING_DIR_HOST
)/bin
/seama
-i
$@
-s
$@.seama \
498 -m
"signature=$(SEAMA_SIGNATURE)"
502 define Build
/senao-header
503 $(STAGING_DIR_HOST
)/bin
/mksenaofw
$(1) -e
$@
-o
$@.new
507 define Build
/sysupgrade-tar
508 sh
$(TOPDIR
)/scripts
/sysupgrade-tar.sh \
509 --board
$(if
$(BOARD_NAME
),$(BOARD_NAME
),$(DEVICE_NAME
)) \
510 --kernel
$(call param_get_default
,kernel
,$(1),$(IMAGE_KERNEL
)) \
511 --rootfs
$(call param_get_default
,rootfs
,$(1),$(IMAGE_ROOTFS
)) \
515 define Build
/tplink-safeloader
516 -$(STAGING_DIR_HOST
)/bin
/tplink-safeloader \
517 -B
$(TPLINK_BOARD_ID
) \
523 $(wordlist
2,$(words $(1)),$(1)) \
524 $(if
$(findstring sysupgrade
,$(word 1,$(1))),-S
) && mv
$@.new
$@ ||
rm -f
$@
527 define Build
/tplink-v1-header
528 $(STAGING_DIR_HOST
)/bin
/mktplinkfw \
529 -c
-H
$(TPLINK_HWID
) -W
$(TPLINK_HWREV
) -L
$(KERNEL_LOADADDR
) \
530 -E
$(if
$(KERNEL_ENTRY
),$(KERNEL_ENTRY
),$(KERNEL_LOADADDR
)) \
531 -m
$(TPLINK_HEADER_VERSION
) -N
"$(VERSION_DIST)" -V
$(REVISION
) \
536 # combine kernel and rootfs into one image
537 # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
538 # <type> is "sysupgrade" or "factory"
540 # -a align the rootfs start on an <align> bytes boundary
541 # -j add jffs2 end-of-filesystem markers
542 # -s strip padding from end of the image
543 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
544 define Build
/tplink-v1-image
545 -$(STAGING_DIR_HOST
)/bin
/mktplinkfw \
546 -H
$(TPLINK_HWID
) -W
$(TPLINK_HWREV
) -F
$(TPLINK_FLASHLAYOUT
) \
547 -N
"$(VERSION_DIST)" -V
$(REVISION
) -m
$(TPLINK_HEADER_VERSION
) \
548 -k
$(IMAGE_KERNEL
) -r
$(IMAGE_ROOTFS
) -o
$@.new
-j
-X
0x40000 \
549 -a
$(call rootfs_align
,$(FILESYSTEM
)) \
550 $(wordlist
2,$(words $(1)),$(1)) \
551 $(if
$(findstring sysupgrade
,$(word 1,$(1))),-s
) && mv
$@.new
$@ ||
rm -f
$@
554 define Build
/tplink-v2-header
555 $(STAGING_DIR_HOST
)/bin
/mktplinkfw2 \
556 -c
-H
$(TPLINK_HWID
) -W
$(TPLINK_HWREV
) -L
$(KERNEL_LOADADDR
) \
557 -E
$(if
$(KERNEL_ENTRY
),$(KERNEL_ENTRY
),$(KERNEL_LOADADDR
)) \
558 -w
$(TPLINK_HWREVADD
) -F
"$(TPLINK_FLASHLAYOUT)" \
559 -T
$(TPLINK_HVERSION
) -V
"ver. 2.0" \
564 define Build
/tplink-v2-image
565 $(STAGING_DIR_HOST
)/bin
/mktplinkfw2 \
566 -H
$(TPLINK_HWID
) -W
$(TPLINK_HWREV
) \
567 -w
$(TPLINK_HWREVADD
) -F
"$(TPLINK_FLASHLAYOUT)" \
568 -T
$(TPLINK_HVERSION
) -V
"ver. 2.0" -a
0x4 -j \
569 -k
$(IMAGE_KERNEL
) -r
$(IMAGE_ROOTFS
) -o
$@.new
$(1)
580 -a
$(KERNEL_LOADADDR
) \
581 -e
$(if
$(KERNEL_ENTRY
),$(KERNEL_ENTRY
),$(KERNEL_LOADADDR
)) \
582 -n
'$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \
583 $(if
$(UIMAGE_MAGIC
),-M
$(UIMAGE_MAGIC
)) \
584 $(wordlist
2,$(words $(1)),$(1)) \
589 define Build
/xor-image
590 $(STAGING_DIR_HOST
)/bin
/xorimage
-i
$@
-o
$@.xor
$(1)
597 mv
$@
$@.tmp
/$(word 1,$(1))
598 TZ
=UTC
$(STAGING_DIR_HOST
)/bin
/zip
-j
-X \
599 $(wordlist
2,$(words $(1)),$(1)) \
600 $@
$@.tmp
/$(if
$(word 1,$(1)),$(word 1,$(1)),$$(basename $@
))
604 define Build
/zyxel-ras-image
606 newsize
="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
607 $(STAGING_DIR_HOST
)/bin
/mkrasimage \
613 $(if
$(findstring separate-kernel
,$(word 1,$(1))),-k
$(IMAGE_KERNEL
)) \