Hannes Schmelzer | ddc0220 | 2018-07-06 15:41:29 +0200 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2018 Hannes Schmelzer <oe5hpm@oevsv.at> - |
| 3 | # B&R Industrial Automation GmbH - http://www.br-automation.com |
| 4 | # |
| 5 | # SPDX-License-Identifier: GPL-2.0+ |
| 6 | # |
| 7 | |
| 8 | hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE) | sed -e 's/am335x-//') |
| 9 | |
| 10 | payload_off :=$(shell printf "%d" $(CONFIG_SYS_SPI_U_BOOT_OFFS)) |
| 11 | |
| 12 | quiet_cmd_prodbin = PRODBIN $@ $(payload_off) |
| 13 | cmd_prodbin = \ |
| 14 | dd if=/dev/zero ibs=1M count=2 2>/dev/null | tr "\000" "\377" >$@ && \ |
| 15 | dd conv=notrunc bs=1 if=MLO.byteswap of=$@ seek=0 2>/dev/null && \ |
| 16 | dd bs=1 if=u-boot-dtb.img of=$@ seek=$(payload_off) 2>/dev/null |
| 17 | |
| 18 | quiet_cmd_prodzip = SAPZIP $@ |
| 19 | cmd_prodzip = \ |
| 20 | test -d misc && rm -r misc; \ |
| 21 | mkdir misc && \ |
| 22 | cp MLO.byteswap misc/ && \ |
| 23 | cp spl/u-boot-spl.bin misc/ && \ |
| 24 | cp u-boot-dtb.img misc/ && \ |
| 25 | zip -9 -r $@ misc/* >/dev/null $< |
| 26 | |
| 27 | ifeq ($(hw-platform-y),brppt1-spi) |
| 28 | ALL-y += $(hw-platform-y)_prog.bin |
| 29 | ALL-y += $(hw-platform-y)_prod.zip |
| 30 | endif |
| 31 | |
| 32 | $(hw-platform-y)_prog.bin: u-boot-dtb.img spl/u-boot-spl.bin |
| 33 | $(call if_changed,prodbin) |
| 34 | |
| 35 | $(hw-platform-y)_prod.zip: $(hw-platform-y)_prog.bin |
| 36 | $(call if_changed,prodzip) |