tree: fix boot and other functions

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-08-09 16:00:41 +02:00
parent e9dc78b35d
commit 26fba39441
5 changed files with 25 additions and 29 deletions

View File

@ -258,7 +258,7 @@ jobs:
- Version:
- arc: Stable Buildroot System (Less Hardware supported / faster Boot)
- arc-next: Latest Buildroot System (More Hardware supported / Hyper-V and XEN (still in testing))
- arc-next: Latest Buildroot System (More Hardware supported (still in testing))
- Full Changelog and Arc Patch (Decryption Key) can be found in my Discord.
### Versions:

View File

@ -1716,14 +1716,14 @@ function saveMenu() {
# let user format disks from inside arc
function formatDisks() {
rm -f "${TMP_PATH}/opts"
while read -r KNAME ID SIZE TYPE PKNAME; do
while read -r KNAME SIZE TYPE PKNAME; do
[ -z "${KNAME}" ] && continue
[ "${KNAME}" = "N/A" ] && continue
[[ "${KNAME}" = /dev/md* ]] && continue
[[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue
[ -z "${SIZE}" ] && SIZE="Unknown"
[ -z "${ID}" ] && ID="Unknown"
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts"
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.id) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
if [ ! -f "${TMP_PATH}/opts" ]; then
dialog --backtitle "$(backtitle)" --title "Format Disks" \
--msgbox "No disk found!" 0 0
@ -1818,15 +1818,15 @@ EOF
# Clone Loader Disk
function cloneLoader() {
rm -f "${TMP_PATH}/opts" >/dev/null
while read -r KNAME ID SIZE TYPE PKNAME; do
while read -r KNAME SIZE TYPE PKNAME; do
[ -z "${KNAME}" ] && continue
[ "${KNAME}" = "N/A" ] && continue
[ "${TYPE}" != "disk" ] && continue
[[ "${KNAME}" = /dev/md* ]] && continue
[[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue
[ -z "${SIZE}" ] && SIZE="Unknown"
[ -z "${ID}" ] && ID="Unknown"
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts"
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.id) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
if [ ! -f "${TMP_PATH}/opts" ]; then
dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \
--msgbox "No disk found!" 0 0
@ -1947,7 +1947,7 @@ function greplogs() {
if [ -n "$(ls /sys/fs/pstore 2>/dev/null)" ]; then
mkdir -p "${TMP_PATH}/logs/pstore"
cp -rf /sys/fs/pstore/* "${TMP_PATH}/logs/pstore"
zlib-flate -uncompress </sys/fs/pstore/*.z >"${TMP_PATH}/logs/pstore/ps.log" 2>/dev/null
[ -n "$(ls /sys/fs/pstore/*.z 2>/dev/null)" ] && zlib-flate -uncompress </sys/fs/pstore/*.z >"${TMP_PATH}/logs/pstore/ps.log" 2>/dev/null
PSTORE=1
fi
if [ ${PSTORE} -eq 1 ]; then

View File

@ -1,6 +1,13 @@
###############################################################################
# Boot
function bootDSM () {
# Clear logs for dbgutils addons
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
rm -rf /sys/fs/pstore/* >/dev/null 2>&1 || true
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
# Get Loader Disk Bus
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
BUS=$(getBus "${LOADER_DISK}")
@ -135,8 +142,6 @@ function bootDSM () {
CMDLINE['log_buf_len']="32M"
CMDLINE['panic']="${KERNELPANIC:-0}"
CMDLINE['pcie_aspm']="off"
CMDLINE['nox2apic']=""
CMDLINE['nomodeset']=""
CMDLINE['modprobe.blacklist']="${MODBLACKLIST}"
[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="disable"
@ -207,6 +212,7 @@ function bootDSM () {
elif [ "${DIRECTBOOT}" == "false" ]; then
grub-editenv ${USER_GRUBENVFILE} unset dsm_cmdline
grub-editenv ${USER_GRUBENVFILE} unset next_entry
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
IPCON=""
@ -281,10 +287,10 @@ function bootDSM () {
fi
# Executes DSM kernel via KEXEC
KEXECARGS=""
KEXECARGS="-a"
if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 4 ] && [ ${EFI} -eq 1 ]; then
echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m"
KEXECARGS="--noefi"
KEXECARGS+=" --noefi"
fi
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
@ -296,23 +302,8 @@ function bootDSM () {
fi
done
# Clear logs for dbgutils addons
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
if [ "${KERNELLOAD}" == "kexec" ]; then
# Unload all network interfaces
for D in $(readlink /sys/class/net/*/device/driver); do rmmod -f "$(basename ${D})" 2>/dev/null || true; done
# Unload all graphics drivers
# for D in $(readlink /sys/class/drm/*/device/driver); do rmmod -f "$(basename ${D})" 2>/dev/null || true; done
for D in $(lsmod | grep -E '^(nouveau|amdgpu|radeon|i915)' | awk '{print $1}'); do rmmod -f "${D}" 2>/dev/null || true; done
for I in $(find /sys/devices -name uevent -exec bash -c 'cat {} 2>/dev/null | grep -Eq "PCI_CLASS=0?30[0|1|2]00" && dirname {}' \;); do
[ -e ${I}/reset ] && cat ${I}/vendor >/dev/null | grep -iq 0x10de && echo 1 >${I}/reset || true # Proc open nvidia driver when booting
done
fi
echo -e "\033[1;37mBooting DSM...\033[0m"
# Boot to DSM
[ "${KERNELLOAD}" == "kexec" ] && kexec -a -e || poweroff
[ "${KERNELLOAD}" == "kexec" ] && kexec -e || poweroff
fi
}

View File

@ -7,6 +7,11 @@
###############################################################################
# Check loader disk
function checkBootLoader() {
while read KNAME RO; do
[ -z "${KNAME}" ] && continue
[ "${RO}" = "0" ] && continue
hdparm -r0 "${KNAME}" >/dev/null 2>&1 || true
done <<<$(lsblk -pno KNAME,RO 2>/dev/null)
[ ! -w "${PART1_PATH}" ] && return 1
[ ! -w "${PART2_PATH}" ] && return 1
[ ! -w "${PART3_PATH}" ] && return 1

View File

@ -83,7 +83,7 @@ set menu_color_normal=white/black
set menu_color_highlight=white/red
set color_normal=white/black
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait net.ifnames=0 panic=0 pcie_aspm=off nox2apic nomodeset"
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait net.ifnames=0 panic=0 pcie_aspm=off"
search --set=root --label "ARC3"
if [ -e /automated ]; then