s5pc110: Only build 8K IPL when mmc 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         if [ "$IPL" = "mmc" ]; then
67                 cat "$IPL"_ipl/"$IPL"-ipl-8k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin
68         fi
69         # To distinguish previous u-boot-onenand.bin, it uses the evt1 suffix
70         cp u-boot-"$IPL".bin u-boot-"$IPL"-evt1.bin
71 }
72
73 make_recovery_image()
74 {
75         if [ "$IPL" != "mmc" ]; then
76                 cat recovery/recovery-evt0.bin u-boot.bin > u-boot-recovery-evt0.bin
77                 cat recovery/recovery-fused.bin u-boot.bin > u-boot-recovery-evt1-fused.bin
78                 cp u-boot-recovery.bin u-boot-recovery-evt1.bin
79         fi
80 }
81
82 check_ccache
83 check_users
84 check_ipl $1
85
86 build_uboot $*
87
88 make_evt_image
89 make_recovery_image
90
91 if [ "$IPL" != "mmc" ]; then
92         size=`ls -al u-boot-onenand.bin | awk -F' ' '{printf $5}'`
93         if [ "$size" -ge "262144" ]; then
94                 echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size"
95                 exit
96         fi
97 fi
98
99 if [ "$USER" = "kmpark" ]; then
100         ls -al u-boot.bin u-boot-onenand.bin u-boot-onenand-evt0.bin
101         # To prevent wrong program
102         cp -f u-boot-onenand-evt0.bin u-boot-onenand.bin
103         cp -f u-boot.bin u-boot-onenand.bin u-boot-onenand-evt0.bin /tftpboot
104         ls -al onenand_ipl
105         pushd ../images
106         ./system.sh
107         popd
108 elif [ "$USER" = "dofmind" ]; then
109         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
110         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
111         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
112         tar cvf system_uboot.tar u-boot-onenand.bin
113         mv -f system_uboot*.tar /home/release
114 elif [ "$USER" = "prom" ]; then
115         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
116         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
117         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
118         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
119         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
120         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
121         mv -f system_uboot* /home/share/Work/bin
122 elif [ "$USER" = "jaehoon" ]; then
123         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
124         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
125         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
126         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
127         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
128         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
129         mv -f system_uboot* /home/jaehoon/shared/new/
130 elif [ "$USER" = "leedonghwa" ]; then
131         tar cvf system_uboot_evt0.tar u-boot-onenand-evt0.bin
132         tar cvf system_uboot_evt1.tar u-boot-onenand-evt1.bin
133         tar cvf system_uboot_evt1-fused.tar u-boot-onenand-evt1-fused.bin
134         tar cvf system_uboot_recovery_evt0.tar u-boot-recovery-evt0.bin
135         tar cvf system_uboot_recovery_evt1.tar u-boot-recovery-evt1.bin
136         tar cvf system_uboot_recovery_evt1-fused.tar u-boot-recovery-evt1-fused.bin
137         mv -f system_uboot* /home/leedonghwa/Build-Binaries/
138 fi