From: Albert H. <he...@us...> - 2009-10-25 18:45:44
|
Update of /cvsroot/gc-linux/linux/arch/powerpc/boot In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29988/arch/powerpc/boot Modified Files: Makefile Added Files: wrapper Log Message: Forward to v.2.6.30. Index: Makefile =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/boot/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 25 Oct 2009 18:33:46 -0000 1.9 --- Makefile 25 Oct 2009 18:45:35 -0000 1.10 *************** *** 34,38 **** endif ! BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt DTS_FLAGS ?= -p 1024 --- 34,38 ---- endif ! BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) DTS_FLAGS ?= -p 1024 *************** *** 54,60 **** $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) ! src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ ! $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ ns16550.c serial.c simple_alloc.c div64.S util.S \ gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ --- 54,65 ---- $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) ! libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c ! libfdtheader := fdt.h libfdt.h libfdt_internal.h ! ! $(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o): \ ! $(addprefix $(obj)/,$(libfdtheader)) ! src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ ! $(libfdt) libfdt-wrapper.c \ ns16550.c serial.c simple_alloc.c div64.S util.S \ gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ *************** *** 71,75 **** cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ ! cuboot-acadia.c src-boot := $(src-wlib) $(src-plat) empty.c --- 76,80 ---- cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ ! cuboot-acadia.c cuboot-amigaone.c src-boot := $(src-wlib) $(src-plat) empty.c *************** *** 97,100 **** --- 102,111 ---- $(call cmd,copy_zliblinuxheader) + quiet_cmd_copy_libfdt = COPY $@ + cmd_copy_libfdt = cp $< $@ + + $(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% + $(call cmd,copy_libfdt) + $(obj)/empty.c: @touch $@ *************** *** 104,107 **** --- 115,119 ---- clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ + $(libfdt) $(libfdtheader) \ empty.c zImage.coff.lds zImage.ps3.lds zImage.lds *************** *** 115,118 **** --- 127,132 ---- cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ + $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE + $(call if_changed_dep,bootcc) $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE $(Q)mkdir -p $(dir $@) *************** *** 125,129 **** $(call if_changed,bootar) ! hostprogs-y := addnote addRamDisk hack-coff mktree dtc targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) --- 139,143 ---- $(call if_changed,bootar) ! hostprogs-y := addnote addRamDisk hack-coff mktree targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) *************** *** 134,178 **** wrapper :=$(srctree)/$(src)/wrapper ! wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ $(wrapper) FORCE ############# - # Bits for building dtc - # DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output - - dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o - dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o - dtc-objs := $(addprefix dtc-src/, $(dtc-objs)) - - # prerequisites on generated files needs to be explicit - $(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h - $(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h - - HOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/ - - targets += dtc-src/dtc-parser.tab.c - targets += dtc-src/dtc-lexer.lex.c - - clean-files += dtc-src/dtc-parser.tab.h - - ifdef DTC_GENPARSER - BISON = bison - FLEX = flex - - quiet_cmd_bison = BISON $@ - cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped - quiet_cmd_flex = FLEX $@ - cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped - - $(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE - $(call if_changed,bison) - - $(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c - - $(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE - $(call if_changed,flex) - endif - - ############# # Bits for building various flavours of zImage --- 148,155 ---- wrapper :=$(srctree)/$(src)/wrapper ! wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ $(wrapper) FORCE ############# # Bits for building various flavours of zImage *************** *** 236,240 **** # Board ports in arch/powerpc/platform/52xx/Kconfig ! image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 cuImage.lite5200b # Board ports in arch/powerpc/platform/82xx/Kconfig --- 213,219 ---- # Board ports in arch/powerpc/platform/52xx/Kconfig ! image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 lite5200.dtb ! image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b lite5200b.dtb ! image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 media5200.dtb # Board ports in arch/powerpc/platform/82xx/Kconfig *************** *** 275,278 **** --- 254,260 ---- image-$(CONFIG_PPC_C2K) += cuImage.c2k + # Board port in arch/powerpc/platform/amigaone/Kconfig + image-$(CONFIG_AMIGAONE) += cuImage.amigaone + # For 32-bit powermacs, build the COFF and miboot images # as well as the ELF images. *************** *** 343,348 **** # Rule to build device tree blobs ! $(obj)/%.dtb: $(dtstree)/%.dts $(obj)/dtc ! $(obj)/dtc -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts # If there isn't a platform selected then just strip the vmlinux. --- 325,332 ---- # Rule to build device tree blobs ! DTC = $(objtree)/scripts/dtc/dtc ! ! $(obj)/%.dtb: $(dtstree)/%.dts ! $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts # If there isn't a platform selected then just strip the vmlinux. *************** *** 363,367 **** zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ zImage.iseries zImage.miboot zImage.pmac zImage.pseries \ ! otheros.bld *.dtb # clean up files cached by wrapper --- 347,351 ---- zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ zImage.iseries zImage.miboot zImage.pmac zImage.pseries \ ! simpleImage.* otheros.bld *.dtb # clean up files cached by wrapper --- NEW FILE: wrapper --- #!/bin/sh # Copyright (C) 2006 Paul Mackerras, IBM Corporation <pa...@sa...> # This program may be used under the terms of version 2 of the GNU # General Public License. # This script takes a kernel binary and optionally an initrd image # and/or a device-tree blob, and creates a bootable zImage for a # given platform. # Options: # -o zImage specify output file # -p platform specify platform (links in $platform.o) # -i initrd specify initrd file # -d devtree specify device-tree blob # -s tree.dts specify device-tree source file (needs dtc installed) # -c cache $kernel.strip.gz (use if present & newer, else make) # -C prefix specify command prefix for cross-building tools # (strip, objcopy, ld) # -D dir specify directory containing data files used by script # (default ./arch/powerpc/boot) # -W dir specify working directory for temporary files (default .) # Stop execution if any command fails set -e # Allow for verbose output if [ "$V" = 1 ]; then set -x fi # defaults kernel= ofile=zImage platform=of initrd= dtb= dts= cacheit= binary= gzip=.gz # cross-compilation prefix CROSS= # directory for object and other files used by this script object=arch/powerpc/boot objbin=$object # directory for working files tmpdir=. usage() { echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2 echo ' [-D datadir] [-W workingdir] [--no-gzip] [vmlinux]' >&2 exit 1 } while [ "$#" -gt 0 ]; do case "$1" in -o) shift [ "$#" -gt 0 ] || usage ofile="$1" ;; -p) shift [ "$#" -gt 0 ] || usage platform="$1" ;; -i) shift [ "$#" -gt 0 ] || usage initrd="$1" ;; -d) shift [ "$#" -gt 0 ] || usage dtb="$1" ;; -s) shift [ "$#" -gt 0 ] || usage dts="$1" ;; -c) cacheit=y ;; -C) shift [ "$#" -gt 0 ] || usage CROSS="$1" ;; -D) shift [ "$#" -gt 0 ] || usage object="$1" objbin="$1" ;; -W) shift [ "$#" -gt 0 ] || usage tmpdir="$1" ;; --no-gzip) gzip= ;; -?) usage ;; *) [ -z "$kernel" ] || usage kernel="$1" ;; esac shift done if [ -n "$dts" ]; then if [ ! -r "$dts" -a -r "$object/dts/$dts" ]; then dts="$object/dts/$dts" fi if [ -z "$dtb" ]; then dtb="$platform.dtb" fi $object/dtc -O dtb -o "$dtb" -b 0 "$dts" fi if [ -z "$kernel" ]; then kernel=vmlinux fi platformo=$object/"$platform".o lds=$object/zImage.lds ext=strip objflags=-S tmp=$tmpdir/zImage.$$.o ksection=.kernel:vmlinux.strip isection=.kernel:initrd link_address='0x400000' case "$platform" in pseries) platformo=$object/of.o link_address='0x4000000' ;; pmac|chrp) platformo=$object/of.o ;; coff) platformo=$object/of.o lds=$object/zImage.coff.lds link_address='0x500000' ;; miboot|uboot) # miboot and U-boot want just the bare bits, not an ELF binary ext=bin objflags="-O binary" tmp="$ofile" ksection=image isection=initrd ;; cuboot*) binary=y gzip= case "$platform" in *-mpc866ads|*-mpc885ads|*-adder875*|*-ep88xc) platformo=$object/cuboot-8xx.o ;; *5200*|*-motionpro) platformo=$object/cuboot-52xx.o ;; *-pq2fads|*-ep8248e|*-mpc8272*|*-storcenter) platformo=$object/cuboot-pq2.o ;; *-mpc824*) platformo=$object/cuboot-824x.o ;; *-mpc83*|*-asp834x*) platformo=$object/cuboot-83xx.o ;; *-tqm8541|*-mpc8560*|*-tqm8560|*-tqm8555|*-ksi8560*) platformo=$object/cuboot-85xx-cpm2.o ;; *-mpc85*|*-tqm85*|*-sbc85*) platformo=$object/cuboot-85xx.o ;; *-amigaone) link_address='0x800000' ;; esac ;; ps3) platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" lds=$object/zImage.ps3.lds gzip= ext=bin objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data" ksection=.kernel:vmlinux.bin isection=.kernel:initrd link_address='' ;; ep88xc|ep405|ep8248e) platformo="$object/fixed-head.o $object/$platform.o" binary=y ;; adder875-redboot) platformo="$object/fixed-head.o $object/redboot-8xx.o" binary=y ;; simpleboot-virtex405-*) platformo="$object/virtex405-head.o $object/simpleboot.o $object/virtex.o" binary=y ;; simpleboot-virtex440-*) platformo="$object/fixed-head.o $object/simpleboot.o $object/virtex.o" binary=y ;; simpleboot-*) platformo="$object/fixed-head.o $object/simpleboot.o" binary=y ;; asp834x-redboot) platformo="$object/fixed-head.o $object/redboot-83xx.o" binary=y ;; esac vmz="$tmpdir/`basename \"$kernel\"`.$ext" if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then ${CROSS}objcopy $objflags "$kernel" "$vmz.$$" if [ -n "$gzip" ]; then gzip -f -9 "$vmz.$$" fi if [ -n "$cacheit" ]; then mv -f "$vmz.$$$gzip" "$vmz$gzip" else vmz="$vmz.$$" fi fi vmz="$vmz$gzip" # Extract kernel version information, some platforms want to include # it in the image header version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ cut -d' ' -f3` if [ -n "$version" ]; then uboot_version="-n Linux-$version" fi # physical offset of kernel image membase=`${CROSS}objdump -p "$kernel" | grep -m 1 LOAD | awk '{print $7}'` case "$platform" in uboot) rm -f "$ofile" mkimage -A ppc -O linux -T kernel -C gzip -a $membase -e $membase \ $uboot_version -d "$vmz" "$ofile" if [ -z "$cacheit" ]; then rm -f "$vmz" fi exit 0 ;; esac addsec() { ${CROSS}objcopy $4 $1 \ --add-section=$3="$2" \ --set-section-flags=$3=contents,alloc,load,readonly,data } addsec $tmp "$vmz" $ksection $object/empty.o if [ -z "$cacheit" ]; then rm -f "$vmz" fi if [ -n "$initrd" ]; then addsec $tmp "$initrd" $isection fi if [ -n "$dtb" ]; then addsec $tmp "$dtb" .kernel:dtb if [ -n "$dts" ]; then rm $dtb fi fi if [ "$platform" != "miboot" ]; then if [ -n "$link_address" ] ; then text_start="-Ttext $link_address --defsym _start=$link_address" fi ${CROSS}ld -m elf32ppc -T $lds $text_start -o "$ofile" \ $platformo $tmp $object/wrapper.a rm $tmp fi # Some platforms need the zImage's entry point and base address base=0x`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1` entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | cut -d' ' -f3` if [ -n "$binary" ]; then mv "$ofile" "$ofile".elf ${CROSS}objcopy -O binary "$ofile".elf "$ofile" fi # post-processing needed for some platforms case "$platform" in pseries|chrp) $objbin/addnote "$ofile" ;; coff) ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" $objbin/hack-coff "$ofile" ;; cuboot*) gzip -f -9 "$ofile" mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \ $uboot_version -d "$ofile".gz "$ofile" ;; treeboot*) mv "$ofile" "$ofile.elf" $objbin/mktree "$ofile.elf" "$ofile" "$base" "$entry" if [ -z "$cacheit" ]; then rm -f "$ofile.elf" fi exit 0 ;; ps3) # The ps3's loader supports loading a gzipped binary image from flash # rom to ram addr zero. The loader then enters the system reset # vector at addr 0x100. A bootwrapper overlay is used to arrange for # a binary image of the kernel to be at addr zero, and yet have a # suitable bootwrapper entry at 0x100. To construct the final rom # image 512 bytes from offset 0x100 is copied to the bootwrapper # place holder at symbol __system_reset_kernel. The 512 bytes of the # bootwrapper entry code at symbol __system_reset_overlay is then # copied to offset 0x100. At runtime the bootwrapper program copies # the data at __system_reset_kernel back to addr 0x100. system_reset_overlay=0x`${CROSS}nm "$ofile" \ | grep ' __system_reset_overlay$' \ | cut -d' ' -f1` system_reset_overlay=`printf "%d" $system_reset_overlay` system_reset_kernel=0x`${CROSS}nm "$ofile" \ | grep ' __system_reset_kernel$' \ | cut -d' ' -f1` system_reset_kernel=`printf "%d" $system_reset_kernel` overlay_dest="256" overlay_size="512" ${CROSS}objcopy -O binary "$ofile" "$ofile.bin" dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ skip=$overlay_dest seek=$system_reset_kernel \ count=$overlay_size bs=1 dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ skip=$system_reset_overlay seek=$overlay_dest \ count=$overlay_size bs=1 odir="$(dirname "$ofile.bin")" rm -f "$odir/otheros.bld" gzip --force -9 --stdout "$ofile.bin" > "$odir/otheros.bld" ;; esac |