Lines Matching +full:ext +full:- +full:reset +full:- +full:output

2 # SPDX-License-Identifier: GPL-2.0-only
7 # and/or a device-tree blob, and creates a bootable zImage for a
11 # -o zImage specify output file
12 # -p platform specify platform (links in $platform.o)
13 # -i initrd specify initrd file
14 # -d devtree specify device-tree blob
15 # -s tree.dts specify device-tree source file (needs dtc installed)
16 # -e esm_blob specify ESM blob for secure images
17 # -c cache $kernel.strip.gz (use if present & newer, else make)
18 # -C prefix specify command prefix for cross-building tools
20 # -D dir specify directory containing data files used by script
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)
27 set -e
29 # Allow for verbose output
31 set -x
32 map="-Map wrapper.map"
52 # cross-compilation prefix
67 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
68 echo ' [-d devtree] [-s tree.dts] [-e esm_blob]' >&2
69 echo ' [-c] [-C cross-prefix] [-D datadir] [-W workingdir]' >&2
70 echo ' [-Z (gz|xz|none)] [--no-compression] [vmlinux]' >&2
83 if [ $? -ne "0" ]; then
87 set -e
91 while [ "$#" -gt 0 ]; do
93 -o)
95 [ "$#" -gt 0 ] || usage
98 -p)
100 [ "$#" -gt 0 ] || usage
103 -i)
105 [ "$#" -gt 0 ] || usage
108 -d)
110 [ "$#" -gt 0 ] || usage
113 -e)
115 [ "$#" -gt 0 ] || usage
118 -s)
120 [ "$#" -gt 0 ] || usage
123 -c)
126 -C)
128 [ "$#" -gt 0 ] || usage
131 -D)
133 [ "$#" -gt 0 ] || usage
137 -W)
139 [ "$#" -gt 0 ] || usage
142 -z)
146 -Z)
148 [ "$#" -gt 0 ] || usage
149 … [ "$1" != "gz" -o "$1" != "xz" -o "$1" != "lzma" -o "$1" != "lzo" -o "$1" != "none" ] || usage
162 --no-gzip)
168 -?)
172 [ -z "$kernel" ] || usage
180 if [ -n "$dts" ]; then
181 if [ ! -r "$dts" -a -r "$object/dts/$dts" ]; then
184 if [ -z "$dtb" ]; then
187 $dtc -O dtb -o "$dtb" -b 0 "$dts"
190 if [ -z "$kernel" ]; then
194 LC_ALL=C elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`"
196 elf64-powerpcle) format=elf64lppc ;;
197 elf64-powerpc) format=elf32ppc ;;
198 elf32-powerpc) format=elf32ppc ;;
203 # Poached from scripts/ld-version.sh, but we don't want to call that because
209 gsub("-.*", "");
216 # Do not include PT_INTERP segment when linking pie. Non-pie linking
218 LD_VERSION=$(${CROSS}ld --version | ld_version)
220 if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VERSION" ] ; then
221 nodl="--no-dynamic-linker"
226 ext=strip
227 objflags=-S
236 if [ -n "$esm_blob" -a "$platform" != "pseries" ]; then
237 echo "ESM blob not support on non-pseries platforms" >&2
247 platformo="$object/pseries-head.o $object/of.o $object/epapr.o"
251 pie=-pie
272 # miboot and U-boot want just the bare bits, not an ELF binary
273 ext=bin
274 objflags="-O binary"
283 *-mpc866ads|*-mpc885ads|*-adder875*|*-ep88xc)
284 platformo=$object/cuboot-8xx.o
286 *5200*|*-motionpro)
287 platformo=$object/cuboot-52xx.o
289 *-pq2fads|*-ep8248e|*-mpc8272*|*-storcenter)
290 platformo=$object/cuboot-pq2.o
292 *-mpc824*)
293 platformo=$object/cuboot-824x.o
295 *-mpc83*|*-asp834x*)
296 platformo=$object/cuboot-83xx.o
298 *-tqm8541|*-mpc8560*|*-tqm8560|*-tqm8555|*-ksi8560*)
299 platformo=$object/cuboot-85xx-cpm2.o
301 *-mpc85*|*-tqm85*)
302 platformo=$object/cuboot-85xx.o
304 *-amigaone)
310 platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o"
313 ext=bin
314 objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data"
322 platformo="$object/fixed-head.o $object/$platform.o"
325 adder875-redboot)
326 platformo="$object/fixed-head.o $object/redboot-8xx.o"
329 simpleboot-*)
330 platformo="$object/fixed-head.o $object/simpleboot.o"
333 asp834x-redboot)
334 platformo="$object/fixed-head.o $object/redboot-83xx.o"
339 platformo=$object/cuboot-85xx.o
343 platformo="$object/$platform-head.o $object/$platform.o"
347 platformo="$object/fixed-head.o $object/$platform.o"
350 treeboot-currituck)
353 treeboot-akebono)
356 treeboot-iss4xx-mpic)
357 platformo="$object/treeboot-iss4xx.o"
360 platformo="$object/pseries-head.o $object/epapr.o $object/epapr-wrapper.o"
362 pie=-pie
363 notext='-z notext'
364 rodynamic=$(if ${CROSS}ld -V 2>&1 | grep -q LLD ; then echo "-z rodynamic"; fi)
367 platformo="$object/fixed-head.o $object/mvme5100.o"
371 platformo="$object/motload-head.o $object/mvme7100.o"
377 vmz="$tmpdir/`basename \"$kernel\"`.$ext"
381 strip_size=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" "$vmz.$$")
383 if [ -z "$cacheit" -o ! -f "$vmz$compression" -o "$vmz$compression" -ot "$kernel" ]; then
387 xz --check=crc32 -f -6 "$vmz.$$"
390 gzip -n -f -9 "$vmz.$$"
393 xz --format=lzma -f -6 "$vmz.$$"
396 lzop -f -9 "$vmz.$$"
405 if [ -n "$cacheit" ]; then
406 mv -f "$vmz.$$$compression" "$vmz$compression"
411 rm -f $vmz.$$
423 if [ $link_addr -lt $strip_size ]; then
433 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
434 cut -d' ' -f3`
435 if [ -n "$version" ]; then
436 uboot_version="-n Linux-$version"
440 membase=`${CROSS}objdump -p "$kernel" | grep -m 1 LOAD | awk '{print $7}'`
444 rm -f "$ofile"
445 ${MKIMAGE} -A ppc -O linux -T kernel -C $uboot_comp -a $membase -e $membase \
446 $uboot_version -d "$vmz" "$ofile"
447 if [ -z "$cacheit" ]; then
448 rm -f "$vmz"
452 uboot-obs600)
453 rm -f "$ofile"
456 if [ -n "$initrd" ]; then
462 ${MKIMAGE} -A ppc -O linux -T multi -C gzip -a $membase -e $membase \
463 $uboot_version -d "$vmz":"$real_rd":"$dtb" "$ofile"
464 if [ -z "$initrd" ]; then
465 rm -f "$real_rd"
467 if [ -z "$cacheit" ]; then
468 rm -f "$vmz"
476 --add-section=$3="$2" \
477 --set-section-flags=$3=contents,alloc,load,readonly,data
481 if [ -z "$cacheit" ]; then
482 rm -f "$vmz"
485 if [ -n "$initrd" ]; then
489 if [ -n "$dtb" ]; then
491 if [ -n "$dts" ]; then
496 if [ -n "$esm_blob" ]; then
501 if [ -n "$link_address" ] ; then
502 text_start="-Ttext $link_address"
505 ${CROSS}ld -m $format -T $lds $text_start $pie $nodl $rodynamic $notext -o "$ofile" $map \
511 base=0x`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
512 entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | cut -d' ' -f3`
514 if [ -n "$binary" ]; then
516 ${CROSS}objcopy -O binary "$ofile".elf "$ofile"
519 # post-processing needed for some platforms
525 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
526 $objbin/hack-coff "$ofile"
529 gzip -n -f -9 "$ofile"
530 ${MKIMAGE} -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
531 $uboot_version -d "$ofile".gz "$ofile"
536 if [ -z "$cacheit" ]; then
537 rm -f "$ofile.elf"
543 # rom to ram addr zero. The loader then enters the system reset
555 | cut -d' ' -f1`
559 | cut -d' ' -f1`
564 ${CROSS}objcopy -O binary "$ofile" "$ofile.bin"
579 # reached, then enter the system reset vector of the partially decompressed
581 rm -f "$odir"/{otheros,otheros-too-big}.bld
582 size=$(${CROSS}nm --no-sort --radix=d "$ofile" | egrep ' _end$' | cut -d' ' -f1)
584 if [ $size -gt $((0x1000000)) ]; then
585 bld="otheros-too-big.bld"
587 gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld"