summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2020-05-29 00:16:51 -0700
committerYe Li <ye.li@nxp.com>2020-05-29 00:42:50 -0700
commit6745ccdcf15384891639b7ced3aa6ce938682365 (patch)
tree426c9b72bd8851a5c6d3eb425a2704ee0cff1f1a
parent8e0c4e73b4b75afc731c8dce15c6254acc82a5a1 (diff)
imx8m: Add script to generate SIT (secondary image table)rel_imx_5.4.24_2.1.0
Run "./scripts/gen_sit.sh [sect_off]" to generate the secondary image table (sit.bin), which is padded to 512 bytes. [sect_off] is the firstSectorNumber field in SIT table. Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit 49bb841fd3f98f2f3f74eac6ad62628aedc33fc0)
-rwxr-xr-xscripts/gen_sit.sh17
-rwxr-xr-xscripts/sit_template10
2 files changed, 27 insertions, 0 deletions
diff --git a/scripts/gen_sit.sh b/scripts/gen_sit.sh
new file mode 100755
index 0000000..cca5a39
--- /dev/null
+++ b/scripts/gen_sit.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+if [ $# -lt 1 ]; then
+ echo "Must set the sector offset of secondary image"
+ exit -1
+fi
+
+sector_num=`printf "0x%X" $1`
+
+sed -e s/%sectornum%/${sector_num}/g scripts/sit_template > sit_gen
+chmod +x sit_gen
+
+./sit_gen
+objcopy -I binary -O binary --pad-to 512 sit.bin
+
+rm sit_gen
+echo "Generated sit.bin"
diff --git a/scripts/sit_template b/scripts/sit_template
new file mode 100755
index 0000000..93959ff
--- /dev/null
+++ b/scripts/sit_template
@@ -0,0 +1,10 @@
+#! /usr/bin/perl -w
+use strict;
+
+open(my $out, '>:raw', 'sit.bin') or die "Unable to open: $!";
+print $out pack("V", 0x0); # chipnum
+print $out pack("V", 0x0); # driver type
+print $out pack("V", 0x00112233); # tag
+print $out pack("V", %sectornum%); # firstSectorNumber
+print $out pack("V", 0x0); # Sector count, not used
+close($out);