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-2008q3/bin/arm-none-linux-gnueabi-
33                 JOBS="-j 5"
34         fi
35         if [ "$USER" = "dh09.lee" ]; then
36                 CROSS_COMPILER=/usr/local/arm/arm-2008q3/bin/arm-none-linux-gnueabi-
37                 JOBS="-j 5"
38         fi
39 }
40
41 build_uboot()
42 {
43         make ARCH=arm CROSS_COMPILE="$CCACHE $CROSS_COMPILER" $JOBS $*
44 }
45
46 make_evt_image()
47 {
48         cat onenand_ipl/onenand-ipl-16k-evt0.bin u-boot.bin > u-boot-onenand-evt0.bin
49         cat onenand_ipl/onenand-ipl-16k-fused.bin u-boot.bin > u-boot-onenand-evt1-fused.bin
50         # To distinguish previous u-boot-onenand.bin, it uses the evt1 suffix
51         cp u-boot-onenand.bin u-boot-onenand-evt1.bin
52 }
53
54 make_recovery_image()
55 {
56         cat recovery/recovery-evt0.bin u-boot.bin > u-boot-recovery-evt0.bin
57         cat recovery/recovery-fused.bin u-boot.bin > u-boot-recovery-evt1-fused.bin
58         cp u-boot-recovery.bin u-boot-recovery-evt1.bin
59 }
60
61 check_ccache
62 check_users
63
64 build_uboot $*
65
66 make_evt_image
67 make_recovery_image
68
69 size=`ls -al u-boot-onenand.bin | awk -F' ' '{printf $5}'`
70 if [ "$size" -ge "262144" ]; then
71         echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size"
72         exit
73 fi
74
75 if [ "$USER" = "kmpark" ]; then
76         ls -al u-boot.bin u-boot-onenand.bin u-boot-onenand-evt0.bin
77         # To prevent wrong program
78         cp -f u-boot-onenand-evt0.bin u-boot-onenand.bin
79         cp -f u-boot.bin u-boot-onenand.bin u-boot-onenand-evt0.bin /tftpboot
80         ls -al onenand_ipl
81         pushd ../images
82         ./system.sh
83         popd
84 elif [ "$USER" = "dofmind" ]; then
85         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
86         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
87         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
88         tar cvf system_uboot.tar u-boot-onenand.bin
89         mv -f system_uboot*.tar /home/release
90 elif [ "$USER" = "prom" ]; then
91         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
92         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
93         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
94         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
95         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
96         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
97         mv -f system_uboot* /home/share/Work/bin
98 fi