Browse Source

dubhe: setup.sh: Update sh script

Added script that enable users to perform build through menu selection.
Signed-off-by: yang.lee <yang.lee@starfivetech.com>
yang.lee 1 year ago
parent
commit
de70805f89
1 changed files with 96 additions and 1 deletions
  1. 96 1
      setup.sh

+ 96 - 1
setup.sh

@@ -30,11 +30,13 @@ elif [ "${0##*/}" = "dash" ]; then
   return
 fi
 # bootstrap OE
+if [[ ":$PATH:" != *":$PWD/meta-starfive:"* ]]; then
+  export PATH=$PATH:$PWD/meta-starfive
+fi
 echo "Init OE"
 export BASH_SOURCE="openembedded-core/oe-init-build-env"
 . ./openembedded-core/oe-init-build-env $DIR
 
-
 # Symlink the cache
 #echo "Setup symlink for sstate"
 #ln -s ~/sstate/${MACHINE} sstate-cache
@@ -77,6 +79,7 @@ require conf/distro/include/security_flags.inc
 INHERIT += "uninative"
 
 DISTRO_FEATURES:append = " largefile opengl ptest multiarch wayland pam  systemd "
+#DISTRO_FEATURES:append = " largefile opengl ptest multiarch wayland pam "
 DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
 VIRTUAL-RUNTIME_init_manager = "systemd"
 ##VIRTUAL-RUNTIME_initscripts = ""
@@ -102,3 +105,95 @@ echo "---------------------------------------------------"
 #echo "Starting build"
 #bitbake $BITBAKEIMAGE
 
+# Launch build script
+# Terminal Style
+PURPLE='\E[1;35m'
+YELLOW='\E[1;33m'
+GREEN='\E[0;32m'
+RED='\E[0;31m'
+NC='\E[0m'
+MARK="\033[0;32m\xE2\x9C\x94\033[0m"
+
+#Function
+runprog(){
+read -p "Do you want to runqemu?[Y/n]:" RES
+
+case $RES in
+ [Yy])
+   MACHINE=starfive-dubhe runqemu nographic $1;;
+ [Nn])
+   return;;
+ *)
+   echo "Invalid option $RES , [Y/n] only.";;
+esac
+}
+
+# Menu script
+echo ""
+echo -e "${PURPLE}*******************************************************************"
+echo "*                                                                 *"
+echo "*                     Welcome to Starfive Yocto                   *"
+echo "*                                                                 *"
+echo -e "*******************************************************************${NC}"
+echo "";
+echo -e "${YELLOW}Description : ";
+echo "";
+echo "This build script consists of two types image.";
+echo "";
+echo "1) QSPI-Image";
+echo "   - Initramfs has been bundled into qspi-image.";
+echo "   - The image generated support both single and multicore vector.";
+echo "   - Generated output : "; 
+echo "     QSPI-Image.bin for single core vector."; 
+echo "     QSPI-Image-Dual.bin for multicore vector.";
+echo "";
+echo "2) Dubhe-image-minimal";
+echo "   - Rootfs has been packaged into SD-Image.img."; 
+echo "   - The image generated support both single and multicore vector.";
+echo "   - Generated output : ";
+echo "     QSPI-EXT4-Image.bin for single core vector.";
+echo "     QSPI-EXT4-Image-Dual.bin for multicore vector.";
+echo -e "     SD-Image.img for ext4 rootfs.${NC}";
+echo "";
+
+PS3="Select your action : "
+options=("Build qspi-image" "Build dubhe-image-minimal" "Show deployed image details" "Quit")
+
+select opt in "${options[@]}" 
+do
+    case $opt in 
+        "Build qspi-image")
+#            cd ../build || { echo "Run setup.sh before building images."; cd meta-starfive; break; };
+            if ! grep -q "ENABLE_EXT4" ./conf/local.conf; then
+                echo 'ENABLE_EXT4="0"' >> ./conf/local.conf;
+            else sed -i 's/ENABLE_EXT4="1"/ENABLE_EXT4="0"/g'  ./conf/local.conf;
+            fi;
+            cur_ter=$(tty);
+            output=$(MACHINE=starfive-dubhe bitbake qspi-image | tee $cur_ter);
+            if [[ $output != *"ERROR"* ]]; then
+                echo -e "\U0002705 ${GREEN}Build Complete${NC}"
+                runprog dubhe-image-initramfs;
+            else echo -e "\U000274C ${RED}Build Failed${NC}"
+            fi;;
+        "Build dubhe-image-minimal")
+ #           cd ../build || { echo "Run setup.sh before building images."; cd meta-starfive; break; };
+            if ! grep -q "ENABLE_EXT4" ./conf/local.conf; then
+                echo 'ENABLE_EXT4="1"' >> ./conf/local.conf;
+            else sed -i 's/ENABLE_EXT4="0"/ENABLE_EXT4="1"/g'  ./conf/local.conf;
+            fi;
+            cur_ter=$(tty);
+            output_min=$(MACHINE=starfive-dubhe bitbake dubhe-image-minimal | tee $cur_ter);
+            if [[ $output_min != *"ERROR"* ]]; then
+                echo -e "\U0002705 ${GREEN}Build Complete${NC}"
+                runprog console-image-minimal;
+            else echo -e "\U000274C ${RED}Build Failed${NC}"
+            fi;;
+        "Show deployed image details")
+            ls -lh tmp-glibc/deploy/images/starfive-dubhe/;;
+	"Quit")
+            break;;
+        *)
+            echo "Invalid option $REPLY. Kindly select choice between menu range."
+    esac
+    REPLY=
+done