fix something

This commit is contained in:
Ing 2024-05-03 15:19:12 +08:00
parent 96bb379689
commit 6e6585b0f9
10 changed files with 34 additions and 29 deletions

View File

@ -127,7 +127,7 @@ fi
if [ ! "${BUS}" = "usb" ]; then
SZ=$(blockdev --getsz ${LOADER_DISK} 2>/dev/null) # SZ=$(cat /sys/block/${LOADER_DISK/\/dev\//}/size)
SS=$(blockdev --getss ${LOADER_DISK} 2>/dev/null) # SS=$(cat /sys/block/${LOADER_DISK/\/dev\//}/queue/hw_sector_size)
SIZE=$((${SZ} * ${SS} / 1024 / 1024 + 10))
SIZE=$((${SZ:-0} * ${SS:-0} / 1024 / 1024 + 10))
# Read SATADoM type
DOM="$(readModelKey "${MODEL}" "dom")"
CMDLINE['synoboot_satadom']="${DOM}"
@ -271,7 +271,7 @@ else
# Executes DSM kernel via KEXEC
KEXECARGS=""
KVER=$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver")
if [ "${KVER:0:1}" = "3" -a ${EFI} -eq 1 ]; then
if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 4 ] && [ ${EFI} -eq 1 ]; then
echo -e "\033[1;33m$(TEXT "Warning, running kexec with --noefi param, strange things will happen!!")\033[0m"
KEXECARGS="--noefi"
fi

View File

@ -223,15 +223,15 @@ function _get_fastest() {
# @1 -mac1,mac2,mac3...
function _sort_netif() {
ETHLIST=""
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) # real network cards list
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
for ETH in ${ETHX}; do
MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
BUS=$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | awk '{print $2}')
BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n"
done
if [ -n "${1}" ]; then
MACS=$(echo "${1}" | sed 's/://g' | tr '[:upper:]' '[:lower:]' | tr ',' ' ')
MACS="$(echo "${1}" | sed 's/://g' | tr '[:upper:]' '[:lower:]' | tr ',' ' ')"
ETHLISTTMPC=""
ETHLISTTMPF=""
@ -260,7 +260,7 @@ EOF
while true; do
# cat ${TMP_PATH}/ethlist
[ ${IDX} -ge $(wc -l <${TMP_PATH}/ethlist) ] && break
ETH=$(cat ${TMP_PATH}/ethlist | sed -n "$((${IDX} + 1))p" | awk '{print $3}')
ETH="$(cat ${TMP_PATH}/ethlist | sed -n "$((${IDX} + 1))p" | cut -d' ' -f3)"
# echo "ETH: ${ETH}"
if [ -n "${ETH}" ] && [ ! "${ETH}" = "eth${IDX}" ]; then
# echo "change ${ETH} <=> eth${IDX}"

View File

