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