Index: /branches/rel_avx_2_7_5_caswell_5070/Makefile
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/Makefile	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/Makefile	(working copy)
@@ -115,4 +115,12 @@
 installable: array
 	./scripts/avxbuildutils.py -o installablebuild
 
+build_iso:
+	cd tools/install_iso_creator && make all
+	mv tools/install_iso_creator/install_AVX_2_7.iso ./
+
+clean_iso:
+	cd tools/install_iso_creator && make clean
+	rm -f install_AVX_2_7.iso
+
 .PHONY: all clean rpm pack infosec installable
Index: /branches/rel_avx_2_7_5_caswell_5070/avx_cli.spec
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/avx_cli.spec	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/avx_cli.spec	(working copy)
@@ -180,6 +180,7 @@
 install -Dm 0755 scripts/reset_microcode.sh %{buildroot}/ca/bin/reset_microcode.sh
 install -Dm 0755 scripts/ssh_config.py %{buildroot}/ca/bin/ssh_config.py
 install -Dm 0755 scripts/ssh-regenkey.sh %{buildroot}/ca/bin/ssh-regenkey.sh
+install -Dm 0755 scripts/init_avx.sh %{buildroot}/ca/bin/init_avx.sh
 install -Dm 0755 tools/click_pub_cert.pem %{buildroot}/ca/etc/
 install -Dm 0755 tools/click_priv_key.pem %{buildroot}/ca/etc/
 install -Dm 0755 tools/words %{buildroot}/ca/etc/
@@ -212,6 +213,7 @@
 install -Dm 0755 conf/system/rc.local %{buildroot}/ca/conf/system/rc.local
 install -Dm 0755 conf/system/libvirtd.conf %{buildroot}/ca/conf/system/libvirtd.conf
 install -Dm 0644 conf/system/group %{buildroot}/ca/conf/system/group
+install -Dm 0644 conf/system/rsyslog.service %{buildroot}/ca/conf/system/rsyslog.service
 install -Dm 0644 conf/system/passwd %{buildroot}/ca/conf/system/passwd
 install -Dm 0644 conf/system/avxdpdk.info.3600 %{buildroot}/ca/conf/system/avxdpdk.info.3600
 install -Dm 0644 conf/system/avxdpdk.info.7600 %{buildroot}/ca/conf/system/avxdpdk.info.7600
@@ -399,6 +401,7 @@
 %attr (755,root,root)/ca/bin/reset_microcode.sh
 %attr (755,root,root)/ca/bin/ssh_config.py
 %attr (755,root,root)/ca/bin/ssh-regenkey.sh
+%attr (755,root,root)/ca/bin/init_avx.sh
 %attr (755,root,root)/usr/sbin/dpdk_nic_bind.py
 %attr (644,root,root)/ca/etc/click_pub_cert.pem
 %attr (644,root,root)/ca/etc/click_priv_key.pem
@@ -437,6 +440,7 @@
 %attr (644,root,root)/ca/conf/system/libvirtd.conf
 %attr (644,root,root)/ca/conf/system/passwd
 %attr (644,root,root)/ca/conf/system/group
+%attr (644,root,root)/ca/conf/system/rsyslog.service
 %attr (600,root,root)/ca/conf/system/securetty
 %attr (644,root,root)/ca/conf/system/login
 %attr (644,root,root)/ca/conf/system/avxdpdk.info.3600
Index: /branches/rel_avx_2_7_5_caswell_5070/conf/shadow
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/conf/shadow	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/conf/shadow	(working copy)
@@ -31,4 +31,6 @@
 test:!!:16525:0:99999:7:::
 tcpdump:!!:16525::::::
 recovery:$1$o8Ez0ZCV$WHEkLFkO9vYokxsQOF/Nv0:16525:0:99999:7:::
+nova:!!:20292:0:99999:7:::
+neutron:!!:20292:0:99999:7:::
 array:$6$5q$QkeSlO6sFeEDBz7GltJ97.8II7ZTNYrgX4rNp6wy7OGvSAJsBDVU8oysPGzqEtjcvSIEw2PV7uSkIe.Mzn8pb.:17003:0:99999:7:::
Index: /branches/rel_avx_2_7_5_caswell_5070/conf/system/group
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/conf/system/group	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/conf/system/group	(working copy)
@@ -53,3 +53,5 @@
 recovery:x:1003:
 guest:x:1005:
 docker:x:1006:array
+nova:x:160:
+neutron:x:161:
Index: /branches/rel_avx_2_7_5_caswell_5070/conf/system/grub.cfg.2U_UEFI
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/conf/system/grub.cfg.2U_UEFI	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/conf/system/grub.cfg.2U_UEFI	(working copy)
@@ -17,7 +17,7 @@
    save_env next_entry
    set boot_once=true
 else
-   set default="1"
+   set default="${saved_entry}"
 fi
 
 if [ x"${feature_menuentry_id}" = xy ]; then
@@ -57,6 +57,7 @@
   fi
 }
 
+terminal_output console
 if [ x$feature_timeout_style = xy ] ; then
   set timeout_style=menu
   set timeout=10
@@ -65,14 +66,24 @@
 else
   set timeout=10
 fi
-
-serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
-terminal_output console serial
 ### END /etc/grub.d/00_header ###
 
-### BEGIN /etc/grub.d/10_linux ###
+### BEGIN /etc/grub.d/00_tuned ###
+set tuned_params=""
+### END /etc/grub.d/00_tuned ###
+
+### BEGIN /etc/grub.d/01_users ###
+if [ -f ${prefix}/user.cfg ]; then
+  source ${prefix}/user.cfg
+  if [ -n ${GRUB2_PASSWORD} ]; then
+    set superusers="root"
+    export superusers
+    password_pbkdf2 root ${GRUB2_PASSWORD}
+  fi
+fi
+### END /etc/grub.d/01_users ###
 
-######## AVX Dual system failover ###########
+######## BEGIN AVX Dual system failover ###########
 if [ ${avx_bootcount} == 0 ]; then
         set avx_bootcount=1
 elif [ ${avx_bootcount} == 1 ]; then
@@ -95,31 +106,40 @@
 else
 set default="1"
 fi
+### END AVX Dual system failover ###
 
-################## end ######################
+### BEGIN /etc/grub.d/10_linux ###
 menuentry 'AVXM' --class centos --class gnu-linux --class gnu --class os --unrestricted {
-	load_video
-	set gfxpayload=keep
-	insmod gzio
-	insmod part_gpt
-	insmod ext2
-	set root='hd0,gpt3'
-	search --no-floppy --fs-uuid --set=root $UUID_SDA3
-	linuxefi /vmlinuz root=UUID=$UUID_SDA3 ro crashkernel=auto arraykicker nomodeset xdriver=vesa brokenmodules=ast rhgb quiet LANG=en_US.UTF-8 console=tty0 console=ttyS0,9600n8 iommu=pt intel_iommu=on hugepagesz=$avx_hgpgsz hugepages=$avx_hgpgs intel_pstate=disable pcie_acs_override=downstream loglevel=3 modprobe.blacklist=ast
-  initrdefi /initramfs.img
+        load_video
+        set gfxpayload=keep
+        insmod gzio
+        insmod part_gpt
+        insmod ext2
+        insmod diskfilter
+        insmod mdraid1x
+        insmod xfs
+
+        set root='hd0,gpt3'
+        search --no-floppy --fs-uuid --set=root $UUID_SDA3
+	linuxefi /vmlinuz root=UUID=$UUID_SDA3 ro crashkernel=auto arraykicker nomodeset xdriver=vesa brokenmodules=ast rhgb quiet LANG=en_US.UTF-8 console=tty0 console=ttyS0,9600n8 iommu=pt intel_iommu=on hugepagesz=$avx_hgpgsz hugepages=$avx_hgpgs intel_pstate=disable pcie_acs_override=downstream loglevel=3 modprobe.blacklist=ast rd.auto=1 fsck.mode=force fsck.repair=yes
+        initrdefi /initramfs-array.img
 }