@ -48,7 +48,6 @@ initConfigKey "patsum" "" "${USER_CONFIG_FILE}"
initConfigKey "sn" "" "${USER_CONFIG_FILE}"
initConfigKey "mac1" "" "${USER_CONFIG_FILE}"
initConfigKey "mac2" "" "${USER_CONFIG_FILE}"
# initConfigKey "maxdisks" "" "${USER_CONFIG_FILE}"
initConfigKey "layout" "qwerty" "${USER_CONFIG_FILE}"
initConfigKey "keymap" "" "${USER_CONFIG_FILE}"
initConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
@ -62,7 +61,7 @@ initConfigKey "addons.reboottoloader" "" "${USER_CONFIG_FILE}"
initConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
if [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
# _sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
for ETH in ${ETHX}; do
[ "${ETH::4}" = "wlan" ] && connectwlanif "${ETH}" && sleep 1

View File

@ -252,14 +252,14 @@ function productversMenu() {
fi
local KVER=$(readModelKey "${MODEL}" "productvers.[${resp}].kver")
if [ -d "/sys/firmware/efi" -a "${KVER:0:1}" = "3" ]; then
if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 4 ] && [ -d "/sys/firmware/efi" ]; then
if [ -z "${1}" ]; then
DIALOG --title "$(TEXT "Product Version")" \
--msgbox "$(TEXT "This version does not support UEFI startup, Please select another version or switch the startup mode.")" 0 0
fi
return 1
fi
# if [ ! "usb" = "$(getBus "${LOADER_DISK}")" -a "${KVER:0:1}" = "5" ]; then
# if [ ! "usb" = "$(getBus "${LOADER_DISK}")" ] && [ $(echo "${KVER:-4}" | cut -d'.' -f1) -gt 4 ]; then
# if [ -z "${1}" ]; then
# DIALOG --title "$(TEXT "Product Version")" \
# --msgbox "$(TEXT "This version only support usb startup, Please select another version or switch the startup mode.")" 0 0
@ -2614,7 +2614,7 @@ function advancedMenu() {
cp -Rf "$(dirname ${WORK_PATH})" "${RDXZ_PATH}/"
(
cd "${RDXZ_PATH}"
find . 2>/dev/null | cpio -o -H newc -R root:root | xz --check=crc32 >"${RR_RAMDISK_FILE}"
find . 2>/dev/null | cpio -o -H newc -R root:root | xz -9 --check=crc32 >"${RR_RAMDISK_FILE}"
) || true
rm -rf "${RDXZ_PATH}"
DIALOG --title "$(TEXT "Advanced")" \

View File

@ -33,7 +33,6 @@ serial:
middle: "UMR"
suffix: "alpha"
macpre: 9009d0
dom: -1
dt: true
beta: false
productvers:

View File

@ -1,17 +1,19 @@
--- a/linuxrc.syno.impl
+++ b/linuxrc.syno.impl
@@ -38,6 +38,8 @@
@@ -38,6 +38,9 @@
UnknownSynoPartitionMigrationFlag="/.unknown_syno_partition_migrate"
IncompatibleRootDevice="/.incompatible_root_device"
+
+/addons/addons.sh early
+
UmountRoot()
{
grep "^${RootDevice}" /proc/mounts && /bin/umount -f ${Mnt}
@@ -59,5 +61,6 @@
@@ -59,5 +61,7 @@
fi
+
+ /addons/addons.sh jrExit
UmountRoot
@ -21,9 +23,9 @@
# insert basic USB modules for detect f401/FDT
echo "Insert basic USB modules..."
SYNOLoadModules $USB_MODULES
+
+/addons/addons.sh modules
+
# insert Etron USB3.0 drivers
@@ -209,6 +214,8 @@

View File

@ -1,18 +1,20 @@
--- a/linuxrc.syno.impl
+++ b/linuxrc.syno.impl
@@ -51,6 +51,8 @@
@@ -51,6 +51,9 @@
UnknownSynoPartitionMigrationFlag="/.unknown_syno_partition_migrate"
IncompatibleRootDevice="/.incompatible_root_device"
+
+/addons/addons.sh early
+
UmountRoot()
{
grep "^${RootDevice}" /proc/mounts && /bin/umount -f ${Mnt}
@@ -67,6 +69,7 @@
@@ -67,6 +69,8 @@
# show date for login info
date
+
+ /addons/addons.sh jrExit
UmountRoot
@ -20,17 +22,18 @@
@@ -176,6 +179,8 @@
echo "Insert basic USB modules..."
SYNOLoadModules $USB_MODULES
+
+/addons/addons.sh modules
+
# insert Etron USB3.0 drivers
if [ $KERNEL_VCODE -ge "$(KernelVersionCode "3.10")" ]; then
@@ -224,6 +229,7 @@
@@ -224,6 +229,8 @@
fi
fi
+/addons/addons.sh patches
+
LoadBrmModules
####################################################

View File

@ -1,18 +1,20 @@
--- a/linuxrc.syno.impl
+++ b/linuxrc.syno.impl
@@ -51,6 +51,8 @@
@@ -51,6 +51,9 @@
UnknownSynoPartitionMigrationFlag="/.unknown_syno_partition_migrate"
IncompatibleRootDevice="/.incompatible_root_device"
+
+/addons/addons.sh early
+
UmountRoot()
{
grep "^${RootDevice}" /proc/mounts && /bin/umount -f ${Mnt}
@@ -67,6 +69,7 @@
@@ -67,6 +69,8 @@
# show date for login info
date
+
+ /addons/addons.sh jrExit
if [ "$1" -eq 0 ]; then
TryRestoringDeviceBackToSwapRaid
@ -20,17 +22,18 @@
@@ -176,6 +179,8 @@
echo "Insert basic USB modules..."
SYNOLoadModules $USB_MODULES
+
+/addons/addons.sh modules
+
# insert Etron USB3.0 drivers
if [ $KERNEL_VCODE -ge "$(KernelVersionCode "3.10")" ]; then
@@ -224,6 +229,7 @@
@@ -224,6 +229,8 @@
fi
fi
+/addons/addons.sh patches
+
LoadBrmModules
if [ "$KERNEL_VCODE" -ge "$(KernelVersionCode "5.10")" ]; then

View File

@ -43,8 +43,7 @@ size_le() {
VMLINUX_MOD=${1}
ZIMAGE_MOD=${2}
KVER_MAJOR=${KVER:0:1}
if [ ${KVER_MAJOR} -eq 4 ] || [ ${KVER_MAJOR} -eq 3 ]; then
if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then
# Kernel version 4.x or 3.x (bromolow)
#zImage_head 16494
#payload(

View File

@ -252,7 +252,7 @@ function repackInitrd() {
[ -f "${OUTPUT_PATH}" ] && rm -rf "${OUTPUT_PATH}"
(
cd "${RDXZ_PATH}"
sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | xz --check=crc32 >"${OUTPUT_PATH}"
sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | xz -9 --check=crc32 >"${OUTPUT_PATH}"
) || true
sudo rm -rf "${RDXZ_PATH}"
}