BUILD: Build images based on SOC
[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 }
49
50 check_ipl()
51 {
52         if [ "$1" = "mmc" ]; then
53                 IPL="mmc"
54         else
55                 IPL="onenand"
56         fi
57 }
58
59 build_uboot()
60 {
61         if [ "$1" != "mmc" ]; then
62                 OPT=$*
63         fi
64         make ARCH=arm CROSS_COMPILE="$CCACHE $CROSS_COMPILER" $JOBS $OPT
65 }
66
67 make_evt_image()
68 {
69         set -x
70         SOC=`grep BOARD include/config.mk | awk -F'_' '{print $2}'`
71         IPL_PREFIX=${IPL}_ipl/${IPL}-ipl
72
73         if [ "$SOC" = "c210" ]; then
74                 # Universal Rev0.0
75                 cat ${IPL_PREFIX}-32k-evt0.bin u-boot.bin > u-boot-"$IPL"-evt0.bin      
76                 # Universal Rev0.1 (Secure boot)
77                 cat ${IPL_PREFIX}-32k-evt0-fused.bin u-boot.bin > u-boot-"$IPL"-evt0-fused.bin
78         elif [ "$SOC" = "c110" ]; then
79                 # C110
80                 cat ${IPL_PREFIX}-16k-evt0.bin u-boot.bin > u-boot-"$IPL"-evt0.bin
81                 cat ${IPL_PREFIX}-16k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
82                 if [ "$IPL" = "mmc" ]; then
83                         cat ${IPL_PREFIX}-8k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
84                 fi
85                 # To distinguish previous u-boot-onenand.bin, it uses the evt1 suffix
86                 cp u-boot-"$IPL".bin u-boot-"$IPL"-evt1.bin
87         fi
88 }
89
90 make_recovery_image()
91 {
92         if [ "$IPL" != "mmc" ]; then
93                 cat recovery/recovery-evt0.bin u-boot.bin > u-boot-recovery-evt0.bin
94                 cat recovery/recovery-fused.bin u-boot.bin > u-boot-recovery-evt1-fused.bin
95                 cp u-boot-recovery.bin u-boot-recovery-evt1.bin
96         fi
97 }
98
99 check_ccache
100 check_users
101 check_ipl $1
102
103 build_uboot $*
104
105 make_evt_image
106 #make_recovery_image
107
108 if [ "$IPL" != "mmc" ]; then
109         size=`ls -al u-boot-onenand.bin | awk -F' ' '{printf $5}'`
110         if [ "$size" -ge "262144" ]; then
111                 echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size"
112                 exit
113         fi
114 fi
115
116 if [ "$USER" = "kmpark" ]; then
117         ls -al u-boot*.bin
118         cp -f u-boot.bin u-boot-onenand.bin /tftpboot
119         ls -al onenand_ipl
120         pushd ../images
121         ./system.sh
122         popd
123 elif [ "$USER" = "dofmind" ]; then
124         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
125         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
126         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
127         tar cvf system_uboot.tar u-boot-onenand.bin
128         mv -f system_uboot*.tar /home/release
129 elif [ "$USER" = "prom" ]; then
130         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
131         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
132         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
133         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
134         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
135         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-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         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
142         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
143         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
144         mv -f system_uboot* /home/jaehoon/shared/new/
145 elif [ "$USER" = "leedonghwa" ]; then
146         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
147         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
148         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
149         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
150         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
151         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
152         mv -f system_uboot* /home/leedonghwa/Build-Binaries/
153 elif [ "$USER" = "cwchoi00" ]; then
154         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
155         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
156         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
157         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
158         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
159         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
160 fi