diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4630f7a..7e420e1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,14 +32,14 @@ on: description: "pre release" default: false type: boolean - next: - description: "next" - default: false - type: boolean - stable: - description: "stable" + minimal: + description: "minimal" default: true type: boolean + extended: + description: "extended" + default: false + type: boolean clean: description: "clean" default: false @@ -112,15 +112,15 @@ jobs: echo "OK" # Build incremental - - name: Build Next Image - if: ${{ inputs.next }} + - name: Build extended Image + if: ${{ inputs.extended }} run: | . scripts/func.sh # Modify Source File ARC_BUILD="`date +'%y%m%d'`" ARC_VERSION="${{ inputs.version }}" - ARC_BRANCH="next" + ARC_BRANCH="extended" echo "${ARC_BUILD}" >files/p1/ARC-BUILD echo "${ARC_VERSION}" >files/p1/ARC-VERSION echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH @@ -129,7 +129,7 @@ jobs: echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV echo "Create Arc Image" - IMAGE_FILE="arc.img" + IMAGE_FILE="arc_create.img" gzip -dc "grub.img.gz" >"${IMAGE_FILE}" fdisk -l "${IMAGE_FILE}" @@ -162,6 +162,9 @@ jobs: sudo losetup --detach ${LOOPX} + # Resize Image + resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" + echo "Image Converter" qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk @@ -174,8 +177,8 @@ jobs: convertova "${IMAGE_FILE}" "arc.ova" # Zip image and generate checksum - - name: Pack Next Image - if: ${{ inputs.next }} + - name: Pack extended Image + if: ${{ inputs.extended }} run: | if [ -n "${{ env.ARC_VERSION }}" ]; then zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img @@ -190,18 +193,18 @@ jobs: # Cleanup - name: Cleanup run: | - rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" + rm -rf "arc.img" "arc_create.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" 2>/dev/null # Build incremental - - name: Build Stable Image - if: ${{ inputs.stable }} + - name: Build minimal Image + if: ${{ inputs.minimal }} run: | . scripts/func.sh # Modify Source File ARC_BUILD="`date +'%y%m%d'`" ARC_VERSION="${{ inputs.version }}" - ARC_BRANCH="stable" + ARC_BRANCH="minimal" echo "${ARC_BUILD}" >files/p1/ARC-BUILD echo "${ARC_VERSION}" >files/p1/ARC-VERSION echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH @@ -210,7 +213,7 @@ jobs: echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV echo "Create Arc Image" - IMAGE_FILE="arc.img" + IMAGE_FILE="arc_create.img" gzip -dc "grub.img.gz" >"${IMAGE_FILE}" fdisk -l "${IMAGE_FILE}" @@ -243,6 +246,9 @@ jobs: sudo losetup --detach ${LOOPX} + # Resize Image + resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" + echo "Image Converter" qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk @@ -255,8 +261,8 @@ jobs: convertova "${IMAGE_FILE}" "arc.ova" # Zip image and generate checksum - - name: Pack Stable Image - if: ${{ inputs.stable }} + - name: Pack minimal Image + if: ${{ inputs.minimal }} run: | if [ -n "${{ env.ARC_VERSION }}" ]; then zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img @@ -286,8 +292,8 @@ jobs: - Discord Account for Arc Patch needed ### Versions: - ${{ inputs.stable && '- Stable: Full Image, all dependencies are included, reduced hardware support (if there is a Next image)' || '' }} - ${{ inputs.next && '- Next: Full Image, all dependencies are included, more hardware support, new features to test' || '' }} + ${{ inputs.minimal && '- minimal: Full Image, all dependencies are included (reduced size, faster boot)' || '' }} + ${{ inputs.extended && '- extended: Full Image, all dependencies are included (new features to test)' || '' }} ### Dependencies: - Addons: ${{ env.ADDONTAG }} @@ -296,8 +302,8 @@ jobs: - Patches: ${{ env.PATCHTAG }} - Custom: ${{ env.CUSTOMTAG }} - LKMs: ${{ env.LKMTAG }} - ${{ inputs.stable && format('- Buildroot Stable: {0}', env.BRSTAG) || '' }} - ${{ inputs.next && format('- Buildroot Next: {0}', env.BRXTAG) || '' }} + ${{ inputs.minimal && format('- Buildroot minimal: {0}', env.BRSTAG) || '' }} + ${{ inputs.extended && format('- Buildroot extended: {0}', env.BRXTAG) || '' }} ### Release - ${{ env.BUILD_TIME }} diff --git a/.github/workflows/grub.yml b/.github/workflows/grub.yml index e1cea90c..6143ef11 100644 --- a/.github/workflows/grub.yml +++ b/.github/workflows/grub.yml @@ -34,7 +34,7 @@ jobs: - name: Make Grub run: | rm -f grub.img.gz - . scripts/grub.sh "grub-2.12" "i386-pc i386-efi x86_64-efi" + . scripts/grub.sh "grub-2.12" "i386-pc i386-efi x86_64-efi" "ARC" - name: Check and Push if: success() && inputs.push == true diff --git a/Taskfile.yaml b/Taskfile.yaml index 9bedde87..f197c2d5 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -3,17 +3,17 @@ version: "3" tasks: - build-img-n: + build-ext: cmds: - git reset --hard - git pull - - ./img-gen-n.sh + - ./img-ext.sh - build-img-s: + build-min: cmds: - git reset --hard - git pull - - ./img-gen-s.sh + - ./img-min.sh compile-kpatch: dir: kpatch diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 837ab5c3..f0f14c33 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -91,6 +91,7 @@ function addonSelection() { ############################################################################### # Permit user select the modules to include function modulesMenu() { + NEXT="1" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" @@ -936,16 +937,16 @@ function updateMenu() { 4) dialog --backtitle "$(backtitle)" --title "Switch Arc Branch" \ --menu "Choose a Branch" 0 0 0 \ - 1 "stable - faster Boot than next" \ - 2 "next - Test for upcoming Features/Support" \ + 1 "minimal - reduced size and faster boot" \ + 2 "extended - new features to test" \ 3 "dev - Development only" \ 2>"${TMP_PATH}/opts" [ $? -ne 0 ] && break opts=$(cat ${TMP_PATH}/opts) if [ ${opts} -eq 1 ]; then - ARC_BRANCH="stable" + ARC_BRANCH="minimal" elif [ ${opts} -eq 2 ]; then - ARC_BRANCH="next" + ARC_BRANCH="extended" elif [ ${opts} -eq 3 ]; then ARC_BRANCH="dev" fi diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index bb8e6d98..587f1019 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -94,7 +94,12 @@ if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then break fi done - [ ${HASATA} -eq 0 ] && echo -e "\033[1;31m*** Please insert at least one Sata/SAS/SCSI Disk for System installation, except for the Bootloader Disk. ***\033[0m" + [ ${HASATA} -eq 0 ] && echo -e "\033[1;31m*** Note: Please insert at least one Sata/SAS/SCSI Disk for System installation, except the Bootloader Disk. ***\033[0m" +fi + +if checkBIOS_VT_d && [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then + echo -e "\033[1;31m*** Notice: Disable Intel(VT-d)/AMD(AMD-V) in BIOS/UEFI settings if you encounter a boot failure. ***\033[0m" + echo fi # Read necessary variables @@ -169,6 +174,7 @@ else CMDLINE["syno_hdd_detect"]="0" CMDLINE["syno_hdd_powerup_seq"]="0" fi + CMDLINE["HddHotplug"]="1" CMDLINE["vender_format_version"]="2" CMDLINE["skip_vender_mac_interfaces"]="0,1,2,3,4,5,6,7" @@ -181,10 +187,15 @@ CMDLINE["root"]="/dev/md0" CMDLINE["loglevel"]="15" CMDLINE["log_buf_len"]="32M" CMDLINE["rootwait"]="" -CMDLINE["panic"]="${KERNELPANIC:-0}" - -# DSM Specific Cmdline -CMDLINE["pcie_aspm"]="off" +CMDLINE['panic']="${KERNELPANIC:-0}" +# CMDLINE['intremap']="off" # no need +# CMDLINE['amd_iommu_intr']="legacy" # no need +# CMDLINE['split_lock_detect']="off" # check KVER +CMDLINE['pcie_aspm']="off" +# CMDLINE['intel_pstate']="disable" +# CMDLINE['amd_pstate']="disable" +# CMDLINE['nox2apic']="" # check platform +# CMDLINE['nomodeset']="" CMDLINE["modprobe.blacklist"]="${MODBLACKLIST}" if [ "${USBMOUNT}" = "true" ]; then CMDLINE['usbinternal']="" @@ -198,18 +209,7 @@ fi if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then CMDLINE["nox2apic"]="" fi -if [ "${DT}" = "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then - if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "mpt3sas"; then - [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE["modprobe.blacklist"]+="," - CMDLINE["modprobe.blacklist"]+="mpt3sas" - fi -fi -if echo "apollolake geminilake" | grep -wq "${PLATFORM}"; then - CMDLINE["intel_iommu"]="igfx_off" -fi -if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then - CMDLINE["SASmodel"]="1" -fi + # Disabled for now # if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ "${BUS}" != "mmc" ] && [ "${EMMCBOOT}" != "true" ]; then # if ! echo "${CMDLINE["modprobe.blacklist"]}" | grep -q "sdhci"; then @@ -217,10 +217,26 @@ fi # CMDLINE["modprobe.blacklist"]+="sdhci,sdhci_pci,sdhci_acpi" # fi # fi -# CMDLINE["nomodeset"]="" +if [ "${DT}" = "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then + if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "mpt3sas"; then + [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE["modprobe.blacklist"]+="," + CMDLINE["modprobe.blacklist"]+="mpt3sas" + fi +#else +# CMDLINE['scsi_mod.scan']="sync" # TODO: kernel panic caused by vmware scsi? (add to cmdline) +fi + # CMDLINE['kvm.ignore_msrs']="1" # CMDLINE['kvm.report_ignored_msrs']="0" +if echo "apollolake geminilake" | grep -wq "${PLATFORM}"; then + CMDLINE["intel_iommu"]="igfx_off" +fi + +if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then + CMDLINE["SASmodel"]="1" +fi + # NIC Cmdline ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null) @@ -261,9 +277,6 @@ if [ "${DIRECTBOOT}" = "true" ]; then CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars grub-editenv ${USER_GRUBENVFILE} set dsm_cmdline="${CMDLINE_DIRECT}" grub-editenv ${USER_GRUBENVFILE} set next_entry="direct" - if ! _bootwait; then - exit 0 - fi echo -e "\033[1;34mReboot with Directboot\033[0m" reboot exit 0 @@ -315,9 +328,6 @@ elif [ "${DIRECTBOOT}" = "false" ]; then done done echo - if ! _bootwait; then - exit 0 - fi DSMLOGO="$(readConfigKey "bootscreen.dsmlogo" "${USER_CONFIG_FILE}")" if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ]; then diff --git a/files/initrd/opt/arc/include/functions.sh b/files/initrd/opt/arc/include/functions.sh index 63679408..5c43bfe1 100755 --- a/files/initrd/opt/arc/include/functions.sh +++ b/files/initrd/opt/arc/include/functions.sh @@ -381,6 +381,33 @@ function delCmdline() { setCmdline "${1}" "${CMDLINE}" } +############################################################################### +# check CPU Intel(VT-d)/AMD(AMD-Vi) +function checkCPU_VT_d() { + lsmod | grep -q msr || modprobe msr 2>/dev/null + if grep -q "GenuineIntel" /proc/cpuinfo 2>/dev/null; then + local VT_D_ENABLED=$(rdmsr 0x3a 2>/dev/null) + [ "$((${VT_D_ENABLED:-0x0} & 0x5))" -eq $((0x5)) ] && return 0 + elif grep -q "AuthenticAMD" /proc/cpuinfo 2>/dev/null; then + local IOMMU_ENABLED=$(rdmsr 0xC0010114 2>/dev/null) + [ "$((${IOMMU_ENABLED:-0x0} & 0x1))" -eq $((0x1)) ] && return 0 + else + return 1 + fi +} + +############################################################################### +# check BIOS Intel(VT-d)/AMD(AMD-Vi) +function checkBIOS_VT_d() { + if grep -q "GenuineIntel" /proc/cpuinfo 2>/dev/null; then + dmesg 2>/dev/null | grep -iq "DMAR-IR.*DRHD base" && return 0 + elif grep -q "AuthenticAMD" /proc/cpuinfo 2>/dev/null; then + dmesg 2>/dev/null | grep -iq "AMD-Vi.*enabled" && return 0 + else + return 1 + fi +} + ############################################################################### # Rebooting function rebootTo() { @@ -609,11 +636,13 @@ function __umountDSMRootDisk() { ############################################################################### # bootwait SSH/Web function _bootwait() { - # Exec Bootwait to check SSH/Web connection - BOOTWAIT=5 + BOOTWAIT="$(readConfigKey "bootwait" "${USER_CONFIG_FILE}")" + [ -z "${BOOTWAIT}" ] && BOOTWAIT=10 busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WB MSG="" - while test ${BOOTWAIT} -ge 0; do + while [ ${BOOTWAIT} -gt 0 ]; do + sleep 1 + BOOTWAIT=$((BOOTWAIT - 1)) MSG="\033[1;33mAccess to SSH/Web will interrupt boot...\033[0m" echo -en "\r${MSG}" busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WC @@ -622,8 +651,6 @@ function _bootwait() { rm -f WB WC return 1 fi - sleep 1 - BOOTWAIT=$((BOOTWAIT - 1)) done rm -f WB WC echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n" diff --git a/files/p1/boot/grub/grub.cfg b/files/p1/boot/grub/grub.cfg index 9bfeb93b..482854ca 100644 --- a/files/p1/boot/grub/grub.cfg +++ b/files/p1/boot/grub/grub.cfg @@ -60,7 +60,7 @@ function set_gfxpayload { fi } -set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable nox2apic nomodeset" +set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off amd_iommu_intr=legacy net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable amd_pstate=disable nox2apic nomodeset" search --set=root --label "ARC3" if [ -s /zImage-dsm -a -s /initrd-dsm ]; then diff --git a/img-gen-n.sh b/img-ext.sh similarity index 94% rename from img-gen-n.sh rename to img-ext.sh index e164d2a3..eaa5fd6b 100755 --- a/img-gen-n.sh +++ b/img-ext.sh @@ -25,7 +25,7 @@ mkdir -p "brx" [ ! -f "../brx/bzImage" ] && getBuildrootx "brx" || copyBuildroot "brx" # Sbase -IMAGE_FILE="arc.img" +IMAGE_FILE="arc_create.img" gzip -dc "grub.img.gz" >"${IMAGE_FILE}" fdisk -l "${IMAGE_FILE}" @@ -69,4 +69,7 @@ sudo rm -rf "/tmp/p3" sudo losetup --detach ${LOOPX} +# Resize Image +resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" + qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk diff --git a/img-gen-s.sh b/img-min.sh similarity index 94% rename from img-gen-s.sh rename to img-min.sh index fa86c2d1..8e99fd2c 100755 --- a/img-gen-s.sh +++ b/img-min.sh @@ -24,7 +24,7 @@ getOffline "files/p3/configs" [ -f "../brs/bzImage" ] && copyBuildroot "brs" || getBuildroots "brs" # Sbase -IMAGE_FILE="arc.img" +IMAGE_FILE="arc_create.img" gzip -dc "grub.img.gz" >"${IMAGE_FILE}" fdisk -l "${IMAGE_FILE}" @@ -68,4 +68,7 @@ sudo rm -rf "/tmp/p3" sudo losetup --detach ${LOOPX} +# Resize Image +resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" + qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk diff --git a/scripts/grub.sh b/scripts/grub.sh index 02702519..04b80655 100755 --- a/scripts/grub.sh +++ b/scripts/grub.sh @@ -35,8 +35,8 @@ fdisk -l grub.img LOOPX=$(sudo losetup -f) sudo losetup -P ${LOOPX} grub.img -sudo mkdosfs -F32 -n ${NAME}1 ${LOOPX}p1 -sudo mkfs.ext2 -F -L ${NAME}2 ${LOOPX}p2 +sudo mkfs.ext4 -F -L ${NAME}1 ${LOOPX}p1 +sudo mkfs.ext4 -F -L ${NAME}2 ${LOOPX}p2 sudo mkfs.ext4 -F -L ${NAME}3 ${LOOPX}p3 rm -rf ${NAME}1