build: adjustement of settings
[kernel/u-boot.git] / build.sh
1 #!/bin/sh
2
3 # Set default cross compiler
4 CROSS_COMPILER=/opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-
5
6 # Check this system has ccache
7 check_ccache()
8 {
9         type ccache
10         if [ "$?" -eq "0" ]; then
11                 CCACHE=ccache
12         fi
13 }
14
15 check_users()
16 {
17         USER=`whoami`
18         if [ "$USER" = "kmpark" ]; then
19                 #CROSS_COMPILER=/pub/toolchains/gcc-4.4.1/bin/arm-none-linux-gnueabi-
20                 CROSS_COMPILER=/scratchbox/compilers/arm-linux-gnueabi-gcc4.4.1-glibc2.10.1-2009q3-93/bin/arm-none-linux-gnueabi-
21                 JOBS="-j 4"
22         fi
23         if [ "$USER" = "dofmind" ]; then
24                 CROSS_COMPILER=arm-none-linux-gnueabi-
25                 JOBS="-j 5"
26         fi
27         if [ "$USER" = "prom" ]; then
28                 CROSS_COMPILER=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-
29                 JOBS="-j 5"
30         fi
31         if [ "$USER" = "jaehoon" ]; then
32                 CROSS_COMPILER=/usr/local/arm/arm-2009q3/bin/arm-none-linux-gnueabi-
33                 JOBS="-j 5"
34         fi
35         if [ "$USER" = "leedonghwa" ]; then
36                 CROSS_COMPILER=/opt/toolchains/scratchbox/compilers/arm-linux-gnueabi-gcc4.4.1-glibc2.10.1-2009q3-93/bin/arm-none-linux-gnueabi-
37                 JOBS="-j 5"
38         fi
39         if [ "$USER" = "riverful" ]; then
40                 CROSS_COMPILER=/opt/arm-2009q3/bin/arm-none-linux-gnueabi-
41                 JOBS="-j 5"
42         fi
43         if [ "$USER" = "cwchoi00" ]; then
44                 CROSS_COMPILER=/opt/arm-2009q3/bin/arm-none-linux-gnueabi-
45                 JOBS="-j 5"
46         fi
47         if [ "$USER" = "donggeun" ]; then
48                 CROSS_COMPILER=/scratchbox/compilers/arm-linux-gnueabi-gcc4.4.1-glibc2.10.1-2009q3-93/bin/arm-none-linux-gnueabi-
49                 JOBS="-j 5"
50         fi
51         if [ "$USER" = "marek" ]; then
52                 CROSS_COMPILER=/home/marek/dev//arm-2008q3/bin/arm-none-linux-gnueabi-
53                 TARGET=${TARGET:-s5pc110}
54                 make clean clobber unconfig mrproper
55                 make ${TARGET}_universal_config
56                 JOBS="-j 2"
57         fi
58         if [ "$USER" = "lukma" ]; then
59             CROSS_COMPILER=/home/lukma/work/arm-2009q3/bin/arm-none-eabi-
60             JOBS="-j 5"
61         fi
62 }
63
64 check_ipl()
65 {
66         if [ "$1" = "mmc" ]; then
67                 IPL="mmc"
68         else
69                 IPL="onenand"
70         fi
71 }
72
73 build_uboot()
74 {
75         if [ "$1" != "mmc" ]; then
76                 OPT=$*
77         fi
78         make ARCH=arm CROSS_COMPILE="$CCACHE $CROSS_COMPILER" $JOBS $OPT
79 }
80
81 make_evt_image()
82 {
83         set -x
84         SOC=`grep BOARD include/config.mk | awk -F'_' '{print $2}'`
85         IPL_PREFIX=${IPL}_ipl/${IPL}-ipl
86
87         if [ "$SOC" = "c210" ]; then
88                 echo "Use the s-boot instead"
89         elif [ "$SOC" = "c110" ]; then
90                 # C110
91                 cat ${IPL_PREFIX}-16k-evt0.bin u-boot.bin > u-boot-"$IPL"-evt0.bin
92                 cat ${IPL_PREFIX}-16k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
93                 if [ "$IPL" = "mmc" ]; then
94                         cat ${IPL_PREFIX}-8k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
95                 fi
96                 # To distinguish previous u-boot-onenand.bin, it uses the evt1 suffix
97                 cp u-boot-"$IPL".bin u-boot-"$IPL"-evt1.bin
98         fi
99 }
100
101 check_ccache
102 check_users
103 #check_ipl $1
104
105 build_uboot $*
106
107 #make_evt_image
108
109 if [ "$IPL" != "mmc" -a -e "$PWD/u-boot-onenand.bin" ]; then
110         size=`ls -al u-boot-onenand.bin | awk -F' ' '{printf $5}'`
111         if [ "$size" -ge "262144" ]; then
112                 echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size"
113                 exit
114         fi
115 fi
116
117 if [ "$USER" = "kmpark" ]; then
118         ls -al u-boot*.bin
119         cp -f u-boot.bin u-boot-onenand.bin /tftpboot
120         ls -al onenand_ipl
121         pushd ../images
122         ./system.sh
123         popd
124 elif [ "$USER" = "dofmind" ]; then
125         tar cvf system_uboot.tar u-boot.bin
126         mv -f system_uboot*.tar /home/release
127 elif [ "$USER" = "prom" ]; then
128         tar cvf system_uboot.tar u-boot.bin
129         mv -f system_uboot* /home/share/Work/bin
130 elif [ "$USER" = "jaehoon" ]; then
131         tar cvf system_uboot.tar u-boot.bin
132         mv -f system_uboot* /home/jaehoon/shared/new/
133 elif [ "$USER" = "leedonghwa" ]; then
134         tar cvf system_uboot.tar u-boot.bin
135         mv -f system_uboot* /home/leedonghwa/Build-Binaries/
136 elif [ "$USER" = "cwchoi00" ]; then
137         tar cvf system_uboot.tar u-boot.bin
138 elif [ "$USER" = "donggeun" ]; then
139         tar cvf system_uboot.tar u-boot.bin
140         mv -f system_uboot*.tar /home/donggeun/workspace/images
141 elif [ "$USER" = "marek" ]; then
142         BOARD=`grep BOARD include/config.mk | awk -F'= ' '{printf $2}'`
143         DATE=`date +%Y%m%d`
144         echo $BOARD
145         if [ "$BOARD" = "universal_c110" ] ; then
146                 tar cfv universal-uboot-system-${DATE}.tar u-boot-onenand-evt0.bin
147                 tar cfv universal-uboot-system-${DATE}-evt1-fused.tar u-boot-onenand-evt1-fused.bin
148                 tar cfv universal-uboot-system-${DATE}-evt1.tar u-boot-onenand-evt1.bin
149                 cp universal-uboot-system-${DATE}.tar ../image/w1
150                 cp universal-uboot-system-${DATE}-evt1-fused.tar ../image/w1
151                 cp universal-uboot-system-${DATE}-evt1.tar ../image/w1
152         fi
153         if [ "$BOARD" = "universal_c210" ] ; then
154                 pushd ../s-boot
155                 ./build.sh
156                 popd
157                 mv s-boot-onenand.bin u-boot-onenand.bin
158                 tar cfv universal-uboot-system-${DATE}-c210-sboot.tar u-boot-onenand.bin
159                 cp universal-uboot-system-${DATE}-c210-sboot.tar ../image/w1
160                 tar cfv universal-uboot-system-${DATE}-c210-raw.tar u-boot.bin
161                 cp universal-uboot-system-${DATE}-c210-raw.tar ../image/w1
162         fi
163 elif [ "$USER" = "lukma" ]; then
164         tar cvf system_uboot.tar u-boot.bin
165         cp system_uboot.tar ../image/w1/uboot-g`git log --pretty=oneline -1 --abbrev-commit | cut -c 1-7`-`date +%Y%m%d`.tar    
166 fi