arc-c: sync with arc

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-03-22 17:54:57 +01:00
parent 87df0fb40d
commit db7cea48b4
3 changed files with 56 additions and 29 deletions

View File

@ -82,7 +82,7 @@ function backtitle() {
BACKTITLE+="Patch: ${ARCPATCH} | " BACKTITLE+="Patch: ${ARCPATCH} | "
BACKTITLE+="Config: ${CONFDONE} | " BACKTITLE+="Config: ${CONFDONE} | "
BACKTITLE+="Build: ${BUILDDONE} | " BACKTITLE+="Build: ${BUILDDONE} | "
BACKTITLE+="${MACHINE}(${BUS^^})" BACKTITLE+="${MACHINE}(${BUS})"
echo "${BACKTITLE}" echo "${BACKTITLE}"
} }
@ -98,10 +98,10 @@ function updateMenu() {
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \ dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \
--infobox "Error checking new Version!\nUse current Version." 0 0 --infobox "Error checking new Version!\nUse current Version." 0 0
sleep 5 sleep 5
arcMenu arcModel
fi fi
if [ "${ACTUALVERSION}" = "${TAG}" ]; then if [ "${ACTUALVERSION}" = "${TAG}" ]; then
arcMenu arcModel
fi fi
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \ dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \
--infobox "Downloading ${TAG}" 0 0 --infobox "Downloading ${TAG}" 0 0
@ -111,7 +111,7 @@ function updateMenu() {
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \ dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \
--infobox "Error downloading Updatefile!\nUse current Version." 0 0 --infobox "Error downloading Updatefile!\nUse current Version." 0 0
sleep 5 sleep 5
arcMenu arcModel
fi fi
unzip -oq "${TMP_PATH}/arc-a-${TAG}.img.zip" -d "${TMP_PATH}" unzip -oq "${TMP_PATH}/arc-a-${TAG}.img.zip" -d "${TMP_PATH}"
rm -f "${TMP_PATH}/arc-a-${TAG}.img.zip" rm -f "${TMP_PATH}/arc-a-${TAG}.img.zip"
@ -119,7 +119,7 @@ function updateMenu() {
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \ dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \
--infobox "Error extracting Updatefile!\nUse current Version." 0 0 --infobox "Error extracting Updatefile!\nUse current Version." 0 0
sleep 5 sleep 5
arcMenu arcModel
fi fi
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \ dialog --backtitle "$(backtitle)" --title "Upgrade Loader" --aspect 18 \
--infobox "Installing new Loader Image" 0 0 --infobox "Installing new Loader Image" 0 0
@ -134,7 +134,7 @@ function updateMenu() {
############################################################################### ###############################################################################
# Make Model Config # Make Model Config
function arcMenu() { function arcModel() {
# read model config for dt and aes # read model config for dt and aes
MODEL="SA6400" MODEL="SA6400"
DT="$(readModelKey "${MODEL}" "dt")" DT="$(readModelKey "${MODEL}" "dt")"
@ -157,12 +157,12 @@ function arcMenu() {
# Delete old files # Delete old files
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}"
fi fi
arcbuild arcVersion
} }
############################################################################### ###############################################################################
# Shows menu to user type one or generate randomly # Shows menu to user type one or generate randomly
function arcbuild() { function arcVersion() {
# read model values for arcbuild # read model values for arcbuild
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readModelKey "${MODEL}" "platform")" PLATFORM="$(readModelKey "${MODEL}" "platform")"
@ -173,23 +173,23 @@ function arcbuild() {
KVER="${PRODUCTVER}-${KVER}" KVER="${PRODUCTVER}-${KVER}"
fi fi
dialog --backtitle "$(backtitle)" --title "Arc Config" \ dialog --backtitle "$(backtitle)" --title "Arc Config" \
--infobox "Reconfiguring Synoinfo, Addons and Modules" 3 46 --infobox "Reconfiguring Synoinfo and Modules" 3 40
# Delete synoinfo and reload model/build synoinfo # Reset synoinfo
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}" writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
while IFS=': ' read -r KEY VALUE; do while IFS=': ' read -r KEY VALUE; do
writeConfigKey "synoinfo.\"${KEY}\"" "${VALUE}" "${USER_CONFIG_FILE}" writeConfigKey "synoinfo.\"${KEY}\"" "${VALUE}" "${USER_CONFIG_FILE}"
done < <(readModelMap "${MODEL}" "productvers.[${PRODUCTVER}].synoinfo") done < <(readModelMap "${MODEL}" "productvers.[${PRODUCTVER}].synoinfo")
# Rebuild modules # Reset modules
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do while read -r ID DESC; do
writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}" writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}"
done < <(getAllModules "${PLATFORM}" "${KVER}") done < <(getAllModules "${PLATFORM}" "${KVER}")
arcsettings arcSettings
} }
############################################################################### ###############################################################################
# Make Arc Settings # Make Arc Settings
function arcsettings() { function arcSettings() {
# Read Model Values # Read Model Values
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
DT="$(readModelKey "${MODEL}" "dt")" DT="$(readModelKey "${MODEL}" "dt")"
@ -211,19 +211,25 @@ function arcsettings() {
fi fi
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
# Get Network Config for Loader # Get Network Config for Loader
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
--infobox "Network Config..." 3 30
getnet getnet
# Get Portmap for Loader # Select Portmap for Loader (nonDT)
getmap getmap
getmapSelection if [[ "${DT}" = "false" && $(lspci -d ::106 | wc -l) -gt 0 ]]; then
dialog --backtitle "$(backtitle)" --colors --title "Storage Map" \
--infobox "Storage Map..." 3 30
getmapSelection
fi
# Config is done # Config is done
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}" writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")" CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
make premake
} }
############################################################################### ###############################################################################
# Building Loader Online # Building Loader Online
function make() { function premake() {
# Read Model Config # Read Model Config
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readModelKey "${MODEL}" "platform")" PLATFORM="$(readModelKey "${MODEL}" "platform")"
@ -263,6 +269,23 @@ function make() {
MODULESCOPY="false" MODULESCOPY="false"
writeConfigKey "arc.modulescopy" "${MODULESCOPY}" "${USER_CONFIG_FILE}" writeConfigKey "arc.modulescopy" "${MODULESCOPY}" "${USER_CONFIG_FILE}"
fi fi
# Build Loader
make
}
###############################################################################
# Building Loader Online
function make() {
# Read Model Config
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readModelKey "${MODEL}" "platform")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver")"
DT="$(readModelKey "${MODEL}" "dt")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
if [ "${PLATFORM}" = "epyc7002" ]; then
KVER="${PRODUCTVER}-${KVER}"
fi
# Cleanup # Cleanup
if [ -d "${UNTAR_PAT_PATH}" ]; then if [ -d "${UNTAR_PAT_PATH}" ]; then
rm -rf "${UNTAR_PAT_PATH}" rm -rf "${UNTAR_PAT_PATH}"
@ -403,7 +426,7 @@ function boot() {
[ "${BUILDDONE}" = "false" ] && dialog --backtitle "$(backtitle)" --title "Alert" \ [ "${BUILDDONE}" = "false" ] && dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0 --yesno "Config changed, you need to rebuild the Loader?" 0 0
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
make premake
fi fi
dialog --backtitle "$(backtitle)" --title "Arc Boot" \ dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Booting DSM...\nPlease stay patient!" 4 25 --infobox "Booting DSM...\nPlease stay patient!" 4 25

View File

@ -24,6 +24,17 @@ TITLE="BOOTING:"
TITLE+=" [${BUS^^}]" TITLE+=" [${BUS^^}]"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}" printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
echo
cat <<EOF
### ##### #### ####
# # # # # # # #
# # # # # #
####### ##### # ### #
# # # # # # # #
# # # # #### ####
EOF
echo
# Check if DSM zImage/Ramdisk is changed, patch it if necessary, update Files if necessary # Check if DSM zImage/Ramdisk is changed, patch it if necessary, update Files if necessary
ZIMAGE_HASH="$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")" ZIMAGE_HASH="$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")"
ZIMAGE_HASH_CUR="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')" ZIMAGE_HASH_CUR="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')"
@ -52,16 +63,6 @@ RAM=$(free -m | grep -i mem | awk '{print$2}')
VENDOR="$(dmidecode -s system-product-name)" VENDOR="$(dmidecode -s system-product-name)"
BOARD="$(dmidecode -s baseboard-product-name)" BOARD="$(dmidecode -s baseboard-product-name)"
cat <<EOF
### ##### #### ####
# # # # # # # #
# # # # # #
####### ##### # ### #
# # # # # # # #
# # # # #### ####
EOF
echo
echo -e " \033[1;37mDSM:\033[0m" echo -e " \033[1;37mDSM:\033[0m"
echo -e " Model: \033[1;37m${MODEL}\033[0m" echo -e " Model: \033[1;37m${MODEL}\033[0m"
echo -e " Version: \033[1;37m${PRODUCTVER}\033[0m" echo -e " Version: \033[1;37m${PRODUCTVER}\033[0m"

View File

@ -18,8 +18,11 @@ if [ "${KERNEL}" = "custom" ]; then
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readModelKey "${MODEL}" "platform")" PLATFORM="$(readModelKey "${MODEL}" "platform")"
KVER="$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver")" KVER="$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver")"
if [ "${PLATFORM}" = "epyc7002" ]; then
KVER="${PRODUCTVER}-${KVER}"
fi
# Extract bzImage # Extract bzImage
gzip -dc "${CUSTOM_PATH}/bzImage-${PLATFORM}-${PRODUCTVER}-${KVER}.gz" >"${MOD_ZIMAGE_FILE}" gzip -dc "${CUSTOM_PATH}/bzImage-${PLATFORM}-${KVER}.gz" >"${MOD_ZIMAGE_FILE}"
else else
echo -e "Patching zImage" echo -e "Patching zImage"
# Extract vmlinux # Extract vmlinux