Skip to content

Commit

Permalink
Merge pull request #2263 from AuxXxilium/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AuxXxilium authored Jul 3, 2024
2 parents 1551f68 + 8be8973 commit b750d68
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 39 deletions.
34 changes: 17 additions & 17 deletions files/initrd/opt/arc/arc-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ function sysinfo() {
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | sed 's/\[.*\] DMI: //i')
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)"
ETHN="${#ETHX}"
ETHN="$(echo ${ETHX} | wc -w)"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
if [ "${CONFDONE}" == "true" ]; then
Expand Down Expand Up @@ -1136,29 +1136,29 @@ function sysinfo() {
# Print Config Informations
TEXT+="\n\Z4> Arc: ${ARC_VERSION}\Zn"
TEXT+="\n Subversion: \ZbAddons ${ADDONSVERSION} | Configs ${CONFIGSVERSION} | LKM ${LKMVERSION} | Modules ${MODULESVERSION} | Patches ${PATCHESVERSION}\Zn"
TEXT+="\n\Z4>> Loader\Zn"
TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn"
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
TEXT+="\n\Z4> Loader\Zn"
TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn"
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
if [ "${CONFDONE}" == "true" ]; then
TEXT+="\n\Z4>> DSM ${PRODUCTVER}: ${MODELID:-${MODEL}}\Zn"
TEXT+="\n Kernel | LKM: \Zb${KVER} | ${LKM}\Zn"
TEXT+="\n Platform | DeviceTree: \Zb${PLATFORM} | ${DT}\Zn"
TEXT+="\n Arc Patch | Kernelload: \Zb${ARCPATCH} | ${KERNELLOAD}\Zn"
TEXT+="\n Directboot: \Zb${DIRECTBOOT}\Zn"
TEXT+="\n Addons selected: \Zb${ADDONSINFO}\Zn"
TEXT+="\n\Z4> DSM ${PRODUCTVER}: ${MODELID:-${MODEL}}\Zn"
TEXT+="\n Kernel | LKM: \Zb${KVER} | ${LKM}\Zn"
TEXT+="\n Platform | DeviceTree: \Zb${PLATFORM} | ${DT}\Zn"
TEXT+="\n Arc Patch | Kernelload: \Zb${ARCPATCH} | ${KERNELLOAD}\Zn"
TEXT+="\n Directboot: \Zb${DIRECTBOOT}\Zn"
TEXT+="\n Addons selected: \Zb${ADDONSINFO}\Zn"
fi
TEXT+="\n Modules loaded: \Zb${MODULESINFO}\Zn"
TEXT+="\n\Z4>> Settings\Zn"
TEXT+="\n Offline Mode: \Zb${OFFLINE}\Zn"
TEXT+="\n Modules loaded: \Zb${MODULESINFO}\Zn"
TEXT+="\n\Z4> Settings\Zn"
TEXT+="\n Offline Mode: \Zb${OFFLINE}\Zn"
if [[ "${REMAP}" == "acports" || "${REMAP}" == "maxports" ]]; then
TEXT+="\n SataPortMap | DiskIdxMap: \Zb${PORTMAP} | ${DISKMAP}\Zn"
TEXT+="\n SataPortMap | DiskIdxMap: \Zb${PORTMAP} | ${DISKMAP}\Zn"
elif [ "${REMAP}" == "remap" ]; then
TEXT+="\n SataRemap: \Zb${PORTMAP}\Zn"
TEXT+="\n SataRemap: \Zb${PORTMAP}\Zn"
elif [ "${REMAP}" == "user" ]; then
TEXT+="\n PortMap: \Zb"User"\Zn"
TEXT+="\n PortMap: \Zb"User"\Zn"
fi
if [ "${DT}" == "true" ]; then
TEXT+="\n Hotplug: \Zb${HDDSORT}\Zn"
TEXT+="\n Hotplug: \Zb${HDDSORT}\Zn"
fi
TEXT+="\n"
# Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
Expand Down
45 changes: 28 additions & 17 deletions files/initrd/opt/arc/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,33 +146,43 @@ function bootDSM () {
CMDLINE["SASmodel"]="1"
fi
# Disable x2apic
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
if grep -q "^flags.*x2apic.*" /proc/cpuinfo; then
eval $(grep -o "ARC_CMDLINE=.*$" "${USER_GRUB_CONFIG}")
[ -z "${ARC_CMDLINE}" ] && ARC_CMDLINE="bzImage-arc"
echo "${ARC_CMDLINE}" | grep -q 'nox2apic' || sed -i "s|${ARC_CMDLINE}|${ARC_CMDLINE} nox2apic|" "${USER_GRUB_CONFIG}"
if grep -q "^flags.*x2apic.*" /proc/cpuinfo; then
eval $(grep -o "ARC_CMDLINE=.*$" "${USER_GRUB_CONFIG}")
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
if ! echo "${ARC_CMDLINE}" | grep -q 'nox2apic'; then
sed -i "s/${ARC_CMDLINE}/${ARC_CMDLINE} nox2apic/g" "${USER_GRUB_CONFIG}"
echo -e "\033[1;33mWarning: x2apic detected but not supported by ${PLATFORM} -> rebooting to disabling x2apic.\033[0m"
exec reboot
sleep 3
fi
else
if echo "${ARC_CMDLINE}" | grep -q 'nox2apic'; then
sed -i "s/ nox2apic//g" "${USER_GRUB_CONFIG}"
echo -e "\033[1;33mWarning: x2apic detected and supported by ${PLATFORM} -> rebooting to enable x2apic.\033[0m"
exec reboot
sleep 3
fi
fi
else
grep -q ' nox2apic' "${USER_GRUB_CONFIG}" && sed -i "s| nox2apic||" "${USER_GRUB_CONFIG}"
fi

# Cmdline NIC Settings
ETHN=0
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
if [ "${ARCPATCH}" == "true" ]; then
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
[ -z "${NICPORTS}" ] && NICPORTS=1
ETHN="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
[ -z "${ETHN}" ] && ETHN=1
else
NICPORTS="$(echo ${ETHX} | wc -w)"
ETHN="$(echo ${ETHX} | wc -w)"
fi
NIC=0
for ETH in ${ETHX}; do
MAC="$(readConfigKey "arc.${ETH}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
ETHN=$((${ETHN} + 1))
[ ${ETHN} -le ${NICPORTS} ] && CMDLINE["mac${ETHN}"]="${MAC}"
NIC=$((${NIC} + 1))
[ ${NIC} -le ${ETHN} ] && CMDLINE["mac${NIC}"]="${MAC}"
[ ${NIC} -eq ${ETHN} ] && break
done
[ ${ETHN} -le ${NICPORTS} ] && CMDLINE['netif_num']="${ETHN}" || CMDLINE['netif_num']="${NICPORTS}"
CMDLINE['netif_num']="${NIC}"

# Read user network settings
while IFS=': ' read -r KEY VALUE; do
Expand Down Expand Up @@ -200,14 +210,15 @@ function bootDSM () {
grub-editenv ${USER_GRUBENVFILE} set dsm_cmdline="${CMDLINE_DIRECT}"
echo -e "\033[1;34mReboot with Directboot\033[0m"
grub-editenv ${USER_GRUBENVFILE} set next_entry="direct"
reboot
exec reboot
exit 0
elif [ "${DIRECTBOOT}" == "false" ]; then
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
ETHN="$(echo ${ETHX} | wc -w)"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=20
IPCON=""
echo -e "\033[1;34mDetected ${ETHN} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
sleep 2
echo -e "\033[1;34mDetected ${NIC} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
sleep 3
for ETH in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
Expand Down
4 changes: 1 addition & 3 deletions files/initrd/opt/arc/include/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ function getBus() {
# 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 '{print $2}' | awk -F':' '{print $(NF-1)}' | sed 's/_host//') # Spaces are intentional
# xen
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | grep -q "xen" && echo "xen")
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk -F':' '{print $(NF-1)}' | sed 's/_host//') #Spaces are intentional
echo "${BUS}"
return 0
}
Expand Down
2 changes: 1 addition & 1 deletion files/initrd/opt/arc/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ echo
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=20
echo -e "\033[1;34mDetected ${ETHN} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
sleep 2
sleep 3
for ETH in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
Expand Down
1 change: 0 additions & 1 deletion files/initrd/opt/arc/ramdisk-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ if [ "${PLATFORM}" == "broadwellntbap" ]; then
fi

# Call user patch scripts
echo -n "."
for F in $(ls -1 ${USER_UP_PATH}/*.sh 2>/dev/null); do
echo "Calling ${F}" >"${LOG_FILE}"
. "${F}" >>"${LOG_FILE}" 2>&1 || exit 1
Expand Down

0 comments on commit b750d68

Please sign in to comment.