diff --git a/files/initrd/opt/rr/boot.sh b/files/initrd/opt/rr/boot.sh index da412ef5..cbe5ec0d 100755 --- a/files/initrd/opt/rr/boot.sh +++ b/files/initrd/opt/rr/boot.sh @@ -119,8 +119,8 @@ else CMDLINE['noefi']="" fi DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${WORK_PATH}/platforms.yml")" -KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" -KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" +KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" +KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then if [ ! "${BUS}" = "usb" ]; then SZ=$(blockdev --getsz ${LOADER_DISK} 2>/dev/null) # SZ=$(cat /sys/block/${LOADER_DISK/\/dev\//}/size) @@ -162,6 +162,10 @@ if [ "${DT}" = "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${ [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+="," CMDLINE['modprobe.blacklist']+="mpt3sas" fi +if true; then + [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+="," + CMDLINE['modprobe.blacklist']+="evbug" +fi if echo "apollolake geminilake" | grep -wq "${PLATFORM}"; then CMDLINE["intel_iommu"]="igfx_off" fi @@ -169,6 +173,16 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then CMDLINE["SASmodel"]="1" fi +if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then + if grep -q "^flags.*x2apic.*" /proc/cpuinfo; then + eval $(grep -o "RR_CMDLINE=.*$" "${USER_GRUB_CONFIG}") + [ -z "${RR_CMDLINE}" ] && RR_CMDLINE="bzImage-rr" + echo "${RR_CMDLINE}" | grep -q 'nox2apic' || sed -i "s|${RR_CMDLINE}|${RR_CMDLINE} nox2apic|" "${USER_GRUB_CONFIG}" + fi +else + grep -q ' nox2apic' "${USER_GRUB_CONFIG}" && sed -i "s| nox2apic||" "${USER_GRUB_CONFIG}" +fi + while IFS=': ' read KEY VALUE; do [ -n "${KEY}" ] && CMDLINE["network.${KEY}"]="${VALUE}" done <<<$(readConfigMap "network" "${USER_CONFIG_FILE}") diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index f6c15ca7..ed777930 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -255,12 +255,14 @@ function _sort_netif() { # 1 - device path function getBus() { BUS="" + # xvd + [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | grep -q "xen" && echo "xen") # usb/ata(sata/ide)/scsi [ -z "${BUS}" ] && BUS=$(udevadm info --query property --name "${1}" 2>/dev/null | grep ID_BUS | cut -d= -f2 | sed 's/ata/sata/') # usb/sata(sata/ide)/nvme [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,TRAN 2>/dev/null | grep "${1} " | awk '{print $2}') #Spaces are intentional # usb/scsi(sata/ide)/virtio(scsi/virtio)/mmc/nvme - [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk -F':' '{print $(NF-1)}' | sed 's/_host//') #Spaces are intentional + [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk '{print $2}' | awk -F':' '{print $(NF-1)}' | sed 's/_host//') # Spaces are intentional echo "${BUS}" return 0 } @@ -287,7 +289,7 @@ function getIP() { function getLogo() { MODEL="${1}" rm -f "${PART3_PATH}/logo.png" - fastest=$(_get_fastest "www.synology.com" "www.synology.cn") + fastest="www.synology.com" # $(_get_fastest "www.synology.com" "www.synology.cn") if [ $? -ne 0 ]; then return 1 fi diff --git a/files/initrd/opt/rr/init.sh b/files/initrd/opt/rr/init.sh index 5f6a8bee..0d883d88 100755 --- a/files/initrd/opt/rr/init.sh +++ b/files/initrd/opt/rr/init.sh @@ -107,7 +107,7 @@ PID="0x0001" TYPE="DoM" BUS=$(getBus "${LOADER_DISK}") -BUSLIST="usb sata scsi nvme mmc" +BUSLIST="usb sata scsi nvme mmc xen" if [ "${BUS}" = "usb" ]; then VID="0x$(udevadm info --query property --name ${LOADER_DISK} 2>/dev/null | grep ID_VENDOR_ID | cut -d= -f2)" PID="0x$(udevadm info --query property --name ${LOADER_DISK} 2>/dev/null | grep ID_MODEL_ID | cut -d= -f2)" @@ -117,7 +117,7 @@ elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then echo "LOCALBUILD MODE" TYPE="PC" else - die "$(TEXT "Loader disk neither USB or SATA/SCSI/NVME/MMC DoM")" + die "$(TEXT "Loader disk neither USB or SATA/SCSI/NVME/MMC/XEN DoM")" fi fi diff --git a/files/initrd/opt/rr/menu.sh b/files/initrd/opt/rr/menu.sh index 0548bf2e..d6107e52 100755 --- a/files/initrd/opt/rr/menu.sh +++ b/files/initrd/opt/rr/menu.sh @@ -167,7 +167,7 @@ function modelMenu() { # If user change model, clean build* and pat* and SN if [ "${MODEL}" != "${resp}" ]; then PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)" - MODEL=${resp} + MODEL="${resp}" writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}" writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}" MODELID="" @@ -180,7 +180,7 @@ function modelMenu() { writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}" writeConfigKey "paturl" "" "${USER_CONFIG_FILE}" writeConfigKey "patsum" "" "${USER_CONFIG_FILE}" - SN=$(generateSerial "${MODEL}") + SN="$(generateSerial "${MODEL}")" writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}" NETIF_NUM=2 MACS=($(generateMacAddress "${MODEL}" ${NETIF_NUM})) @@ -329,8 +329,8 @@ function productversMenu() { writeConfigKey "synoinfo.\"${KEY}\"" "${VALUE}" "${USER_CONFIG_FILE}" done <<<$(readConfigMap "platforms.${PLATFORM}.synoinfo" "${WORK_PATH}/platforms.yml") # Check addons - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" while IFS=': ' read ADDON PARAM; do [ -z "${ADDON}" ] && continue if ! checkAddonExist "${ADDON}" "${PLATFORM}" "$([ -n "${KPRE}" ] && echo "${KPRE}-")${KVER}"; then @@ -369,12 +369,12 @@ function setConfigFromDSM() { PS="$(readConfigEntriesArray "platforms" "${WORK_PATH}/platforms.yml" | sort)" VS="$(readConfigEntriesArray "platforms.${PLATFORMTMP,,}.productvers" "${WORK_PATH}/platforms.yml" | sort -r)" if arrayExistItem "${PLATFORMTMP,,}" ${PS} && arrayExistItem "${majorversion}.${minorversion}" ${VS}; then - PLATFORM=${PLATFORMTMP,,} - MODEL=$(echo ${MODELTMP} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/') - MODELID=${MODELTMP} - PRODUCTVER=${majorversion}.${minorversion} - BUILDNUM=${buildnumber} - SMALLNUM=${smallfixnumber} + PLATFORM="${PLATFORMTMP,,}" + MODEL="$(echo ${MODELTMP} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')" + MODELID="${MODELTMP}" + PRODUCTVER="${majorversion}.${minorversion}" + BUILDNUM="${buildnumber}" + SMALLNUM="${smallfixnumber}" else echo "$(printf "$(TEXT "Currently, %s is not supported.")" "${MODELTMP}-${majorversion}.${minorversion}")" >"${LOG_FILE}" return 1 @@ -385,7 +385,7 @@ function setConfigFromDSM() { writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}" writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}" writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}" - SN=$(generateSerial "${MODEL}") + SN="$(generateSerial "${MODEL}")" writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}" NETIF_NUM=2 MACS=($(generateMacAddress "${MODEL}" ${NETIF_NUM})) @@ -407,8 +407,8 @@ function setConfigFromDSM() { done <<<$(readConfigMap "platforms.${PLATFORM}.synoinfo" "${WORK_PATH}/platforms.yml") # Check addons - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" while IFS=': ' read ADDON PARAM; do [ -z "${ADDON}" ] && continue if ! checkAddonExist "${ADDON}" "${PLATFORM}" "$([ -n "${KPRE}" ] && echo "${KPRE}-")${KVER}"; then @@ -516,8 +516,8 @@ function ParsePat() { # Manage addons function addonMenu() { # Read 'platform' and kernel version to check if addon exists - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" NEXT="a" # Loop menu @@ -654,8 +654,8 @@ function addonMenu() { ############################################################################### function moduleMenu() { - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" NEXT="c" # loop menu while true; do @@ -1797,7 +1797,7 @@ function tryRecoveryDSM() { fi if [ -f "${TMP_PATH}/mdX/etc/synoinfo.conf" ]; then - R_SN=$(_get_conf_kv SN "${TMP_PATH}/mdX/etc/synoinfo.conf") + R_SN="$(_get_conf_kv SN "${TMP_PATH}/mdX/etc/synoinfo.conf")" [ -n "${R_SN}" ] && SN=${R_SN} && writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}" fi @@ -2910,8 +2910,8 @@ function updateRR() { cp -Rf "${TMP_PATH}/update/${VALUE}"/* "${VALUE}" if [ "$(realpath "${VALUE}")" = "$(realpath "${MODULES_PATH}")" ]; then if [ -n "${MODEL}" -a -n "${PRODUCTVER}" ]; then - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" if [ -n "${PLATFORM}" -a -n "${KVER}" ]; then writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" while read ID DESC; do @@ -3044,8 +3044,8 @@ function updateModules() { rm -rf "${MODULES_PATH}/"* cp -rf "${TMP_PATH}/update/"* "${MODULES_PATH}/" if [ -n "${MODEL}" -a -n "${PRODUCTVER}" ]; then - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" if [ -n "${PLATFORM}" -a -n "${KVER}" ]; then writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" while read ID DESC; do @@ -3166,8 +3166,8 @@ function updateCKs() { rm -rf "${CKS_PATH}/"* cp -rf "${TMP_PATH}/update/"* "${CKS_PATH}/" if [ -n "${MODEL}" -a -n "${PRODUCTVER}" -a "${KERNEL}" = "custom" ]; then - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" if [ -n "${PLATFORM}" -a -n "${KVER}" ]; then writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" while read ID DESC; do @@ -3394,8 +3394,8 @@ else fi echo "u \"$(TEXT "Parse pat")\"" >>"${TMP_PATH}/menu" if [ -n "${PRODUCTVER}" ]; then - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" if [ -f "${CKS_PATH}/bzImage-${PLATFORM}-$([ -n "${KPRE}" ] && echo "${KPRE}-")${KVER}.gz" ] && [ -f "${CKS_PATH}/modules-${PLATFORM}-$([ -n "${KPRE}" ] && echo "${KPRE}-")${KVER}.tgz" ]; then echo "s \"$(TEXT "Kernel:") \Z4${KERNEL}\Zn\"" >>"${TMP_PATH}/menu" diff --git a/files/initrd/opt/rr/ramdisk-patch.sh b/files/initrd/opt/rr/ramdisk-patch.sh index 193a30cc..28cbdabb 100755 --- a/files/initrd/opt/rr/ramdisk-patch.sh +++ b/files/initrd/opt/rr/ramdisk-patch.sh @@ -72,8 +72,8 @@ writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}" echo -n "." # Read model data -KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" -KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" +KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" +KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" # Sanity check if [ -z "${PLATFORM}" -o -z "${KVER}" ]; then diff --git a/files/initrd/opt/rr/vmlinux-to-bzImage.sh b/files/initrd/opt/rr/vmlinux-to-bzImage.sh index ccc1bf12..96fa9121 100755 --- a/files/initrd/opt/rr/vmlinux-to-bzImage.sh +++ b/files/initrd/opt/rr/vmlinux-to-bzImage.sh @@ -7,8 +7,8 @@ PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" -KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" -KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" +KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" +KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" # Adapted from: scripts/Makefile.lib # Usage: size_append FILE [FILE2] [FILEn]... diff --git a/files/initrd/opt/rr/zimage-patch.sh b/files/initrd/opt/rr/zimage-patch.sh index a3ebf00d..42a56d48 100755 --- a/files/initrd/opt/rr/zimage-patch.sh +++ b/files/initrd/opt/rr/zimage-patch.sh @@ -21,8 +21,8 @@ if [ "${KERNEL}" = "custom" ]; then echo -n "." PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${WORK_PATH}/platforms.yml")" - KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kpre" "${WORK_PATH}/platforms.yml")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${WORK_PATH}/platforms.yml")" + KPRE="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kpre" "${WORK_PATH}/platforms.yml")" # Extract bzImage gzip -dc "${CKS_PATH}/bzImage-${PLATFORM}-$([ -n "${KPRE}" ] && echo "${KPRE}-")${KVER}.gz" >"${MOD_ZIMAGE_FILE}" else diff --git a/scripts/func.sh b/scripts/func.sh index 3c3950fd..b4325e9c 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -373,6 +373,8 @@ extendedConfigFile = "${VMNAME}.vmxf" floppy0.present = "FALSE" ethernet0.addressType = "generated" ethernet0.virtualDev = "vmxnet3" +ethernet0.connectionType = "nat" +ethernet0.allowguestconnectioncontrol = "true" ethernet0.present = "TRUE" sata0.present = "TRUE" sata0:0.fileName = "${VMNAME}-disk1.vmdk"