aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/boot
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-01-15 01:30:44 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-15 01:30:44 -0500
commita7fdd90bc43e3e9cb08bc1b13650024d419b89e5 (patch)
tree5c99a41b9d157186668ed63c001f72a09965143b /arch/ppc/boot
parente8625d463560198cff7cb3eb22886c47d728d501 (diff)
[PATCH] ppc: Remove powermac support from ARCH=ppc
This makes it possible to build kernels for PReP and/or CHRP with ARCH=ppc by removing the (non-building) powermac support. It's now also possible to select PReP and CHRP independently. Powermac users should now build with ARCH=powerpc instead of ARCH=ppc. (This does mean that it is no longer possible to build a 32-bit kernel for a G5.) Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc/boot')
-rw-r--r--arch/ppc/boot/Makefile2
-rw-r--r--arch/ppc/boot/openfirmware/Makefile96
-rw-r--r--arch/ppc/boot/openfirmware/coffmain.c101
-rw-r--r--arch/ppc/boot/openfirmware/newworldmain.c94
4 files changed, 10 insertions, 283 deletions
diff --git a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
index 995f89bb049c..efd8ce515d5f 100644
--- a/arch/ppc/boot/Makefile
+++ b/arch/ppc/boot/Makefile
@@ -18,7 +18,7 @@ BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
18bootdir-y := simple 18bootdir-y := simple
19bootdir-$(CONFIG_PPC_OF) += openfirmware 19bootdir-$(CONFIG_PPC_OF) += openfirmware
20subdir-y := lib common images 20subdir-y := lib common images
21subdir-$(CONFIG_PPC_OF) += of1275 21subdir-$(CONFIG_PPC_MULTIPLATFORM) += of1275
22 22
23# for cleaning 23# for cleaning
24subdir- += simple openfirmware 24subdir- += simple openfirmware
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
index 83a6433459ce..2a411ec2e650 100644
--- a/arch/ppc/boot/openfirmware/Makefile
+++ b/arch/ppc/boot/openfirmware/Makefile
@@ -21,26 +21,16 @@ bootlib := $(boot)/lib
21of1275 := $(boot)/of1275 21of1275 := $(boot)/of1275
22images := $(boot)/images 22images := $(boot)/images
23 23
24OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
25COFF_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \
26 -Bstatic
27CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000 24CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
28NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000
29 25
30COMMONOBJS := start.o misc.o common.o 26COMMONOBJS := start.o misc.o common.o
31COFFOBJS := coffcrt0.o $(COMMONOBJS) coffmain.o
32CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o 27CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
33NEWWORLDOBJS := crt0.o $(COMMONOBJS) newworldmain.o
34 28
35targets := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o 29targets := $(CHRPOBJS) dummy.o
36COFFOBJS := $(addprefix $(obj)/, $(COFFOBJS))
37CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS)) 30CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
38NEWWORLDOBJS := $(addprefix $(obj)/, $(NEWWORLDOBJS))
39 31
40LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a 32LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
41 33
42HACKCOFF := $(utils)/hack-coff
43
44ifdef CONFIG_SMP 34ifdef CONFIG_SMP
45END := .smp 35END := .smp
46endif 36endif
@@ -72,56 +62,11 @@ targets += image.initrd.o
72$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE 62$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
73 $(call if_changed,genimage-initrd) 63 $(call if_changed,genimage-initrd)
74 64
75# Create the note section for New-World PowerMacs.
76quiet_cmd_mknote = MKNOTE $@
77 cmd_mknote = $(utils)/mknote > $@
78targets += note
79$(obj)/note: $(utils)/mknote FORCE
80 $(call if_changed,mknote)
81
82 65
83$(obj)/coffcrt0.o: EXTRA_AFLAGS := -DXCOFF 66targets += crt0.o
84targets += coffcrt0.o crt0.o 67$(obj)/crt0.o: $(common)/crt0.S FORCE
85$(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE
86 $(call if_changed_dep,as_o_S) 68 $(call if_changed_dep,as_o_S)
87 69
88quiet_cmd_gencoffb = COFF $@
89 cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \
90 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
91targets += coffboot
92$(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE
93 $(call if_changed,gencoffb)
94targets += coffboot.initrd
95$(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \
96 $(srctree)/$(boot)/ld.script FORCE
97 $(call if_changed,gencoffb)
98
99
100quiet_cmd_gen-coff = COFF $@
101 cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \
102 $(HACKCOFF) $@ && \
103 ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac
104
105$(images)/vmlinux.coff: $(obj)/coffboot
106 $(call cmd,gen-coff)
107
108$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
109 $(call cmd,gen-coff)
110
111quiet_cmd_gen-elf-pmac = ELF $@
112 cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \
113 $(NEWWORLDOBJS) $(LIBS) $< && \
114 $(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \
115 -R .comment $(del-ramdisk-sec)
116
117$(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \
118 $(obj)/note $(srctree)/$(boot)/ld.script
119 $(call cmd,gen-elf-pmac)
120$(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \
121 $(LIBS) $(obj)/note \
122 $(srctree)/$(boot)/ld.script
123 $(call cmd,gen-elf-pmac)
124
125quiet_cmd_gen-chrp = CHRP $@ 70quiet_cmd_gen-chrp = CHRP $@
126 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \ 71 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
127 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec) 72 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
@@ -139,46 +84,23 @@ $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
139 %-rs6k: % 84 %-rs6k: %
140 $(call cmd,addnote) 85 $(call cmd,addnote)
141 86
142quiet_cmd_gen-miboot = GEN $@
143 cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \
144 --add-section=$1=$(word 2, $^) $< $@
145$(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
146 $(call cmd,gen-miboot,image)
147
148$(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
149 $(call cmd,gen-miboot,initrd)
150
151# The targets used on the make command-line 87# The targets used on the make command-line
152 88
153.PHONY: zImage zImage.initrd 89.PHONY: zImage zImage.initrd
154zImage: $(images)/vmlinux.coff \ 90zImage: $(images)/zImage.chrp \
155 $(images)/vmlinux.elf-pmac \ 91 $(images)/zImage.chrp-rs6k
156 $(images)/zImage.chrp \
157 $(images)/zImage.chrp-rs6k \
158 $(images)/miboot.image
159 @echo ' kernel: $@ is ready ($<)' 92 @echo ' kernel: $@ is ready ($<)'
160zImage.initrd: $(images)/vmlinux.initrd.coff \ 93zImage.initrd: $(images)/zImage.initrd.chrp \
161 $(images)/vmlinux.initrd.elf-pmac \ 94 $(images)/zImage.initrd.chrp-rs6k
162 $(images)/zImage.initrd.chrp \
163 $(images)/zImage.initrd.chrp-rs6k \
164 $(images)/miboot.initrd.image
165 @echo ' kernel: $@ is ready ($<)' 95 @echo ' kernel: $@ is ready ($<)'
166 96
167TFTPIMAGE := /tftpboot/zImage 97TFTPIMAGE := /tftpboot/zImage
168 98
169.PHONY: znetboot znetboot.initrd 99.PHONY: znetboot znetboot.initrd
170znetboot: $(images)/vmlinux.coff \ 100znetboot: $(images)/zImage.chrp
171 $(images)/vmlinux.elf-pmac \
172 $(images)/zImage.chrp
173 cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
174 cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf
175 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END) 101 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
176 @echo ' kernel: $@ is ready ($<)' 102 @echo ' kernel: $@ is ready ($<)'
177znetboot.initrd:$(images)/vmlinux.initrd.coff \ 103znetboot.initrd:$(images)/zImage.initrd.chrp
178 $(images)/vmlinux.initrd.elf-pmac \
179 $(images)/zImage.initrd.chrp
180 cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
181 cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
182 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END) 104 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
183 @echo ' kernel: $@ is ready ($<)' 105 @echo ' kernel: $@ is ready ($<)'
184 106
diff --git a/arch/ppc/boot/openfirmware/coffmain.c b/arch/ppc/boot/openfirmware/coffmain.c
deleted file mode 100644
index 2da8855e2be0..000000000000
--- a/arch/ppc/boot/openfirmware/coffmain.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/string.h>
10#include <asm/processor.h>
11#include <asm/page.h>
12
13#include "nonstdio.h"
14#include "of1275.h"
15
16/* Passed from the linker */
17extern char __image_begin, __image_end;
18extern char __ramdisk_begin[], __ramdisk_end;
19extern char _start, _end;
20
21extern char image_data[], initrd_data[];
22extern int initrd_len, image_len;
23extern unsigned int heap_max;
24extern void flush_cache(void *start, unsigned int len);
25extern void gunzip(void *, int, unsigned char *, int *);
26extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
27 unsigned int progend);
28extern void setup_bats(unsigned long start);
29
30char *avail_ram;
31char *begin_avail, *end_avail;
32char *avail_high;
33
34#define SCRATCH_SIZE (128 << 10)
35
36static char heap[SCRATCH_SIZE];
37
38static unsigned long ram_start = 0;
39static unsigned long ram_end = 0x1000000;
40
41static unsigned long prog_start = 0x800000;
42static unsigned long prog_size = 0x700000;
43
44typedef void (*kernel_start_t)(int, int, void *);
45
46void boot(int a1, int a2, void *prom)
47{
48 unsigned sa, len;
49 void *dst;
50 unsigned char *im;
51 unsigned initrd_start, initrd_size;
52
53 printf("coffboot starting: loaded at 0x%p\n", &_start);
54 setup_bats(ram_start);
55
56 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
57 if (initrd_size) {
58 initrd_start = (ram_end - initrd_size) & ~0xFFF;
59 a1 = initrd_start;
60 a2 = initrd_size;
61 claim(initrd_start, ram_end - initrd_start, 0);
62 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
63 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
64 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
65 prog_size = initrd_start - prog_start;
66 } else
67 a2 = 0xdeadbeef;
68
69 im = (char *)(&__image_begin);
70 len = (char *)(&__image_end) - (char *)(&__image_begin);
71 /* claim 4MB starting at PROG_START */
72 claim(prog_start, prog_size, 0);
73 map(prog_start, prog_start, prog_size);
74 dst = (void *) prog_start;
75 if (im[0] == 0x1f && im[1] == 0x8b) {
76 /* set up scratch space */
77 begin_avail = avail_high = avail_ram = heap;
78 end_avail = heap + sizeof(heap);
79 printf("heap at 0x%p\n", avail_ram);
80 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
81 gunzip(dst, prog_size, im, &len);
82 printf("done %u bytes\n", len);
83 printf("%u bytes of heap consumed, max in use %u\n",
84 avail_high - begin_avail, heap_max);
85 } else {
86 memmove(dst, im, len);
87 }
88
89 flush_cache(dst, len);
90 make_bi_recs(((unsigned long) dst + len), "coffboot", _MACH_Pmac,
91 (prog_start + prog_size));
92
93 sa = (unsigned long)prog_start;
94 printf("start address = 0x%x\n", sa);
95
96 (*(kernel_start_t)sa)(a1, a2, prom);
97
98 printf("returned?\n");
99
100 pause();
101}
diff --git a/arch/ppc/boot/openfirmware/newworldmain.c b/arch/ppc/boot/openfirmware/newworldmain.c
deleted file mode 100644
index fa8a8f9313f9..000000000000
--- a/arch/ppc/boot/openfirmware/newworldmain.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/string.h>
10#include "nonstdio.h"
11#include "of1275.h"
12#include <asm/processor.h>
13#include <asm/page.h>
14
15/* Passed from the linker */
16extern char __image_begin, __image_end;
17extern char __ramdisk_begin[], __ramdisk_end;
18extern char _start, _end;
19
20extern unsigned int heap_max;
21extern void flush_cache(void *start, unsigned int len);
22extern void gunzip(void *, int, unsigned char *, int *);
23extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
24 unsigned int progend);
25
26char *avail_ram;
27char *begin_avail, *end_avail;
28char *avail_high;
29
30
31#define RAM_END (16 << 20)
32
33#define PROG_START 0x00010000
34#define PROG_SIZE 0x007f0000
35
36#define SCRATCH_SIZE (128 << 10)
37
38typedef void (*kernel_start_t)(int, int, void *);
39
40void boot(int a1, int a2, void *prom)
41{
42 unsigned sa, len;
43 void *dst;
44 unsigned char *im;
45 unsigned initrd_start, initrd_size;
46
47 printf("chrpboot starting: loaded at 0x%p\n", &_start);
48
49 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
50 if (initrd_size) {
51 initrd_start = (RAM_END - initrd_size) & ~0xFFF;
52 a1 = initrd_start;
53 a2 = initrd_size;
54 claim(initrd_start, RAM_END - initrd_start, 0);
55 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
56 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
57 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
58 } else
59 a2 = 0xdeadbeef;
60
61 im = (char *)(&__image_begin);
62 len = (char *)(&__image_end) - (char *)(&__image_begin);
63 /* claim 3MB starting at PROG_START */
64 claim(PROG_START, PROG_SIZE, 0);
65 dst = (void *) PROG_START;
66 if (im[0] == 0x1f && im[1] == 0x8b) {
67 /* claim some memory for scratch space */
68 avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10);
69 begin_avail = avail_high = avail_ram;
70 end_avail = avail_ram + SCRATCH_SIZE;
71 printf("heap at 0x%p\n", avail_ram);
72 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
73 gunzip(dst, PROG_SIZE, im, &len);
74 printf("done %u bytes\n", len);
75 printf("%u bytes of heap consumed, max in use %u\n",
76 avail_high - begin_avail, heap_max);
77 release(begin_avail, SCRATCH_SIZE);
78 } else {
79 memmove(dst, im, len);
80 }
81
82 flush_cache(dst, len);
83 make_bi_recs(((unsigned long) dst + len), "chrpboot", _MACH_Pmac,
84 (PROG_START + PROG_SIZE));
85
86 sa = (unsigned long)PROG_START;
87 printf("start address = 0x%x\n", sa);
88
89 (*(kernel_start_t)sa)(a1, a2, prom);
90
91 printf("returned?\n");
92
93 pause();
94}