+
 menuentry 'AVXS' --class centos --class gnu-linux --class gnu --class os --unrestricted {
-	load_video
-	set gfxpayload=keep
-	insmod gzio
-	insmod part_gpt
-	insmod ext2
-	set root='hd0,gpt5'
-	search --no-floppy --fs-uuid --set=root $UUID_SDA5
-	linuxefi /vmlinuz root=UUID=$UUID_SDA5 ro crashkernel=auto arraykicker nomodeset xdriver=vesa brokenmodules=ast rhgb quiet LANG=en_US.UTF-8 console=tty0 console=ttyS0,9600n8 iommu=pt intel_iommu=on hugepagesz=$avx_hgpgsz hugepages=$avx_hgpgs intel_pstate=disable pcie_acs_override=downstream loglevel=3 modprobe.blacklist=ast
-  initrdefi /initramfs.img
+        load_video
+        set gfxpayload=keep
+        insmod gzio
+        insmod part_gpt
+        insmod ext2
+        insmod diskfilter
+        insmod mdraid1x
+        insmod xfs
+
+        set root='hd0,gpt5'
+        search --no-floppy --fs-uuid --set=root $UUID_SDA5
+        linuxefi /vmlinuz root=UUID=$UUID_SDA5 ro crashkernel=auto arraykicker nomodeset xdriver=vesa brokenmodules=ast rhgb quiet LANG=en_US.UTF-8 console=tty0 console=ttyS0,9600n8 iommu=pt intel_iommu=on hugepagesz=$avx_hgpgsz hugepages=$avx_hgpgs intel_pstate=disable pcie_acs_override=downstream loglevel=3 modprobe.blacklist=ast rd.auto=1 fsck.mode=force fsck.repair=yes
+        initrdefi /initramfs-array.img
 }
-
 ### END /etc/grub.d/10_linux ###
 
 ### BEGIN /etc/grub.d/20_linux_xen ###
Index: /branches/rel_avx_2_7_5_caswell_5070/conf/system/passwd
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/conf/system/passwd	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/conf/system/passwd	(working copy)
@@ -31,4 +31,6 @@
 test:x:1001:1002::/home/test:/bin/bash
 recovery:x:1003:1003::/:/ca/bin/recovery
 guest:x:1005:1005::/home/guest:/bin/bash
+nova:x:160:160::/var/lib/nova:/sbin/nologin
+neutron:x:161:161::/var/lib/neutron:/sbin/nologin
 array:x:1006:1000::/home/array:/ca/bin/ca_shell
Index: /branches/rel_avx_2_7_5_caswell_5070/conf/system/rc.local
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/conf/system/rc.local	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/conf/system/rc.local	(working copy)
@@ -14,4 +14,5 @@
 
 rm -f /var/lib/rsyslog/imjournal.state
 
+/ca/bin/set_avx_huge_mem.sh
 /usr/local/avx/bin/start_avxmonitor.sh
Index: /branches/rel_avx_2_7_5_caswell_5070/conf/system/rsyslog.service
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/conf/system/rsyslog.service	(revision 0)
+++ /branches/rel_avx_2_7_5_caswell_5070/conf/system/rsyslog.service	(working copy)
@@ -0,0 +1,13 @@
+[Unit]
+Description=System Logging Service
+;Requires=syslog.socket
+
+[Service]
+Type=notify
+EnvironmentFile=-/etc/sysconfig/rsyslog
+ExecStart=/usr/sbin/rsyslogd -n $SYSLOGD_OPTIONS
+StandardOutput=null
+
+[Install]
+WantedBy=multi-user.target
+;Alias=syslog.service

Property changes on: conf/system/rsyslog.service
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: /branches/rel_avx_2_7_5_caswell_5070/init/backend.service
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/init/backend.service	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/init/backend.service	(working copy)
@@ -12,6 +12,7 @@
 ExecStartPre=/ca/bin/init_network.py
 ExecStart=/ca/bin/backend
 ExecStartPost=/usr/bin/grub2-editenv - set avx_bootcount=0
+ExecStartPost=/ca/bin/get_port.py
 KillMode=process
 
 [Install]
Index: /branches/rel_avx_2_7_5_caswell_5070/lib/avxpci/get_port.py
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/lib/avxpci/get_port.py	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/lib/avxpci/get_port.py	(working copy)
@@ -1,3 +1,5 @@
+#!/usr/bin/python
+
 import argparse
 import os
 import json
Index: /branches/rel_avx_2_7_5_caswell_5070/scripts/avxapps_startup.sh
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/scripts/avxapps_startup.sh	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/scripts/avxapps_startup.sh	(working copy)
@@ -19,9 +19,6 @@
 # First boot up
 if [ -f "/etc/arrayfirstboot" ]
 then
-
-    rm -f /etc/arrayfirstboot
-
     ## When upgrade from 2.1 to 2.2, the below case should happen.
     # If NetworkManager service is still enabled, we should disable the service, and
     # rmmod ixgbe&i40e driver
@@ -101,19 +98,14 @@
     [ ! -d /var/array/backup ] && mkdir -p /var/array/backup
     [ ! -d /var/array/backup/tmp ] && mkdir -p /var/array/backup/tmp
 
-    /usr/bin/ipmitool lan set 1 ipsrc static
-    /usr/bin/ipmitool lan set 1 ipaddr 0.0.0.0
-    sleep 1
-
-    /usr/bin/ipmitool raw 0x30 0x70 0x0c 0x1 0x0
-
     # reset N5 card firmware to V2.0 during 1st boot
     /ca/bin/reset_microcode.sh V2.0
 
     MEM_TOTAL=$(free | awk '{if($1=="Mem:"){print $2}}')
     AVX_HUGES=$(awk -F '=' '{if($1=="avx_hgpgs"){print $2}}' $GRUBENV_PATH)
-    NEW_AVX_HUGES=5120
-    
+    /ca/bin/set_avx_huge_mem.sh
+    NEW_AVX_HUGES=$(awk -F '=' '{if($1=="avx_hgpgs"){print $2}}' $GRUBENV_PATH)
+
     pcie_acs_override_changed=0
     if [ "x${model}" == "x955800" ]; then
         if ! grep -q pcie_acs_override $GRUB_PATH; then
@@ -121,33 +113,6 @@
 		pcie_acs_override_changed=1
 	fi
     fi
-    if [ $MEM_TOTAL -gt 512000000 ]
-    then
-        NEW_AVX_HUGES=204800 #400G
-    elif [ $MEM_TOTAL -gt 384000000 ]
-    then
-        NEW_AVX_HUGES=153600 #300G
-    elif [ $MEM_TOTAL -gt 256000000 ]
-    then
-        NEW_AVX_HUGES=102400 #200G
-    elif [ $MEM_TOTAL -gt 176000000 ]
-    then
-        NEW_AVX_HUGES=65536 #128G
-    elif [ $MEM_TOTAL -gt 128000000 ]
-    then
-        NEW_AVX_HUGES=40960 #80G
-    elif [ $MEM_TOTAL -gt 96000000 ]
-    then
-        NEW_AVX_HUGES=32768 #64
-    elif [ $MEM_TOTAL -gt 64000000 ]
-    then
-        NEW_AVX_HUGES=20480 #40
-    fi
-
-    if [ $AVX_HUGES -ne $NEW_AVX_HUGES ]
-    then
-        sed -i "s/avx_hgpgs=.*/avx_hgpgs=$NEW_AVX_HUGES/g" $GRUBENV_PATH 
-    fi
 
     if [ $pcie_acs_override_changed -eq 1 ] || [ $AVX_HUGES -ne $NEW_AVX_HUGES ]
     then
@@ -168,6 +133,7 @@
     fi
     systemctl stop docker 1>/dev/null 2>&1
 
