image-commands.mk 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. # Build commands that can be called from Device/* templates
  2. IMAGE_KERNEL = $(word 1,$^)
  3. IMAGE_ROOTFS = $(word 2,$^)
  4. define rootfs_align
  5. $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
  6. endef
  7. define Build/append-dtb
  8. cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
  9. endef
  10. define Build/append-dtb-elf
  11. $(TARGET_CROSS)objcopy \
  12. --set-section-flags=.appended_dtb=alloc,contents \
  13. --update-section \
  14. .appended_dtb=$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@
  15. endef
  16. define Build/append-kernel
  17. dd if=$(IMAGE_KERNEL) >> $@
  18. endef
  19. compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0)
  20. json_quote=$(subst ','\'',$(subst ",\",$(1)))
  21. #")')
  22. legacy_supported_message=$(SUPPORTED_DEVICES) - Image version mismatch: image $(compat_version), \
  23. device 1.0. Please wipe config during upgrade (force required) or reinstall. \
  24. $(if $(DEVICE_COMPAT_MESSAGE),Reason: $(DEVICE_COMPAT_MESSAGE),Please check documentation ...)
  25. metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))"))))
  26. metadata_json = \
  27. '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
  28. "metadata_version": "1.1", \
  29. "compat_version": "$(call json_quote,$(compat_version))", \
  30. $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
  31. $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
  32. [$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \
  33. "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
  34. $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \
  35. "version": { \
  36. "dist": "$(call json_quote,$(VERSION_DIST))", \
  37. "version": "$(call json_quote,$(VERSION_NUMBER))", \
  38. "revision": "$(call json_quote,$(REVISION))", \
  39. "target": "$(call json_quote,$(TARGETID))", \
  40. "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
  41. } \
  42. }'
  43. define Build/append-metadata
  44. $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json) | fwtool -I - $@)
  45. [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
  46. cp "$(BUILD_KEY).ucert" "[email protected]" ;\
  47. usign -S -m "$@" -s "$(BUILD_KEY)" -x "[email protected]" ;\
  48. ucert -A -c "[email protected]" -x "[email protected]" ;\
  49. fwtool -S "[email protected]" "$@" ;\
  50. }
  51. endef
  52. define Build/append-rootfs
  53. dd if=$(IMAGE_ROOTFS) >> $@
  54. endef
  55. define Build/append-squashfs-fakeroot-be
  56. rm -rf [email protected] [email protected]
  57. mkdir [email protected]
  58. $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
  59. [email protected] [email protected] \
  60. -noappend -root-owned -be -nopad -b 65536 \
  61. $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
  62. cat [email protected] >> $@
  63. endef
  64. define Build/append-string
  65. echo -n $(1) >> $@
  66. endef
  67. define Build/append-ubi
  68. sh $(TOPDIR)/scripts/ubinize-image.sh \
  69. $(if $(UBOOTENV_IN_UBI),--uboot-env) \
  70. $(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
  71. $(foreach part,$(UBINIZE_PARTS),--part $(part)) \
  72. $(IMAGE_ROOTFS) \
  73. [email protected] \
  74. -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
  75. $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
  76. $(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
  77. $(UBINIZE_OPTS)
  78. cat [email protected] >> $@
  79. rm [email protected]
  80. endef
  81. define Build/append-uboot
  82. dd if=$(UBOOT_PATH) >> $@
  83. endef
  84. # append a fake/empty uImage header, to fool bootloaders rootfs integrity check
  85. # for example
  86. define Build/append-uImage-fakehdr
  87. $(eval type=$(word 1,$(1)))
  88. $(eval magic=$(word 2,$(1)))
  89. touch [email protected]
  90. $(STAGING_DIR_HOST)/bin/mkimage \
  91. -A $(LINUX_KARCH) -O linux -T $(type) -C none \
  92. -n '$(VERSION_DIST) fake $(type)' \
  93. $(if $(magic),-M $(magic)) \
  94. -d [email protected] \
  95. -s \
  96. [email protected]
  97. cat [email protected] >> $@
  98. endef
  99. define Build/buffalo-dhp-image
  100. $(STAGING_DIR_HOST)/bin/mkdhpimg $@ [email protected]
  101. mv [email protected] $@
  102. endef
  103. define Build/buffalo-enc
  104. $(eval product=$(word 1,$(1)))
  105. $(eval version=$(word 2,$(1)))
  106. $(eval args=$(wordlist 3,$(words $(1)),$(1)))
  107. $(STAGING_DIR_HOST)/bin/buffalo-enc \
  108. -p $(product) -v $(version) $(args) \
  109. -i $@ -o [email protected]
  110. mv [email protected] $@
  111. endef
  112. define Build/buffalo-enc-tag
  113. $(call Build/buffalo-enc,'' '' -S 152 $(1))
  114. endef
  115. define Build/buffalo-tag-dhp
  116. $(eval product=$(word 1,$(1)))
  117. $(eval region=$(word 2,$(1)))
  118. $(eval language=$(word 3,$(1)))
  119. $(STAGING_DIR_HOST)/bin/buffalo-tag \
  120. -d 0x01000000 -w 1 \
  121. -a $(BUFFALO_TAG_PLATFORM) \
  122. -v $(BUFFALO_TAG_VERSION) -m $(BUFFALO_TAG_MINOR) \
  123. -b $(product) -p $(product) \
  124. -r $(region) -r $(region) -l $(language) \
  125. -I $@ -o [email protected]
  126. mv [email protected] $@
  127. endef
  128. define Build/check-size
  129. @imagesize="$$(stat -c%s $@)"; \
  130. limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \
  131. [ $$limitsize -ge $$imagesize ] || { \
  132. echo "WARNING: Image file $@ is too big: $$imagesize > $$limitsize" >&2; \
  133. rm -f $@; \
  134. }
  135. endef
  136. define Build/elecom-product-header
  137. $(eval product=$(word 1,$(1)))
  138. $(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))
  139. ( \
  140. echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
  141. echo -n "0.00" | dd bs=16 count=1 conv=sync; \
  142. dd if=$(fw); \
  143. ) > $(fw).new
  144. mv $(fw).new $(fw)
  145. endef
  146. define Build/elx-header
  147. $(eval hw_id=$(word 1,$(1)))
  148. $(eval xor_pattern=$(word 2,$(1)))
  149. ( \
  150. echo -ne "\x00\x00\x00\x00\x00\x00\x00\x03" | \
  151. dd bs=42 count=1 conv=sync; \
  152. hw_id="$(hw_id)"; \
  153. echo -ne "\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \
  154. dd bs=20 count=1 conv=sync; \
  155. echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
  156. dd bs=8 count=1 conv=sync; \
  157. echo -ne "$$($(STAGING_DIR_HOST)/bin/mkhash md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
  158. dd bs=58 count=1 conv=sync; \
  159. ) > $(KDIR)/tmp/$(DEVICE_NAME).header
  160. $(call Build/xor-image,-p $(xor_pattern) -x)
  161. cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > [email protected]
  162. mv [email protected] $@
  163. rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header
  164. endef
  165. define Build/eva-image
  166. $(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ [email protected]
  167. mv [email protected] $@
  168. endef
  169. define Build/fit
  170. $(TOPDIR)/scripts/mkits.sh \
  171. -D $(DEVICE_NAME) -o [email protected] -k $@ \
  172. $(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \
  173. -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
  174. $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
  175. -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \
  176. -A $(LINUX_KARCH) -v $(LINUX_VERSION)
  177. PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f [email protected] [email protected]
  178. @mv [email protected] $@
  179. endef
  180. define Build/gzip
  181. gzip -f -9n -c $@ $(1) > [email protected]
  182. @mv [email protected] $@
  183. endef
  184. define Build/install-dtb
  185. $(call locked, \
  186. $(foreach dts,$(DEVICE_DTS), \
  187. $(CP) \
  188. $(DTS_DIR)/$(dts).dtb \
  189. $(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \
  190. ), \
  191. install-dtb-$(IMG_PREFIX) \
  192. )
  193. endef
  194. define Build/jffs2
  195. rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
  196. mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
  197. cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(1) && \
  198. $(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad \
  199. $(if $(CONFIG_BIG_ENDIAN),--big-endian,--little-endian) \
  200. --squash-uids -v -e $(patsubst %k,%KiB,$(BLOCKSIZE)) \
  201. -o [email protected] \
  202. -d $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 \
  203. 2>&1 1>/dev/null | awk '/^.+$$$$/' && \
  204. $(STAGING_DIR_HOST)/bin/padjffs2 [email protected] -J $(patsubst %k,,$(BLOCKSIZE))
  205. -rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/
  206. @mv [email protected] $@
  207. endef
  208. define Build/kernel2minor
  209. kernel2minor -k $@ -r [email protected] $(1)
  210. mv [email protected] $@
  211. endef
  212. define Build/kernel-bin
  213. rm -f $@
  214. cp $< $@
  215. endef
  216. define Build/linksys-image
  217. $(TOPDIR)/scripts/linksys-image.sh \
  218. "$(call param_get_default,type,$(1),$(DEVICE_NAME))" \
  219. $@ [email protected]
  220. mv [email protected] $@
  221. endef
  222. define Build/lzma
  223. $(call Build/lzma-no-dict,-lc1 -lp2 -pb2 $(1))
  224. endef
  225. define Build/lzma-no-dict
  226. $(STAGING_DIR_HOST)/bin/lzma e $@ $(1) [email protected]
  227. @mv [email protected] $@
  228. endef
  229. define Build/netgear-chk
  230. $(STAGING_DIR_HOST)/bin/mkchkimg \
  231. -o [email protected] \
  232. -k $@ \
  233. -b $(NETGEAR_BOARD_ID) \
  234. $(if $(NETGEAR_REGION),-r $(NETGEAR_REGION),)
  235. mv [email protected] $@
  236. endef
  237. define Build/netgear-dni
  238. $(STAGING_DIR_HOST)/bin/mkdniimg \
  239. -B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \
  240. $(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \
  241. -r "$(1)" \
  242. -i $@ -o [email protected]
  243. mv [email protected] $@
  244. endef
  245. define Build/openmesh-image
  246. $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
  247. "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
  248. "[email protected]" \
  249. "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" \
  250. "$(call param_get_default,rootfs,$(1),$@)"
  251. $(TOPDIR)/scripts/combined-ext-image.sh \
  252. "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" "$@" \
  253. "[email protected]" "fwupgrade.cfg" \
  254. "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" "kernel" \
  255. "$(call param_get_default,rootfs,$(1),$@)" "rootfs"
  256. endef
  257. define Build/pad-extra
  258. dd if=/dev/zero bs=$(1) count=1 >> $@
  259. endef
  260. define Build/pad-offset
  261. let \
  262. size="$$(stat -c%s $@)" \
  263. pad="$(subst k,* 1024,$(word 1, $(1)))" \
  264. offset="$(subst k,* 1024,$(word 2, $(1)))" \
  265. pad="(pad - ((size + offset) % pad)) % pad" \
  266. newsize='size + pad'; \
  267. dd if=$@ [email protected] bs=$$newsize count=1 conv=sync
  268. mv [email protected] $@
  269. endef
  270. define Build/pad-rootfs
  271. $(STAGING_DIR_HOST)/bin/padjffs2 $@ $(1) \
  272. $(if $(BLOCKSIZE),$(BLOCKSIZE:%k=%),4 8 16 64 128 256)
  273. endef
  274. define Build/pad-to
  275. $(call Image/pad-to,$@,$(1))
  276. endef
  277. define Build/patch-cmdline
  278. $(STAGING_DIR_HOST)/bin/patch-cmdline $@ '$(CMDLINE)'
  279. endef
  280. # Convert a raw image into a $1 type image.
  281. # E.g. | qemu-image vdi
  282. define Build/qemu-image
  283. if command -v qemu-img; then \
  284. qemu-img convert -f raw -O $1 $@ [email protected]; \
  285. mv [email protected] $@; \
  286. else \
  287. echo "WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit 1; \
  288. fi
  289. endef
  290. define Build/qsdk-ipq-factory-nand
  291. $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
  292. [email protected] ubi $@
  293. PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f [email protected] [email protected]
  294. @mv [email protected] $@
  295. endef
  296. define Build/qsdk-ipq-factory-nor
  297. $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
  298. [email protected] hlos $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
  299. PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f [email protected] [email protected]
  300. @mv [email protected] $@
  301. endef
  302. define Build/seama
  303. $(STAGING_DIR_HOST)/bin/seama -i $@ \
  304. -m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware"
  305. mv [email protected] $@
  306. endef
  307. define Build/seama-seal
  308. $(STAGING_DIR_HOST)/bin/seama -i $@ -s [email protected] \
  309. -m "signature=$(SEAMA_SIGNATURE)"
  310. mv [email protected] $@
  311. endef
  312. define Build/senao-header
  313. $(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o [email protected]
  314. mv [email protected] $@
  315. endef
  316. define Build/sysupgrade-tar
  317. sh $(TOPDIR)/scripts/sysupgrade-tar.sh \
  318. --board $(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)) \
  319. --kernel $(call param_get_default,kernel,$(1),$(IMAGE_KERNEL)) \
  320. --rootfs $(call param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \
  321. $@
  322. endef
  323. define Build/tplink-safeloader
  324. -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
  325. -B $(TPLINK_BOARD_ID) \
  326. -V $(REVISION) \
  327. -k $(IMAGE_KERNEL) \
  328. -r $@ \
  329. -o [email protected] \
  330. -j \
  331. $(wordlist 2,$(words $(1)),$(1)) \
  332. $(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv [email protected] $@ || rm -f $@
  333. endef
  334. define Build/tplink-v1-header
  335. $(STAGING_DIR_HOST)/bin/mktplinkfw \
  336. -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
  337. -E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
  338. -m $(TPLINK_HEADER_VERSION) -N "$(VERSION_DIST)" -V $(REVISION) \
  339. -k $@ -o [email protected] $(1)
  340. @mv [email protected] $@
  341. endef
  342. # combine kernel and rootfs into one image
  343. # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
  344. # <type> is "sysupgrade" or "factory"
  345. #
  346. # -a align the rootfs start on an <align> bytes boundary
  347. # -j add jffs2 end-of-filesystem markers
  348. # -s strip padding from end of the image
  349. # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
  350. define Build/tplink-v1-image
  351. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  352. -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) \
  353. -N "$(VERSION_DIST)" -V $(REVISION) -m $(TPLINK_HEADER_VERSION) \
  354. -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o [email protected] -j -X 0x40000 \
  355. -a $(call rootfs_align,$(FILESYSTEM)) \
  356. $(wordlist 2,$(words $(1)),$(1)) \
  357. $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv [email protected] $@ || rm -f $@
  358. endef
  359. define Build/tplink-v2-header
  360. $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
  361. -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
  362. -E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
  363. -w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
  364. -T $(TPLINK_HVERSION) -V "ver. 2.0" \
  365. -k $@ -o [email protected] $(1)
  366. @mv [email protected] $@
  367. endef
  368. define Build/tplink-v2-image
  369. $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
  370. -H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
  371. -w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
  372. -T $(TPLINK_HVERSION) -V "ver. 2.0" -a 0x4 -j \
  373. -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o [email protected] $(1)
  374. cat [email protected] >> $@
  375. rm -rf [email protected]
  376. endef
  377. define Build/uImage
  378. mkimage \
  379. -A $(LINUX_KARCH) \
  380. -O linux \
  381. -T kernel \
  382. -C $(word 1,$(1)) \
  383. -a $(KERNEL_LOADADDR) \
  384. -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
  385. -n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \
  386. $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \
  387. $(wordlist 2,$(words $(1)),$(1)) \
  388. -d $@ [email protected]
  389. mv [email protected] $@
  390. endef
  391. define Build/xor-image
  392. $(STAGING_DIR_HOST)/bin/xorimage -i $@ -o [email protected] $(1)
  393. mv [email protected] $@
  394. endef
  395. define Build/zip
  396. mkdir [email protected]
  397. mv $@ [email protected]/$(1)
  398. zip -j -X \
  399. $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \
  400. $@ [email protected]/$(if $(1),$(1),$@)
  401. rm -rf [email protected]
  402. endef
  403. define Build/zyxel-ras-image
  404. let \
  405. newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
  406. $(STAGING_DIR_HOST)/bin/mkrasimage \
  407. -b $(RAS_BOARD) \
  408. -v $(RAS_VERSION) \
  409. -r $@ \
  410. -s $$newsize \
  411. -o [email protected] \
  412. $(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \
  413. && mv [email protected] $@
  414. endef