Compare commits

..

21 Commits
1.4.1 ... 1.4.6

Author SHA1 Message Date
AuxXxilium
358dda3f1b func: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-15 00:58:48 +01:00
AuxXxilium
755d1fc6a7 func: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-15 00:48:21 +01:00
AuxXxilium
eb6ed84381 build: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-15 00:43:50 +01:00
AuxXxilium
9cfa2095b7 build: optimize
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-15 00:29:41 +01:00
AuxXxilium
0cc5bed9c3 build: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-15 00:13:31 +01:00
AuxXxilium
5147002d0d custom: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-14 21:11:18 +01:00
AuxXxilium
b23b551d2e arc-functions: add new branch
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-14 18:59:15 +01:00
AuxXxilium
9c654b8661 ramdisk: rework more
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-14 18:52:35 +01:00
AuxXxilium
4b07877e50 ramdisk: fix more
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-14 18:35:43 +01:00
AuxXxilium
7d2583aa68 ramdisk: remove empty line
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-14 18:25:29 +01:00
AuxXxilium
2133cc94c6 ramdisk: more rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-14 18:20:16 +01:00
AuxXxilium
9cef565971 tree: more rewrite
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-14 18:10:50 +01:00
AuxXxilium
4e40d54f2d tree: update more
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-13 20:32:05 +01:00
AuxXxilium
abfabee34a tree: rewrite
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-13 18:28:13 +01:00
AuxXxilium
faf340458c grub: update 2025-01-12 18:55:33 2025-01-12 18:55:33 +01:00
AuxXxilium
7c432898f5 boot: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-12 18:51:19 +01:00
AuxXxilium
1923b4774d build: update grub
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-12 18:47:22 +01:00
AuxXxilium
e297f7ccfe arc: update modulelist
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-11 17:30:00 +01:00
AuxXxilium
3cfa988a15 tree: more updates
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-11 16:09:20 +01:00
AuxXxilium
9a66f15f1d tree: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-11 15:17:35 +01:00
AuxXxilium
48b1443974 arc-functions: fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2025-01-08 21:39:32 +01:00
17 changed files with 695 additions and 549 deletions

View File

@@ -36,6 +36,10 @@ on:
description: "minimal"
default: true
type: boolean
microcode:
description: "microcode"
default: false
type: boolean
extended:
description: "extended"
default: false
@@ -96,6 +100,7 @@ jobs:
getTheme "files/p1/boot/grub"
getBuildrootx "brx"
getBuildroots "brs"
getBuildrootm "brm"
# Export Dependencies Version to env
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
@@ -107,6 +112,7 @@ jobs:
echo "THEMETAG=${THEMETAG}" >> $GITHUB_ENV
echo "BRXTAG=${BRXTAG}" >> $GITHUB_ENV
echo "BRSTAG=${BRSTAG}" >> $GITHUB_ENV
echo "BRMTAG=${BRMTAG}" >> $GITHUB_ENV
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK"
@@ -129,7 +135,7 @@ jobs:
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc_create.img"
IMAGE_FILE="arc.img"
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
@@ -162,11 +168,11 @@ jobs:
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
resizeImg "${IMAGE_FILE}" "+1024M" "arc2G.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
mv -f "arc2G.img" "${IMAGE_FILE}"
echo "Image Converter"
IMAGE_FILE="arc.img"
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
@@ -193,6 +199,7 @@ jobs:
# Cleanup
- name: Cleanup
if: ${{ inputs.extended }}
run: |
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" 2>/dev/null
@@ -214,7 +221,7 @@ jobs:
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc_create.img"
IMAGE_FILE="arc.img"
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
@@ -247,11 +254,97 @@ jobs:
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
resizeImg "${IMAGE_FILE}" "+1024M" "arc2G.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
mv -f "arc2G.img" "${IMAGE_FILE}"
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
echo "Create Arc vhd"
createvmc "arc.vmc"
qemu-img convert -p -f raw -O vpc ${IMAGE_FILE} arc.vhd
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- 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
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhd.zip" arc.vhd arc.vmc
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.ova.zip" arc.ova
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
sha256sum update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip >"update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.hash"
fi
# Cleanup
- name: Cleanup
if: ${{ inputs.minimal }}
run: |
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" 2>/dev/null
# Build incremental
- name: Build microcode Image
if: ${{ inputs.microcode }}
run: |
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="microcode"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc.img"
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
echo "Mounting Image File"
mkdir -p "/tmp/p1"
mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
[ ! -f "brm/bzImage-arc" ] || [ ! -f "brm/initrd-arc" ] && return 1
echo "Repack initrd"
cp -f "brm/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brm/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
sudo cp -rf "files/p3/"* "/tmp/p3"
sudo sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
rmdir "/tmp/p1"
rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc2G.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
mv -f "arc2G.img" "${IMAGE_FILE}"
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
@@ -295,6 +388,7 @@ jobs:
### Versions:
${{ inputs.minimal && '- minimal: Full Image, all dependencies are included (reduced size, faster boot)' || '' }}
${{ inputs.microcode && '- microcode: Minimal + additional Microcode Updates' || '' }}
${{ inputs.extended && '- extended: Full Image, all dependencies are included (new features to test)' || '' }}
### Dependencies:

View File

@@ -247,7 +247,7 @@ jobs:
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download: ${{ env.FIOURL }}
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
If this will not work, do not use customized Versions!
If this isn't working, do not use customized Versions!
----
- name: Update Comment Fail
@@ -260,10 +260,8 @@ jobs:
update-mode: replace
body: |
Hi @${{ github.event.issue.user.login }}.
arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }} failed to build and package, please try again.
arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }} failed to build and package, please try again later.
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
If this will not work, do not use customized Versions!
----
- name: Close Issues

View File

@@ -28,8 +28,8 @@ jobs:
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
sudo apt install -y autoconf automake autopoint gettext build-essential bison flex libtool dosfstools e2fsprogs
sudo apt install -y libfreetype6-dev unifont fonts-dejavu libfuse-dev liblzma-dev libzfslinux-dev
sudo apt install -y autoconf automake autopoint build-essential pkg-config bison flex gettext gawk libtool dosfstools e2fsprogs
sudo apt install -y libfreetype6-dev unifont fonts-dejavu libfuse-dev libzfslinux-dev liblzma-dev libdevmapper-dev
- name: Make Grub
run: |

View File

