#!/bin/sh # ####################################################### # # BuildLinux # # Version: 1.1 # Date: 2001/05/31 # Firstdate:2000/01/28 # Author: FP # Copyright:(c) 2000,2001 VAS GmbH # ####################################################### # $execute : execute path for cross tools # $linux : root to linux kernel sources # $kernel : where to store cross kernels # $host : build tools to run on host system # $target : build tools to create code for target system execute=/Data2/Projekte/CrossPPC/bin linux=/Data2/LinuxPPC/usr/src/linux kernel=/Data2/Projekte/DNC/CrossGCC/Kernels # run cross compiler on host host=i686-gnu/linux # for target system: embedded application binary interface #target=powerpc-motorola-eabi #problems compiling linux kernels, so switch to linux target=powerpc-linux echo "host="$host", target="$target echo "execute="$execute echo "linux="$linux echo "kernel="$kernel if test -d $execute ; then echo "executable dir "$execute" exists" else echo "executable dir "$execute" not found" exit -1 fi # add cross utils to PATH if test -z "$(echo $PATH | grep $execute)" ; then echo "adding "$execute' to $PATH' PATH=$PATH':'$execute echo '$PATH='$PATH else echo $execute' already in $PATH' fi cd $linux if test -z "$OFFSET" ; then OFFSET=10000 fi if test "$1" == "initrd" ; then if test "$2" == "make" ; then echo "building zvmlinux.initrd" make zImage.initrd 2>&1 | tee make.out fi echo "adjusting zvmlinux.initrd using OFFSET="$OFFSET cp -vb $linux/arch/ppc/mbxboot/zvmlinux.initrd $kernel/ LOADADDR=$($target-objdump -h $kernel/zvmlinux.initrd | grep .text | awk '{print toupper($4)}') IMAGEOFFSET=$($target-objdump -h $kernel/zvmlinux.initrd | grep image | awk '{print toupper($6)}') INITRDOFFSET=$($target-objdump -h $kernel/zvmlinux.initrd | grep initrd | awk '{print toupper($6)}') IMAGEVMA=$(echo "obase=16;ibase=16;"$IMAGEOFFSET"+"$LOADADDR"-"$OFFSET | bc) INITRDVMA=$(echo "obase=16;ibase=16;"$INITRDOFFSET"+"$LOADADDR"-"$OFFSET | bc) echo "LOADADDR="$LOADADDR echo "IMAGEOFFSET="$IMAGEOFFSET echo "INITRDOFFSET="$INITRDOFFSET echo "IMAGEVMA="$IMAGEVMA echo "INITRDVMA="$INITRDVMA $target-objcopy \ --set-section-flags=image=contents,alloc,load,readonly,data \ --adjust-section-vma=image=0x$IMAGEVMA \ --set-section-flags=initrd=contents,alloc,load,readonly,data \ --adjust-section-vma=initrd=0x$INITRDVMA \ $kernel/zvmlinux.initrd $kernel/zvmlinux2.initrd $target-objdump -h $kernel/zvmlinux2.initrd elif test "$1" == "make" -o -z "$1" ; then if test "$1" == "make" ; then echo "building zvmlinux" make zImage 2>&1 | tee make.out fi echo "adjusting zvmlinux using OFFSET="$OFFSET cp -vb $linux/arch/ppc/mbxboot/zvmlinux $kernel/ LOADADDR=$($target-objdump -h $kernel/zvmlinux | grep .text | awk '{print toupper($4)}') IMAGEOFFSET=$($target-objdump -h $kernel/zvmlinux | grep image | awk '{print toupper($6)}') IMAGEVMA=$(echo "obase=16;ibase=16;"$IMAGEOFFSET"+"$LOADADDR"-"$OFFSET | bc) echo "LOADADDR="$LOADADDR echo "IMAGEOFFSET="$IMAGEOFFSET echo "IMAGEVMA="$IMAGEVMA $target-objcopy \ --set-section-flags=image=contents,alloc,load,readonly,data \ --adjust-section-vma=image=0x$IMAGEVMA \ $kernel/zvmlinux $kernel/zvmlinux2 $target-objdump -h $kernel/zvmlinux2 else echo "illegal option, use:" echo $0 " [initrd] [make]" echo $0 ": 'make' to rebuild kernel image" echo $0 ": 'initrd' to include initial ram disk" echo $0 " preload \$OFFSET to use OFFSET different from 10000 [hex]" exit 1 fi