1 This patch makes it possible to set a custom image magic.
5 @@ -20,6 +20,7 @@ static struct image_tool_params params =
7 .type = IH_TYPE_KERNEL,
10 .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
13 @@ -76,11 +77,12 @@ static void usage(const char *msg)
14 " -l ==> list image header information\n",
17 - " %s [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image\n"
18 + " %s [-x] -A arch -O os -T type -C comp -M magic -a addr -e ep -n name -d data_file[:data_file...] image\n"
19 " -A ==> set architecture to 'arch'\n"
20 " -O ==> set operating system to 'os'\n"
21 " -T ==> set image type to 'type'\n"
22 " -C ==> set compression type 'comp'\n"
23 + " -M ==> set image magic to 'magic'\n"
24 " -a ==> set load address to 'addr' (hex)\n"
25 " -e ==> set entry point to 'ep' (hex)\n"
26 " -n ==> set image name to 'name'\n"
27 @@ -143,7 +145,7 @@ static void process_args(int argc, char
30 while ((opt = getopt(argc, argv,
31 - "a:A:b:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qsT:vVx")) != -1) {
32 + "a:A:b:c:C:d:D:e:Ef:Fk:i:K:lM:n:N:p:O:rR:qsT:vVx")) != -1) {
35 params.addr = strtoull(optarg, &ptr, 16);
36 @@ -221,6 +223,14 @@ static void process_args(int argc, char
41 + params.magic = strtoull(optarg, &ptr, 16);
43 + fprintf(stderr, "%s: invalid magic %s\n",
44 + params.cmdname, optarg);
49 params.imagename = optarg;
51 --- a/tools/default_image.c
52 +++ b/tools/default_image.c
53 @@ -116,7 +116,7 @@ static void image_set_header(void *ptr,
56 /* Build new header */
57 - image_set_magic(hdr, IH_MAGIC);
58 + image_set_magic(hdr, params->magic);
59 image_set_time(hdr, time);
60 image_set_size(hdr, imagesize);
61 image_set_load(hdr, addr);
62 --- a/tools/imagetool.h
63 +++ b/tools/imagetool.h
64 @@ -53,6 +53,7 @@ struct image_tool_params {