diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2007-07-03 19:07:18 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-10 07:56:40 -0400 |
commit | bafdb645779c63300763acb383f7b9dd2d427228 (patch) | |
tree | 57a25d02c09a426dda4c45db50f63089a2f5a19d /arch/powerpc/boot/wrapper | |
parent | 76a5b8bb3525b63db137c714cf9ad5b3b99e75f0 (diff) |
[POWERPC] PS3: Bootwrapper support.
Add support to build the PS3 flash rom image and remove some unneeded
lmb calls.
The PS3's lv1 loader supports loading gzipped binary images from flash
rom to addr zero. The loader enters the image at addr 0x100.
In this implementation a bootwrapper overlay is use to arrange for the
kernel to be loaded to addr zero and to have a suitable bootwrapper
entry at 0x100. To construct the rom image, 0x100 bytes from offset
0x100 in the kernel is copied to the bootwrapper symbol
__system_reset_kernel. The 0x100 bytes at the bootwrapper symbol
__system_reset_overlay is then copied to offset 0x100. At runtime the
bootwrapper program copies the 0x100 bytes at __system_reset_kernel to
addr 0x100.
zImage.ps3 is a wrapped image that contains a flat device tree, an lv1
compatible entry point, and an optional initrd. otheros.bld is the gzip
compresed rom image built from zImage.ps3. otheros.bld is suitable for
programming into the PS3 boot flash memory.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/wrapper')
-rwxr-xr-x | arch/powerpc/boot/wrapper | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index da77adc73078..65f685479175 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper | |||
@@ -144,6 +144,15 @@ miboot|uboot) | |||
144 | cuboot*) | 144 | cuboot*) |
145 | gzip= | 145 | gzip= |
146 | ;; | 146 | ;; |
147 | ps3) | ||
148 | platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" | ||
149 | lds=$object/zImage.ps3.lds | ||
150 | gzip= | ||
151 | ext=bin | ||
152 | objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data" | ||
153 | ksection=.kernel:vmlinux.bin | ||
154 | isection=.kernel:initrd | ||
155 | ;; | ||
147 | esac | 156 | esac |
148 | 157 | ||
149 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" | 158 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" |
@@ -239,4 +248,50 @@ treeboot*) | |||
239 | fi | 248 | fi |
240 | exit 0 | 249 | exit 0 |
241 | ;; | 250 | ;; |
251 | ps3) | ||
252 | # The ps3's loader supports loading gzipped binary images from flash | ||
253 | # rom to addr zero. The loader enters the image at addr 0x100. A | ||
254 | # bootwrapper overlay is use to arrange for the kernel to be loaded | ||
255 | # to addr zero and to have a suitable bootwrapper entry at 0x100. | ||
256 | # To construct the rom image, 0x100 bytes from offset 0x100 in the | ||
257 | # kernel is copied to the bootwrapper symbol __system_reset_kernel. | ||
258 | # The 0x100 bytes at the bootwrapper symbol __system_reset_overlay is | ||
259 | # then copied to offset 0x100. At runtime the bootwrapper program | ||
260 | # copies the 0x100 bytes at __system_reset_kernel to addr 0x100. | ||
261 | |||
262 | system_reset_overlay=0x`${CROSS}nm "$ofile" \ | ||
263 | | grep ' __system_reset_overlay$' \ | ||
264 | | cut -d' ' -f1` | ||
265 | system_reset_overlay=`printf "%d" $system_reset_overlay` | ||
266 | system_reset_kernel=0x`${CROSS}nm "$ofile" \ | ||
267 | | grep ' __system_reset_kernel$' \ | ||
268 | | cut -d' ' -f1` | ||
269 | system_reset_kernel=`printf "%d" $system_reset_kernel` | ||
270 | overlay_dest="256" | ||
271 | overlay_size="256" | ||
272 | |||
273 | rm -f "$object/otheros.bld" | ||
274 | |||
275 | ${CROSS}objcopy -O binary "$ofile" "$ofile.bin" | ||
276 | |||
277 | msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ | ||
278 | skip=$overlay_dest seek=$system_reset_kernel \ | ||
279 | count=$overlay_size bs=1 2>&1) | ||
280 | |||
281 | if [ $? -ne "0" ]; then | ||
282 | echo $msg | ||
283 | exit 1 | ||
284 | fi | ||
285 | |||
286 | msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ | ||
287 | skip=$system_reset_overlay seek=$overlay_dest \ | ||
288 | count=$overlay_size bs=1 2>&1) | ||
289 | |||
290 | if [ $? -ne "0" ]; then | ||
291 | echo $msg | ||
292 | exit 2 | ||
293 | fi | ||
294 | |||
295 | gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld" | ||
296 | ;; | ||
242 | esac | 297 | esac |