summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2015-04-13 14:27:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-04-15 07:12:17 +0200
commitb6c786528b291733f979e57ae5e62803dfc44bbb (patch)
treec8eed54ff482bf16c9bd699507875ab134fd536a /scripts
parent16df43459255745465f296610be1000ab9165fa2 (diff)
downloadbarebox-b6c786528b291733f979e57ae5e62803dfc44bbb.tar.gz
barebox-b6c786528b291733f979e57ae5e62803dfc44bbb.tar.xz
imx-image: add option to prepare image for HAB signing
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/imx/imx-image.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index cff1997573..25ea4d8d1b 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -33,6 +33,7 @@
#define MAX_DCD 1024
#define HEADER_LEN 0x1000 /* length of the blank area + IVT + DCD */
+#define CSF_LEN 0x2000 /* length of the CSF (needed for HAB) */
static uint32_t image_load_addr;
static uint32_t image_dcd_offset;
@@ -41,6 +42,7 @@ static int curdcd;
static int header_version;
static int cpu_type;
static int add_barebox_header;
+static int prepare_sign;
/*
* ============================================================================
@@ -194,6 +196,11 @@ static int add_header_v2(void *buf, int offset, uint32_t loadaddr, uint32_t imag
hdr->boot_data.start = loadaddr;
hdr->boot_data.size = imagesize;
+ if (prepare_sign) {
+ hdr->csf = loadaddr + imagesize;
+ hdr->boot_data.size += CSF_LEN;
+ }
+
hdr->dcd_header.tag = TAG_DCD_HEADER;
hdr->dcd_header.length = htobe16(sizeof(uint32_t) + dcdsize);
hdr->dcd_header.version = DCD_VERSION;
@@ -214,6 +221,7 @@ static void usage(const char *prgname)
"-b add barebox header to image. If used, barebox recognizes\n"
" the image as regular barebox image which can be used as\n"
" second stage image\n"
+ "-p prepare image for signing\n"
"-h this help\n", prgname);
exit(1);
}
@@ -655,7 +663,7 @@ int main(int argc, char *argv[])
int dcd_only = 0;
int now = 0;
- while ((opt = getopt(argc, argv, "c:hf:o:bd")) != -1) {
+ while ((opt = getopt(argc, argv, "c:hf:o:bdp")) != -1) {
switch (opt) {
case 'c':
configfile = optarg;
@@ -672,6 +680,9 @@ int main(int argc, char *argv[])
case 'd':
dcd_only = 1;
break;
+ case 'p':
+ prepare_sign = 1;
+ break;
case 'h':
usage(argv[0]);
default: