diff options
author | Paul Mackerras <paulus@samba.org> | 2008-10-20 13:42:42 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-21 00:19:13 -0400 |
commit | 0dcd440120ef12879ff34fc78d7e4abf171c79e4 (patch) | |
tree | 138849b6a25f3d185b59f8de15937d43a30a97ba /arch | |
parent | fe55249d17f7979cf9bbc58e38e9ceaf1918b415 (diff) |
powerpc: Revert CHRP boot wrapper to real-base = 12MB on 32-bit
Commit 9b09c6d909dfd8de96b99b9b9c808b94b0a71614 ("powerpc: Change the
default link address for pSeries zImage kernels") changed the
real-base value in the CHRP note added by addnote to the zImage from
12MB to 32MB. It turns out that this causes unnecessary extra reboots
on old 32-bit CHRP machines. This therefore adds a -r flag to addnote
to allow us to specify what real-base value it should put in the CHRP
note, and adjusts the wrapper script to pass -r c00000 to addnote when
making a zImage for a CHRP machine. Also, CHRP machines ignore the
RPA note, so we don't need to arrange for it to be the same as the
kernel's.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/boot/addnote.c | 41 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 5 |
2 files changed, 31 insertions, 15 deletions
diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c index dcc9ab2ca82..3091d1d21ae 100644 --- a/arch/powerpc/boot/addnote.c +++ b/arch/powerpc/boot/addnote.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * as published by the Free Software Foundation; either version | 11 | * as published by the Free Software Foundation; either version |
12 | * 2 of the License, or (at your option) any later version. | 12 | * 2 of the License, or (at your option) any later version. |
13 | * | 13 | * |
14 | * Usage: addnote zImage [note.elf] | 14 | * Usage: addnote [-r realbase] zImage [note.elf] |
15 | * | 15 | * |
16 | * If note.elf is supplied, it is the name of an ELF file that contains | 16 | * If note.elf is supplied, it is the name of an ELF file that contains |
17 | * an RPA note to use instead of the built-in one. Alternatively, the | 17 | * an RPA note to use instead of the built-in one. Alternatively, the |
@@ -153,18 +153,31 @@ unsigned char *read_rpanote(const char *fname, int *nnp) | |||
153 | int | 153 | int |
154 | main(int ac, char **av) | 154 | main(int ac, char **av) |
155 | { | 155 | { |
156 | int fd, n, i; | 156 | int fd, n, i, ai; |
157 | int ph, ps, np; | 157 | int ph, ps, np; |
158 | int nnote, nnote2, ns; | 158 | int nnote, nnote2, ns; |
159 | unsigned char *rpap; | 159 | unsigned char *rpap; |
160 | 160 | char *p, *endp; | |
161 | if (ac != 2 && ac != 3) { | 161 | |
162 | fprintf(stderr, "Usage: %s elf-file [rpanote.elf]\n", av[0]); | 162 | ai = 1; |
163 | if (ac >= ai + 2 && strcmp(av[ai], "-r") == 0) { | ||
164 | /* process -r realbase */ | ||
165 | p = av[ai + 1]; | ||
166 | descr[1] = strtol(p, &endp, 16); | ||
167 | if (endp == p || *endp != 0) { | ||
168 | fprintf(stderr, "Can't parse -r argument '%s' as hex\n", | ||
169 | p); | ||
170 | exit(1); | ||
171 | } | ||
172 | ai += 2; | ||
173 | } | ||
174 | if (ac != ai + 1 && ac != ai + 2) { | ||
175 | fprintf(stderr, "Usage: %s [-r realbase] elf-file [rpanote.elf]\n", av[0]); | ||
163 | exit(1); | 176 | exit(1); |
164 | } | 177 | } |
165 | fd = open(av[1], O_RDWR); | 178 | fd = open(av[ai], O_RDWR); |
166 | if (fd < 0) { | 179 | if (fd < 0) { |
167 | perror(av[1]); | 180 | perror(av[ai]); |
168 | exit(1); | 181 | exit(1); |
169 | } | 182 | } |
170 | 183 | ||
@@ -184,12 +197,12 @@ main(int ac, char **av) | |||
184 | if (buf[E_IDENT+EI_CLASS] != ELFCLASS32 | 197 | if (buf[E_IDENT+EI_CLASS] != ELFCLASS32 |
185 | || buf[E_IDENT+EI_DATA] != ELFDATA2MSB) { | 198 | || buf[E_IDENT+EI_DATA] != ELFDATA2MSB) { |
186 | fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n", | 199 | fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n", |
187 | av[1]); | 200 | av[ai]); |
188 | exit(1); | 201 | exit(1); |
189 | } | 202 | } |
190 | 203 | ||
191 | if (ac == 3) | 204 | if (ac == ai + 2) |
192 | rpap = read_rpanote(av[2], &nnote2); | 205 | rpap = read_rpanote(av[ai + 1], &nnote2); |
193 | 206 | ||
194 | ph = GET_32BE(buf, E_PHOFF); | 207 | ph = GET_32BE(buf, E_PHOFF); |
195 | ps = GET_16BE(buf, E_PHENTSIZE); | 208 | ps = GET_16BE(buf, E_PHENTSIZE); |
@@ -202,7 +215,7 @@ main(int ac, char **av) | |||
202 | for (i = 0; i < np; ++i) { | 215 | for (i = 0; i < np; ++i) { |
203 | if (GET_32BE(buf, ph + PH_TYPE) == PT_NOTE) { | 216 | if (GET_32BE(buf, ph + PH_TYPE) == PT_NOTE) { |
204 | fprintf(stderr, "%s already has a note entry\n", | 217 | fprintf(stderr, "%s already has a note entry\n", |
205 | av[1]); | 218 | av[ai]); |
206 | exit(0); | 219 | exit(0); |
207 | } | 220 | } |
208 | ph += ps; | 221 | ph += ps; |
@@ -260,18 +273,18 @@ main(int ac, char **av) | |||
260 | exit(1); | 273 | exit(1); |
261 | } | 274 | } |
262 | if (i < n) { | 275 | if (i < n) { |
263 | fprintf(stderr, "%s: write truncated\n", av[1]); | 276 | fprintf(stderr, "%s: write truncated\n", av[ai]); |
264 | exit(1); | 277 | exit(1); |
265 | } | 278 | } |
266 | 279 | ||
267 | exit(0); | 280 | exit(0); |
268 | 281 | ||
269 | notelf: | 282 | notelf: |
270 | fprintf(stderr, "%s does not appear to be an ELF file\n", av[1]); | 283 | fprintf(stderr, "%s does not appear to be an ELF file\n", av[ai]); |
271 | exit(1); | 284 | exit(1); |
272 | 285 | ||
273 | nospace: | 286 | nospace: |
274 | fprintf(stderr, "sorry, I can't find space in %s to put the note\n", | 287 | fprintf(stderr, "sorry, I can't find space in %s to put the note\n", |
275 | av[1]); | 288 | av[ai]); |
276 | exit(1); | 289 | exit(1); |
277 | } | 290 | } |
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index ee0dc41d7c5..f39073511a4 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper | |||
@@ -306,11 +306,14 @@ fi | |||
306 | 306 | ||
307 | # post-processing needed for some platforms | 307 | # post-processing needed for some platforms |
308 | case "$platform" in | 308 | case "$platform" in |
309 | pseries|chrp) | 309 | pseries) |
310 | ${CROSS}objcopy -O binary -j .fakeelf "$kernel" "$ofile".rpanote | 310 | ${CROSS}objcopy -O binary -j .fakeelf "$kernel" "$ofile".rpanote |
311 | $objbin/addnote "$ofile" "$ofile".rpanote | 311 | $objbin/addnote "$ofile" "$ofile".rpanote |
312 | rm -r "$ofile".rpanote | 312 | rm -r "$ofile".rpanote |
313 | ;; | 313 | ;; |
314 | chrp) | ||
315 | $objbin/addnote -r c00000 "$ofile" | ||
316 | ;; | ||
314 | coff) | 317 | coff) |
315 | ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" | 318 | ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" |
316 | $objbin/hack-coff "$ofile" | 319 | $objbin/hack-coff "$ofile" |