aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/boot/wrapper')
-rwxr-xr-xarch/powerpc/boot/wrapper53
1 files changed, 41 insertions, 12 deletions
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 024e4d425c59..5cedd901201f 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -29,6 +29,7 @@ initrd=
29dtb= 29dtb=
30dts= 30dts=
31cacheit= 31cacheit=
32gzip=.gz
32 33
33# cross-compilation prefix 34# cross-compilation prefix
34CROSS= 35CROSS=
@@ -42,7 +43,7 @@ tmpdir=.
42usage() { 43usage() {
43 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2 44 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
44 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2 45 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
45 echo ' [-D datadir] [-W workingdir] [vmlinux]' >&2 46 echo ' [-D datadir] [-W workingdir] [--no-gzip] [vmlinux]' >&2
46 exit 1 47 exit 1
47} 48}
48 49
@@ -91,6 +92,9 @@ while [ "$#" -gt 0 ]; do
91 [ "$#" -gt 0 ] || usage 92 [ "$#" -gt 0 ] || usage
92 tmpdir="$1" 93 tmpdir="$1"
93 ;; 94 ;;
95 --no-gzip)
96 gzip=
97 ;;
94 -?) 98 -?)
95 usage 99 usage
96 ;; 100 ;;
@@ -137,31 +141,44 @@ miboot|uboot)
137 ksection=image 141 ksection=image
138 isection=initrd 142 isection=initrd
139 ;; 143 ;;
144cuboot*)
145 gzip=
146 ;;
140esac 147esac
141 148
142vmz="$tmpdir/`basename \"$kernel\"`.$ext" 149vmz="$tmpdir/`basename \"$kernel\"`.$ext"
143if [ -z "$cacheit" -o ! -f "$vmz.gz" -o "$vmz.gz" -ot "$kernel" ]; then 150if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then
144 ${CROSS}objcopy $objflags "$kernel" "$vmz.$$" 151 ${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
145 gzip -f -9 "$vmz.$$" 152
153 if [ -n "$gzip" ]; then
154 gzip -f -9 "$vmz.$$"
155 fi
156
146 if [ -n "$cacheit" ]; then 157 if [ -n "$cacheit" ]; then
147 mv -f "$vmz.$$.gz" "$vmz.gz" 158 mv -f "$vmz.$$$gzip" "$vmz$gzip"
148 else 159 else
149 vmz="$vmz.$$" 160 vmz="$vmz.$$"
150 fi 161 fi
151fi 162fi
152 163
164vmz="$vmz$gzip"
165
153case "$platform" in 166case "$platform" in
154uboot) 167uboot|cuboot*)
155 rm -f "$ofile"
156 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ 168 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
157 cut -d' ' -f3` 169 cut -d' ' -f3`
158 if [ -n "$version" ]; then 170 if [ -n "$version" ]; then
159 version="-n Linux-$version" 171 version="-n Linux-$version"
160 fi 172 fi
173esac
174
175case "$platform" in
176uboot)
177 rm -f "$ofile"
161 mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \ 178 mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
162 $version -d "$vmz.gz" "$ofile" 179 $version -d "$vmz" "$ofile"
163 if [ -z "$cacheit" ]; then 180 if [ -z "$cacheit" ]; then
164 rm -f $vmz.gz 181 rm -f "$vmz"
165 fi 182 fi
166 exit 0 183 exit 0
167 ;; 184 ;;
@@ -173,9 +190,9 @@ addsec() {
173 --set-section-flags=$3=contents,alloc,load,readonly,data 190 --set-section-flags=$3=contents,alloc,load,readonly,data
174} 191}
175 192
176addsec $tmp "$vmz.gz" $ksection $object/empty.o 193addsec $tmp "$vmz" $ksection $object/empty.o
177if [ -z "$cacheit" ]; then 194if [ -z "$cacheit" ]; then
178 rm -f "$vmz.gz" 195 rm -f "$vmz"
179fi 196fi
180 197
181if [ -n "$initrd" ]; then 198if [ -n "$initrd" ]; then
@@ -191,7 +208,7 @@ fi
191 208
192if [ "$platform" != "miboot" ]; then 209if [ "$platform" != "miboot" ]; then
193 ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \ 210 ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
194 $object/crt0.o $platformo $tmp $object/wrapper.a 211 $platformo $tmp $object/wrapper.a
195 rm $tmp 212 rm $tmp
196fi 213fi
197 214
@@ -201,7 +218,19 @@ pseries|chrp)
201 $object/addnote "$ofile" 218 $object/addnote "$ofile"
202 ;; 219 ;;
203pmaccoff) 220pmaccoff)
204 ${CROSS}objcopy -O aixcoff-rs6000 --set-start 0x500000 "$ofile" 221 entry=`objdump -f "$ofile" | grep '^start address ' | \
222 cut -d' ' -f3`
223 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
205 $object/hack-coff "$ofile" 224 $object/hack-coff "$ofile"
206 ;; 225 ;;
226cuboot*)
227 base=`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
228 entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | \
229 cut -d' ' -f3`
230 mv "$ofile" "$ofile".elf
231 ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin
232 gzip -f -9 "$ofile".bin
233 mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
234 $version -d "$ofile".bin.gz "$ofile"
235 ;;
207esac 236esac