Merge branch 'master' of git://git.denx.de/u-boot
[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 }
44
45 check_ipl()
46 {
47         if [ "$1" = "mmc" ]; then
48                 IPL="mmc"
49         else
50                 IPL="onenand"
51         fi
52 }
53
54 build_uboot()
55 {
56         if [ "$1" != "mmc" ]; then
57                 OPT=$*
58         fi
59         make ARCH=arm CROSS_COMPILE="$CCACHE $CROSS_COMPILER" $JOBS $OPT
60 }
61
62 make_evt_image()
63 {
64         cat "$IPL"_ipl/"$IPL"-ipl-16k-evt0.bin u-boot.bin > u-boot-"$IPL"-evt0.bin
65         cat "$IPL"_ipl/"$IPL"-ipl-16k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
66         # To distinguish previous u-boot-onenand.bin, it uses the evt1 suffix
67         cp u-boot-"$IPL".bin u-boot-"$IPL"-evt1.bin
68 }
69
70 make_recovery_image()
71 {
72         if [ "$IPL" != "mmc" ]; then
73                 cat recovery/recovery-evt0.bin u-boot.bin > u-boot-recovery-evt0.bin
74                 cat recovery/recovery-fused.bin u-boot.bin > u-boot-recovery-evt1-fused.bin
75                 cp u-boot-recovery.bin u-boot-recovery-evt1.bin
76         fi
77 }
78
79 check_ccache
80 check_users
81 check_ipl $1
82
83 build_uboot $*
84
85 make_evt_image
86 make_recovery_image
87
88 if [ "$IPL" != "mmc" ]; then
89         size=`ls -al u-boot-onenand.bin | awk -F' ' '{printf $5}'`
90         if [ "$size" -ge "262144" ]; then
91                 echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size"
92                 exit
93         fi
94 fi
95
96 if [ "$USER" = "kmpark" ]; then
97         ls -al u-boot.bin u-boot-onenand.bin u-boot-onenand-evt0.bin
98         # To prevent wrong program
99         cp -f u-boot-onenand-evt0.bin u-boot-onenand.bin
100         cp -f u-boot.bin u-boot-onenand.bin u-boot-onenand-evt0.bin /tftpboot
101         ls -al onenand_ipl
102         pushd ../images
103         ./system.sh
104         popd
105 elif [ "$USER" = "dofmind" ]; then
106         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
107         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
108         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
109         tar cvf system_uboot.tar u-boot-onenand.bin
110         mv -f system_uboot*.tar /home/release
111 elif [ "$USER" = "prom" ]; then
112         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
113         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
114         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
115         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
116         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
117         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
118         mv -f system_uboot* /home/share/Work/bin
119 elif [ "$USER" = "jaehoon" ]; then
120         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
121         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
122         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
123         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
124         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
125         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
126         mv -f system_uboot* /home/jaehoon/shared/new/
127 elif [ "$USER" = "leedonghwa" ]; then
128         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
129         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
130         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
131         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
132         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
133         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
134         mv -f system_uboot* /home/leedonghwa/Build-Binaries/
135 fi