blob: 4e0925c72c9509eb5a3627188169677b3711675b [file] [log] [blame]
Jan Kiszkaa2db09e2021-09-18 08:17:53 +02001.. SPDX-License-Identifier: GPL-2.0+
2.. sectionauthor:: Jan Kiszka <jan.kiszka@siemens.com>
3
4SIMATIC IOT2050 BASIC and ADVANCED
5==================================
6
7The SIMATIC IOT2050 is an open industrial IoT gateway that is using the TI
8AM6528 GP (Basic variant) or the AM6548 HS (Advanced variant). The Advanced
9variant is prepared for secure boot.
10
11The IOT2050 starts only from OSPI. It loads a Siemens-provided bootloader
12called SE-Boot for the MCU domain (R5F cores), then hands over to ATF and
13OP-TEE, before booting U-Boot on the A53 cores. This describes how to build all
14open artifacts into a flashable image for the OSPI flash. The flash image will
15work on both variants.
16
17Dependencies
18------------
19
20ATF: Upstream release 2.4 or newer
21OP-TEE: Upstream release 3.10.0 or newer
22
23Binary dependencies can be found in
24https://github.com/siemens/meta-iot2050/tree/master/recipes-bsp/u-boot/files/prebuild.
25The following binaries from that source need to be present in the build folder:
26
Su Baochengea0f45d2023-02-28 19:19:09 +010027 - seboot_pg1.bin
Su Baochengea0f45d2023-02-28 19:19:09 +010028 - seboot_pg2.bin
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020029
30Building
31--------
32
33Make sure that CROSS_COMPILE is set appropriately:
34
35.. code-block:: text
36
37 $ export CROSS_COMPILE=aarch64-linux-gnu-
38
39ATF:
40
41.. code-block:: text
42
43 $ make PLAT=k3 SPD=opteed K3_USART=1
44
45OP-TEE:
46
47.. code-block:: text
48
Ivan Mikhaylov2f7c7ae2021-11-28 21:57:01 +000049 $ make PLATFORM=k3-am65x CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=2 CFG_CONSOLE_UART=1 CFG_USER_TA_TARGETS="ta_arm64"
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020050
51U-Boot:
52
53.. code-block:: text
54
55 $ export ATF=/path/to/bl31.bin
56 $ export TEE=/path/to/tee-pager_v2.bin
Su Baochengea0f45d2023-02-28 19:19:09 +010057
58 # configure for PG1
59 $ make iot2050_pg1_defconfig
60
61 # or configure for PG2
62 $ make iot2050_pg2_defconfig
63
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020064 $ make
65
66Flashing
67--------
68
69Via U-Boot:
70
71.. code-block:: text
72
73 IOT2050> sf probe
74 IOT2050> load mmc 0:1 $loadaddr /path/to/flash.bin
75 IOT2050> sf update $loadaddr 0x0 $filesize
76
77Via external programmer Dediprog SF100 or SF600:
78
79.. code-block:: text
80
81 $ dpcmd --vcc 2 -v -u flash.bin
Jan Kiszka033ab462023-02-28 19:19:17 +010082
83Signing (optional)
84------------------
85
86To enable verified boot for the firmware artifacts after the Siemens-managed
87first-stage loader (seboot_pg*.bin), the following steps need to be taken
88before and after the build:
89
90Generate dtsi holding the public key
91^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92
93.. code-block:: text
94
95 tools/key2dtsi.py -c -s key.pem public-key.dtsi
96
97This will be used to embed the public key into U-Boot SPL and main so that each
98step can validate signatures of the succeeding one.
99
100Adjust U-Boot configuration
101^^^^^^^^^^^^^^^^^^^^^^^^^^^
102
103Enabled at least the following options in U-Boot:
104
105.. code-block:: text
106
107 CONFIG_SPL_FIT_SIGNATURE=y
108 CONFIG_DEVICE_TREE_INCLUDES="/path/to/public-key.dtsi"
109 CONFIG_RSA=y
110
111Note that there are more configuration changes needed in order to lock-down
112the command line and the boot process of U-Boot for secure scenarios. These are
113not in scope here.
114
115Build U-Boot
116^^^^^^^^^^^^
117
118See related section above.
119
120Sign flash.bin
121^^^^^^^^^^^^^^
122
123In the build folder still containing artifacts from step 3, invoke:
124
125.. code-block:: text
126
127 tools/iot2050-sign-fw.sh /path/to/key.pem
128
129Flash signed flash.bin
130^^^^^^^^^^^^^^^^^^^^^^
131
132The signing has happen in-place in flash.bin, thus the flashing procedure
133described above.