aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2016-09-22 02:54:33 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-09-28 00:32:27 -0400
commitf1e510bbb9f265acb4147a3a650882876a76d48b (patch)
tree08127f565c17ac1beb45bf1dd8acb1c82a577436 /arch/powerpc/boot
parenta4da56fbc553ea941f3de6ec55070d62f6957d51 (diff)
powerpc/boot: Add XZ support to the wrapper script
This modifies the wrapper script so that the -Z option takes an argument to specify the compression type. It can either be 'gz', 'xz' or 'none'. The legazy --no-gzip and -z options are still supported and will set the compression to none and gzip respectively, but they are not documented. Only XZ -6 is used for compression rather than XZ -9. Using compression levels higher than 6 requires the decompressor to build a large (64MB) dictionary when decompressing and some environments cannot satisfy such large allocations (e.g. POWER 6 LPAR partition firmware). Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r--arch/powerpc/boot/Makefile7
-rwxr-xr-xarch/powerpc/boot/wrapper61
2 files changed, 50 insertions, 18 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 861348c72519..9fb451d0586e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -225,10 +225,13 @@ CROSSWRAP := -C "$(CROSS_COMPILE)"
225endif 225endif
226endif 226endif
227 227
228compressor-$(CONFIG_KERNEL_GZIP) := gz
229
228# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd 230# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
229quiet_cmd_wrap = WRAP $@ 231quiet_cmd_wrap = WRAP $@
230 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ 232 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \
231 $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux 233 $(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \
234 vmlinux
232 235
233image-$(CONFIG_PPC_PSERIES) += zImage.pseries 236image-$(CONFIG_PPC_PSERIES) += zImage.pseries
234image-$(CONFIG_PPC_POWERNV) += zImage.pseries 237image-$(CONFIG_PPC_POWERNV) += zImage.pseries
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 6681ec3625c9..404b3aabdb4d 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -20,6 +20,8 @@
20# -D dir specify directory containing data files used by script 20# -D dir specify directory containing data files used by script
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# -z use gzip (legacy)
24# -Z zsuffix compression to use (gz, xz or none)
23 25
24# Stop execution if any command fails 26# Stop execution if any command fails
25set -e 27set -e
@@ -38,7 +40,7 @@ dtb=
38dts= 40dts=
39cacheit= 41cacheit=
40binary= 42binary=
41gzip=.gz 43compression=.gz
42pie= 44pie=
43format= 45format=
44 46
@@ -59,7 +61,8 @@ tmpdir=.
59usage() { 61usage() {
60 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2 62 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
61 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2 63 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
62 echo ' [-D datadir] [-W workingdir] [--no-gzip] [vmlinux]' >&2 64 echo ' [-D datadir] [-W workingdir] [-Z (gz|xz|none)]' >&2
65 echo ' [--no-compression] [vmlinux]' >&2
63 exit 1 66 exit 1
64} 67}
65 68
@@ -126,8 +129,24 @@ while [ "$#" -gt 0 ]; do
126 [ "$#" -gt 0 ] || usage 129 [ "$#" -gt 0 ] || usage
127 tmpdir="$1" 130 tmpdir="$1"
128 ;; 131 ;;
132 -z)
133 compression=.gz
134 ;;
135 -Z)
136 shift
137 [ "$#" -gt 0 ] || usage
138 [ "$1" != "gz" -o "$1" != "xz" -o "$1" != "none" ] || usage
139
140 compression=".$1"
141
142 if [ $compression = ".none" ]; then
143 compression=
144 fi
145 ;;
129 --no-gzip) 146 --no-gzip)
130 gzip= 147 # a "feature" of the the wrapper script is that it can be used outside
148 # the kernel tree. So keeping this around for backwards compatibility.
149 compression=
131 ;; 150 ;;
132 -?) 151 -?)
133 usage 152 usage
@@ -140,6 +159,7 @@ while [ "$#" -gt 0 ]; do
140 shift 159 shift
141done 160done
142 161
162
143if [ -n "$dts" ]; then 163if [ -n "$dts" ]; then
144 if [ ! -r "$dts" -a -r "$object/dts/$dts" ]; then 164 if [ ! -r "$dts" -a -r "$object/dts/$dts" ]; then
145 dts="$object/dts/$dts" 165 dts="$object/dts/$dts"
@@ -212,7 +232,7 @@ miboot|uboot*)
212 ;; 232 ;;
213cuboot*) 233cuboot*)
214 binary=y 234 binary=y
215 gzip= 235 compression=
216 case "$platform" in 236 case "$platform" in
217 *-mpc866ads|*-mpc885ads|*-adder875*|*-ep88xc) 237 *-mpc866ads|*-mpc885ads|*-adder875*|*-ep88xc)
218 platformo=$object/cuboot-8xx.o 238 platformo=$object/cuboot-8xx.o
@@ -243,7 +263,7 @@ cuboot*)
243ps3) 263ps3)
244 platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" 264 platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o"
245 lds=$object/zImage.ps3.lds 265 lds=$object/zImage.ps3.lds
246 gzip= 266 compression=
247 ext=bin 267 ext=bin
248 objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data" 268 objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data"
249 ksection=.kernel:vmlinux.bin 269 ksection=.kernel:vmlinux.bin
@@ -310,27 +330,37 @@ mvme7100)
310esac 330esac
311 331
312vmz="$tmpdir/`basename \"$kernel\"`.$ext" 332vmz="$tmpdir/`basename \"$kernel\"`.$ext"
313if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then
314 ${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
315 333
316 strip_size=$(stat -c %s $vmz.$$) 334# Calculate the vmlinux.strip size
335${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
336strip_size=$(stat -c %s $vmz.$$)
317 337
318 if [ -n "$gzip" ]; then 338if [ -z "$cacheit" -o ! -f "$vmz$compression" -o "$vmz$compression" -ot "$kernel" ]; then
339 # recompress the image if we need to
340 case $compression in
341 .xz)
342 xz --check=crc32 -f -6 "$vmz.$$"
343 ;;
344 .gz)
319 gzip -n -f -9 "$vmz.$$" 345 gzip -n -f -9 "$vmz.$$"
320 fi 346 ;;
347 *)
348 # drop the compression suffix so the stripped vmlinux is used
349 compression=
350 ;;
351 esac
321 352
322 if [ -n "$cacheit" ]; then 353 if [ -n "$cacheit" ]; then
323 mv -f "$vmz.$$$gzip" "$vmz$gzip" 354 mv -f "$vmz.$$$compression" "$vmz$compression"
324 else 355 else
325 vmz="$vmz.$$" 356 vmz="$vmz.$$"
326 fi 357 fi
327else 358else
328 # Calculate the vmlinux.strip size
329 ${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
330 strip_size=$(stat -c %s $vmz.$$)
331 rm -f $vmz.$$ 359 rm -f $vmz.$$
332fi 360fi
333 361
362vmz="$vmz$compression"
363
334if [ "$make_space" = "y" ]; then 364if [ "$make_space" = "y" ]; then
335 # Round the size to next higher MB limit 365 # Round the size to next higher MB limit
336 round_size=$(((strip_size + 0xfffff) & 0xfff00000)) 366 round_size=$(((strip_size + 0xfffff) & 0xfff00000))
@@ -346,8 +376,6 @@ if [ "$make_space" = "y" ]; then
346 fi 376 fi
347fi 377fi
348 378
349vmz="$vmz$gzip"
350
351# Extract kernel version information, some platforms want to include 379# Extract kernel version information, some platforms want to include
352# it in the image header 380# it in the image header
353version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ 381version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
@@ -417,6 +445,7 @@ if [ "$platform" != "miboot" ]; then
417 if [ -n "$link_address" ] ; then 445 if [ -n "$link_address" ] ; then
418 text_start="-Ttext $link_address" 446 text_start="-Ttext $link_address"
419 fi 447 fi
448#link everything
420 ${CROSS}ld -m $format -T $lds $text_start $pie -o "$ofile" \ 449 ${CROSS}ld -m $format -T $lds $text_start $pie -o "$ofile" \
421 $platformo $tmp $object/wrapper.a 450 $platformo $tmp $object/wrapper.a
422 rm $tmp 451 rm $tmp