blob: cb49a0e36bf80cdae2a7ef776ffc6b4d22eaf842 [file] [log] [blame]
Jan Kiszka8ff2ff82021-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 Baocheng0dcd3372023-02-28 19:19:09 +010027 - seboot_pg1.bin
Su Baocheng0dcd3372023-02-28 19:19:09 +010028 - seboot_pg2.bin
Jan Kiszka8ff2ff82021-09-18 08:17:53 +020029
Jan Kiszkaaebb5b92023-02-28 19:19:18 +010030For building an image containing the OTP key provisioning data, below binary
31needs to be present in the build folder:
32
33 - otpcmd.bin
34
35Regarding how to generating this otpcmd.bin, please refer to:
36https://github.com/siemens/meta-iot2050/tree/master/recipes-bsp/secure-boot-otp-provisioning/files/make-otpcmd.sh
37
Jan Kiszka8ff2ff82021-09-18 08:17:53 +020038Building
39--------
40
41Make sure that CROSS_COMPILE is set appropriately:
42
43.. code-block:: text
44
45 $ export CROSS_COMPILE=aarch64-linux-gnu-
46
47ATF:
48
49.. code-block:: text
50
51 $ make PLAT=k3 SPD=opteed K3_USART=1
52
53OP-TEE:
54
55.. code-block:: text
56
Ivan Mikhaylov07bc02a2021-11-28 21:57:01 +000057 $ 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 Kiszka8ff2ff82021-09-18 08:17:53 +020058
59U-Boot:
60
61.. code-block:: text
62
63 $ export ATF=/path/to/bl31.bin
64 $ export TEE=/path/to/tee-pager_v2.bin
Su Baocheng0dcd3372023-02-28 19:19:09 +010065
66 # configure for PG1
67 $ make iot2050_pg1_defconfig
68
69 # or configure for PG2
70 $ make iot2050_pg2_defconfig
71
Jan Kiszka8ff2ff82021-09-18 08:17:53 +020072 $ make
73
74Flashing
75--------
76
77Via U-Boot:
78
79.. code-block:: text
80
81 IOT2050> sf probe
82 IOT2050> load mmc 0:1 $loadaddr /path/to/flash.bin
83 IOT2050> sf update $loadaddr 0x0 $filesize
84
85Via external programmer Dediprog SF100 or SF600:
86
87.. code-block:: text
88
89 $ dpcmd --vcc 2 -v -u flash.bin
Jan Kiszka15bb43b2023-02-28 19:19:17 +010090
91Signing (optional)
92------------------
93
94To enable verified boot for the firmware artifacts after the Siemens-managed
95first-stage loader (seboot_pg*.bin), the following steps need to be taken
96before and after the build:
97
98Generate dtsi holding the public key
99^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100
101.. code-block:: text
102
103 tools/key2dtsi.py -c -s key.pem public-key.dtsi
104
105This will be used to embed the public key into U-Boot SPL and main so that each
106step can validate signatures of the succeeding one.
107
108Adjust U-Boot configuration
109^^^^^^^^^^^^^^^^^^^^^^^^^^^
110
111Enabled at least the following options in U-Boot:
112
113.. code-block:: text
114
115 CONFIG_SPL_FIT_SIGNATURE=y
116 CONFIG_DEVICE_TREE_INCLUDES="/path/to/public-key.dtsi"
117 CONFIG_RSA=y
118
119Note that there are more configuration changes needed in order to lock-down
120the command line and the boot process of U-Boot for secure scenarios. These are
121not in scope here.
122
123Build U-Boot
124^^^^^^^^^^^^
125
126See related section above.
127
128Sign flash.bin
129^^^^^^^^^^^^^^
130
131In the build folder still containing artifacts from step 3, invoke:
132
133.. code-block:: text
134
135 tools/iot2050-sign-fw.sh /path/to/key.pem
136
137Flash signed flash.bin
138^^^^^^^^^^^^^^^^^^^^^^
139
140The signing has happen in-place in flash.bin, thus the flashing procedure
141described above.