+    rm -f /etc/arrayfirstboot
 fi
 
 for upgrade_sh in /ca/bin/upgrade_script/*
@@ -286,3 +252,5 @@
 if [ ! -d "/var/log/httpd" ]; then
   mkdir /var/log/httpd
 fi
+
+rm -f /var/run/avx_port.cache
Index: /branches/rel_avx_2_7_5_caswell_5070/scripts/avxapps_upgrade.sh
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/scripts/avxapps_upgrade.sh	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/scripts/avxapps_upgrade.sh	(working copy)
@@ -136,6 +136,13 @@
             else
                 install -m 0644 /caupgrade/ca/conf/system/grub.cfg.2U $GRUB_CFG_PATH
             fi
+        elif { [ $mtpt == "md126p3md126p5" ] || [ $mtpt == "md126p5md126p3" ]; } \
+          && { [ "x${model}" == "x957902" ] || [ "x${model}" == "x959902" ]; }; then
+            UUID_SDA3=$(lsblk -f /dev/md126 -nl --output=LABEL,UUID | awk '{if($1=="root"){print $2}}')
+            UUID_SDA5=$(lsblk -f /dev/md126 -nl --output=LABEL,UUID | awk '{if($1=="caupgrade"){print $2}}')
+            install -m 0644 /caupgrade/ca/conf/system/grub.cfg.2U_UEFI $GRUB_CFG_PATH
+            sed -i "s/\$UUID_SDA3/$UUID_SDA3/g" $GRUB_CFG_PATH
+            sed -i "s/\$UUID_SDA5/$UUID_SDA5/g" $GRUB_CFG_PATH
         elif [ $mtpt == "sda5sda6" ] || [ $mtpt == "sda6sda5" ]; then
             install -m 0644 /caupgrade/ca/conf/system/grub.cfg.2U_cmcc $GRUB_CFG_PATH
         elif [ $mtpt == "sda4sda5" ] || [ $mtpt == "sda5sda4" ]; then
Index: /branches/rel_avx_2_7_5_caswell_5070/scripts/avxbuildutils.py
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/scripts/avxbuildutils.py	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/scripts/avxbuildutils.py	(working copy)
@@ -382,7 +382,23 @@
                     full_path = os.path.join(dirname, filename)
         if full_path:
             dst_file = BUILD_CHROOT_BASE_PATH + "vmlinuz"
-            os.rename(full_path, dst_file)
+            shutil.copy2(full_path, dst_file)
+            logging.debug("copy file from %s to %s", full_path, dst_file)
+            return True
+        else:
+            return False
+
+    def _copy_initramfs(self):
+        current_vm_path = DEFAULT_CHROOT_DIR + "/boot/"
+        full_path = None
+        for dirname, dirnames, filenames in os.walk(current_vm_path):
+            for filename in filenames:
+                if filename.startswith("initramfs-3.10.0"):
+                    full_path = os.path.join(dirname, filename)
+                    break
+        if full_path:
+            dst_file = BUILD_CHROOT_BASE_PATH + "initramfs-array.img"
+            shutil.copy2(full_path, dst_file)
             logging.debug("copy file from %s to %s", full_path, dst_file)
             return True
         else:
@@ -392,10 +408,12 @@
         try:
             if not self._copy_vmlinuz():
                 logging.error("Failed to copy vmlinuz")
+            if not self._copy_initramfs():
+                logging.error("Failed to copy initramfs")
             # make tar.gz package
             pack_dirs = ['root', 'etc', 'home', 'mnt', 'opt', 'run',
                          'media', 'srv', 'tmp', 'usr', 'ca', 'bin', 'dev',
-                         'lib', 'lib64', 'proc', 'sys', 'sbin', 'vmlinuz', 'rpm.txt']
+                         'lib', 'lib64', 'proc', 'sys', 'sbin', 'vmlinuz', 'initramfs-array.img', 'rpm.txt']
             tar_cmd = ['tar', 'zcf', TAR_PACKAGE_NAME, '-C', BUILD_CHROOT_BASE_PATH] + pack_dirs
             log_exec(tar_cmd)
             # make avxupdate.array package
Index: /branches/rel_avx_2_7_5_caswell_5070/scripts/buildenv.ks
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/scripts/buildenv.ks	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/scripts/buildenv.ks	(working copy)
@@ -186,4 +186,7 @@
 libunistring-devel
 ldns-devel
 libffi-devel
+# for RAID
+mdadm-4.1-6.el7.x86_64
+dosfstools-3.0.20-9.el7.x86_64
 %end
Index: /branches/rel_avx_2_7_5_caswell_5070/scripts/init_avx.sh
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/scripts/init_avx.sh	(revision 0)
+++ /branches/rel_avx_2_7_5_caswell_5070/scripts/init_avx.sh	(working copy)
@@ -0,0 +1,193 @@
+#!/usr/bin/bash
+
+AVX_MODEL_NAME=
+AVX_MODEL_ID="$1"
+AVX_PRODUCT_ID=`date +%Y%m%d%H%M%S`0
+MGMT_PORT="$2"
+AVX_HOST_NAME=AN
+MB_NAME="$3"
+GRUB_PATH=/boot/grub2/grub.cfg
+GRUBENV_PATH=/boot/grub2/grubenv
+FSTAB_FILE=fstab
+GRUB_FILE=grub.cfg
+
+if [  -d "/boot/efi/EFI/centos" ];then
+    GRUB_PATH=/boot/efi/EFI/centos/grub.cfg
+    GRUBENV_PATH=/boot/efi/EFI/centos/grubenv
+    FSTAB_FILE=fstab.efi
+    GRUB_FILE=grub.cfg.efi
+fi
+
+#check array model
+function check_avx_model()
+{
+    if [ -z "$AVX_MODEL_ID" ]; then
+        echo "AVX model ID is not provided, exit!"
+        exit 1
+    fi
+}
+
+#check MGMT port
+function get_mgmt_port()
+{
+    if [ -z "$MGMT_PORT" ]; then
+        if [ -z  "$MB_NAME" ]; then
+            MB_NAME=`dmidecode -s baseboard-product-name`
+        fi
+
+        if [ "$MB_NAME" == "CAPB-5070NR-8000" ]; then
+            MGMT_PORT=enp1s0f0
+        else
+            echo "Management port is not provided, exit!"
+            exit 1
+        fi
+    fi
+}
+
+#configure hugepage memory size
+/ca/bin/set_avx_huge_mem.sh
+
+echo "=== Checking AVX model ID ==="
+check_avx_model
+echo "AVX Model ID: $AVX_MODEL_ID"
+
+echo "=== Getting management port ==="
+get_mgmt_port
+echo "Management Port: $MGMT_PORT"
+
+# Disable selinux
+setenforce 0
+
+#copy repo into /opt
+for file in `ls /etc/yum.repos.d/ |grep .repo`
+do
+    mv /etc/yum.repos.d/$file /opt/
+done
+
+# create basic directory
+
+# For sendmail service
+mkdir -p /var/spool/mqueue/
+chmod 755 -R /var/spool/mqueue/
+install -d -m 770 -o smmsp -g smmsp /var/spool/clientmqueue
+
+# For xmlrpm function
+mkdir -p /var/www/cgi-bin/
+mkdir -p /var/www/html/
+
+chmod 755 -R /var/www/
+
+mkdir -p /var/array/public/config/
+mkdir -p /var/array/public/images/ani/
+mkdir -p /var/array/public/openvswitch/
+mkdir -p /var/array/va/conf/
+mkdir -p /var/array/va/images/
+mkdir -p /var/array/va/docker
+mkdir -p /var/crash
+
+chmod 777 -R /var/array/
+
+mkdir -p /caupgrade/etc/libvirt/
+mkdir -p /etc/libvirt/
+mkdir -p /caupgrade/etc/keepalived/
+
+chmod 755 /caupgrade/etc/
+chmod 755 /caupgrade/etc/libvirt
+chmod 755 /etc/libvirt
+chmod 755 /caupgrade/etc/keepalived
+
+# copy the configuration file into system
+install -m 0644 /ca/conf/system/group /etc/
+install -m 0644 /ca/conf/system/group /caupgrade/etc/
+install -m 0644 /ca/conf/system/passwd /etc/
+install -m 0644 /ca/conf/system/passwd /caupgrade/etc/
+install -m 0000 /ca/conf/shadow /etc/
+install -m 0000 /ca/conf/shadow /caupgrade/etc/
+install -m 0644 /ca/conf/system/libvirtd.conf /etc/libvirt/libvirtd.conf
+install -m 0644 /ca/conf/system/libvirtd.conf /caupgrade/etc/libvirt/libvirtd.conf
+install -Dm 0755 /ca/conf/system/rc.local /etc/rc.d/rc.local
+install -Dm 0755 /ca/conf/system/rc.local /caupgrade/etc/rc.d/rc.local
+install -m 0644 /ca/conf/system/rsyslog.service /usr/lib/systemd/system/rsyslog.service
+install -m 0644 /ca/conf/system/rsyslog.service /caupgrade/usr/lib/systemd/system/rsyslog.service
+
+# customize hostname
+echo $AVX_HOST_NAME > /etc/hostname
+install -m 0644 /etc/hostname /caupgrade/etc/hostname
+
+echo $AVX_PRODUCT_ID > /var/array/public/config/arrayid
+echo $AVX_MODEL_ID > /var/array/public/config/arraymodel
+echo $MGMT_PORT > /var/array/public/config/mgmtport
+# set powersupplyid
+if [ "x${model}" == "x953600" ];
+then
+    echo 110112 > /var/array/public/config/powersupplyid
+else
+    echo 210112 > /var/array/public/config/powersupplyid
+fi
+/usr/bin/grub2-editenv $GRUBENV_PATH set avx_bootcount=0
+/usr/bin/grub2-editenv $GRUBENV_PATH set avx_menuent=0
+
+# disable useless service
+systemctl stop  NetworkManager
+systemctl disable NetworkManager
+
+systemctl stop firewalld.service
+systemctl disable firewalld.service
+
+# enable service
+chkconfig network on
+
+# disable selinux
+sed  -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
+sed  -i "s/SELINUX=enforcing/SELINUX=disabled/g" /caupgrade/etc/selinux/config
+
+case "$AVX_MODEL_ID" in
+    959702)
+        install -m 0644 /ca/conf/system/avxdpdk.info.7900 /var/array/public/openvswitch/avxdpdk.info
+        ;;
+    959902)
+        install -m 0644 /ca/conf/system/avxdpdk.info.9900 /var/array/public/openvswitch/avxdpdk.info
+        ;;
+    *)
+        install -m 0644 /ca/conf/system/avxdpdk.info.3600 /var/array/public/openvswitch/avxdpdk.info
+        ;;
+esac
+
+# Configure mgmt_port as a slave of br0 and enable it at boot
+BRIDGE=br0
+CFG_FILE=/etc/sysconfig/network-scripts/ifcfg-$MGMT_PORT
+
+echo "=== Configuring $MGMT_PORT as a slave of bridge $BRIDGE ==="
+cat << EOF > $CFG_FILE
+TYPE=Ethernet
+DEVICE=$MGMT_PORT
+BOOTPROTO=none
+ONBOOT=yes
+BRIDGE=$BRIDGE
+EOF
+
+cp -f $CFG_FILE /caupgrade$CFG_FILE
+
+echo "[OK] $CFG_FILE has been created"
+echo "[INFO] Restarting network service"
+systemctl restart network
+
+
+# Fix sshd service
+SSHD_DIR=/var/empty/sshd
+echo "=== Checking SSH privilege separation directory ststus ==="
+if [ -d "$SSHD_DIR" ]; then
+    echo "[OK] $SSHD_DIR already exists"
+else
+    echo "[INFO] Directory does not exist, creating..."
+    mkdir -p $SSHD_DIR
+fi
+
+echo "[INFO] Setting directory permissions and ownership"
+chmod 700 $SSHD_DIR
+chown root:root $SSHD_DIR
+
+echo "[INFO] Restarting sshd service"
+systemctl restart sshd
+
+echo "Completed Successfully! Please reboot this appliance to switch to the AVX system."

Property changes on: scripts/init_avx.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: /branches/rel_avx_2_7_5_caswell_5070/scripts/set_avx_huge_mem.sh
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/scripts/set_avx_huge_mem.sh	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/scripts/set_avx_huge_mem.sh	(working copy)
@@ -6,6 +6,7 @@
 fi
 
 MEM_TOTAL=$(free | awk '{if($1=="Mem:"){print $2}}')
+
 AVX_HUGES=20480
 if [ $MEM_TOTAL -gt 512000000 ]
 then
@@ -30,5 +31,19 @@
     AVX_HUGES=20480 #40G
 fi
 
-sed -i "s/avx_hgpgsz=.*/avx_hgpgsz=2M/g" $GRUBENV_PATH
-sed -i "s/avx_hgpgs=.*/avx_hgpgs=$AVX_HUGES/g" $GRUBENV_PATH
+OLD_HUGES=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 2>/dev/null)
+if [ -z $OLD_HUGES ] || [ $OLD_HUGES -ne $AVX_HUGES ]
+then
+    echo "$AVX_HUGES" > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
+fi
+
+OLD_HUGES=$(awk -F '=' '{if($1=="avx_hgpgs"){print $2}}' $GRUBENV_PATH)
+if [ -z $OLD_HUGES ] || [ $OLD_HUGES -ne $AVX_HUGES ]
+then
+    /usr/bin/grub2-editenv $GRUBENV_PATH set avx_hgpgsz=2M
+    /usr/bin/grub2-editenv $GRUBENV_PATH set avx_hgpgs=$AVX_HUGES
+    echo "Hugepage size changed from $OLD_HUGES to $AVX_HUGES, need to reboot to take effect." >> /var/log/avxd.log
+    rm -f /initrd.img
+    rm -f /var/run/avx_port.cache
+    reboot
+fi
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/Makefile
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/Makefile	(revision 0)
+++ /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/Makefile	(working copy)
@@ -0,0 +1,181 @@
+# Define variables
+ROOT_DIR := ../..
+
+ISO_NAME     := install_AVX_2_7.iso
+BASE_ISO     := Rocky-9.5-x86_64-minimal.iso
+MOUNT_DIR    := ./iso_mount
+BUILD_DIR    := ./rocky_liveCD
+LABEL        := Rocky-9-5-x86_64-dvd
+
+AVX_KS_FILE  := avx_deploy.ks
+CENTOS_BOOT  := centos_boot.tar.gz
+
+PEM_FILE     := click_pub_cert.pem
+AVX_PEM_FILE := $(ROOT_DIR)/tools/$(PEM_FILE)
+
+ORGINAL_SIGN_UNPACK_DIR:= ./sign_unpack
+SIGN_UNPACK_FILE       := sign_unpack
+SIGN_UNPACK  := $(ORGINAL_SIGN_UNPACK_DIR)/$(SIGN_UNPACK_FILE)
+
+UEFI_GRUB    := grub.cfg
+UEFI_GRUB_DIR:= $(BUILD_DIR)/EFI/BOOT/
+
+# Directories for AVX assets
+ARRAY_DIR    := $(BUILD_DIR)/ArrayAVX
+SIGN_DIR     := $(ARRAY_DIR)/sign_unpack
+
+# Repository URLs
+REPO_URL := http://192.168.100.11/everything
+REPO_FILE := /etc/yum.repos.d/internal_temp.repo
+
+# Default target
+all: build_iso
+
+## 1. Prepare environment
+prepare:
+	@echo "Creating directories..."
+	mkdir -p $(MOUNT_DIR)
+	mkdir -p $(BUILD_DIR)
+	mkdir -p $(SIGN_DIR)
+
+## 2. Extract ISO contents (requires sudo to mount)
+extract: prepare
+	@if [ ! -f $(BASE_ISO) ]; then \
+		wget http://192.168.100.11/install_iso_creator_apv_avx/$(BASE_ISO); \
+		if [ ! -f $(BASE_ISO) ]; then \
+			wget https://download.rockylinux.org/pub/rocky/9/isos/x86_64/$(BASE_ISO); \
+		fi; \
+		if [ ! -f $(BASE_ISO) ]; then \
+			echo "Error: $(BASE_ISO) not found!"; \
+			exit 1; \
+		fi; \
+	fi
+
+	@if [ -d "$(BUILD_DIR)" ] && [ -f "$(BUILD_DIR)/isolinux/isolinux.bin" ]; then \
+		echo "Directory $(BUILD_DIR) already exists and is not empty. Skipping extract."; \
+	else \
+		echo "Mounting and copying ISO contents..."; \
+		mount -o loop $(BASE_ISO) $(MOUNT_DIR); \
+		cp -r $(MOUNT_DIR)/. $(BUILD_DIR)/; \
+		umount $(MOUNT_DIR); \
+		chmod -R 755 $(BUILD_DIR); \
+	fi
+
+## 3. Compile and inject files (this part requires manual placement of source code)
+# Assuming you have placed sign_unpack.c in the current directory
+inject: extract
+	@echo "Injecting AVX 2.7 assets..."
+	# Copy Kickstart and Array images
+	cp -f $(AVX_KS_FILE) $(ARRAY_DIR)/
+	cp -f $(CENTOS_BOOT) $(ARRAY_DIR)/
+	cp -f $(ROOT_DIR)/*.array $(ARRAY_DIR)/
+
+	cp -f $(AVX_PEM_FILE) $(SIGN_DIR)/
+	cp -f $(SIGN_UNPACK) $(SIGN_DIR)/
+
+	cp -f $(UEFI_GRUB) $(UEFI_GRUB_DIR)/
+
+check_files: inject
+	@if [ ! -f $(ARRAY_DIR)/$(AVX_KS_FILE) ]; then \
+		echo "Error: Kickstart file $(AVX_KS_FILE) not found in $(ARRAY_DIR)!"; \
+		exit 1; \
+	fi
+
+	@if [ ! -f $(ARRAY_DIR)/$(CENTOS_BOOT) ]; then \
+		echo "Error: Boot image $(CENTOS_BOOT) not found in $(ARRAY_DIR)!"; \
+		exit 1; \
+	fi
+
+	@if [ $$(ls $(ARRAY_DIR)/*.array 2>/dev/null | wc -l) -eq 0 ]; then \
+		echo "Error: No .array files found in $(ARRAY_DIR)!"; \
+		exit 1; \
+	fi
+
+	@if [ ! -f $(SIGN_DIR)/$(PEM_FILE) ]; then \
+		echo "Error: PEM file $(PEM_FILE) not found in $(SIGN_DIR)!"; \
+		exit 1; \
+	fi
+
+	@if [ ! -f $(SIGN_DIR)/$(SIGN_UNPACK_FILE) ]; then \
+		echo "Error: $(SIGN_UNPACK_FILE) binary not found in $(SIGN_DIR)!"; \
+		exit 1; \
+	fi
+
+	@if [ ! -f $(UEFI_GRUB_DIR)/$(UEFI_GRUB) ]; then \
+		echo "Error: UEFI $(UEFI_GRUB) not found in $(UEFI_GRUB_DIR)!"; \
+		exit 1; \
+	fi
+
+install_deps:
+	@if ! which mkisofs > /dev/null 2>&1; then \
+		echo "mkisofs not found. Setting up temporary repo..."; \
+		bash -c 'echo -e "[internal-temp]\nname=Internal Temp Repo\nbaseurl=$(REPO_URL)\nenabled=1\ngpgcheck=0" > $(REPO_FILE)'; \
+		yum clean expire-cache; \
+		yum install -y genisoimage; \
+		rm -f $(REPO_FILE); \
+	fi
+
+	@if ! which isohybrid > /dev/null 2>&1; then \
+		echo "isohybrid not found. Setting up temporary repo..."; \
+		bash -c 'echo -e "[internal-temp]\nname=Internal Temp Repo\nbaseurl=$(REPO_URL)\nenabled=1\ngpgcheck=0" > $(REPO_FILE)'; \
+		yum clean expire-cache; \
+		yum install -y syslinux; \
+		rm -f $(REPO_FILE); \
+	fi
+
+## 4. Build ISO
+build_iso: check_files install_deps
+	@echo "Generating bootable UEFI ISO..."
+
+# CentOS 7 is using genisoimage
+	mkisofs -o ./$(ISO_NAME) \
+		-v -R -J -T \
+		-cache-inodes \
+		-joliet-long \
+		-b isolinux/isolinux.bin \
+		-c isolinux/boot.cat \
+		-no-emul-boot \
+		-boot-load-size 4 \
+		-boot-info-table \
+		-eltorito-alt-boot \
+		-e images/efiboot.img \
+		-no-emul-boot \
+		-V '$(LABEL)' \
+		$(BUILD_DIR)/
+
+# for RockyLinux 9
+# 	mkisofs -o ./$(ISO_NAME) \
+# 		-b isolinux/isolinux.bin \
+# 		-c isolinux/boot.cat \
+# 		-no-emul-boot \
+# 		-boot-load-size 4 \
+# 		-boot-info-table \
+# 		-eltorito-alt-boot \
+# 		-e images/efiboot.img \
+# 		-no-emul-boot \
+# 		-isohybrid-gpt-basdat \
+# 		-V '$(LABEL)' \
+# 		-R -J -v -T $(BUILD_DIR)/
+
+	@if [ $$? -ne 0 ]; then \
+		echo "Error: ISO creation failed!"; \
+		exit 1; \
+	fi
+
+# Make the ISO hybrid (bootable on both BIOS and UEFI)
+# For CentOS 7, isohybrid is part of syslinux package
+	isohybrid --uefi ./$(ISO_NAME)
+	@if [ $$? -ne 0 ]; then \
+		echo "Error: isohybrid failed!"; \
+		exit 1; \
+	fi
+
+	@echo "Done! Output: $(ISO_NAME)"
+
+## 5. Clean environment
+clean:
+	@echo "Cleaning up..."
+	umount $(MOUNT_DIR) 2>/dev/null || true
+	rm -rf $(MOUNT_DIR) $(BUILD_DIR) $(REPO_FILE) $(ISO_NAME) $(BASE_ISO)
+
+.PHONY: all prepare extract inject build_iso clean check_files install_deps
\ No newline at end of file
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/README.md
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/README.md	(revision 0)
+++ /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/README.md	(working copy)
@@ -0,0 +1,74 @@
+# Install iso creator
+
+Created UEFI disk for AVX by modifying the RockyLinux 9.5 LiveCD to install AVX 2.7.
+
+1. Download the base ISO: **Rocky-9.5-x86_64-minimal.iso**  
+Since the CentOS 7 LiveCD does not support EFI boot, Rocky Linux 9 is used as the base instead.
+    - [RockyLinux official](https://dl.rockylinux.org/vault/rocky/9.5/isos/x86_64/Rocky-9.5-x86_64-minimal.iso)
+    - [ArrayNetworks repo server](http://192.168.100.11/install_iso_creator_apv_avx/Rocky-9.5-x86_64-minimal.iso)
+
+2. Extract the contents  
+```
+mkdir iso_mount
+mkdir rocky_liveCD
+mount Rocky-9.5-x86_64-minimal.iso ./iso_mount/
+cp -r ./iso_mount/. ./rocky_liveCD/
+umount ./iso_mount/
+```
+
+3. Add file
+    - create folder in `./rocky_liveCD/Array`
+        - `avx_deploy.ks`
+        - `*.array`  
+        This `*.array` must be the version modified to support `UEFI`. The previous version cannot be used.
+        - `centos_boot.tar.gz`  
+        Use `CentOS-7-x86_64-LiveGNOME-1511.iso` to install UEFI CentOS 7, and copy the `/boot` directory from it.
+            - [CentOS official](https://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-LiveGNOME-1511.iso)
+            - [ArrayNetworks repo server](http://192.168.100.11/install_iso_creator_apv_avx/CentOS-7-x86_64-LiveGNOME-1511.iso)
+    - create folder in `./rocky_liveCD/Array/sign_unpack`
+        - copy `click_pub_cert.pem` from `usr/click/tools/click_pub_cert.pem`
+        - compile `sign_unpack` from `usr\click\bin\sign_unpack` in `RockyLinux 9.5`  
+        Since the LiveCD environment is `RockyLinux 9.5`, the `sign_unpack.c` from the AVX 2.7 project needs to be brought into `RockyLinux 9.5` for compilation.
+
+4. Modify `./rocky_liveCD/EFI/BOOT/grub.cfg`
+
+5. Rebuild the ISO  
+The -V \<Label\> should not be modified arbitrarily; it must match other configuration files.
+    - RockyLinux 9.5  
+    ```
+    mkisofs -o ./install_AVX_2_7.iso \
+    -b isolinux/isolinux.bin \
+    -c isolinux/boot.cat \
+    -no-emul-boot \
+    -boot-load-size 4 \
+    -boot-info-table \
+    -eltorito-alt-boot \
+    -e images/efiboot.img \
+    -no-emul-boot \
+    -isohybrid-gpt-basdat \
+    -V 'Rocky-9-5-x86_64-dvd' \
+    -R -J -v -T ./rocky_liveCD/
+    ```
+    - CentOS 7  
+    ```
+    mkisofs -o ./install_AVX_2_7.iso \
+		-v -R -J -T \
+		-cache-inodes \
+		-joliet-long \
+		-b isolinux/isolinux.bin \
+		-c isolinux/boot.cat \
+		-no-emul-boot \
+		-boot-load-size 4 \
+		-boot-info-table \
+		-eltorito-alt-boot \
+		-e images/efiboot.img \
+		-no-emul-boot \
+		-V 'Rocky-9-5-x86_64-dvd' \
+		./rocky_liveCD/
+
+    isohybrid --uefi ./install_AVX_2_7.iso
+    ```
+
+6. Create the installation USB drive.
+    - Use [Rufus](https://rufus.ie/zh_TW/) in Windows
+    - Use `dd` in Linux
\ No newline at end of file
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/avx_deploy.ks
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/avx_deploy.ks	(revision 0)
+++ /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/avx_deploy.ks	(working copy)
@@ -0,0 +1,370 @@
+# Install using text interface
+text
+
+# Language settings
+keyboard --vckeymap=us --xlayouts='us'
+lang en_US.UTF-8
+eula --agreed
+timezone US/Eastern
+
+# Do not configure the X Window System
+skipx
+
+# Automatically shut down after installation is complete
+poweroff
+
+# Because we need to specify the partition order,
+# we are not using Kickstart's built-in partitioning commands to initialize the disk.
+# # Use GPT partitioning + specify the target disk vda for kvm, sda for other
+# ignoredisk --only-use=sda
+# zerombr
+# clearpart --all --initlabel
+
+# using this pre instead of regular partitioning to preserve the order of the partitions
+%pre
+
+# output to main screen
+LOG_FILE="/tmp/ks-pre-debug.log"
+touch $LOG_FILE
+
+print_msg() {
+  while IFS= read -r line; do
+    echo -e "${line}\r" > /dev/tty1
+    echo "${line}" >> $LOG_FILE
+  done
+}
+
+echo "Waiting for disk to be ready..." | print_msg
+udevadm trigger --action=add
+udevadm settle
+
+DISK_BASE=""
+DEV_PATH=""
+DEV_PATHS=()
+PART_NUMS=(0 1 2 3 4 5 6 7 8)
+
+echo "Start to find disk..." | print_msg
+if grep -qw 'arrayraid' /proc/cmdline; then
+  MDSTAT="/proc/mdstat"
+  echo "cat $MDSTAT" | print_msg
+  cat "$MDSTAT" 2>&1 | print_msg
+  echo "lsblk -f" | print_msg
+  lsblk -f 2>&1 | print_msg
+
+  TIMEOUT=60
+  while [[ $TIMEOUT -gt 0 ]]; do
+    while read -r line; do
+      if [[ $line =~ ^(md[0-9]+)[[:space:]]*:[[:space:]]*active[[:space:]]+raid ]]; then
+        DISK_BASE="${BASH_REMATCH[1]}"
+        DEV_PATH="/dev/$DISK_BASE"
+        break 2
+      fi
+    done < "$MDSTAT"
+
+    sleep 1
+    ((TIMEOUT--))
+  done
+
+  if [[ -z "$DISK_BASE" ]]; then
+    echo "raid disk still not found after waiting." | print_msg
+    echo "cat $MDSTAT" | print_msg
+    cat "$MDSTAT" 2>&1 | print_msg
+    exit 1
+  fi
+
+  PART_NUMS=(p0 p1 p2 p3 p4 p5 p6 p7 p8)
+else
+  if [ ! -b /dev/sda ]; then
+    echo "/dev/sda still not found after waiting." | print_msg
+    echo "lsblk -f" | print_msg
+    lsblk -f 2>&1 | print_msg
+    exit 1
+  fi
+
+  DISK_BASE="sda"
+  DEV_PATH="/dev/$DISK_BASE"
+fi
+
+for p in "${PART_NUMS[@]}"; do
+  DEV_PATHS+=("${DEV_PATH}${p}")
+done
+
+# create partitions
+echo "Start to create partitions..." | print_msg
+size=$(lsblk -bd -o NAME,SIZE | grep "^sda" | awk '{print $2}')
+num_size=$((size/1024/1024/1024))
+
+ROOT_SIZE="+8G"
+SWAP_SIZE="+4G"
+if [ "$num_size" -lt 900 ]; then
+  ROOT_SIZE="+8G"
+  SWAP_SIZE="+4G"
+else
+  ROOT_SIZE="+32G"
+  SWAP_SIZE="+64G"
+fi
+
+vgchange -an
+wipefs -af "$DEV_PATH"
+sgdisk -og "$DEV_PATH"
+sgdisk -n 1:0:+200M       -t 1:ef00 -c 1:"efi" "$DEV_PATH"
+sgdisk -n 2:0:+200M       -t 2:8300 -c 2:"boot" "$DEV_PATH"
+sgdisk -n 3:0:$ROOT_SIZE  -t 3:8300 -c 3:"root" "$DEV_PATH"
+sgdisk -n 4:0:$SWAP_SIZE  -t 4:8200 -c 4:"swap" "$DEV_PATH"
+sgdisk -n 5:0:$ROOT_SIZE  -t 5:8300 -c 5:"caupgrade" "$DEV_PATH"
+sgdisk -n 6:0:0           -t 6:8300 -c 6:"var" "$DEV_PATH"
+
+mkfs.vfat -F32 -n EFI "${DEV_PATHS[1]}"
+mkfs.ext4 -F -O ^metadata_csum -L boot "${DEV_PATHS[2]}"
+mkfs.xfs -f -m crc=0 -L root "${DEV_PATHS[3]}"
+mkswap -f -L swap "${DEV_PATHS[4]}"
+mkfs.xfs -f -m crc=0 -L caupgrade "${DEV_PATHS[5]}"
+mkfs.xfs -f -m crc=0 -L var "${DEV_PATHS[6]}"
+
+parted "$DEV_PATH" set 1 boot on
+parted "$DEV_PATH" set 1 esp on
+
+##################################################
+
+ARRAY_PATH="/run/install/repo/ArrayAVX"
+SIGN_UNPACK_PATH="$ARRAY_PATH/sign_unpack"
+VAR_PATH="/mnt/var"
+ROOT_PATH="/mnt/root"
+BOOT_PATH="/mnt/boot"
+EFI_PATH="$BOOT_PATH/efi"
+
+#################### Get *.tar.gz ####################
+# Due to space limitations, the *.array file is copied to /var.
+# It is then extracted to obtain avx.tar.gz.
+echo "Start to get *.tar.gz from *.array..." | print_msg
+mkdir -p "$VAR_PATH"
+mount "${DEV_PATHS[6]}" "$VAR_PATH"
+
+if [ ! -f "$SIGN_UNPACK_PATH/sign_unpack" ]; then
+  echo "Not found $SIGN_UNPACK_PATH/sign_unpack file..." | print_msg
+  exit 1
+fi
+cp "$SIGN_UNPACK_PATH/sign_unpack" "$VAR_PATH/"
+chmod +x "$VAR_PATH/sign_unpack"
+
+if [ ! -f "$SIGN_UNPACK_PATH/click_pub_cert.pem" ]; then
+  echo "Not found $SIGN_UNPACK_PATH/click_pub_cert.pem file..." | print_msg
+  exit 1
+fi
+cp "$SIGN_UNPACK_PATH/click_pub_cert.pem" "$VAR_PATH/"
+
+file=$(find "$ARRAY_PATH" -maxdepth 1 -name "*.array" | sort | head -n 1 | xargs basename)
+if [ -n "$file" ]; then
+  cp "$ARRAY_PATH/$file" "$VAR_PATH/"
+fi
+
+"$VAR_PATH/sign_unpack" -i "$VAR_PATH/$file" -o "$VAR_PATH/avx.tar.gz"  -c "$VAR_PATH/click_pub_cert.pem"
+if [ ! -f "$VAR_PATH/avx.tar.gz" ]; then
+  echo "Not found $VAR_PATH/avx.tar.gz file..." | print_msg
+  exit 1
+fi
+#################### End ####################
+
+#################### Install to LABEL=root ####################
+echo "Start to install to LABEL=root..." | print_msg
+mkdir -p "$ROOT_PATH"
+mount "${DEV_PATHS[3]}" "$ROOT_PATH"
+tar -xzvf "$VAR_PATH/avx.tar.gz" -C "$ROOT_PATH/"
+
+echo 'LABEL=root       /              xfs     defaults        0 0' >  "$ROOT_PATH/etc/fstab"
+echo 'LABEL=boot       /boot          ext4    defaults        1 2' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=caupgrade  /caupgrade     xfs     defaults        0 0' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=swap       swap           swap    defaults        0 0' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=var        /var           xfs     defaults        0 0' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=EFI        /boot/efi      vfat    umask=0077,shortname=winnt  0 2' >> "$ROOT_PATH/etc/fstab"
+
+#echo "SELINUX=disabled" > "$ROOT_PATH/etc/selinux/config"
+#echo "SELINUXTYPE=targeted" >> "$ROOT_PATH/etc/selinux/config"
+echo "AN" > "$ROOT_PATH/etc/hostname"
+#################### End ####################
+
+#################### Install to LABEL=caupgrade ####################
+echo "Start to install to LABEL=caupgrade..." | print_msg
+umount "$ROOT_PATH"
+mount "${DEV_PATHS[5]}" "$ROOT_PATH"
+tar -xzvf "$VAR_PATH/avx.tar.gz" -C "$ROOT_PATH/"
+
+echo 'LABEL=caupgrade  /              xfs     defaults        0 0' >  "$ROOT_PATH/etc/fstab"
+echo 'LABEL=boot       /boot          ext4    defaults        1 2' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=root       /caupgrade     xfs     defaults        0 0' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=swap       swap           swap    defaults        0 0' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=var        /var           xfs     defaults        0 0' >> "$ROOT_PATH/etc/fstab"
+echo 'LABEL=EFI        /boot/efi      vfat    umask=0077,shortname=winnt  0 2' >> "$ROOT_PATH/etc/fstab"
+
+#echo "SELINUX=disabled" > "$ROOT_PATH/etc/selinux/config"
+#echo "SELINUXTYPE=targeted" >> "$ROOT_PATH/etc/selinux/config"
+echo "AN" > "$ROOT_PATH/etc/hostname"
+#################### End ####################
+
+#################### Copy CentOS7 boot ####################
+echo "Start to copy CentOS7 boot to LABEL=boot..." | print_msg
+mkdir -p "$BOOT_PATH"
+mount "${DEV_PATHS[2]}" "$BOOT_PATH"
+mount "${DEV_PATHS[1]}" "$EFI_PATH"
+
+shopt -s dotglob
+
+rm -rf "$EFI_PATH"/*
+umount "$EFI_PATH"
+rm -rf "$BOOT_PATH"/*
+mkdir -p "$EFI_PATH"
+mount "${DEV_PATHS[1]}" "$EFI_PATH"
+
+shopt -u dotglob
+
+if [ ! -f "$ARRAY_PATH/centos_boot.tar.gz" ]; then
+  echo "Not found $ARRAY_PATH/centos_boot.tar.gz file..." | print_msg
+  exit 1
+fi
+tar -xzvf "$ARRAY_PATH/centos_boot.tar.gz" -C "$BOOT_PATH/" --strip-components=1
+#################### End ####################
+
+#################### Modify /boot/efi/EFI/centos/grub.cfg ####################
+echo "Start to write /boot/efi/EFI/centos/grub.cfg..." | print_msg
+UUID_SDA3=$(blkid -s UUID -o value "${DEV_PATHS[3]}")
+UUID_SDA5=$(blkid -s UUID -o value "${DEV_PATHS[5]}")
+
+read -r -d '' DUAL_SYSTEM_BLOCK <<'EOF'
+######## BEGIN AVX Dual system failover ###########
+if [ ${avx_bootcount} == 0 ]; then
+        set avx_bootcount=1
+elif [ ${avx_bootcount} == 1 ]; then
+        set avx_bootcount=2
+elif [ ${avx_bootcount} == 2 ]; then
+        set avx_bootcount=3
+else
+        set avx_bootcount=0
+        if [ ${avx_menuent} == 0 ]; then
+                set avx_menuent=1
+        else
+                set avx_menuent=0
+        fi
+fi
+save_env avx_menuent
+save_env avx_bootcount
+
+if [ ${avx_menuent} == 0 ]; then
+set default="0"
+else
+set default="1"
+fi
+### END AVX Dual system failover ###
+EOF
+
+read -r -d '' BOOT_OPTION <<EOF
+### BEGIN /etc/grub.d/10_linux ###
+menuentry 'AVXM' --class centos --class gnu-linux --class gnu --class os --unrestricted {
+        load_video
+        set gfxpayload=keep
+        insmod gzio
+        insmod part_gpt
+        insmod ext2
+        insmod diskfilter
+        insmod mdraid1x
+        insmod xfs
+
+        set root='hd0,gpt3'
+        search --no-floppy --fs-uuid --set=root $UUID_SDA3
+	linuxefi /vmlinuz root=UUID=$UUID_SDA3 ro crashkernel=auto arraykicker nomodeset xdriver=vesa brokenmodules=ast rhgb quiet LANG=en_US.UTF-8 console=tty0 console=ttyS0,9600n8 iommu=pt intel_iommu=on hugepagesz=\$avx_hgpgsz hugepages=\$avx_hgpgs intel_pstate=disable pcie_acs_override=downstream loglevel=3 modprobe.blacklist=ast rd.auto=1 fsck.mode=force fsck.repair=yes
+        initrdefi /initramfs-array.img
+}
+
+menuentry 'AVXS' --class centos --class gnu-linux --class gnu --class os --unrestricted {
+        load_video
+        set gfxpayload=keep
+        insmod gzio
+        insmod part_gpt
+        insmod ext2
+        insmod diskfilter
+        insmod mdraid1x
+        insmod xfs
+
+        set root='hd0,gpt5'
+        search --no-floppy --fs-uuid --set=root $UUID_SDA5
+        linuxefi /vmlinuz root=UUID=$UUID_SDA5 ro crashkernel=auto arraykicker nomodeset xdriver=vesa brokenmodules=ast rhgb quiet LANG=en_US.UTF-8 console=tty0 console=ttyS0,9600n8 iommu=pt intel_iommu=on hugepagesz=\$avx_hgpgsz hugepages=\$avx_hgpgs intel_pstate=disable pcie_acs_override=downstream loglevel=3 modprobe.blacklist=ast rd.auto=1 fsck.mode=force fsck.repair=yes
+        initrdefi /initramfs-array.img
+}
+### END /etc/grub.d/10_linux ###
+EOF
+
+tmpfile=$(mktemp)
+{
+  echo "$DUAL_SYSTEM_BLOCK"
+  echo ""
+  echo "$BOOT_OPTION"
+} > "$tmpfile"
+
+PLACEHOLDER="__ARRAY_NETWORKS_PLACEHOLDER__"
+
+sed -i "/^### BEGIN \/etc\/grub.d\/10_linux ###/,/^### END \/etc\/grub.d\/10_linux ###$/c\\
+$PLACEHOLDER
+" "$EFI_PATH/EFI/centos/grub.cfg"
+
+sed -i "/^$PLACEHOLDER\$/{
+    r $tmpfile
+    d
+}" "$EFI_PATH/EFI/centos/grub.cfg"
+
+rm -f "$tmpfile"
+
+sed -i '/^saved_entry=/d' "$EFI_PATH/EFI/centos/grubenv"
+#################### End ####################
+
+#################### Clear /var ####################
+find "$VAR_PATH" -mindepth 1 -delete
+#################### End ####################
+
+umount "$EFI_PATH"
+umount "$BOOT_PATH"
+umount "$ROOT_PATH"
+umount "$VAR_PATH"
+
+#################### Init AVX ####################
+echo "Start to init avx..." | print_msg
+CHROOT_ROOT_PATH="/mnt/chroot"
+
+mkdir -p "$CHROOT_ROOT_PATH"
+mount "${DEV_PATHS[3]}" "$CHROOT_ROOT_PATH"
+
+mkdir -p "$CHROOT_ROOT_PATH/caupgrade"
+mkdir -p "$CHROOT_ROOT_PATH/var"
+mkdir -p "$CHROOT_ROOT_PATH/boot"
+
+mount "${DEV_PATHS[5]}" "$CHROOT_ROOT_PATH/caupgrade"
+mount "${DEV_PATHS[6]}" "$CHROOT_ROOT_PATH/var"
+mount "${DEV_PATHS[2]}" "$CHROOT_ROOT_PATH/boot"
+
+mkdir -p "$CHROOT_ROOT_PATH/boot/efi"
+mount "${DEV_PATHS[1]}" "$CHROOT_ROOT_PATH/boot/efi"
+
+CMDLINE=$(cat /proc/cmdline)
+ARRAYMODEL=$(echo $CMDLINE | sed -n 's/.*arraymodel=\([^ ]*\).*/\1/p')
+if [ -n "$ARRAYMODEL" ]; then
+  chroot "$CHROOT_ROOT_PATH" /bin/bash -c "mount proc /proc -t proc"
+  chroot "$CHROOT_ROOT_PATH" /bin/bash -c "chmod +x /ca/bin/init_avx.sh"
+
+  MB_NAME=$(dmidecode -s baseboard-product-name | xargs)
+  echo "run /ca/bin/init_avx.sh \"$ARRAYMODEL\" \"\" \"$MB_NAME\"" | print_msg
+  chroot "$CHROOT_ROOT_PATH" /bin/bash -c "/ca/bin/init_avx.sh \"$ARRAYMODEL\" \"\" \"$MB_NAME\"" | print_msg
+
+  chroot "$CHROOT_ROOT_PATH" /bin/bash -c "umount /proc"
+  umount "$CHROOT_ROOT_PATH/boot/efi"
+  umount "$CHROOT_ROOT_PATH/boot"
+  umount "$CHROOT_ROOT_PATH/var"
+  umount "$CHROOT_ROOT_PATH/caupgrade"
+  umount "$CHROOT_ROOT_PATH"
+else
+  echo "Not found arraymodel..." | print_msg
+  exit 1
+fi
+
+#################### End ####################
+
+reboot
+%end
+
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/centos_boot.tar.gz
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-gzip
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/centos_boot.tar.gz
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/centos_boot.tar.gz	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/centos_boot.tar.gz	(working copy)

