UNIVERSAL: added user to build.sh
[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-2009q3/bin/arm-none-linux-gnueabi-
53                 TARGET=${TARGET:-s5pc110}
54                 if [ ! -z "$DOCONFIG" ] ; then
55                         make clean clobber unconfig mrproper
56                         make ${TARGET}_universal_config
57                 fi
58                 JOBS="-j 2"
59         fi
60         if [ "$USER" = "lukma" ]; then
61                 CROSS_COMPILER=/home/lukma/work/arm-2009q3/bin/arm-none-eabi-
62         fi
63         if [ "$USER" = "mzx" ]; then
64                 CROSS_COMPILER=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-
65                 JOBS="-j 4"
66         fi
67         if [ "$USER" = "daeinki" ]; then
68                 CROSS_COMPILER=/usr/local/arm/arm-2010q1/bin/arm-none-linux-gnueabi-
69                 JOBS="-j 5"
70         fi
71 }
72
73 check_ipl()
74 {
75         if [ "$1" = "mmc" ]; then
76                 IPL="mmc"
77         else
78                 IPL="onenand"
79         fi
80 }
81
82 build_uboot()
83 {
84         if [ "$1" != "mmc" ]; then
85                 OPT=$*
86         fi
87         make ARCH=arm CROSS_COMPILE="$CCACHE $CROSS_COMPILER" $JOBS $OPT
88 }
89
90 make_evt_image()
91 {
92         set -x
93         SOC=`grep BOARD include/config.mk | awk -F'_' '{print $2}'`
94         IPL_PREFIX=${IPL}_ipl/${IPL}-ipl
95
96         if [ "$SOC" = "c210" ]; then
97                 echo "Use the s-boot instead"
98         elif [ "$SOC" = "c110" ]; then
99                 # C110
100                 cat ${IPL_PREFIX}-16k-evt0.bin u-boot.bin > u-boot-"$IPL"-evt0.bin
101                 cat ${IPL_PREFIX}-16k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
102                 if [ "$IPL" = "mmc" ]; then
103                         cat ${IPL_PREFIX}-8k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
104                 fi
105                 # To distinguish previous u-boot-onenand.bin, it uses the evt1 suffix
106                 cp u-boot-"$IPL".bin u-boot-"$IPL"-evt1.bin
107         fi
108 }
109
110 check_size()
111 {
112         SIZEFILE=".oldsize"
113         if [ -e "$PWD/$SIZEFILE" ]; then
114                 OLDSIZE=`cat $SIZEFILE`
115         else
116                 OLDSIZE=0
117         fi
118         SIZE=`ls -al u-boot.bin | awk -F' ' '{printf $5}'`
119         if [ "$SIZE" -gt "$OLDSIZE" ]; then
120                 echo "New size $SIZE is bigger than prev $OLDSIZE"
121                 echo "$SIZE" > $SIZEFILE
122         elif [ "$SIZE" -lt "$OLDSIZE" ]; then
123                 echo "Good reduced size $SIZE is less than prev $OLDSIZE"
124                 echo "$SIZE" > $SIZEFILE
125         else
126                 echo "Size is $SIZE"
127         fi
128 }
129
130 check_ccache
131 check_users
132 #check_ipl $1
133
134 build_uboot $*
135
136 #make_evt_image
137 check_size
138
139 if [ "$IPL" != "mmc" -a -e "$PWD/u-boot.bin" ]; then
140         size=`ls -al u-boot.bin | awk -F' ' '{printf $5}'`
141         if [ "$size" -ge "262144" ]; then
142                 echo "u-boot.bin execced the 256KiB 262144 -> $size"
143         fi
144 fi
145
146 if [ "$USER" = "kmpark" ]; then
147         ls -al u-boot*.bin
148         cp -f u-boot.bin /tftpboot
149         pushd ../images
150         ./system.sh
151         popd
152 elif [ "$USER" = "dofmind" ]; then
153         tar cvf system_uboot.tar u-boot.bin
154         mv -f system_uboot*.tar /home/release
155 elif [ "$USER" = "prom" ]; then
156         tar cvf boot_system_uboot.tar u-boot.bin
157         mv -f boot_system_uboot* /home/share/Work/bin
158 elif [ "$USER" = "jaehoon" ]; then
159         tar cvf system_uboot.tar u-boot.bin
160         mv -f system_uboot* /home/jaehoon/shared/new/
161 elif [ "$USER" = "leedonghwa" ]; then
162         tar cvf boot_system_uboot.tar u-boot.bin
163         mv -f boot_system_uboot* /home/leedonghwa/Build-Binaries
164 elif [ "$USER" = "cwchoi00" ]; then
165         tar cvf system_uboot.tar u-boot.bin
166 elif [ "$USER" = "donggeun" ]; then
167         tar cvf system_uboot.tar u-boot.bin
168         mv -f system_uboot*.tar /home/donggeun/workspace/images
169 elif [ "$USER" = "marek" ]; then
170         BOARD=`grep BOARD include/config.mk | awk -F'= ' '{printf $2}'`
171         DATE=`date +%Y%m%d`
172         tar cvf system_uboot.tar u-boot.bin
173         echo $BOARD
174         if [ "$BOARD" = "universal_c110" ] ; then
175                 cp system_uboot.tar ../image/w1/uboot-c110-`date +%Y%m%d`-g`git log --pretty=oneline -1 --abbrev-commit | cut -c 1-7`.tar
176         fi
177         if [ "$BOARD" = "universal_c210" ] ; then
178                 cp system_uboot.tar ../image/w1/uboot-c210-`date +%Y%m%d`-g`git log --pretty=oneline -1 --abbrev-commit | cut -c 1-7`.tar
179         fi
180 elif [ "$USER" = "lukma" ]; then
181 # Check the built binary size if not exceeded.
182 # Particularly needed when DEBUG enabled
183         size=`ls -al u-boot.bin | awk -F' ' '{printf $5}'`
184         if [ "$size" -ge "262144" ]; then
185                 echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size"
186                 echo "Remove u-boot.bin"
187                 rm u-boot.bin
188                 exit -1
189         fi
190         tar cvf system_uboot.tar u-boot.bin
191         cp system_uboot.tar ../image/w1/uboot-g`git log --pretty=oneline -1 --abbrev-commit | cut -c 1-7`-`date +%Y%m%d`.tar
192 elif [ "$USER" = "mzx" ]; then
193         tar cvf u-boot-system.tar u-boot.bin
194         cp u-boot-system.tar /home/smb/
195 fi