aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/main.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-01-13 23:04:06 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-13 23:04:06 -0500
commit66a45dd3620ee5f913ba1af3d2dca8b9bdfa2b96 (patch)
treef98b25a1004d6e6bc84244186db61e76d5b2fe1c /arch/powerpc/boot/main.c
parent36874579dbf4cafa31486d4207c6807efbbf1378 (diff)
powerpc: Make COFF zImages for old 32-bit powermacs
This adds code to build zImage.coff and/or zImage.initrd.coff when CONFIG_PPC32 and CONFIG_PPC_PMAC are defined. It also restructures the OF client code and adds some workarounds for OF quirks on the older machines. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/main.c')
-rw-r--r--arch/powerpc/boot/main.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 64ec93116fa..55ec5986725 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -21,8 +21,8 @@ extern void flush_cache(void *, unsigned long);
21 21
22 22
23/* Value picked to match that used by yaboot */ 23/* Value picked to match that used by yaboot */
24#define PROG_START 0x01400000 24#define PROG_START 0x01400000 /* only used on 64-bit systems */
25#define RAM_END (512<<20) // Fixme: use OF */ 25#define RAM_END (512<<20) /* Fixme: use OF */
26#define ONE_MB 0x100000 26#define ONE_MB 0x100000
27 27
28extern char _start[]; 28extern char _start[];
@@ -160,6 +160,17 @@ static int is_elf64(void *hdr)
160 elfoffset = (unsigned long)elf64ph->p_offset; 160 elfoffset = (unsigned long)elf64ph->p_offset;
161 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset; 161 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset;
162 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset; 162 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset;
163
164#if defined(PROG_START)
165 /*
166 * Maintain a "magic" minimum address. This keeps some older
167 * firmware platforms running.
168 */
169
170 if (claim_base < PROG_START)
171 claim_base = PROG_START;
172#endif
173
163 return 1; 174 return 1;
164} 175}
165 176
@@ -206,12 +217,18 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
206 exit(); 217 exit();
207 if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4) 218 if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
208 exit(); 219 exit();
209 stderr = stdout;
210 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
211 exit();
212 220
213 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp); 221 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
214 222
223 /*
224 * The first available claim_base must be above the end of the
225 * the loaded kernel wrapper file (_start to _end includes the
226 * initrd image if it is present) and rounded up to a nice
227 * 1 MB boundary for good measure.
228 */
229
230 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
231
215 vmlinuz.addr = (unsigned long)_vmlinux_start; 232 vmlinuz.addr = (unsigned long)_vmlinux_start;
216 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); 233 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
217 234
@@ -228,25 +245,6 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
228 exit(); 245 exit();
229 } 246 }
230 247
231 /*
232 * The first available claim_base must be above the end of the
233 * the loaded kernel wrapper file (_start to _end includes the
234 * initrd image if it is present) and rounded up to a nice
235 * 1 MB boundary for good measure.
236 */
237
238 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
239
240#if defined(PROG_START)
241 /*
242 * Maintain a "magic" minimum address. This keeps some older
243 * firmware platforms running.
244 */
245
246 if (claim_base < PROG_START)
247 claim_base = PROG_START;
248#endif
249
250 /* We need to claim the memsize plus the file offset since gzip 248 /* We need to claim the memsize plus the file offset since gzip
251 * will expand the header (file offset), then the kernel, then 249 * will expand the header (file offset), then the kernel, then
252 * possible rubbish we don't care about. But the kernel bss must 250 * possible rubbish we don't care about. But the kernel bss must