summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/x-load/files/signGP.c
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2011-01-17 16:33:04 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-21 11:18:35 +0000
commitb6cbf223d838bca674301927d6c3ec48e349009b (patch)
tree63a476e6739c412a60408fb89c028ee2a0e36cfd /meta/recipes-bsp/x-load/files/signGP.c
parentbcb18738361ee2394bc266911e9e75d5bf1c10cd (diff)
downloadpoky-b6cbf223d838bca674301927d6c3ec48e349009b.tar.gz
x-load: us TI upstream repository, update recipes accordingly
TI is now maintaining an upstream x-loader git repository and sakoman will no longer be maintained. Current upstream includes signGP and incorporates it into the Makefile. The new Makefile ift target builds the universal MLO binary. The armv7-a patch is included. Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Tom Zanussi <tom.zanussi@intel.com> CC: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta/recipes-bsp/x-load/files/signGP.c')
-rw-r--r--meta/recipes-bsp/x-load/files/signGP.c108
1 files changed, 0 insertions, 108 deletions
diff --git a/meta/recipes-bsp/x-load/files/signGP.c b/meta/recipes-bsp/x-load/files/signGP.c
deleted file mode 100644
index 9325064013..0000000000
--- a/meta/recipes-bsp/x-load/files/signGP.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33*/
34
35
36//
37// signGP.c
38// Read the x-load.bin file and write out the x-load.bin.ift file.
39// The signed image is the original pre-pended with the size of the image
40// and the load address. If not entered on command line, file name is
41// assumed to be x-load.bin in current directory and load address is
42// 0x40200800.
43
44#include <stdio.h>
45#include <stdlib.h>
46#include <fcntl.h>
47#include <sys/stat.h>
48#include <string.h>
49#include <malloc.h>
50
51
52main(int argc, char *argv[])
53{
54 int i;
55 char ifname[FILENAME_MAX], ofname[FILENAME_MAX], ch;
56 FILE *ifile, *ofile;
57 unsigned long loadaddr, len;
58 struct stat sinfo;
59
60
61 // Default to x-load.bin and 0x40200800.
62 strcpy(ifname, "x-load.bin");
63 loadaddr = 0x40200800;
64
65 if ((argc == 2) || (argc == 3))
66 strcpy(ifname, argv[1]);
67
68 if (argc == 3)
69 loadaddr = strtol(argv[2], NULL, 16);
70
71 // Form the output file name.
72 strcpy(ofname, ifname);
73 strcat(ofname, ".ift");
74
75 // Open the input file.
76 ifile = fopen(ifname, "rb");
77 if (ifile == NULL) {
78 printf("Cannot open %s\n", ifname);
79 exit(0);
80 }
81
82 // Get file length.
83 stat(ifname, &sinfo);
84 len = sinfo.st_size;
85
86 // Open the output file and write it.
87 ofile = fopen(ofname, "wb");
88 if (ofile == NULL) {
89 printf("Cannot open %s\n", ofname);
90 fclose(ifile);
91 exit(0);
92 }
93
94 // Pad 1 sector of zeroes.
95 //ch = 0x00;
96 //for (i=0; i<0x200; i++)
97 // fwrite(&ch, 1, 1, ofile);
98
99 fwrite(&len, 1, 4, ofile);
100 fwrite(&loadaddr, 1, 4, ofile);
101 for (i=0; i<len; i++) {
102 fread(&ch, 1, 1, ifile);
103 fwrite(&ch, 1, 1, ofile);
104 }
105
106 fclose(ifile);
107 fclose(ofile);
108}