diff options
Diffstat (limited to 'arch/powerpc/boot/wrapper')
-rwxr-xr-x | arch/powerpc/boot/wrapper | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index 39b27e5ef6c1..31147a037728 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper | |||
@@ -21,6 +21,14 @@ | |||
21 | # (default ./arch/powerpc/boot) | 21 | # (default ./arch/powerpc/boot) |
22 | # -W dir specify working directory for temporary files (default .) | 22 | # -W dir specify working directory for temporary files (default .) |
23 | 23 | ||
24 | # Stop execution if any command fails | ||
25 | set -e | ||
26 | |||
27 | # Allow for verbose output | ||
28 | if [ "$V" = 1 ]; then | ||
29 | set -x | ||
30 | fi | ||
31 | |||
24 | # defaults | 32 | # defaults |
25 | kernel= | 33 | kernel= |
26 | ofile=zImage | 34 | ofile=zImage |
@@ -111,7 +119,7 @@ if [ -n "$dts" ]; then | |||
111 | if [ -z "$dtb" ]; then | 119 | if [ -z "$dtb" ]; then |
112 | dtb="$platform.dtb" | 120 | dtb="$platform.dtb" |
113 | fi | 121 | fi |
114 | dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1 | 122 | dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" |
115 | fi | 123 | fi |
116 | 124 | ||
117 | if [ -z "$kernel" ]; then | 125 | if [ -z "$kernel" ]; then |
@@ -149,7 +157,6 @@ cuboot*) | |||
149 | ps3) | 157 | ps3) |
150 | platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" | 158 | platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" |
151 | lds=$object/zImage.ps3.lds | 159 | lds=$object/zImage.ps3.lds |
152 | binary=y | ||
153 | gzip= | 160 | gzip= |
154 | ext=bin | 161 | ext=bin |
155 | objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data" | 162 | objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data" |
@@ -233,7 +240,7 @@ entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | cut -d' ' -f3` | |||
233 | 240 | ||
234 | if [ -n "$binary" ]; then | 241 | if [ -n "$binary" ]; then |
235 | mv "$ofile" "$ofile".elf | 242 | mv "$ofile" "$ofile".elf |
236 | ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin | 243 | ${CROSS}objcopy -O binary "$ofile".elf "$ofile" |
237 | fi | 244 | fi |
238 | 245 | ||
239 | # post-processing needed for some platforms | 246 | # post-processing needed for some platforms |
@@ -246,9 +253,9 @@ coff) | |||
246 | $object/hack-coff "$ofile" | 253 | $object/hack-coff "$ofile" |
247 | ;; | 254 | ;; |
248 | cuboot*) | 255 | cuboot*) |
249 | gzip -f -9 "$ofile".bin | 256 | gzip -f -9 "$ofile" |
250 | mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \ | 257 | mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \ |
251 | $uboot_version -d "$ofile".bin.gz "$ofile" | 258 | $uboot_version -d "$ofile".gz "$ofile" |
252 | ;; | 259 | ;; |
253 | treeboot*) | 260 | treeboot*) |
254 | mv "$ofile" "$ofile.elf" | 261 | mv "$ofile" "$ofile.elf" |
@@ -269,11 +276,11 @@ ps3) | |||
269 | # then copied to offset 0x100. At runtime the bootwrapper program | 276 | # then copied to offset 0x100. At runtime the bootwrapper program |
270 | # copies the 0x100 bytes at __system_reset_kernel to addr 0x100. | 277 | # copies the 0x100 bytes at __system_reset_kernel to addr 0x100. |
271 | 278 | ||
272 | system_reset_overlay=0x`${CROSS}nm "$ofile".elf \ | 279 | system_reset_overlay=0x`${CROSS}nm "$ofile" \ |
273 | | grep ' __system_reset_overlay$' \ | 280 | | grep ' __system_reset_overlay$' \ |
274 | | cut -d' ' -f1` | 281 | | cut -d' ' -f1` |
275 | system_reset_overlay=`printf "%d" $system_reset_overlay` | 282 | system_reset_overlay=`printf "%d" $system_reset_overlay` |
276 | system_reset_kernel=0x`${CROSS}nm "$ofile".elf \ | 283 | system_reset_kernel=0x`${CROSS}nm "$ofile" \ |
277 | | grep ' __system_reset_kernel$' \ | 284 | | grep ' __system_reset_kernel$' \ |
278 | | cut -d' ' -f1` | 285 | | cut -d' ' -f1` |
279 | system_reset_kernel=`printf "%d" $system_reset_kernel` | 286 | system_reset_kernel=`printf "%d" $system_reset_kernel` |
@@ -282,23 +289,15 @@ ps3) | |||
282 | 289 | ||
283 | rm -f "$object/otheros.bld" | 290 | rm -f "$object/otheros.bld" |
284 | 291 | ||
285 | msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ | 292 | ${CROSS}objcopy -O binary "$ofile" "$ofile.bin" |
286 | skip=$overlay_dest seek=$system_reset_kernel \ | ||
287 | count=$overlay_size bs=1 2>&1) | ||
288 | 293 | ||
289 | if [ $? -ne "0" ]; then | 294 | dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ |
290 | echo $msg | 295 | skip=$overlay_dest seek=$system_reset_kernel \ |
291 | exit 1 | 296 | count=$overlay_size bs=1 |
292 | fi | ||
293 | |||
294 | msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ | ||
295 | skip=$system_reset_overlay seek=$overlay_dest \ | ||
296 | count=$overlay_size bs=1 2>&1) | ||
297 | 297 | ||
298 | if [ $? -ne "0" ]; then | 298 | dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ |
299 | echo $msg | 299 | skip=$system_reset_overlay seek=$overlay_dest \ |
300 | exit 2 | 300 | count=$overlay_size bs=1 |
301 | fi | ||
302 | 301 | ||
303 | gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld" | 302 | gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld" |
304 | ;; | 303 | ;; |