mediatek: add Adtran SmartRG SDG-8733A
[openwrt/openwrt.git] / target / linux / mediatek / image / gen_scatterfile.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0-only
3 #
4 # Copyright © 2020 David Woodhouse <dwmw2@infradead.org>
5 #
6 # Generate as "scatter file" for use with the MediaTek SP Flash tool for
7 # writing images to MediaTek boards. This can be used to write images
8 # even on a bricked board which has no preloader installed, or broken
9 # U-Boot.
10 #
11 # NOTE: At the time of writing (2020-07-20), the Linux tool linked from
12 # the front page of https://spflashtool.com/ is out of date and does not
13 # support MT7623. The newer v5.1916 found on the download page at
14 # https://spflashtool.com/download/ has been tested on UniElec U7623 and
15 # Banana Pi R2 from Linux, and does work.
16 #
17
18 SOC=$1
19 IMAGE=${2%.gz}
20 PROJECT=${3%-scatter.txt}
21 DEVICENAME="$4"
22
23 cat <<EOF
24 # OpenWrt eMMC scatter file for ${DEVICENAME}
25 # For use with SP Flash Tool: https://spflashtool.com/download/
26 #
27 # Unzip the file system file ${PROJECT}-${IMAGE}.gz before flashing.
28 # Connect the device's USB port, although it won't appear to the host yet.
29 # Load this scatter file into the SP Flash Tool, select 'Format All + Download'
30 # After pressing the 'Download' button, power on the board.
31 # The /dev/ttyACM0 device should appear on USB and the tool should find it.
32
33 - general: MTK_PLATFORM_CFG
34 info:
35 - config_version: V1.1.2
36 platform: ${SOC}
37 project: ${PROJECT}
38 storage: EMMC
39 boot_channel: MSDC_0
40 block_size: 0x20000
41
42 - partition_index: SYS0
43 partition_name: PRELOADER
44 file_name: ${PROJECT}-preloader.bin
45 is_download: true
46 type: SV5_BL_BIN
47 linear_start_addr: 0x0
48 physical_start_addr: 0x0
49 partition_size: 0x40000
50 region: EMMC_BOOT_1
51 storage: HW_STORAGE_EMMC
52 boundary_check: true
53 is_reserved: false
54 operation_type: BOOTLOADERS
55 d_type: FALSE
56 reserve: 0x00
57
58 - partition_index: SYS1
59 partition_name: OPENWRT
60 file_name: ${PROJECT}-${IMAGE}
61 is_download: true
62 type: NORMAL_ROM
63 linear_start_addr: 0x00000
64 physical_start_addr: 0x00000
65 partition_size: 0x4000000
66 region: EMMC_USER
67 storage: HW_STORAGE_EMMC
68 boundary_check: true
69 is_reserved: false
70 operation_type: UPDATE
71 d_type: FALSE
72 reserve: 0x00
73 EOF