diff options
Diffstat (limited to 'arch/powerpc/boot/wrapper')
-rwxr-xr-x | arch/powerpc/boot/wrapper | 53 |
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= | |||
29 | dtb= | 29 | dtb= |
30 | dts= | 30 | dts= |
31 | cacheit= | 31 | cacheit= |
32 | gzip=.gz | ||
32 | 33 | ||
33 | # cross-compilation prefix | 34 | # cross-compilation prefix |
34 | CROSS= | 35 | CROSS= |
@@ -42,7 +43,7 @@ tmpdir=. | |||
42 | usage() { | 43 | usage() { |
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 | ;; |
144 | cuboot*) | ||
145 | gzip= | ||
146 | ;; | ||
140 | esac | 147 | esac |
141 | 148 | ||
142 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" | 149 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" |
143 | if [ -z "$cacheit" -o ! -f "$vmz.gz" -o "$vmz.gz" -ot "$kernel" ]; then | 150 | if [ -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 |
151 | fi | 162 | fi |
152 | 163 | ||
164 | vmz="$vmz$gzip" | ||
165 | |||
153 | case "$platform" in | 166 | case "$platform" in |
154 | uboot) | 167 | uboot|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 |
173 | esac | ||
174 | |||
175 | case "$platform" in | ||
176 | uboot) | ||
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 | ||
176 | addsec $tmp "$vmz.gz" $ksection $object/empty.o | 193 | addsec $tmp "$vmz" $ksection $object/empty.o |
177 | if [ -z "$cacheit" ]; then | 194 | if [ -z "$cacheit" ]; then |
178 | rm -f "$vmz.gz" | 195 | rm -f "$vmz" |
179 | fi | 196 | fi |
180 | 197 | ||
181 | if [ -n "$initrd" ]; then | 198 | if [ -n "$initrd" ]; then |
@@ -191,7 +208,7 @@ fi | |||
191 | 208 | ||
192 | if [ "$platform" != "miboot" ]; then | 209 | if [ "$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 |
196 | fi | 213 | fi |
197 | 214 | ||
@@ -201,7 +218,19 @@ pseries|chrp) | |||
201 | $object/addnote "$ofile" | 218 | $object/addnote "$ofile" |
202 | ;; | 219 | ;; |
203 | pmaccoff) | 220 | pmaccoff) |
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 | ;; |
226 | cuboot*) | ||
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 | ;; | ||
207 | esac | 236 | esac |