Property changes on: tools/install_iso_creator/centos_boot.tar.gz
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-gzip
\ No newline at end of property
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/grub.cfg
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/grub.cfg	(revision 0)
+++ /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/grub.cfg	(working copy)
@@ -0,0 +1,36 @@
+set default="1"
+
+function load_video {
+  insmod efi_gop
+  insmod efi_uga
+  insmod video_bochs
+  insmod video_cirrus
+  insmod all_video
+}
+
+load_video
+set gfxpayload=keep
+insmod gzio
+insmod part_gpt
+insmod ext2
+
+set timeout=60
+### END /etc/grub.d/00_header ###
+
+search --no-floppy --set=root -l 'Rocky-9-5-x86_64-dvd'
+
+### BEGIN /etc/grub.d/10_linux ###
+menuentry 'Install Rocky Linux 9.5' --class fedora --class gnu-linux --class gnu --class os {
+	linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Rocky-9-5-x86_64-dvd quiet net.ifnames.scheme=v216
+	initrdefi /images/pxeboot/initrd.img
+}
+submenu 'Install CentOS 7 AVX N series -->' {
+	menuentry 'AVX 7900 N' --class fedora --class gnu-linux --class gnu --class os {
+		linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Rocky-9-5-x86_64-dvd inst.ks=hd:LABEL=Rocky-9-5-x86_64-dvd:/ArrayAVX/avx_deploy.ks quiet arraymodel=957902 arrayraid
+		initrdefi /images/pxeboot/initrd.img
+	}
+	menuentry 'AVX 9900 N' --class fedora --class gnu-linux --class gnu --class os {
+		linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Rocky-9-5-x86_64-dvd inst.ks=hd:LABEL=Rocky-9-5-x86_64-dvd:/ArrayAVX/avx_deploy.ks quiet arraymodel=959902 arrayraid
+		initrdefi /images/pxeboot/initrd.img
+	}
+}
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/sign_unpack/Makefile
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/sign_unpack/Makefile	(revision 0)
+++ /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/sign_unpack/Makefile	(working copy)
@@ -0,0 +1,15 @@
+CFLAGS = -Wall -O2
+LDFLAGS = -lcrypto
+
+TARGET = sign_unpack
+SRC = sign_unpack.c
+
+.PHONY: all clean
+
+all: $(TARGET)
+
+$(TARGET): $(SRC)
+	$(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LDFLAGS)
+
+clean:
+	rm -f $(TARGET)
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/sign_unpack/sign_unpack
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/sign_unpack/sign_unpack
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/sign_unpack/sign_unpack	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/tools/install_iso_creator/sign_unpack/sign_unpack	(working copy)

Property changes on: tools/install_iso_creator/sign_unpack/sign_unpack
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: /branches/rel_avx_2_7_5_caswell_5070/update/avxsystem.ks
===================================================================
--- /branches/rel_avx_2_7_5_caswell_5070/update/avxsystem.ks	(revision 9210)
+++ /branches/rel_avx_2_7_5_caswell_5070/update/avxsystem.ks	(working copy)
@@ -513,6 +513,9 @@
 pam_radius-1.4.0-4.el7.x86_64
 libnss-ato-0.2-1.x86_64
 avx_cli-1.0-2.el7.centos.x86_64
+# for RAID
+mdadm-4.1-6.el7.x86_64
+dosfstools-3.0.20-9.el7.x86_64
 %end
 
 %post --nochroot --interpreter ../tools/image-minimizer
