diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-06-21 20:15:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-21 21:46:26 -0400 |
commit | 6879dc137ea4efad65cab8bf8a7c0b742bcf92cc (patch) | |
tree | 13ca02150a892e97f3da20ac9cc052508cc7e8a8 /arch/ppc/boot | |
parent | a70d439345875d476ede258094356e2acd09b1a1 (diff) |
[PATCH] ppc32: Kill embedded system.map, use kallsyms
This patch kills the whole embedded System.map mecanism and the
bootloader-passed System.map that was used to provide symbol resolution in
xmon. Instead, xmon now uses kallsyms like ppc64 does.
No hurry getting that in Linus tree, let it be tested in -mm for a while
first and make sure it doesn't break various embedded configs.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc/boot')
-rw-r--r-- | arch/ppc/boot/ld.script | 3 | ||||
-rw-r--r-- | arch/ppc/boot/openfirmware/Makefile | 5 | ||||
-rw-r--r-- | arch/ppc/boot/openfirmware/common.c | 16 | ||||
-rw-r--r-- | arch/ppc/boot/simple/Makefile | 4 | ||||
-rw-r--r-- | arch/ppc/boot/utils/addSystemMap.c | 186 |
5 files changed, 3 insertions, 211 deletions
diff --git a/arch/ppc/boot/ld.script b/arch/ppc/boot/ld.script index 6ee602d8b6a0..9362193742ac 100644 --- a/arch/ppc/boot/ld.script +++ b/arch/ppc/boot/ld.script | |||
@@ -58,9 +58,6 @@ SECTIONS | |||
58 | *(.ramdisk) | 58 | *(.ramdisk) |
59 | __ramdisk_end = .; | 59 | __ramdisk_end = .; |
60 | . = ALIGN(4096); | 60 | . = ALIGN(4096); |
61 | __sysmap_begin = .; | ||
62 | *(.sysmap) | ||
63 | __sysmap_end = .; | ||
64 | CONSTRUCTORS | 61 | CONSTRUCTORS |
65 | } | 62 | } |
66 | _edata = .; | 63 | _edata = .; |
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile index 4eacbd8c772a..03415238fabf 100644 --- a/arch/ppc/boot/openfirmware/Makefile +++ b/arch/ppc/boot/openfirmware/Makefile | |||
@@ -54,13 +54,10 @@ $(images)/ramdisk.image.gz: | |||
54 | @echo ' RAM disk image must be provided separately' | 54 | @echo ' RAM disk image must be provided separately' |
55 | @/bin/false | 55 | @/bin/false |
56 | 56 | ||
57 | objcpxmon-$(CONFIG_XMON) := --add-section=.sysmap=System.map \ | ||
58 | --set-section-flags=.sysmap=contents,alloc,load,readonly,data | ||
59 | quiet_cmd_genimage = GEN $@ | 57 | quiet_cmd_genimage = GEN $@ |
60 | cmd_genimage = $(OBJCOPY) -R .comment \ | 58 | cmd_genimage = $(OBJCOPY) -R .comment \ |
61 | --add-section=.image=$(images)/vmlinux.gz \ | 59 | --add-section=.image=$(images)/vmlinux.gz \ |
62 | --set-section-flags=.image=contents,alloc,load,readonly,data \ | 60 | --set-section-flags=.image=contents,alloc,load,readonly,data $< $@ |
63 | $(objcpxmon-y) $< $@ | ||
64 | 61 | ||
65 | targets += image.o | 62 | targets += image.o |
66 | $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE | 63 | $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE |
diff --git a/arch/ppc/boot/openfirmware/common.c b/arch/ppc/boot/openfirmware/common.c index 9e6952781f1f..0f46756a903e 100644 --- a/arch/ppc/boot/openfirmware/common.c +++ b/arch/ppc/boot/openfirmware/common.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <asm/page.h> | 15 | #include <asm/page.h> |
16 | 16 | ||
17 | /* Information from the linker */ | 17 | /* Information from the linker */ |
18 | extern char __sysmap_begin, __sysmap_end; | ||
19 | 18 | ||
20 | extern int strcmp(const char *s1, const char *s2); | 19 | extern int strcmp(const char *s1, const char *s2); |
21 | extern char *avail_ram, *avail_high; | 20 | extern char *avail_ram, *avail_high; |
@@ -116,14 +115,8 @@ void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) | |||
116 | void make_bi_recs(unsigned long addr, char *name, unsigned int mach, | 115 | void make_bi_recs(unsigned long addr, char *name, unsigned int mach, |
117 | unsigned long progend) | 116 | unsigned long progend) |
118 | { | 117 | { |
119 | unsigned long sysmap_size; | ||
120 | struct bi_record *rec; | 118 | struct bi_record *rec; |
121 | 119 | ||
122 | /* Figure out the size of a possible System.map we're going to | ||
123 | * pass along. | ||
124 | * */ | ||
125 | sysmap_size = (unsigned long)(&__sysmap_end) - | ||
126 | (unsigned long)(&__sysmap_begin); | ||
127 | 120 | ||
128 | /* leave a 1MB gap then align to the next 1MB boundary */ | 121 | /* leave a 1MB gap then align to the next 1MB boundary */ |
129 | addr = _ALIGN(addr+ (1<<20) - 1, (1<<20)); | 122 | addr = _ALIGN(addr+ (1<<20) - 1, (1<<20)); |
@@ -147,15 +140,6 @@ void make_bi_recs(unsigned long addr, char *name, unsigned int mach, | |||
147 | rec->size = sizeof(struct bi_record) + 2 * sizeof(unsigned long); | 140 | rec->size = sizeof(struct bi_record) + 2 * sizeof(unsigned long); |
148 | rec = (struct bi_record *)((unsigned long)rec + rec->size); | 141 | rec = (struct bi_record *)((unsigned long)rec + rec->size); |
149 | 142 | ||
150 | if (sysmap_size) { | ||
151 | rec->tag = BI_SYSMAP; | ||
152 | rec->data[0] = (unsigned long)(&__sysmap_begin); | ||
153 | rec->data[1] = sysmap_size; | ||
154 | rec->size = sizeof(struct bi_record) + 2 * | ||
155 | sizeof(unsigned long); | ||
156 | rec = (struct bi_record *)((unsigned long)rec + rec->size); | ||
157 | } | ||
158 | |||
159 | rec->tag = BI_LAST; | 143 | rec->tag = BI_LAST; |
160 | rec->size = sizeof(struct bi_record); | 144 | rec->size = sizeof(struct bi_record); |
161 | rec = (struct bi_record *)((unsigned long)rec + rec->size); | 145 | rec = (struct bi_record *)((unsigned long)rec + rec->size); |
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile index c28061ad5982..991b4cbb83c8 100644 --- a/arch/ppc/boot/simple/Makefile +++ b/arch/ppc/boot/simple/Makefile | |||
@@ -203,7 +203,7 @@ $(obj)/zvmlinux: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \ | |||
203 | $(obj)/dummy.o $(obj)/image.o | 203 | $(obj)/dummy.o $(obj)/image.o |
204 | $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS) | 204 | $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS) |
205 | $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \ | 205 | $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \ |
206 | -R .stabstr -R .ramdisk -R .sysmap | 206 | -R .stabstr -R .ramdisk |
207 | 207 | ||
208 | $(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \ | 208 | $(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \ |
209 | $(images)/vmlinux.gz $(obj)/dummy.o | 209 | $(images)/vmlinux.gz $(obj)/dummy.o |
@@ -215,7 +215,7 @@ $(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \ | |||
215 | $(obj)/dummy.o $(obj)/image.o | 215 | $(obj)/dummy.o $(obj)/image.o |
216 | $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS) | 216 | $(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS) |
217 | $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \ | 217 | $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \ |
218 | -R .stabstr -R .sysmap | 218 | -R .stabstr |
219 | 219 | ||
220 | # Sort-of dummy rules, that let us format the image we want. | 220 | # Sort-of dummy rules, that let us format the image we want. |
221 | zImage: $(images)/$(zimage-y) $(obj)/zvmlinux | 221 | zImage: $(images)/$(zimage-y) $(obj)/zvmlinux |
diff --git a/arch/ppc/boot/utils/addSystemMap.c b/arch/ppc/boot/utils/addSystemMap.c deleted file mode 100644 index 4654f891b274..000000000000 --- a/arch/ppc/boot/utils/addSystemMap.c +++ /dev/null | |||
@@ -1,186 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <byteswap.h> | ||
4 | #include <sys/types.h> | ||
5 | #include <sys/stat.h> | ||
6 | |||
7 | void xlate( char * inb, char * trb, unsigned len ) | ||
8 | { | ||
9 | unsigned i; | ||
10 | for ( i=0; i<len; ++i ) { | ||
11 | char c = *inb++; | ||
12 | char c1 = c >> 4; | ||
13 | char c2 = c & 0xf; | ||
14 | if ( c1 > 9 ) | ||
15 | c1 = c1 + 'A' - 10; | ||
16 | else | ||
17 | c1 = c1 + '0'; | ||
18 | if ( c2 > 9 ) | ||
19 | c2 = c2 + 'A' - 10; | ||
20 | else | ||
21 | c2 = c2 + '0'; | ||
22 | *trb++ = c1; | ||
23 | *trb++ = c2; | ||
24 | } | ||
25 | *trb = 0; | ||
26 | } | ||
27 | |||
28 | #define ElfHeaderSize (64 * 1024) | ||
29 | #define ElfPages (ElfHeaderSize / 4096) | ||
30 | #define KERNELBASE (0xc0000000) | ||
31 | |||
32 | void get4k( /*istream *inf*/FILE *file, char *buf ) | ||
33 | { | ||
34 | unsigned j; | ||
35 | unsigned num = fread(buf, 1, 4096, file); | ||
36 | for ( j=num; j<4096; ++j ) | ||
37 | buf[j] = 0; | ||
38 | } | ||
39 | |||
40 | void put4k( /*ostream *outf*/FILE *file, char *buf ) | ||
41 | { | ||
42 | fwrite(buf, 1, 4096, file); | ||
43 | } | ||
44 | |||
45 | int main(int argc, char **argv) | ||
46 | { | ||
47 | char inbuf[4096]; | ||
48 | FILE *ramDisk = NULL; | ||
49 | FILE *inputVmlinux = NULL; | ||
50 | FILE *outputVmlinux = NULL; | ||
51 | unsigned i = 0; | ||
52 | unsigned long ramFileLen = 0; | ||
53 | unsigned long ramLen = 0; | ||
54 | unsigned long roundR = 0; | ||
55 | unsigned long kernelLen = 0; | ||
56 | unsigned long actualKernelLen = 0; | ||
57 | unsigned long round = 0; | ||
58 | unsigned long roundedKernelLen = 0; | ||
59 | unsigned long ramStartOffs = 0; | ||
60 | unsigned long ramPages = 0; | ||
61 | unsigned long roundedKernelPages = 0; | ||
62 | if ( argc < 2 ) { | ||
63 | printf("Name of System Map file missing.\n"); | ||
64 | exit(1); | ||
65 | } | ||
66 | |||
67 | if ( argc < 3 ) { | ||
68 | printf("Name of vmlinux file missing.\n"); | ||
69 | exit(1); | ||
70 | } | ||
71 | |||
72 | if ( argc < 4 ) { | ||
73 | printf("Name of vmlinux output file missing.\n"); | ||
74 | exit(1); | ||
75 | } | ||
76 | |||
77 | ramDisk = fopen(argv[1], "r"); | ||
78 | if ( ! ramDisk ) { | ||
79 | printf("System Map file \"%s\" failed to open.\n", argv[1]); | ||
80 | exit(1); | ||
81 | } | ||
82 | inputVmlinux = fopen(argv[2], "r"); | ||
83 | if ( ! inputVmlinux ) { | ||
84 | printf("vmlinux file \"%s\" failed to open.\n", argv[2]); | ||
85 | exit(1); | ||
86 | } | ||
87 | outputVmlinux = fopen(argv[3], "w"); | ||
88 | if ( ! outputVmlinux ) { | ||
89 | printf("output vmlinux file \"%s\" failed to open.\n", argv[3]); | ||
90 | exit(1); | ||
91 | } | ||
92 | fseek(ramDisk, 0, SEEK_END); | ||
93 | ramFileLen = ftell(ramDisk); | ||
94 | fseek(ramDisk, 0, SEEK_SET); | ||
95 | printf("%s file size = %ld\n", argv[1], ramFileLen); | ||
96 | |||
97 | ramLen = ramFileLen; | ||
98 | |||
99 | roundR = 4096 - (ramLen % 4096); | ||
100 | if ( roundR ) { | ||
101 | printf("Rounding System Map file up to a multiple of 4096, adding %ld\n", roundR); | ||
102 | ramLen += roundR; | ||
103 | } | ||
104 | |||
105 | printf("Rounded System Map size is %ld\n", ramLen); | ||
106 | fseek(inputVmlinux, 0, SEEK_END); | ||
107 | kernelLen = ftell(inputVmlinux); | ||
108 | fseek(inputVmlinux, 0, SEEK_SET); | ||
109 | printf("kernel file size = %ld\n", kernelLen); | ||
110 | if ( kernelLen == 0 ) { | ||
111 | printf("You must have a linux kernel specified as argv[2]\n"); | ||
112 | exit(1); | ||
113 | } | ||
114 | |||
115 | actualKernelLen = kernelLen - ElfHeaderSize; | ||
116 | |||
117 | printf("actual kernel length (minus ELF header) = %ld\n", actualKernelLen); | ||
118 | |||
119 | round = actualKernelLen % 4096; | ||
120 | roundedKernelLen = actualKernelLen; | ||
121 | if ( round ) | ||
122 | roundedKernelLen += (4096 - round); | ||
123 | |||
124 | printf("actual kernel length rounded up to a 4k multiple = %ld\n", roundedKernelLen); | ||
125 | |||
126 | ramStartOffs = roundedKernelLen; | ||
127 | ramPages = ramLen / 4096; | ||
128 | |||
129 | printf("System map pages to copy = %ld\n", ramPages); | ||
130 | |||
131 | // Copy 64K ELF header | ||
132 | for (i=0; i<(ElfPages); ++i) { | ||
133 | get4k( inputVmlinux, inbuf ); | ||
134 | put4k( outputVmlinux, inbuf ); | ||
135 | } | ||
136 | |||
137 | |||
138 | |||
139 | roundedKernelPages = roundedKernelLen / 4096; | ||
140 | |||
141 | fseek(inputVmlinux, ElfHeaderSize, SEEK_SET); | ||
142 | |||
143 | { | ||
144 | for ( i=0; i<roundedKernelPages; ++i ) { | ||
145 | get4k( inputVmlinux, inbuf ); | ||
146 | if ( i == 0 ) { | ||
147 | unsigned long * p; | ||
148 | printf("Storing embedded_sysmap_start at 0x3c\n"); | ||
149 | p = (unsigned long *)(inbuf + 0x3c); | ||
150 | |||
151 | #if (BYTE_ORDER == __BIG_ENDIAN) | ||
152 | *p = ramStartOffs; | ||
153 | #else | ||
154 | *p = bswap_32(ramStartOffs); | ||
155 | #endif | ||
156 | |||
157 | printf("Storing embedded_sysmap_end at 0x44\n"); | ||
158 | p = (unsigned long *)(inbuf + 0x44); | ||
159 | #if (BYTE_ORDER == __BIG_ENDIAN) | ||
160 | *p = ramStartOffs + ramFileLen; | ||
161 | #else | ||
162 | *p = bswap_32(ramStartOffs + ramFileLen); | ||
163 | #endif | ||
164 | } | ||
165 | put4k( outputVmlinux, inbuf ); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | { | ||
170 | for ( i=0; i<ramPages; ++i ) { | ||
171 | get4k( ramDisk, inbuf ); | ||
172 | put4k( outputVmlinux, inbuf ); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | |||
177 | fclose(ramDisk); | ||
178 | fclose(inputVmlinux); | ||
179 | fclose(outputVmlinux); | ||
180 | /* Set permission to executable */ | ||
181 | chmod(argv[3], S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); | ||
182 | |||
183 | return 0; | ||
184 | |||
185 | } | ||
186 | |||