Browse Source

create_sunxi - use create_or_pull for all git repository

Émile Morel 10 years ago
parent
commit
5ee0e21d58
1 changed files with 19 additions and 25 deletions
  1. 19 25
      olinux/create_sunxi_boot_files.sh

+ 19 - 25
olinux/create_sunxi_boot_files.sh

@@ -4,45 +4,39 @@
 #     Sunxi part     #
 ######################
 
-# Sunxi u-boot
-#if [ -d /olinux/sunxi/u-boot-sunxi/ ] ; then 
-#  cd /olinux/sunxi/u-boot-sunxi/ && make clean && git pull 
-#else
-#  git clone -b sunxi https://github.com/linux-sunxi/u-boot-sunxi.git /olinux/sunxi/u-boot-sunxi
-#fi
-#
-#cd /olinux/sunxi/u-boot-sunxi && make CROSS_COMPILE=arm-linux-gnueabihf A20-OLinuXino-Lime_config && make CROSS_COMPILE=arm-linux-gnueabihf-
+offline=$1
 
 clone_or_pull (){
-  repo=$1
-  if [ -d /olinux/sunxi/$repo/ ] ; then 
-    cd /olinux/sunxi/$repo/ && make clean && git pull 
+  project=$1
+  repo=$2
+  if [ "$offline" ] ; then
+    cd /olinux/sunxi/$project/ && make clean
+    return 0
+  fi 
+  if [ -d /olinux/sunxi/$project/ ] ; then 
+    cd /olinux/sunxi/$project/ && make clean && git pull 
   else
-    git clone https://github.com/linux-sunxi/$repo /olinux/sunxi/$repo/
+    git clone $repo/$project /olinux/sunxi/$project/
   fi
 }
 
-if [ -d /olinux/sunxi/u-boot/ ] ; then 
-  cd /olinux/sunxi/u-boot/ && make clean && git pull 
-else
-  git clone git://git.denx.de/u-boot.git /olinux/sunxi/u-boot
-fi
-
-cd /olinux/sunxi/u-boot && make CROSS_COMPILE=arm-linux-gnueabihf A20-OLinuXino-Lime_config && make CROSS_COMPILE=arm-linux-gnueabihf-
+# Sunxi u-boot
+#clone_or_pull u-boot-sunxi
+clone_or_pull u-boot.git git://git.denx.de
+cd /olinux/sunxi/u-boot.git && make CROSS_COMPILE=arm-linux-gnueabihf A20-OLinuXino-Lime_config && make CROSS_COMPILE=arm-linux-gnueabihf-
 
 # Sunxi kernel
-clone_or_pull linux-sunxi
-# Sunxi board configs
-clone_or_pull sunxi-boards
-# Sunxi tools 
-clone_or_pull sunxi-tools
-
+clone_or_pull linux-sunxi https://github.com/linux-sunxi
 cp /olinux/a20_defconfig /olinux/sunxi/linux-sunxi/arch/arm/configs/.
 cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm a20_defconfig
 cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 uImage  
 cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 INSTALL_MOD_PATH=out modules
 cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 INSTALL_MOD_PATH=out modules_install
 
+# Sunxi board configs
+clone_or_pull sunxi-boards https://github.com/linux-sunxi
+# Sunxi tools 
+clone_or_pull sunxi-tools https://github.com/linux-sunxi
 cd /olinux/sunxi/sunxi-tools/ && make
 cd /olinux/sunxi/ && rm -f script.bin && ./sunxi-tools/fex2bin sunxi-boards/sys_config/a20/a20-olinuxino_lime2.fex script.bin
 cd /olinux/sunxi/ && chmod +x script.bin