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