aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2011-01-04 06:39:14 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-04 22:25:05 -0500
commit571e08f6e2ddd6ec5d547358f55342726c063072 (patch)
tree5b92230f7e1ab95779ad8d75df1d00ed2a0631b6 /arch/sparc
parent9c239053045568abf960b01e4eb2c7205e3cd7d6 (diff)
sparc: remove obsolete ELF support in piggyback_32.c
As we always convert to a.out there is no need to support ELF. Removing ELF support because: - it is not used - it simplifies code to support a.out only Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/boot/piggyback_32.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/arch/sparc/boot/piggyback_32.c b/arch/sparc/boot/piggyback_32.c
index 5e856f2e9e0f..369634d8271e 100644
--- a/arch/sparc/boot/piggyback_32.c
+++ b/arch/sparc/boot/piggyback_32.c
@@ -44,12 +44,6 @@ static unsigned short ld2(char *p)
44 return (p[0] << 8) | p[1]; 44 return (p[0] << 8) | p[1];
45} 45}
46 46
47/* read 4 bytes as big endian */
48static unsigned int ld4(char *p)
49{
50 return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
51}
52
53/* save 4 bytes as big endian */ 47/* save 4 bytes as big endian */
54static void st4(char *p, unsigned int x) 48static void st4(char *p, unsigned int x)
55{ 49{
@@ -130,7 +124,7 @@ int main(int argc,char **argv)
130{ 124{
131 static char aout_magic[] = { 0x01, 0x03, 0x01, 0x07 }; 125 static char aout_magic[] = { 0x01, 0x03, 0x01, 0x07 };
132 char buffer[1024], *q, *r; 126 char buffer[1024], *q, *r;
133 unsigned int i, j, k, start, end, offset; 127 unsigned int i, start, end, offset;
134 struct stat s; 128 struct stat s;
135 int image, tail; 129 int image, tail;
136 130
@@ -147,21 +141,10 @@ int main(int argc,char **argv)
147 die(argv[1]); 141 die(argv[1]);
148 if (read(image, buffer, 512) != 512) 142 if (read(image, buffer, 512) != 512)
149 die(argv[1]); 143 die(argv[1]);
150 if (memcmp (buffer, "\177ELF", 4) == 0) { 144 if (memcmp(buffer, aout_magic, 4) != 0) {
151 q = buffer + ld4(buffer + 28); 145 fprintf (stderr, "Not a.out. Don't blame me.\n");
152 i = ld4(q + 4) + ld4(buffer + 24) - ld4(q + 8);
153 if (lseek(image, i, 0) < 0)
154 die("lseek");
155 if (read(image, buffer, 512) != 512)
156 die(argv[1]);
157 j = 0;
158 } else if (memcmp(buffer, aout_magic, 4) == 0) {
159 i = j = AOUT_TEXT_OFFSET;
160 } else {
161 fprintf (stderr, "Not ELF nor a.out. Don't blame me.\n");
162 exit(1); 146 exit(1);
163 } 147 }
164 k = i;
165 /* 148 /*
166 * We need to fill in values for sparc_ramdisk_image + sparc_ramdisk_size 149 * We need to fill in values for sparc_ramdisk_image + sparc_ramdisk_size
167 * To locate these symbols search for the "HdrS" text which appear 150 * To locate these symbols search for the "HdrS" text which appear
@@ -170,7 +153,7 @@ int main(int argc,char **argv)
170 */ 153 */
171 154
172 /* Find the gokernel label */ 155 /* Find the gokernel label */
173 i += (ld2(buffer + j + 2) << 2) - 512; 156 i = AOUT_TEXT_OFFSET + (ld2(buffer + AOUT_TEXT_OFFSET + 2) << 2) - 512;
174 if (lseek(image, i, 0) < 0) 157 if (lseek(image, i, 0) < 0)
175 die("lseek"); 158 die("lseek");
176 if (read(image, buffer, 1024) != 1024) 159 if (read(image, buffer, 1024) != 1024)
@@ -203,7 +186,7 @@ int main(int argc,char **argv)
203 die(argv[1]); 186 die(argv[1]);
204 187
205 /* seek page aligned boundary in the image file and add boot image */ 188 /* seek page aligned boundary in the image file and add boot image */
206 if (lseek(image, k - start + ((end + 32 + 4095) & ~4095), 0) < 0) 189 if (lseek(image, AOUT_TEXT_OFFSET - start + ((end + 32 + 4095) & ~4095), 0) < 0)
207 die("lseek"); 190 die("lseek");
208 if ((tail = open(argv[3],O_RDONLY)) < 0) 191 if ((tail = open(argv[3],O_RDONLY)) < 0)
209 die(argv[3]); 192 die(argv[3]);