build : Added support to build using sudo linux_all
authorYaniv Machani <yanivma@ti.com>
Thu, 23 Oct 2014 08:02:16 +0000 (11:02 +0300)
committerYaniv Machani <yanivma@ti.com>
Thu, 23 Oct 2014 08:13:23 +0000 (11:13 +0300)
To build using sudo,
run 'sudo_build_wl18xx.sh'
the script will generate a new build script based on the non-sudo one.

Signed-off-by: Yaniv Machani <yanivma@ti.com>
build_wl18xx.sh
sudo_build_wl18xx.sh [new file with mode: 0755]

index b0631191260ce55221f144629b5ca6ff747527f9..b6e28297a3fa57c2cc9ac8d88f41b8d45de0e03a 100755 (executable)
@@ -21,21 +21,21 @@ function usage ()
     echo ""
     echo "This script compiles one/all of the following utilities: kernel, libnl, openssl, hostapd, wpa_supplicant,wl18xx_modules,firmware,crda,calibrator"
     echo "by calling specific utility name and action."
+    echo "A web guide can be found here : http://processors.wiki.ti.com/index.php/WL18xx_System_Build_Scripts"
     echo ""
     echo " Usage: ./wl18xx_build.sh init         <head|TAG>  [ Update w/o build        ] "
     echo "                          update       <head|TAG>  [ Update & build          ] "
     echo "                          rebuild                  [ Build w/o update        ] "
     echo "                          clean                    [ Clean, Update & build   ] "
     echo "                              "
-    echo " Building a specific module usage "
+    echo " Building a specific component usage "
     echo "       ./build.sh    hostapd "
     echo "                     wpa_supplicant "
-    echo "                     modules(driver) "
+    echo "                     modules "
     echo "                     firmware "
     echo "                     scripts "
-    echo "                     calibrator "
-    echo "                     wlconf "
-    echo "                     uimage "
+    echo "                     utils "
+    echo "                     iw "
     echo "                     openssl "
     echo "                     libnl "
     echo "                     crda "
@@ -312,10 +312,8 @@ function build_modules()
        find . -name \*.ko -exec cp {} `path debugging`/ \;
        find . -name \*.ko -exec ${CROSS_COMPILE}strip -g {} \;
     
-#      make -C ${KERNEL_PATH} M=`pwd` "INSTALL_MOD_PATH=`path filesystem`" modules_install
        make  modules_install
        assert_no_error
-       #chmod -R 0777 ${PATH__FILESYSTEM}/lib/modules/
        cd_back
 }
 
diff --git a/sudo_build_wl18xx.sh b/sudo_build_wl18xx.sh
new file mode 100755 (executable)
index 0000000..642b61f
--- /dev/null
@@ -0,0 +1,32 @@
+ORG_FILENAME="build_wl18xx.sh"
+SUDO_FILENAME="_build_with_sudo.sh"
+cp $ORG_FILENAME $SUDO_FILENAME
+
+MAKE_PREFIX="sudo PATH=\$PATH -E "
+SUDO_PREFIX="sudo "
+
+makeregex[1]="modules_install"
+makeregex[2]="make install"
+
+for i in {1..2}
+do
+    #echo "Add 'sudo' for $i) ${makeregex[$i]}"
+    sed -i "/${makeregex[$i]}/s/^/${MAKE_PREFIX} /" ./$SUDO_FILENAME
+done
+
+sudoregex[1]="mkdir"
+sudoregex[2]="tar "
+sudoregex[3]="cp "
+sudoregex[4]="chmod "
+sudoregex[5]="rm "
+
+for i in {1..5}
+do
+    #echo "Add 'sudo' for $i) ${sudoregex[$i]}"
+    #sed -i "s/${sudoregex[$i]}/${SUDO_PREFIX} /" ./$SUDO_FILENAME
+       sed -i "s/\(${sudoregex[$i]}\)/${SUDO_PREFIX} \1/g" ./$SUDO_FILENAME
+done
+
+echo "Finished adding sudo to build script, Running..."
+
+./$SUDO_FILENAME $@