aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Gerlach2020-10-13 03:41:24 -0500
committerDave Gerlach2020-10-16 13:05:46 -0500
commitf5ec1e42000032affce5f8c2a2afe64fc4586f04 (patch)
tree90d5496be1cd0e841fabb96ea6c2f76dd15e4c8c
parent06c24e0a883432f68ba00f73e203be9e29130e94 (diff)
downloadk3-image-gen-f5ec1e42000032affce5f8c2a2afe64fc4586f04.tar.gz
k3-image-gen-f5ec1e42000032affce5f8c2a2afe64fc4586f04.tar.xz
k3-image-gen-f5ec1e42000032affce5f8c2a2afe64fc4586f04.zip
scripts: gen_x509_combined_cert: modify to support multiple boardcfg images
With the new bootflows being introduced, it is possible for boards to have multiple boardcfg images provided. Modify the gen_x509_combined_cert script to accept two different boardcfg binaries and load them to the defined addresses. This mandates that all platforms using combined bootflow will use the split boardcfg images. Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
-rw-r--r--Makefile14
-rwxr-xr-xscripts/gen_x509_combined_cert.sh36
-rw-r--r--soc/j7200/Makefile3
3 files changed, 43 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index d827e6a8f..7f8bdee09 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,8 @@ SOC_BIN_NAMES += $(SOURCES:%.c=%.bin)
111 111
112ITB ?= $(binroot)/sysfw-$(SOC)-$(CONFIG).itb 112ITB ?= $(binroot)/sysfw-$(SOC)-$(CONFIG).itb
113ITS ?= $(soc_objroot)/$(basename $(notdir $(ITB))).its 113ITS ?= $(soc_objroot)/$(basename $(notdir $(ITB))).its
114COMBINED_BRDCFG ?= $(soc_objroot)/combined-cfg.bin 114COMBINED_SYSFW_BRDCFG ?= $(soc_objroot)/combined-sysfw-cfg.bin
115COMBINED_DM_BRDCFG ?= $(soc_objroot)/combined-dm-cfg.bin
115 116
116vpath %.itb $(soc_objroot) 117vpath %.itb $(soc_objroot)
117vpath %.bin $(soc_objroot) 118vpath %.bin $(soc_objroot)
@@ -172,11 +173,14 @@ sysfw.itb: $(ITB)
172 173
173soc_objs: $(SOC_OBJS) 174soc_objs: $(SOC_OBJS)
174 175
175$(COMBINED_BRDCFG): $(SOC_BINS) 176$(COMBINED_SYSFW_BRDCFG): $(SOC_BINS)
176 python3 ./scripts/sysfw_boardcfg_blob_creator.py -b $(soc_objroot)/board-cfg.bin -s $(soc_objroot)/sec-cfg.bin -p $(soc_objroot)/pm-cfg.bin -r $(soc_objroot)/rm-cfg.bin -o $@ 177 python3 ./scripts/sysfw_boardcfg_blob_creator.py -b $(soc_objroot)/board-cfg.bin -s $(soc_objroot)/sec-cfg.bin -o $@
177 178
178tiboot3.bin: $(SBL) $(SYSFW_PATH) $(COMBINED_BRDCFG) 179$(COMBINED_DM_BRDCFG): $(SOC_BINS)
179 ./scripts/gen_x509_combined_cert.sh -b $(SBL) -l $(SBL_LOADADDDR) -s $(SYSFW_PATH) -m 0x40000 -d $(COMBINED_BRDCFG) -n $(COMBINED_BRDCFG_LOADADDR) -k $(KEY) -o $@ 180 python3 ./scripts/sysfw_boardcfg_blob_creator.py -p $(soc_objroot)/pm-cfg.bin -r $(soc_objroot)/rm-cfg.bin -o $@
181
182tiboot3.bin: $(SBL) $(SYSFW_PATH) $(COMBINED_SYSFW_BRDCFG) $(COMBINED_DM_BRDCFG)
183 ./scripts/gen_x509_combined_cert.sh -b $(SBL) -l $(SBL_LOADADDDR) -s $(SYSFW_PATH) -m 0x40000 -d $(COMBINED_SYSFW_BRDCFG) -n $(COMBINED_SYSFW_BRDCFG_LOADADDR) -t $(COMBINED_DM_BRDCFG) -y $(COMBINED_DM_BRDCFG_LOADADDR) -k $(KEY) -o $@
180 184
181$(soc_objroot)/%.o: %.c 185$(soc_objroot)/%.o: %.c
182 $(CROSS_COMPILE)gcc $(CFLAGS) -c -o $@-pre-validated $< 186 $(CROSS_COMPILE)gcc $(CFLAGS) -c -o $@-pre-validated $<
diff --git a/scripts/gen_x509_combined_cert.sh b/scripts/gen_x509_combined_cert.sh
index 3fed87b0b..c6c596fdb 100755
--- a/scripts/gen_x509_combined_cert.sh
+++ b/scripts/gen_x509_combined_cert.sh
@@ -99,9 +99,11 @@ options_help[s]="SYSFW: Bin file corresponding to sysfw image"
99options_help[m]="SYSFW loadaddress: SYSFW image load address" 99options_help[m]="SYSFW loadaddress: SYSFW image load address"
100options_help[d]="SYSFW_DATA: Bin file corresponding to combined board configurations" 100options_help[d]="SYSFW_DATA: Bin file corresponding to combined board configurations"
101options_help[n]="SYSFW_DATA loadaddr: Combine board configuration load address" 101options_help[n]="SYSFW_DATA loadaddr: Combine board configuration load address"
102options_help[t]="DM_DATA: Bin file corresponding to combined board configurations for RM and PM. If this is used, RM and PM do not need to be provided as part of SYSFW_DATA."
103options_help[y]="DM_DATA loadaddr: Combine RM and PM blob board configuration load address"
102options_help[k]="key_file:file with key inside it. If not provided script generates a random key." 104options_help[k]="key_file:file with key inside it. If not provided script generates a random key."
103 105
104while getopts "b:l:s:m:d:n:k:o:h" opt 106while getopts "b:l:s:m:d:n:k:o:h:t:y:" opt
105do 107do
106 case $opt in 108 case $opt in
107 b) 109 b)
@@ -122,6 +124,12 @@ do
122 n) 124 n)
123 SYSFW_DATA_LOADADDR=$OPTARG 125 SYSFW_DATA_LOADADDR=$OPTARG
124 ;; 126 ;;
127 t)
128 DM_DATA=$OPTARG
129 ;;
130 y)
131 DM_DATA_LOADADDR=$OPTARG
132 ;;
125 k) 133 k)
126 KEY=$OPTARG 134 KEY=$OPTARG
127 ;; 135 ;;
@@ -182,7 +190,12 @@ SYSFW_ADDR=`printf "%08x" $SYSFW_LOADADDR`
182SYSFW_DATA_SHA_VAL=`openssl dgst -$SHA -hex $SYSFW_DATA | sed -e "s/^.*= //g"` 190SYSFW_DATA_SHA_VAL=`openssl dgst -$SHA -hex $SYSFW_DATA | sed -e "s/^.*= //g"`
183SYSFW_DATA_SIZE=`cat $SYSFW_DATA | wc -c` 191SYSFW_DATA_SIZE=`cat $SYSFW_DATA | wc -c`
184SYSFW_DATA_ADDR=`printf "%08x" $SYSFW_DATA_LOADADDR` 192SYSFW_DATA_ADDR=`printf "%08x" $SYSFW_DATA_LOADADDR`
185TOTAL_SIZE=$(expr $SBL_SIZE + $SYSFW_SIZE + $SYSFW_DATA_SIZE) 193
194DM_DATA_SHA_VAL=`openssl dgst -$SHA -hex $DM_DATA | sed -e "s/^.*= //g"`
195DM_DATA_SIZE=`cat $DM_DATA | wc -c`
196DM_DATA_ADDR=`printf "%08x" $DM_DATA_LOADADDR`
197
198TOTAL_SIZE=$(expr $SBL_SIZE + $SYSFW_SIZE + $SYSFW_DATA_SIZE + $DM_DATA_SIZE)
186 199
187# Generate x509 Template 200# Generate x509 Template
188gen_template() { 201gen_template() {
@@ -213,10 +226,11 @@ cat << 'EOF' > $TEMP_X509
213 226
214 [ext_boot_info] 227 [ext_boot_info]
215 extImgSize=INTEGER:TOTAL_IMAGE_LENGTH 228 extImgSize=INTEGER:TOTAL_IMAGE_LENGTH
216 numComp=INTEGER:3 229 numComp=INTEGER:4
217 sbl=SEQUENCE:sbl 230 sbl=SEQUENCE:sbl
218 sysfw=SEQUENCE:sysfw 231 sysfw=SEQUENCE:sysfw
219 sysfw_data=SEQUENCE:sysfw_data 232 sysfw_data=SEQUENCE:sysfw_data
233 dm_data=SEQUENCE:dm_data
220 234
221 [sbl] 235 [sbl]
222 compType = INTEGER:1 236 compType = INTEGER:1
@@ -244,6 +258,15 @@ cat << 'EOF' > $TEMP_X509
244 compSize = INTEGER:SYSFW_DATA_IMAGE_SIZE 258 compSize = INTEGER:SYSFW_DATA_IMAGE_SIZE
245 shaType = OID:SYSFW_DATA_IMAGE_SHA_OID 259 shaType = OID:SYSFW_DATA_IMAGE_SHA_OID
246 shaValue = FORMAT:HEX,OCT:SYSFW_DATA_IMAGE_SHA_VAL 260 shaValue = FORMAT:HEX,OCT:SYSFW_DATA_IMAGE_SHA_VAL
261
262 [dm_data]
263 compType = INTEGER:17
264 bootCore = INTEGER:16
265 compOpts = INTEGER:0
266 destAddr = FORMAT:HEX,OCT:DM_DATA_DEST_ADDR
267 compSize = INTEGER:DM_DATA_IMAGE_SIZE
268 shaType = OID:DM_DATA_IMAGE_SHA_OID
269 shaValue = FORMAT:HEX,OCT:DM_DATA_IMAGE_SHA_VAL
247EOF 270EOF
248} 271}
249 272
@@ -264,6 +287,11 @@ gen_cert() {
264 sed -i "s/SYSFW_DATA_IMAGE_SIZE/$SYSFW_DATA_SIZE/" $TEMP_X509 287 sed -i "s/SYSFW_DATA_IMAGE_SIZE/$SYSFW_DATA_SIZE/" $TEMP_X509
265 sed -i "s/SYSFW_DATA_IMAGE_SHA_OID/$SHA_OID/" $TEMP_X509 288 sed -i "s/SYSFW_DATA_IMAGE_SHA_OID/$SHA_OID/" $TEMP_X509
266 sed -i "s/SYSFW_DATA_IMAGE_SHA_VAL/$SYSFW_DATA_SHA_VAL/" $TEMP_X509 289 sed -i "s/SYSFW_DATA_IMAGE_SHA_VAL/$SYSFW_DATA_SHA_VAL/" $TEMP_X509
290 #echo $DM_DATA_ADDR $DM_DATA_SIZE $DM_DATA_SHA_VAL
291 sed -i "s/DM_DATA_DEST_ADDR/$DM_DATA_ADDR/" $TEMP_X509
292 sed -i "s/DM_DATA_IMAGE_SIZE/$DM_DATA_SIZE/" $TEMP_X509
293 sed -i "s/DM_DATA_IMAGE_SHA_OID/$SHA_OID/" $TEMP_X509
294 sed -i "s/DM_DATA_IMAGE_SHA_VAL/$DM_DATA_SHA_VAL/" $TEMP_X509
267 #echo $TOTAL_SIZE 295 #echo $TOTAL_SIZE
268 sed -i "s/TOTAL_IMAGE_LENGTH/$TOTAL_SIZE/" $TEMP_X509 296 sed -i "s/TOTAL_IMAGE_LENGTH/$TOTAL_SIZE/" $TEMP_X509
269 openssl req -new -x509 -key $KEY -nodes -outform DER -out $CERT -config $TEMP_X509 -$SHA 297 openssl req -new -x509 -key $KEY -nodes -outform DER -out $CERT -config $TEMP_X509 -$SHA
@@ -271,7 +299,7 @@ gen_cert() {
271 299
272gen_template 300gen_template
273gen_cert 301gen_cert
274cat $CERT $SBL $SYSFW $SYSFW_DATA > $OUTPUT 302cat $CERT $SBL $SYSFW $SYSFW_DATA $DM_DATA > $OUTPUT
275 303
276echo "SUCCESS: Image $OUTPUT generated." 304echo "SUCCESS: Image $OUTPUT generated."
277 305
diff --git a/soc/j7200/Makefile b/soc/j7200/Makefile
index 8a1005a64..d8904d24d 100644
--- a/soc/j7200/Makefile
+++ b/soc/j7200/Makefile
@@ -31,7 +31,8 @@
31# 31#
32 32
33SBL_LOADADDDR ?= 0x41c00000 33SBL_LOADADDDR ?= 0x41c00000
34COMBINED_BRDCFG_LOADADDR ?= 0x7f000 34COMBINED_SYSFW_BRDCFG_LOADADDR ?= 0x7f000
35COMBINED_DM_BRDCFG_LOADADDR ?= 0x41c80000
35LOADADDR ?= 0x40000 36LOADADDR ?= 0x40000
36 37
37.PHONY: all 38.PHONY: all