@@ -822,15 +822,20 @@ function backupMenu() {
(
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
if [ -f "${PART2_PATH}/machine.key" ]; then
cp -f "${PART2_PATH}/machine.key" "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key"
BACKUPKEY="true"
sync
fi
umount "${TMP_PATH}/mdX"
while true; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
if [ -f "${PART2_PATH}/machine.key" ]; then
mkdir -p "${TMP_PATH}/mdX/usr/arc/backup/p2"
cp -f "${PART2_PATH}/machine.key" "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key"
if [ -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" ]; then
BACKUPKEY="true"
sync
break
fi
fi
umount "${TMP_PATH}/mdX"
done
done
rm -rf "${TMP_PATH}/mdX" >/dev/null
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \
@@ -938,16 +943,19 @@ function updateMenu() {
dialog --backtitle "$(backtitle)" --title "Switch Arc Branch" \
--menu "Choose a Branch" 0 0 0 \
1 "minimal - reduced size and faster boot" \
2 "extended - new features to test" \
3 "dev - Development only" \
2 "microcode - minimal with microcode" \
3 "extended - new features to test" \
4 "dev - Development only" \
2>"${TMP_PATH}/opts"
[ $? -ne 0 ] && break
opts=$(cat ${TMP_PATH}/opts)
if [ ${opts} -eq 1 ]; then
ARC_BRANCH="minimal"
elif [ ${opts} -eq 2 ]; then
ARC_BRANCH="extended"
ARC_BRANCH="microcode"
elif [ ${opts} -eq 3 ]; then
ARC_BRANCH="extended"
elif [ ${opts} -eq 4 ]; then
ARC_BRANCH="dev"
fi
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
@@ -995,7 +1003,7 @@ function sysinfo() {
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
ETHN=$(echo ${ETHX} | wc -w)
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
HWID="$(genHWID)"
@@ -1286,7 +1294,7 @@ function uploadDiag () {
# Shows Networkdiag to user
function networkdiag() {
(
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
for N in ${ETHX}; do
echo
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
@@ -1390,7 +1398,7 @@ function credits() {
###############################################################################
# Setting Static IP for Loader
function staticIPMenu() {
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
IPCON=""
for N in ${ETHX}; do
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
@@ -2129,7 +2137,7 @@ function rebootMenu() {
echo -e "recovery \"DSM: Recovery Mode\"" >>"${TMP_PATH}/opts"
echo -e "junior \"DSM: Reinstall Mode\"" >>"${TMP_PATH}/opts"
fi
echo -e "bios \"System: BIOS/UEFI\"" >>"${TMP_PATH}/opts"
echo -e "uefi \"System: UEFI\"" >>"${TMP_PATH}/opts"
echo -e "poweroff \"System: Shutdown\"" >>"${TMP_PATH}/opts"
echo -e "shell \"System: Shell Cmdline\"" >>"${TMP_PATH}/opts"
dialog --backtitle "$(backtitle)" --title "Power Menu" \
@@ -2238,8 +2246,8 @@ function governorSelection () {
touch "${TMP_PATH}/opts"
# Selectable CPU governors
[ "${PLATFORM}" = "epyc7002" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/opts"
[ "${PLATFORM}" != "epyc7002" ] && echo -e "ondemand \"use ondemand to scale frequency\"" >>"${TMP_PATH}/opts"
[ "${PLATFORM}" != "epyc7002" ] && echo -e "conservative \"use conservative to scale frequency *\"" >>"${TMP_PATH}/opts"
[ "${PLATFORM}" != "epyc7002" ] && echo -e "ondemand \"use ondemand to scale frequency\"" >>"${TMP_PATH}/opts"
echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/opts"
echo -e "powersave \"always run at lowest frequency\"" >>"${TMP_PATH}/opts"
dialog --backtitle "$(backtitle)" --title "CPU Frequency Scaling" \

View File

@@ -288,9 +288,11 @@ function arcVersion() {
PV=$(cat ${TMP_PATH}/resp)
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".url" "${D_FILE}")"
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".hash" "${D_FILE}")"
[ "${PRODUCTVER}" != "${PV:0:3}" ] && PRODUCTVER="${PV:0:3}"
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true" && break
writeConfigKey "productver" "${PV:0:3}" "${USER_CONFIG_FILE}"
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
VALID="true"
break
fi
done
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
while true; do
@@ -320,11 +322,10 @@ function arcVersion() {
--yesno "${MSG}" 6 55
if [ $? -eq 0 ]; then
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
else
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
fi
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
fi
elif [ "${ARCMODE}" = "automated" ] || [ "${ARCRESTORE}" = "true" ]; then
VALID="true"
@@ -415,18 +416,18 @@ function arcPatch() {
# Read Model Values
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
# Check for Custom Build
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
if [ "${ARCMODE}" = "automated" ] && [ "${ARCPATCH}" != "user" ]; then
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
elif [ "${ARCMODE}" = "config" ]; then
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
if [ -n "${ARCCONF}" ]; then
dialog --clear --backtitle "$(backtitlep)" \
--nocancel --title "SN/Mac Options"\
generate_and_write_serial "true"
else
generate_and_write_serial "false"
fi
elif [ "${ARCMODE}" = "config" ]; then
if [ -n "${ARCCONF}" ]; then
dialog --clear --backtitle "$(backtitlep)" \
--nocancel --title "SN/Mac Options" \
--menu "Choose an Option" 7 60 0 \
1 "Use Arc Patch (AME, QC, Push Notify and more)" \
2 "Use random SN/Mac (Reduced DSM Features)" \
@@ -434,37 +435,39 @@ function arcPatch() {
2>"${TMP_PATH}/resp"
else
dialog --clear --backtitle "$(backtitlep)" \
--nocancel --title "SN/Mac Options"\
--menu "Choose an Option" 7 60 0 \
2 "Use random SN/Mac (Reduced DSM Features)" \
3 "Use my own SN/Mac (Be sure your Data is valid)" \
2>"${TMP_PATH}/resp"
--nocancel --title "SN/Mac Options" \
--menu "Choose an Option" 7 60 0 \
2 "Use random SN/Mac (Reduced DSM Features)" \
3 "Use my own SN/Mac (Be sure your Data is valid)" \
2>"${TMP_PATH}/resp"
fi
resp=$(cat ${TMP_PATH}/resp)
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
SN="$(generateSerial "${MODEL}" "true")"
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
SN="$(generateSerial "${MODEL}" "false")"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 3 ]; then
while true; do
dialog --backtitle "$(backtitlep)" --colors --title "Serial" \
--inputbox "Please enter a valid SN!" 7 50 "" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break 2
SN="$(cat ${TMP_PATH}/resp)"
if [ -z "${SN}" ]; then
return
else
case ${resp} in
1)
generate_and_write_serial "true"
;;
2)
generate_and_write_serial "false"
;;
3)
while true; do
dialog --backtitle "$(backtitlep)" --colors --title "Serial" \
--inputbox "Please enter a valid SN!" 7 50 "" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break 2
SN="$(cat "${TMP_PATH}/resp" | tr '[:lower:]' '[:upper:]')"
[ -z "${SN}" ] && return
break
fi
done
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
fi
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
done
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
;;
esac
fi
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
arcSettings
}
@@ -472,85 +475,76 @@ function arcPatch() {
###############################################################################
# Arc Settings Section
function arcSettings() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
STEP="build"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
# Get Network Config for Loader
if [ "${ARCMODE}" = "config" ] || [ "${ARCPATCH}" = "true" ] || [ "${ARCPATCH}" = "false" ]; then
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
# Network Config for Loader
if [ "${ARCMODE}" = "config" ]; then
STEP="network"
dialog --backtitle "$(backtitlep)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40
sleep 2
getnet
[ $? -ne 0 ] && return
getnet || return
fi
if [ "${ONLYPATCH}" = "true" ]; then
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYPATCH="false"
return 0
fi
# Select Portmap for Loader
if [ "${DT}" = "false" ] && [ ${SATADRIVES} -gt 0 ]; then
STEP="storagemap"
dialog --backtitle "$(backtitlep)" --colors --title "Storage Map" \
--infobox "Generating Storage Map..." 3 40
sleep 2
getmapSelection
[ $? -ne 0 ] && return
getmapSelection || return
fi
# Check for Custom Build
# Select Addons
if [ "${ARCMODE}" = "config" ]; then
# Select Addons
STEP="addons"
dialog --backtitle "$(backtitlep)" --colors --title "Addons" \
--infobox "Loading Addons Table..." 3 40
addonSelection
[ $? -ne 0 ] && return
addonSelection || return
fi
# Check for CPU Frequency Scaling & Governor
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
dialog --backtitle "$(backtitlep)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40
governorSelection
[ $? -ne 0 ] && return
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
[ "${PLATFORM}" = "epyc7002" ] && writeConfigKey "governor" "schedutil" "${USER_CONFIG_FILE}" || writeConfigKey "governor" "conservative" "${USER_CONFIG_FILE}"
fi
if [ "${ARCMODE}" = "config" ]; then
# Check for DT and HBA/Raid Controller
if [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
# CPU Frequency Scaling & Governor
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ]; then
dialog --backtitle "$(backtitlep)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40
governorSelection || return
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ]; then
if [ "${PLATFORM}" = "epyc7002" ]; then
writeConfigKey "governor" "schedutil" "${USER_CONFIG_FILE}"
else
writeConfigKey "governor" "conservative" "${USER_CONFIG_FILE}"
fi
fi
# Check for more then 8 Ethernet Ports
fi
# Warnings and Checks
if [ "${ARCMODE}" = "config" ]; then
[ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
MODELNIC="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
if [ ${DEVICENIC} -gt 8 ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You have more NIC (${DEVICENIC}) then 8 NIC.\nOnly 8 supported by DSM." 6 60
fi
if [ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
fi
# Check for AES
if [ "${AESSYS}" = "false" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: Your System doesn't support Hardwareencryption in DSM. (AES)" 5 70
fi
# Check for CPUFREQ
if [[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
fi
[ ${DEVICENIC} -gt 8 ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than 8 NIC.\nOnly 8 supported by DSM." 6 60
[ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
[ "${AESSYS}" = "false" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: Your System doesn't support Hardware encryption in DSM. (AES)" 5 70
[[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling" && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
fi
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
# eMMC Boot Support
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
if [ "${EMMCBOOT}" = "true" ]; then
writeConfigKey "modules.mmc_block" "" "${USER_CONFIG_FILE}"
writeConfigKey "modules.mmc_core" "" "${USER_CONFIG_FILE}"
@@ -558,13 +552,11 @@ function arcSettings() {
deleteConfigKey "modules.mmc_block" "${USER_CONFIG_FILE}"
deleteConfigKey "modules.mmc_core" "${USER_CONFIG_FILE}"
fi
# Final Config Check
if [ -n "${PLATFORM}" ] && [ -n "${MODEL}" ] && [ -n "${KVER}" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
# Config is done
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" = "config" ]; then
# Ask for Build
dialog --clear --backtitle "$(backtitlep)" --title "Config done" \
--no-cancel --menu "Build now?" 7 40 0 \
1 "Yes - Build Arc Loader now" \
@@ -572,19 +564,12 @@ function arcSettings() {
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return
if [ ${resp} -eq 1 ]; then
arcSummary
elif [ ${resp} -eq 2 ]; then
dialog --clear --no-items --backtitle "$(backtitle)"
return
fi
[ ${resp} -eq 1 ] && arcSummary || dialog --clear --no-items --backtitle "$(backtitle)"
else
# Build Loader
make
fi
else
dialog --backtitle "$(backtitle)" --title "Config failed" \
--msgbox "ERROR: Config failed!\nExit." 6 40
dialog --backtitle "$(backtitle)" --title "Config failed" --msgbox "ERROR: Config failed!\nExit." 6 40
return 1
fi
}
@@ -603,19 +588,13 @@ function arcSummary() {
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
if [ "${REMAP}" = "acports" ] || [ "${REMAP}" = "maxports" ]; then
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
elif [ "${REMAP}" = "remap" ]; then
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
elif [ "${REMAP}" = "ahci" ]; then
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
else
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
fi
# Read remap configurations
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
@@ -625,13 +604,14 @@ function arcSummary() {
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ]; then
if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Error" \
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
return 1
fi
# Check for user-defined remap values
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ] && [ -z "${PORTMAP}${DISKMAP}${PORTREMAP}${AHCIPORTREMAP}" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Error" \
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
return 1
fi
# Print Summary
SUMMARY="\Z4> DSM Information\Zn"
SUMMARY+="\n>> Model: \Zb${MODEL}\Zn"
@@ -656,24 +636,21 @@ function arcSummary() {
SUMMARY+="\n>> Addons: \Zb${ADDONSINFO}\Zn"
SUMMARY+="\n"
SUMMARY+="\n\Z4> Device Information\Zn"
SUMMARY+="\n>> AES: \Zb${AESSYS}\Zn"
SUMMARY+="\n>> CPU FreqScaling | ACPI: \Zb${CPUFREQ} | ${ACPISYS}\Zn"
SUMMARY+="\n>> NIC: \Zb${NIC}\Zn"
SUMMARY+="\n>> Total Disks: \Zb${DRIVES}\Zn"
SUMMARY+="\n>> Internal Disks: \Zb${HARDDRIVES}\Zn"
SUMMARY+="\n>> Additional Controller: \Zb${EXTERNALCONTROLLER}\Zn"
SUMMARY+="\n>> Memory: \Zb${RAMTOTAL}GB\Zn"
SUMMARY+="\n"
dialog --backtitle "$(backtitlep)" --colors --title "Config Summary" \
--extra-button --extra-label "Cancel" --msgbox "${SUMMARY}" 0 0
RET=$?
case ${RET} in
0)
make
;;
3)
return 0
;;
255)
3|255)
return 0
;;
esac
@@ -749,25 +726,22 @@ function arcFinish() {
STEP="boot"
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
if [ -n "${MODELID}" ]; then
writeConfigKey "arc.builddone" "true" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "automated" ] || [ "${UPDATEMODE}" = "true" ]; then
boot
else
# Ask for Boot
dialog --clear --backtitle "$(backtitle)" --title "Build done"\
dialog --clear --backtitle "$(backtitle)" --title "Build done" \
--no-cancel --menu "Boot now?" 7 40 0 \
1 "Yes - Boot DSM now" \
2 "No - I want to make changes" \
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return
if [ ${resp} -eq 1 ]; then
boot
elif [ ${resp} -eq 2 ]; then
return
fi
resp=$(cat "${TMP_PATH}/resp")
[ "${resp}" -eq 1 ] && boot || return
fi
fi
}

View File

@@ -9,7 +9,6 @@ set -e
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
# Get Loader Disk Bus
@@ -59,6 +58,27 @@ DSMINFO="$(readConfigKey "bootscreen.dsminfo" "${USER_CONFIG_FILE}")"
SYSTEMINFO="$(readConfigKey "bootscreen.systeminfo" "${USER_CONFIG_FILE}")"
DISKINFO="$(readConfigKey "bootscreen.diskinfo" "${USER_CONFIG_FILE}")"
HWIDINFO="$(readConfigKey "bootscreen.hwidinfo" "${USER_CONFIG_FILE}")"
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
# Build Sanity Check
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
if [ -z "${MODELID}" ] || [ "${MODELID}" != "${MODEL}" ]; then
die "Loader build not completed! Model mismatch!"
fi
# HardwareID Check
if [ "${ARCPATCH}" = "true" ]; then
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
HWID="$(genHWID)"
if [ "${HARDWAREID}" != "${HWID}" ]; then
echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
sleep 5
rebootTo "config"
fi
fi
if [ "${DSMINFO}" = "true" ]; then
echo -e "\033[1;37mDSM:\033[0m"
@@ -73,6 +93,8 @@ if [ "${SYSTEMINFO}" = "true" ]; then
echo -e "Vendor: \033[1;37m${VENDOR}\033[0m"
echo -e "CPU: \033[1;37m${CPU}\033[0m"
echo -e "Memory: \033[1;37m${RAMTOTAL}GB\033[0m"
echo -e "Governor: \033[1;37m${GOVERNOR}\033[0m"
[ "${USBMOUNT}" = "true" ] && echo -e "USB Mount: \033[1;37m${USBMOUNT}\033[0m"
echo
fi
if [ "${DISKINFO}" = "true" ]; then
@@ -109,34 +131,33 @@ SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
KERNELPANIC="$(readConfigKey "kernelpanic" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
MODBLACKLIST="$(readConfigKey "modblacklist" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
# HardwareID Check
if [ "${ARCPATCH}" = "true" ]; then
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
HWID="$(genHWID)"
if [ "${HARDWAREID}" != "${HWID}" ]; then
echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
sleep 5
rebootTo "config"
fi
fi
declare -A CMDLINE
# Automated Cmdline
CMDLINE["syno_hw_version"]="${MODELID:-${MODEL}}"
CMDLINE["syno_hw_version"]="${MODELID}"
CMDLINE["vid"]="${VID:-"0x46f4"}" # Sanity check
CMDLINE["pid"]="${PID:-"0x0001"}" # Sanity check
CMDLINE["sn"]="${SN}"
# NIC Cmdline
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)
ETHN=$(echo "${ETHX}" | wc -w)
ETHM=${ETHM:-${ETHN}}
NIC=0
for N in ${ETHX}; do
MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}")
MAC=${MAC:-$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')}
NIC=$((NIC + 1))
CMDLINE["mac${NIC}"]="${MAC}"
[ ${NIC} -ge ${ETHM} ] && break
done
CMDLINE["netif_num"]="${NIC}"
# Boot Cmdline
if grep -q "force_junior" /proc/cmdline; then
CMDLINE["force_junior"]=""
@@ -159,13 +180,14 @@ if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then
SIZE=$((${SZ:-0} * ${SS:-0} / 1024 / 1024 + 10))
# Read SATADoM type
SATADOM="$(readConfigKey "satadom" "${USER_CONFIG_FILE}")"
CMDLINE["synoboot_satadom"]="${SATADOM:-2}"
CMDLINE["dom_szmax"]="${SIZE}"
CMDLINE['synoboot_satadom']="${SATADOM:-2}"
CMDLINE['dom_szmax']="${SIZE}"
fi
CMDLINE['elevator']="elevator"
CMDLINE["elevator"]="elevator"
else
CMDLINE["split_lock_detect"]="off"
fi
if [ "${DT}" = "true" ]; then
CMDLINE["syno_ttyS0"]="serial,0x3f8"
CMDLINE["syno_ttyS1"]="serial,0x2f8"
@@ -177,35 +199,33 @@ fi
CMDLINE["HddHotplug"]="1"
CMDLINE["vender_format_version"]="2"
CMDLINE["skip_vender_mac_interfaces"]="0,1,2,3,4,5,6,7"
CMDLINE["earlyprintk"]=""
CMDLINE["earlycon"]="uart8250,io,0x3f8,115200n8"
CMDLINE["console"]="ttyS0,115200n8"
CMDLINE["consoleblank"]="600"
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
CMDLINE['earlyprintk']=""
CMDLINE['earlycon']="uart8250,io,0x3f8,115200n8"
CMDLINE['console']="ttyS0,115200n8"
CMDLINE['consoleblank']="600"
# CMDLINE['no_console_suspend']="1"
CMDLINE["root"]="/dev/md0"
CMDLINE["loglevel"]="15"
CMDLINE["log_buf_len"]="32M"
CMDLINE["rootwait"]=""
CMDLINE['root']="/dev/md0"
CMDLINE['loglevel']="15"
CMDLINE['log_buf_len']="32M"
CMDLINE['rootwait']=""
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}"
CMDLINE['modprobe.blacklist']="${MODBLACKLIST}"
if [ "${USBMOUNT}" = "true" ]; then
CMDLINE['usbinternal']=""
fi
if [ "${GOVERNOR}" = "ondemand" ] || [ "${GOVERNOR}" = "conservative" ] || [ "${GOVERNOR}" = "schedutil" ]; then
CMDLINE["governor"]="${GOVERNOR}"
fi
if [ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ]; then
CMDLINE["intel_pstate"]="disable"
if [ -n "${GOVERNOR}" ]; then
CMDLINE['governor']="${GOVERNOR}"
fi
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
CMDLINE["nox2apic"]=""
fi
@@ -219,11 +239,11 @@ fi
# 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"
[ ! "${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)
# CMDLINE['scsi_mod.scan']="sync" # TODO: redpill panic of vmware scsi? (add to cmdline)
fi
# CMDLINE['kvm.ignore_msrs']="1"
@@ -237,20 +257,6 @@ 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)
ETHN=$(echo ${ETHX} | wc -w)
[ -z "${ETHM}" ] && ETHM="${ETHN}"
NIC=0
for N in ${ETHX}; do
MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')" || NIC=$((NIC + 1))
[ ${NIC} -le ${ETHM} ] && CMDLINE["mac${NIC}"]="${MAC}"
[ ${NIC} -ge ${ETHM} ] && break
done
CMDLINE["netif_num"]="${NIC}"
# Read user network settings
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && CMDLINE["network.${KEY}"]="${VALUE}"
@@ -293,8 +299,10 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
fi
echo
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
sleep 3
sleep 2
for N in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
@@ -359,7 +367,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m"
KEXECARGS+=" --noefi"
fi
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE} kexecboot" >"${LOG_FILE}" 2>&1 || dieLog
echo -e "\033[1;37mBooting DSM...\033[0m"
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff

View File

@@ -113,3 +113,19 @@ function updateAddon() {
rm -f "${F}"
done
}
###############################################################################
# Read Addon Key
# 1 - Addon
# 2 - key
function readAddonKey() {
if [ -z "${1}" ] || [ -z "${2}" ]; then
echo ""
return 1
fi
if [ ! -f "${ADDONS_PATH}/${1}/manifest.yml" ]; then
echo ""
return 1
fi
readConfigKey "${2}" "${ADDONS_PATH}/${1}/manifest.yml"
}

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.

View File

@@ -147,6 +147,14 @@ function generateMacAddress() {
return 0
}
###############################################################################
function generate_and_write_serial() {
local use_patch=$1
SN="$(generateSerial "${MODEL}" "${use_patch}")"
writeConfigKey "arc.patch" "${use_patch}" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
}
###############################################################################
# Validate a serial number for a model
# 1 - Model

View File

@@ -7,13 +7,25 @@
# eg: N i915.ko
# kvm
N irqbypass.ko
N kvm-intel.ko
N kvm-amd.ko
N kvm.ko
F irqbypass.ko
F kvm-intel.ko
F kvm-amd.ko
F kvm.ko
# acpi
N acpi_call.ko
N acpi-cpufreq.ko
N processor.ko
N button.ko
# cpufreq
N cpufreq_governor.ko
N cpufreq_ondemand.ko
N cpufreq_conservative.ko
N cpufreq_performance.ko
N cpufreq_powersave.ko
N cpufreq_userspace.ko
N cpufreq_stats.ko
# misc
N check_signature.ko
@@ -34,14 +46,6 @@ N cdc_ether.ko
N rndis_host.ko
N r8152.ko
# iwlwifi
N libarc4.ko
N cfg80211.ko
N mac80211.ko
N iwlwifi.ko
N iwlmvm.ko
N iwldvm.ko
## i915
#N dmabuf.ko
#N drm.ko

View File

@@ -1,34 +1,33 @@
# Get Network Config for Loader
function getnet() {
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
ETHN=$(echo ${ETHX} | wc -w)
if [ "${ARCPATCH}" = "true" ]; then
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true"))
for I in $(seq 1 ${ETHN}); do
eval MAC${I}="${MACS[$((${I} - 1))]}"
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
generate_and_write_macs() {
local patch=$1
local macs=($(generateMacAddress "${MODEL}" "${ETHN}" "${patch}"))
for i in $(seq 1 "${ETHN}"); do
local mac="${macs[$((i - 1))]}"
writeConfigKey "eth$((i - 1))" "${mac}" "${USER_CONFIG_FILE}"
done
elif [ "${ARCPATCH}" = "false" ]; then
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false"))
for I in $(seq 1 ${ETHN}); do
eval MAC${I}="${MACS[$((${I} - 1))]}"
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
done
elif [ "${ARCPATCH}" = "user" ]; then
# User Mac
}
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
MODEL=$(readConfigKey "model" "${USER_CONFIG_FILE}")
ARCPATCH=$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")
ETHN=$(echo "${ETHX}" | wc -w)
if [ "${ARCPATCH}" != "user" ]; then
generate_and_write_macs "${ARCPATCH}"
else
for N in ${ETHX}; do
while true; do
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
--inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50\
--inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50 \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
MAC=$(cat "${TMP_PATH}/resp")
[ -z "${MAC}" ] && MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')"
[ -z "${MAC}" ] && MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}")
[ -z "${MAC}" ] && MAC=$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')
MAC=$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')
if [ ${#MAC} -eq 12 ]; then
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Set Mac for ${N} to ${MAC}!" 5 50
writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}"
@@ -42,7 +41,7 @@ function getnet() {
}
# Get Amount of NIC
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
# Get actual IP
for N in ${ETHX}; do
IPCON="$(getIP "${N}")"

View File

@@ -1,109 +1,124 @@
# Get PortMap for Loader
function detect_drives() {
local pci_id=$1
local drive_var=$2
local class_path=$3
local grep_pattern=$4
local sed_pattern=$5
eval "${drive_var}=0"
if [ $(lspci -d ::${pci_id} 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::${pci_id} 2>/dev/null | awk '{print $1}'); do
PORT=$(ls -l ${class_path} | grep "${PCI}" | awk -F'/' '{print $NF}' | sed "${sed_pattern}" | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "${grep_pattern}${PORT}:" | wc -l)
eval "${drive_var}=\$((\${${drive_var}} + \${PORTNUM}))"
done
fi
}
function show_dialog() {
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
}
function set_remap() {
case ${resp} in
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
esac
}
function getmap() {
# Sata Disks
SATADRIVES=0
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
# Clean old files
[ -f "${TMP_PATH}/drivesmax" ] && rm -f "${TMP_PATH}/drivesmax" && touch "${TMP_PATH}/drivesmax"
[ -f "${TMP_PATH}/drivescon" ] && rm -f "${TMP_PATH}/drivescon" && touch "${TMP_PATH}/drivescon"
[ -f "${TMP_PATH}/ports" ] && rm -f "${TMP_PATH}/ports" && touch "${TMP_PATH}/ports"
[ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap" && touch "${TMP_PATH}/remap"
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
let DISKIDXMAPIDX=0
DISKIDXMAP=""
let DISKIDXMAPIDXMAX=0
DISKIDXMAPMAX=""
for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do
NUMPORTS=0
CONPORTS=0
unset HOSTPORTS
declare -A HOSTPORTS
while read -r LINE; do
ATAPORT="$(echo ${LINE} | grep -o 'ata[0-9]*')"
PORT=$(echo ${ATAPORT} | sed 's/ata//')
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
while read -r PORT; do
ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && ATTACH=1 || ATTACH=0
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
[ ${PCMD} = 0 ] && DUMMY=1 || DUMMY=0
[ ${ATTACH} = 1 ] && CONPORTS="$((${CONPORTS} + 1))" && echo "$((${PORT} - 1))" >>"${TMP_PATH}/ports"
[ ${DUMMY} = 1 ] # Do nothing for now
NUMPORTS=$((${NUMPORTS} + 1))
done < <(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n)
[ ${NUMPORTS} -gt 8 ] && NUMPORTS=8
[ ${CONPORTS} -gt 8 ] && CONPORTS=8
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon"
DISKIDXMAP=$DISKIDXMAP$(printf "%02x" $DISKIDXMAPIDX)
let DISKIDXMAPIDX=$DISKIDXMAPIDX+$CONPORTS
DISKIDXMAPMAX=$DISKIDXMAPMAX$(printf "%02x" $DISKIDXMAPIDXMAX)
let DISKIDXMAPIDXMAX=$DISKIDXMAPIDXMAX+$NUMPORTS
SATADRIVES=$((${SATADRIVES} + ${CONPORTS}))
for file in drivesmax drivescon ports remap; do
> "${TMP_PATH}/${file}"
done
DISKIDXMAPIDX=0
DISKIDXMAP=""
DISKIDXMAPIDXMAX=0
DISKIDXMAPMAX=""
for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do
NUMPORTS=0
CONPORTS=0
declare -A HOSTPORTS
while read -r LINE; do
PORT=$(echo ${LINE} | grep -o 'ata[0-9]*' | sed 's/ata//')
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
for PORT in $(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n); do
ATTACH=$(ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && echo 1 || echo 0)
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
DUMMY=$([ ${PCMD} = 0 ] && echo 1 || echo 0)
[ ${ATTACH} = 1 ] && CONPORTS=$((CONPORTS + 1)) && echo $((PORT - 1)) >>"${TMP_PATH}/ports"
NUMPORTS=$((NUMPORTS + 1))
done
fi
NUMPORTS=$((NUMPORTS > 8 ? 8 : NUMPORTS))
CONPORTS=$((CONPORTS > 8 ? 8 : CONPORTS))
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon"
DISKIDXMAP+=$(printf "%02x" $DISKIDXMAPIDX)
DISKIDXMAPIDX=$((DISKIDXMAPIDX + CONPORTS))
DISKIDXMAPMAX+=$(printf "%02x" $DISKIDXMAPIDXMAX)
DISKIDXMAPIDXMAX=$((DISKIDXMAPIDXMAX + NUMPORTS))
SATADRIVES=$((SATADRIVES + CONPORTS))
done
fi
# SAS Disks
SASDRIVES=0
if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
SASDRIVES=$((${SASDRIVES} + ${PORTNUM}))
done
fi
detect_drives "107" "SASDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
# SCSI Disks
SCSIDRIVES=0
if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort - 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
SCSIDRIVES=$((${SCSIDRIVES} + ${PORTNUM}))
done
fi
detect_drives "100" "SCSIDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
# Raid Disks
RAIDDRIVES=0
if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
RAIDDRIVES=$((${RAIDDRIVES} + ${PORTNUM}))
done
fi
detect_drives "104" "RAIDDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
# NVMe Disks
detect_drives "108" "NVMEDRIVES" "/sys/class/nvme" "\[N:${PORT}:" "s/nvme//"
# USB Disks
USBDRIVES=0
if [ $(ls -l /sys/class/scsi_host 2>/dev/null | grep usb | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
[ ${PORTNUM} -eq 0 ] && continue
USBDRIVES=$((${USBDRIVES} + ${PORTNUM}))
USBDRIVES=$((USBDRIVES + PORTNUM))
done
fi
# MMC Disks
MMCDRIVES=0
if [ $(ls -l /sys/block/mmc* 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::805 | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l 2>/dev/null)
[ ${PORTNUM} -eq 0 ] && continue
MMCDRIVES=$((${MMCDRIVES} + ${PORTNUM}))
done
fi
# NVMe Disks
NVMEDRIVES=0
if [ $(lspci -d ::108 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/nvme | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[N:${PORT}:" | wc -l)
NVMEDRIVES=$((${NVMEDRIVES} + ${PORTNUM}))
MMCDRIVES=$((MMCDRIVES + PORTNUM))
done
fi
# Disk Count for MaxDisks
DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES}))
HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES}))
@@ -116,30 +131,32 @@ function getmap() {
writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
# Check for Sata Boot
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
LASTDRIVE=0
while read -r D; do
if [ "${BUS}" = "sata" ] && [ "${MACHINE}" != "Native" ] && [ ${D} -eq 0 ]; then
MAXDISKS=${DRIVES}
echo -n "${D}>${MAXDISKS}:">>"${TMP_PATH}/remap"
elif [ ${D} != ${LASTDRIVE} ]; then
echo -n "${D}>${LASTDRIVE}:">>"${TMP_PATH}/remap"
LASTDRIVE=$((${LASTDRIVE} + 1))
elif [ ${D} = ${LASTDRIVE} ]; then
LASTDRIVE=$((${D} + 1))
echo -n "${D}>${MAXDISKS}:" >>"${TMP_PATH}/remap"
elif [ ${D} -ne ${LASTDRIVE} ]; then
echo -n "${D}>${LASTDRIVE}:" >>"${TMP_PATH}/remap"
LASTDRIVE=$((LASTDRIVE + 1))
else
LASTDRIVE=$((D + 1))
fi
done < <(cat "${TMP_PATH}/ports")
done < "${TMP_PATH}/ports"
fi
}
function getmapSelection() {
# Compute PortMap Options
SATAPORTMAPMAX="$(awk '{print $1}' "${TMP_PATH}/drivesmax")"
SATAPORTMAP="$(awk '{print $1}' "${TMP_PATH}/drivescon")"
SATAREMAP="$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')"
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
SATAPORTMAPMAX=$(awk '{print $1}' "${TMP_PATH}/drivesmax")
SATAPORTMAP=$(awk '{print $1}' "${TMP_PATH}/drivescon")
SATAREMAP=$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')
EXTERNALCONTROLLER=$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")
ARCMODE=$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")
if [ "${ARCMODE}" = "config" ]; then
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
@@ -149,42 +166,13 @@ function getmapSelection() {
else
REMAP1="*"
fi
# Ask for Portmap
if [ "${STEP}" = "storagemap" ]; then
dialog --backtitle "$(backtitlep)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
show_dialog
set_remap
else
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
fi
if [ ${resp} -eq 1 ]; then
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 3 ]; then
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 4 ]; then
writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 5 ]; then
writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}"
show_dialog
set_remap
fi
else
# Show recommended Option to user
@@ -198,53 +186,46 @@ function getmapSelection() {
fi
# Check Remap for correct config
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
# Write Map to config and show Map to User
if [ "${REMAP}" = "acports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "maxports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "remap" ]; then
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "ahci" ]; then
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
fi
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
case "${REMAP}" in
"acports")
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
;;
"maxports")
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
;;
"remap")
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
;;
"ahci")
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
;;
esac
return
}
# Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
SATACONTROLLER=$(lspci -d ::106 2>/dev/null | wc -l)
writeConfigKey "device.satacontroller" "${SATACONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${SATACONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "false" "${USER_CONFIG_FILE}"
fi
SASCONTROLLER=$(lspci -d ::107 2>/dev/null | wc -l)
writeConfigKey "device.sascontroller" "${SASCONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${SASCONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi
SCSICONTROLLER=$(lspci -d ::100 2>/dev/null | wc -l)
writeConfigKey "device.scsicontroller" "${SCSICONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${SCSICONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi
RAIDCONTROLLER=$(lspci -d ::104 2>/dev/null | wc -l)
writeConfigKey "device.raidcontroller" "${RAIDCONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${RAIDCONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi
declare -A controllers=(
[satacontroller]=106
[sascontroller]=107
[scsicontroller]=100
[raidcontroller]=104
)
external_controller=false
for controller in "${!controllers[@]}"; do
count=$(lspci -d ::${controllers[$controller]} 2>/dev/null | wc -l)
writeConfigKey "device.${controller}" "${count}" "${USER_CONFIG_FILE}"
if [ "${controller}" != "satacontroller" ] && [ ${count} -gt 0 ]; then
external_controller=true
fi
done
writeConfigKey "device.externalcontroller" "${external_controller}" "${USER_CONFIG_FILE}"

View File

@@ -457,9 +457,14 @@ function updateLKMs() {
function updateOffline() {
local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
if [ "${ARCOFFLINE}" != "true" ]; then
[ -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml" "${MODEL_CONFIG_PATH}/data.yml.bak"
[ -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml" "${MODEL_CONFIG_PATH}/data.yml.bak" || true
curl -skL "https://raw.githubusercontent.com/AuxXxilium/arc-dsm/refs/heads/main/data.yml" -o "${MODEL_CONFIG_PATH}/data.yml"
[ ! -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml.bak" "${MODEL_CONFIG_PATH}/data.yml"
# Check file size and restore backup if necessary
local FILESIZE=$(stat -c%s "${MODEL_CONFIG_PATH}/data.yml")
if [ "${FILESIZE}" -lt 3072 ]; then
cp -f "${MODEL_CONFIG_PATH}/data.yml.bak" "${MODEL_CONFIG_PATH}/data.yml"
fi
fi
return 0
}
@@ -467,34 +472,24 @@ function updateOffline() {
###############################################################################
# Loading Update Mode
function dependenciesUpdate() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
FAILED="false"
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Updating Dependencies..." 3 40
sleep 2
updateAddons
[ $? -ne 0 ] && FAILED="true"
updateModules
[ $? -ne 0 ] && FAILED="true"
updateCustom
[ $? -ne 0 ] && FAILED="true"
updatePatches
[ $? -ne 0 ] && FAILED="true"
updateLKMs
[ $? -ne 0 ] && FAILED="true"
updateOffline
[ $? -ne 0 ] && FAILED="true"
FAILED="false"
for updateFunction in updateAddons updateModules updateCustom updatePatches updateLKMs updateOffline; do
$updateFunction || FAILED="true"
done
if [ "${FAILED}" = "true" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update Dependencies failed! Try again later." 3 40
sleep 3
elif [ "${FAILED}" = "false" ]; then
else
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update Dependencies successful!" 3 40
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
sleep 3
clear
exec arc.sh
fi
sleep 3
clear
exec arc.sh
}

View File

@@ -43,46 +43,52 @@ ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
[ "${PATURL:0:1}" = "#" ] && PATURL=""
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
# Check if DSM Version changed
. "${RAMDISK_PATH}/etc/VERSION"
if [[ -n "${PRODUCTVER}" && -n "${BUILDNUM}" && -n "${SMALLNUM}" ]] &&
([ "${PRODUCTVER}" != "${majorversion}.${minorversion}" ] || [ "${BUILDNUM}" != "${buildnumber}" ] || [ "${SMALLNUM}" != "${smallfixnumber}" ]); then
OLDVER="${PRODUCTVER}(${BUILDNUM}$([ ${SMALLNUM:-0} -ne 0 ] && echo "u${SMALLNUM}"))"
NEWVER="${majorversion}.${minorversion}(${buildnumber}$([ ${smallfixnumber:-0} -ne 0 ] && echo "u${smallfixnumber}"))"
([[ "${PRODUCTVER}" != "${majorversion}.${minorversion}" ]] || [[ "${BUILDNUM}" != "${buildnumber}" ]] || [[ "${SMALLNUM}" != "${smallfixnumber}" ]]); then
OLDVER="${PRODUCTVER}(${BUILDNUM}$([[ ${SMALLNUM:-0} -ne 0 ]] && echo "u${SMALLNUM}"))"
NEWVER="${majorversion}.${minorversion}(${buildnumber}$([[ ${smallfixnumber:-0} -ne 0 ]] && echo "u${smallfixnumber}"))"
PAT_URL=""
PAT_HASH=""
echo "Version changed from ${OLDVER} to ${NEWVER}"
fi
PRODUCTVER=${majorversion}.${minorversion}
BUILDNUM=${buildnumber}
SMALLNUM=${smallfixnumber}
[ "${PATURL:0:1}" = "#" ] && PATURL=""
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
# Re-read PAT_URL and PAT_HASH if they are empty
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".url" "${D_FILE}")"
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".hash" "${D_FILE}")"
fi
PRODUCTVER="${majorversion}.${minorversion}"
BUILDNUM="${buildnumber}"
SMALLNUM="${smallfixnumber}"
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "${BUILDNUM}" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}"
# Read model data
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Sanity check
if [ -z "${PLATFORM}" ] || [ -z "${KVER}" ]; then
echo "ERROR: Configuration for model ${MODEL} and productversion ${PRODUCTVER} not found." >"${LOG_FILE}"
echo "ERROR: Configuration for Model ${MODEL} and Version ${PRODUCTVER} not found." >"${LOG_FILE}"
exit 1
fi
declare -A SYNOINFO
declare -A ADDONS
declare -A MODULES
# Read synoinfo and addons from config
declare -A SYNOINFO ADDONS MODULES
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
@@ -93,32 +99,32 @@ while IFS=': ' read -r KEY VALUE; do
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
# Patches (diff -Naru OLDFILE NEWFILE > xxx.patch)
PATCHS=(
PATCHES=(
"ramdisk-etc-rc-*.patch"
"ramdisk-init-script-*.patch"
"ramdisk-post-init-script-*.patch"
"ramdisk-disable-root-pwd-*.patch"
"ramdisk-disable-disabled-ports-*.patch"
)
for PE in "${PATCHS[@]}"; do
RET=1
echo "Patching with ${PE}" >"${LOG_FILE}"
# ${PE} contains *, so double quotes cannot be added
for PF in $(ls ${PATCH_PATH}/${PE} 2>/dev/null); do
echo "Patching with ${PF}" >>"${LOG_FILE}"
# busybox patch and gun patch have different processing methods and parameters.
(cd "${RAMDISK_PATH}" && busybox patch -p1 -i "${PF}") >>"${LOG_FILE}" 2>&1
RET=$?
[ ${RET} -eq 0 ] && break
for PATCH in "${PATCHES[@]}"; do
echo "Patching with ${PATCH}" >>"${LOG_FILE}"
for PF in ${PATCH_PATH}/${PATCH}; do
[ -e "${PF}" ] || continue
echo "Applying patch ${PF}" >>"${LOG_FILE}"
if ! (cd "${RAMDISK_PATH}" && busybox patch -p1 -i "${PF}") >>"${LOG_FILE}" 2>&1; then
echo "Failed to apply patch ${FILE}" >>"${LOG_FILE}"
continue
fi
done
[ ${RET} -ne 0 ] && exit 1
done
# Add serial number to synoinfo.conf, to help to recovery a installed DSM
echo "Set synoinfo SN" >"${LOG_FILE}"
# Add serial number to synoinfo.conf, to help to recover an installed DSM
echo "Set synoinfo SN" >>"${LOG_FILE}"
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
for KEY in ${!SYNOINFO[@]}; do
for KEY in "${!SYNOINFO[@]}"; do
echo "Set synoinfo ${KEY}" >>"${LOG_FILE}"
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
@@ -163,7 +169,7 @@ mkdir -p "${RAMDISK_PATH}/addons"
echo "export PLATFORM=\"${PLATFORM}\""
echo "export MODEL=\"${MODEL}\""
echo "export MODELID=\"${MODELID}\""
echo "export PRODUCTVER=\"${PRODUCTVER}\""
echo "export PRODUCTVERL=\"${PRODUCTVERL}\""
echo "export MLINK=\"${PAT_URL}\""
echo "export MCHECKSUM=\"${PAT_HASH}\""
echo "export LAYOUT=\"${LAYOUT:-qwerty}\""
@@ -172,7 +178,7 @@ mkdir -p "${RAMDISK_PATH}/addons"
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
# System Addons
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol" "mountloader"; do
for ADDON in redpill revert misc eudev disks localrss notify wol mountloader; do
PARAMS=""
if [ "${ADDON}" = "disks" ]; then
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
@@ -184,8 +190,8 @@ for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol"
done
# User Addons
for ADDON in ${!ADDONS[@]}; do
PARAMS=${ADDONS[${ADDON}]}
for ADDON in "${!ADDONS[@]}"; do
PARAMS="${ADDONS[${ADDON}]}"
installAddon "${ADDON}" "${PLATFORM}" || echo "Addon ${ADDON} not found"
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
done

View File

@@ -1,44 +1,66 @@
set default="boot"
set timeout="5"
set timeout_style="menu"
set vesa_mode=1
set menu_color_normal=white/black
set menu_color_highlight=white/red
set color_normal=white/black
if [ -s ${prefix}/grubenv ]; then
load_env --skip-sig
fi
if [ "${next_entry}" ]; then
set default="${next_entry}"
unset next_entry
save_env next_entry
fi
if [ "${vesa_mode}" ]; then
set vesa_mode=${vesa_mode}
fi
terminal_input console
terminal_output console
if [ "${feature_all_video_module}" = "y" ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
set default="boot"
fi
if loadfont unicode; then
if [ "${linux_gfx_mode}" ]; then
save_env linux_gfx_mode
else
set linux_gfx_mode=keep
save_env linux_gfx_mode
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
function load_video {
if [ x"${feature_all_video_module}" = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
set menu_color_normal=white/black
set menu_color_highlight=white/red
set color_normal=white/black
if [ x"${feature_default_font_path}" = xy ]; then
font=unicode
else
font=${prefix}/fonts/unicode.pf2
fi
if loadfont ${font}; then
if [ "${grub_platform}" = "efi" ]; then
set gfxmode=auto
else
set gfxmode=1024x768
fi
terminal_output gfxterm
load_video
insmod gfxterm
insmod gfxmenu
loadfont ${prefix}/theme/dejavu_bold_14.pf2
loadfont ${prefix}/theme/dejavu_mono_12.pf2
@@ -47,17 +69,20 @@ if loadfont unicode; then
export theme
fi
terminal_output gfxterm
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
terminal_input --append serial
terminal_output --append serial
fi
function set_gfxpayload {
if [ ${vesa_mode} -eq 1 ]; then
set gfxpayload=keep
else
set gfxpayload=text
fi
function gfxmode {
set gfxpayload="${linux_gfx_mode}"
if [ "${linux_gfx_mode}" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
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"
@@ -66,8 +91,8 @@ search --set=root --label "ARC3"
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
if [ "${default}" = "direct" ]; then
set timeout="1"
menuentry 'DSM Direct Mode' --id direct {
set_gfxpayload
menuentry 'DSM Direct Mode' ${menuentry_id_option} direct {
gfxmode
echo "Loading DSM Kernel..."
linux /zImage-dsm ${dsm_cmdline}
echo "Loading DSM Initramfs..."
@@ -76,8 +101,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
echo "Access http://find.synology.com/ to connect the DSM via web."
}
fi
menuentry 'Arc DSM Mode' --id boot {
set_gfxpayload
menuentry 'Arc DSM Mode' ${menuentry_id_option} boot {
gfxmode
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline}
echo "Loading Arc Initramfs..."
@@ -91,8 +116,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
fi
if [ -e /automated ]; then
menuentry 'Arc Automated Mode' --id automated {
set_gfxpayload
menuentry 'Arc Automated Mode' ${menuentry_id_option} automated {
gfxmode
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} automated_arc
echo "Loading Arc Initramfs..."
@@ -105,8 +130,8 @@ if [ -e /automated ]; then
}
fi
menuentry 'Arc Config Mode' --id config {
set_gfxpayload
menuentry 'Arc Config Mode' ${menuentry_id_option} config {
gfxmode
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_arc
echo "Loading Arc Initramfs..."
@@ -119,8 +144,8 @@ menuentry 'Arc Config Mode' --id config {
}
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
menuentry 'Arc Update Mode' --id update {
set_gfxpayload
menuentry 'Arc Update Mode' ${menuentry_id_option} update {
gfxmode
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} update_arc
echo "Loading Arc Initramfs..."
@@ -131,8 +156,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
fi
echo "Booting..."
}
menuentry 'DSM Recovery Mode' --id recovery {
set_gfxpayload
menuentry 'DSM Recovery Mode' ${menuentry_id_option} recovery {
gfxmode
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} recovery
echo "Loading Arc Initramfs..."
@@ -143,8 +168,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
fi
echo "Booting..."
}
menuentry 'DSM Reinstall Mode' --id junior {
set_gfxpayload
menuentry 'DSM Reinstall Mode' ${menuentry_id_option} junior {
gfxmode
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_junior
echo "Loading Arc Initramfs..."
@@ -157,28 +182,28 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
}
fi
menuentry 'Enter BIOS Setup' --id bios {
menuentry 'Enter UEFI Setup' ${menuentry_id_option} uefi {
fwsetup
}
menuentry 'Start Memtest86+' --id memtest {
menuentry 'Start Memtest86+' ${menuentry_id_option} memtest {
echo "Loading memtest86+..."
linux ${prefix}/memtest
}
menuentry 'Poweroff' --id poweroff {
menuentry 'Poweroff' ${menuentry_id_option} poweroff {
echo "System is powering off..."
halt
}
if [ ${vesa_mode} = 1 ]; then
menuentry 'Change Vesa to Text Output' --id videomode {
menuentry 'Change Vesa to Text Output' ${menuentry_id_option} videomode {
set vesa_mode=0
save_env vesa_mode
configfile ${prefix}/grub.cfg
}
else
menuentry 'Change Text to Vesa Output' --id videomode {
menuentry 'Change Text to Vesa Output' ${menuentry_id_option} videomode {
set vesa_mode=1
save_env vesa_mode
reboot

Binary file not shown.

View File

@@ -231,6 +231,29 @@ function getBuildroots() {
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Buildroot-M
# $1 path
function getBuildrootm() {
echo "Getting Buildroot-M begin"
local DEST_PATH="${1}"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export BRSTAG="${TAG}"
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
rm -f "${DEST_PATH}/bzImage-arc"
rm -f "${DEST_PATH}/initrd-arc"
while read -r ID NAME; do
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases/assets/${ID}" -o "${DEST_PATH}/brm.zip"
echo "Buildroot-M: ${TAG}"
unzip -o "${DEST_PATH}/brm.zip" -d "${DEST_PATH}"
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
fi
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Offline
# $1 path
function getOffline() {
@@ -294,36 +317,43 @@ function repackInitrd() {
sudo rm -rf "${RDXZ_PATH}"
}
# resizeimg
# resizeImg
# $1 input file
# $2 changsize MB eg: +50M -50M
# $2 change size MB e.g., +50M -50M
# $3 output file
function resizeImg() {
INPUT_FILE="${1}"
CHANGE_SIZE="${2}"
OUTPUT_FILE="${3:-${INPUT_FILE}}"
local INPUT_FILE="${1}"
local CHANGE_SIZE="${2}"
local OUTPUT_FILE="${3:-${INPUT_FILE}}"
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && exit 1
[ -z "${CHANGE_SIZE}" ] && exit 1
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && { echo "Input file not specified or does not exist"; exit 1; }
[[ -z "${CHANGE_SIZE}" ]] && { echo "Change size not specified"; exit 1; }
INPUT_FILE="$(realpath "${INPUT_FILE}")"
OUTPUT_FILE="$(realpath "${OUTPUT_FILE}")"
local CURRENT_SIZE
CURRENT_SIZE=$(du -m "${INPUT_FILE}" | awk '{print $1}')
local SIZE
SIZE=$((CURRENT_SIZE + ${CHANGE_SIZE//M/}))
SIZE=$(($(du -m "${INPUT_FILE}" | awk '{print $1}')$(echo "${CHANGE_SIZE}" | sed 's/M//g; s/b//g')))
[[ -z "${SIZE}" || "${SIZE}" -lt 0 ]] && exit 1
[[ -z "${SIZE}" || "${SIZE}" -lt 0 ]] && { echo "Invalid size calculated"; exit 1; }
if [ ! "${INPUT_FILE}" = "${OUTPUT_FILE}" ]; then
if [[ "${INPUT_FILE}" != "${OUTPUT_FILE}" ]]; then
sudo cp -f "${INPUT_FILE}" "${OUTPUT_FILE}"
fi
sudo truncate -s ${SIZE}M "${OUTPUT_FILE}"
echo -e "d\n\nn\n\n\n\n\nn\nw" | sudo fdisk "${OUTPUT_FILE}"
sudo truncate -s "${SIZE}M" "${OUTPUT_FILE}"
# Use `parted` to resize partition 3
sudo parted "${OUTPUT_FILE}" --script -- resizepart 3 "${SIZE}M"
local LOOPX
LOOPX=$(sudo losetup -f)
sudo losetup -P ${LOOPX} "${OUTPUT_FILE}"
sudo e2fsck -fp $(ls ${LOOPX}* | sort -n | tail -1)
sudo resize2fs $(ls ${LOOPX}* | sort -n | tail -1)
sudo losetup -d ${LOOPX}
sudo losetup -P "${LOOPX}" "${OUTPUT_FILE}"
sudo e2fsck -fp "$(ls "${LOOPX}p3")"
sudo resize2fs "$(ls "${LOOPX}p3")"
sudo losetup -d "${LOOPX}"
}
# createvmx
@@ -499,4 +529,4 @@ function copyBuildroot() {
mkdir -p "${DEST_PATH}"
cp -f "../${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
cp -f "../${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
}
}