[package] ebtales: update to v2.0.10-4
[openwrt.git] / tools / mkimage / patches / 030-allow-to-use-different-magic.patch
1 --- a/tools/mkimage.c
2 +++ b/tools/mkimage.c
3 @@ -37,6 +37,7 @@ struct mkimage_params params = {
4 .arch = IH_ARCH_PPC,
5 .type = IH_TYPE_KERNEL,
6 .comp = IH_COMP_GZIP,
7 + .magic = IH_MAGIC,
8 .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
9 .imagename = "",
10 };
11 @@ -180,6 +181,16 @@ main (int argc, char **argv)
12 genimg_get_comp_id (*++argv)) < 0)
13 usage ();
14 goto NXTARG;
15 + case 'M':
16 + if (--argc <=0)
17 + usage ();
18 + params.magic = strtoul (*++argv, &ptr, 16);
19 + if (*ptr) {
20 + fprintf (stderr,
21 + "%s: invalid magic %s\n",
22 + params.cmdname, *argv);
23 + }
24 + goto NXTARG;
25 case 'D':
26 if (--argc <= 0)
27 usage ();
28 @@ -580,12 +591,13 @@ usage ()
29 fprintf (stderr, "Usage: %s -l image\n"
30 " -l ==> list image header information\n",
31 params.cmdname);
32 - fprintf (stderr, " %s [-x] -A arch -O os -T type -C comp "
33 + fprintf (stderr, " %s [-x] -A arch -O os -T type -C comp -M magic "
34 "-a addr -e ep -n name -d data_file[:data_file...] image\n"
35 " -A ==> set architecture to 'arch'\n"
36 " -O ==> set operating system to 'os'\n"
37 " -T ==> set image type to 'type'\n"
38 " -C ==> set compression type 'comp'\n"
39 + " -M ==> set image magic to 'magic'\n"
40 " -a ==> set load address to 'addr' (hex)\n"
41 " -e ==> set entry point to 'ep' (hex)\n"
42 " -n ==> set image name to 'name'\n"
43 --- a/tools/mkimage.h
44 +++ b/tools/mkimage.h
45 @@ -64,6 +64,7 @@ struct mkimage_params {
46 int arch;
47 int type;
48 int comp;
49 + unsigned int magic;
50 char *dtc;
51 unsigned int addr;
52 unsigned int ep;
53 --- a/tools/default_image.c
54 +++ b/tools/default_image.c
55 @@ -110,7 +110,7 @@ static void image_set_header (void *ptr,
56 sbuf->st_size - sizeof(image_header_t));
57
58 /* Build new header */
59 - image_set_magic (hdr, IH_MAGIC);
60 + image_set_magic (hdr, params->magic);
61 image_set_time (hdr, sbuf->st_mtime);
62 image_set_size (hdr, sbuf->st_size - sizeof(image_header_t));
63 image_set_load (hdr, params->addr);
This page took 0.060544 seconds and 5 git commands to generate.