mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 19:19:52 +07:00
tree: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
d9ebdd95d8
commit
c77d646d26
8
.github/workflows/autobuild.yml
vendored
8
.github/workflows/autobuild.yml
vendored
@ -45,8 +45,12 @@ jobs:
|
||||
sudo timedatectl set-timezone "Europe/Berlin"
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
|
||||
sudo snap install yq
|
||||
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
|
||||
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
|
||||
# sudo snap install yq
|
||||
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
|
||||
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
|
||||
fi
|
||||
|
||||
df -h
|
||||
|
||||
|
@ -1742,14 +1742,12 @@ function bootipwaittime() {
|
||||
# let user format disks from inside arc
|
||||
function formatDisks() {
|
||||
rm -f "${TMP_PATH}/opts"
|
||||
while read -r KNAME SIZE TYPE PKNAME; do
|
||||
[ -z "${KNAME}" ] && continue
|
||||
[ "${KNAME}" = "N/A" ] && continue
|
||||
[[ "${KNAME}" = /dev/md* ]] && continue
|
||||
[[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue
|
||||
[ -z "${SIZE}" ] && SIZE="Unknown"
|
||||
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts"
|
||||
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
|
||||
while read -r KNAME SIZE TYPE MODEL; do
|
||||
[ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue
|
||||
[ "${KNAME:0:7}" = "/dev/md" ] && continue
|
||||
[ "${KNAME:0:8}" = "${LOADER_DISK}" ] && continue
|
||||
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${MODEL}" "${TYPE}" >>"${TMP_PATH}/opts"
|
||||
done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model)"' 2>/dev/null)
|
||||
if [ ! -f "${TMP_PATH}/opts" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Format Disks" \
|
||||
--msgbox "No disk found!" 0 0
|
||||
@ -1786,18 +1784,16 @@ function formatDisks() {
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Clone Loader Disk
|
||||
# Clone bootloader disk
|
||||
function cloneLoader() {
|
||||
rm -f "${TMP_PATH}/opts" >/dev/null
|
||||
while read -r KNAME SIZE TYPE PKNAME; do
|
||||
[ -z "${KNAME}" ] && continue
|
||||
[ "${KNAME}" = "N/A" ] && continue
|
||||
[ "${TYPE}" != "disk" ] && continue
|
||||
[[ "${KNAME}" = /dev/md* ]] && continue
|
||||
[[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue
|
||||
[ -z "${SIZE}" ] && SIZE="Unknown"
|
||||
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts"
|
||||
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
|
||||
rm -f "${TMP_PATH}/opts"
|
||||
while read -r KNAME SIZE TYPE MODEL; do
|
||||
[ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue
|
||||
[ "${KNAME:0:7}" = "/dev/md" ] && continue
|
||||
[ "${KNAME:0:8}" = "${LOADER_DISK}" ] && continue
|
||||
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${MODEL}" "${TYPE}" >>"${TMP_PATH}/opts"
|
||||
done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model)"' 2>/dev/null)
|
||||
|
||||
if [ ! -f "${TMP_PATH}/opts" ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \
|
||||
--msgbox "No disk found!" 0 0
|
||||
@ -1829,9 +1825,73 @@ function cloneLoader() {
|
||||
rm -rf "${PART3_PATH}/dl" >/dev/null
|
||||
CLEARCACHE=0
|
||||
|
||||
gzip -dc "${ARC_PATH}/grub.img.gz" | dd of="${resp}" bs=1M conv=fsync status=progress
|
||||
hdparm -z "${resp}" # reset disk cache
|
||||
fdisk -l "${resp}"
|
||||
gzip -dc "${ARC_PATH}/grub.img.gz" | dd of="${RESP}" bs=1M conv=fsync status=progress
|
||||
hdparm -z "${RESP}" # reset disk cache
|
||||
fdisk -l "${RESP}"
|
||||
sleep 1
|
||||
|
||||
NEW_BLDISK_P1="$(lsblk "${RESP}" -pno KNAME,LABEL 2>/dev/null | grep 'ARC1' | awk '{print $1}')"
|
||||
NEW_BLDISK_P2="$(lsblk "${RESP}" -pno KNAME,LABEL 2>/dev/null | grep 'ARC2' | awk '{print $1}')"
|
||||
NEW_BLDISK_P3="$(lsblk "${RESP}" -pno KNAME,LABEL 2>/dev/null | grep 'ARC3' | awk '{print $1}')"
|
||||
SIZEOFDISK=$(cat /sys/block/${RESP/\/dev\//}/size)
|
||||
ENDSECTOR=$(($(fdisk -l ${RESP} | grep "${NEW_BLDISK_P3}" | awk '{print $3}') + 1))
|
||||
|
||||
if [ ${SIZEOFDISK}0 -ne ${ENDSECTOR}0 ]; then
|
||||
echo -e "\033[1;36mResizing ${NEW_BLDISK_P3}\033[0m"
|
||||
echo -e "d\n\nn\n\n\n\n\nn\nw" | fdisk "${RESP}" >/dev/null 2>&1
|
||||
resize2fs "${NEW_BLDISK_P3}"
|
||||
fdisk -l "${RESP}"
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
mkdir -p "${TMP_PATH}/sdX1" "${TMP_PATH}/sdX2" "${TMP_PATH}/sdX3"
|
||||
mount "${NEW_BLDISK_P1}" "${TMP_PATH}/sdX1" || {
|
||||
printf "Can't mount %s." "${NEW_BLDISK_P1}" >"${LOG_FILE}"
|
||||
__umountNewBlDisk
|
||||
break
|
||||
}
|
||||
mount "${NEW_BLDISK_P2}" "${TMP_PATH}/sdX2" || {
|
||||
printf "Can't mount %s." "${NEW_BLDISK_P2}" >"${LOG_FILE}"
|
||||
__umountNewBlDisk
|
||||
break
|
||||
}
|
||||
mount "${NEW_BLDISK_P3}" "${TMP_PATH}/sdX3" || {
|
||||
printf "Can't mount %s." "${NEW_BLDISK_P3}" >"${LOG_FILE}"
|
||||
__umountNewBlDisk
|
||||
break
|
||||
}
|
||||
|
||||
SIZEOLD1="$(du -sm "${PART1_PATH}" 2>/dev/null | awk '{print $1}')"
|
||||
SIZEOLD2="$(du -sm "${PART2_PATH}" 2>/dev/null | awk '{print $1}')"
|
||||
SIZEOLD3="$(du -sm "${PART3_PATH}" 2>/dev/null | awk '{print $1}')"
|
||||
SIZENEW1="$(df -m "${NEW_BLDISK_P1}" 2>/dev/null | awk 'NR==2 {print $4}')"
|
||||
SIZENEW2="$(df -m "${NEW_BLDISK_P2}" 2>/dev/null | awk 'NR==2 {print $4}')"
|
||||
SIZENEW3="$(df -m "${NEW_BLDISK_P3}" 2>/dev/null | awk 'NR==2 {print $4}')"
|
||||
|
||||
if [ ${SIZEOLD1:-0} -ge ${SIZENEW1:-0} ] || [ ${SIZEOLD2:-0} -ge ${SIZENEW2:-0} ] || [ ${SIZEOLD3:-0} -ge ${SIZENEW3:-0} ]; then
|
||||
MSG="Cloning failed due to insufficient remaining disk space on the selected hard drive."
|
||||
echo "${MSG}" >"${LOG_FILE}"
|
||||
__umountNewBlDisk
|
||||
break
|
||||
fi
|
||||
|
||||
cp -vRf "${PART1_PATH}/". "${TMP_PATH}/sdX1/" || {
|
||||
printf "Can't copy to %s." "${NEW_BLDISK_P1}" >"${LOG_FILE}"
|
||||
__umountNewBlDisk
|
||||
break
|
||||
}
|
||||
cp -vRf "${PART2_PATH}/". "${TMP_PATH}/sdX2/" || {
|
||||
printf "Can't copy to %s." "${NEW_BLDISK_P2}" >"${LOG_FILE}"
|
||||
__umountNewBlDisk
|
||||
break
|
||||
}
|
||||
cp -vRf "${PART3_PATH}/". "${TMP_PATH}/sdX3/" || {
|
||||
printf "Can't copy to %s." "${NEW_BLDISK_P3}" >"${LOG_FILE}"
|
||||
__umountNewBlDisk
|
||||
break
|
||||
}
|
||||
sync
|
||||
__umountNewBlDisk
|
||||
sleep 3
|
||||
|
||||
mkdir -p "${TMP_PATH}/sdX1"
|
||||
@ -1869,7 +1929,8 @@ function resetLoader() {
|
||||
fi
|
||||
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}" >/dev/null
|
||||
[ -f "${USER_CONFIG_FILE}" ] && rm -f "${USER_CONFIG_FILE}" >/dev/null
|
||||
dialog --backtitle "$(backtitle)" --title "Reset Loader" --aspect 18 \
|
||||
[ -f "${ARC_RAMDISK_USER_FILE}" ] && rm -f "${ARC_RAMDISK_USER_FILE}" >/dev/null
|
||||
dialog --backtitle "$(backtitle)" --title "Reset Loader" --aspect 18 \
|
||||
--yesno "Reset successful.\nReboot required!" 0 0
|
||||
[ $? -ne 0 ] && return
|
||||
rebootTo config
|
||||
|
@ -4,14 +4,14 @@
|
||||
# Overlay Init Section
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
. ${ARC_PATH}/include/addons.sh
|
||||
. ${ARC_PATH}/include/modules.sh
|
||||
. ${ARC_PATH}/include/update.sh
|
||||
. ${ARC_PATH}/include/storage.sh
|
||||
. ${ARC_PATH}/include/network.sh
|
||||
. ${ARC_PATH}/include/compat.sh
|
||||
. ${ARC_PATH}/arc-functions.sh
|
||||
. "${ARC_PATH}/include/functions.sh"
|
||||
. "${ARC_PATH}/include/addons.sh"
|
||||
. "${ARC_PATH}/include/modules.sh"
|
||||
. "${ARC_PATH}/include/update.sh"
|
||||
. "${ARC_PATH}/include/storage.sh"
|
||||
. "${ARC_PATH}/include/network.sh"
|
||||
. "${ARC_PATH}/include/compat.sh"
|
||||
. "${ARC_PATH}/arc-functions.sh"
|
||||
|
||||
# Get Keymap and Timezone Config
|
||||
onlineCheck
|
||||
@ -874,6 +874,14 @@ else
|
||||
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "sequentialio"; then
|
||||
echo "Q \"SequentialIO Options \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
echo "K \"Kernel: \Z4${KERNEL}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${DT}" = "true" ]; then
|
||||
echo "H \"Hotplug/SortDrives: \Z4${HDDSORT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
else
|
||||
echo "h \"USB Mount: \Z4${USBMOUNT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
fi
|
||||
if [ "${BOOTOPTS}" = "true" ]; then
|
||||
echo "6 \"\Z1Hide Boot Options\Zn \" " >>"${TMP_PATH}/menu"
|
||||
@ -898,23 +906,14 @@ else
|
||||
echo "= \"\Z4===== DSM =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "j \"Cmdline \" " >>"${TMP_PATH}/menu"
|
||||
echo "k \"Synoinfo \" " >>"${TMP_PATH}/menu"
|
||||
echo "l \"Edit User Config \" " >>"${TMP_PATH}/menu"
|
||||
echo "s \"Allow Downgrade \" " >>"${TMP_PATH}/menu"
|
||||
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
|
||||
echo "N \"Add new User\" " >>"${TMP_PATH}/menu"
|
||||
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
|
||||
echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu"
|
||||
echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu"
|
||||
echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu"
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
echo "K \"Kernel: \Z4${KERNEL}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${DT}" = "true" ]; then
|
||||
echo "H \"Hotplug/SortDrives: \Z4${HDDSORT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
else
|
||||
echo "h \"USB Mount: \Z4${USBMOUNT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu"
|
||||
echo "l \"Edit User Config \" " >>"${TMP_PATH}/menu"
|
||||
echo "s \"Allow Downgrade Version \" " >>"${TMP_PATH}/menu"
|
||||
echo "O \"Official Driver Priority: \Z4${ODP}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "B \"Grep DSM Config from Backup \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
fi
|
||||
if [ "${LOADEROPTS}" = "true" ]; then
|
||||
@ -923,24 +922,25 @@ else
|
||||
echo "8 \"\Z1Show Loader Options\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${LOADEROPTS}" = "true" ]; then
|
||||
echo "= \"\Z4===== Loader =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z1== Edit with caution! ==\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "D \"StaticIP for Loader/DSM \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4===== Loader =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "c \"Offline Mode: \Z4${ARCOFFLINE}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "D \"StaticIP for Loader/DSM \" " >>"${TMP_PATH}/menu"
|
||||
echo "f \"Bootscreen Options \" " >>"${TMP_PATH}/menu"
|
||||
echo "W \"RD Compression: \Z4${RD_COMPRESSED}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "X \"Sata DOM: \Z4${SATADOM}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "u \"LKM Version: \Z4${LKM}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "L \"Grep Logs from dbgutils \" " >>"${TMP_PATH}/menu"
|
||||
echo "U \"Change Loader Password \" " >>"${TMP_PATH}/menu"
|
||||
echo "Z \"Change Loader Ports \" " >>"${TMP_PATH}/menu"
|
||||
echo "w \"Reset Loader to Defaults \" " >>"${TMP_PATH}/menu"
|
||||
echo "L \"Grep Logs from dbgutils \" " >>"${TMP_PATH}/menu"
|
||||
echo "B \"Grep DSM Config from Backup \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z1== Edit with caution! ==\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "W \"RD Compression: \Z4${RD_COMPRESSED}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "X \"Sata DOM: \Z4${SATADOM}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "u \"LKM Version: \Z4${LKM}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "C \"Clone Loader to another Disk \" " >>"${TMP_PATH}/menu"
|
||||
echo "n \"Grub Bootloader Config \" " >>"${TMP_PATH}/menu"
|
||||
echo "y \"Choose a Keymap for Loader \" " >>"${TMP_PATH}/menu"
|
||||
echo "F \"\Z1Formate Disks \Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
echo "= \"\Z4===== Misc =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4===== Misc =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "x \"Backup/Restore/Recovery \" " >>"${TMP_PATH}/menu"
|
||||
[ "${ARCOFFLINE}" != "true" ] && echo "z \"Update Menu \" " >>"${TMP_PATH}/menu"
|
||||
echo "I \"Power/Service Menu \" " >>"${TMP_PATH}/menu"
|
||||
@ -1021,8 +1021,7 @@ else
|
||||
J) resetDSMNetwork; NEXT="J" ;;
|
||||
M) mountDSM; NEXT="M" ;;
|
||||
T) disablescheduledTasks; NEXT="T" ;;
|
||||
Z) loaderPorts; NEXT="Z" ;;
|
||||
K) [ "${KERNEL}" = "official" ] && KERNEL='custom' || KERNEL='official'
|
||||
K) KERNEL=$([ "${KERNEL}" = "official" ] && echo 'custom' || echo 'official')
|
||||
writeConfigKey "kernel" "${KERNEL}" "${USER_CONFIG_FILE}"
|
||||
dialog --backtitle "$(backtitle)" --title "Kernel" \
|
||||
--infobox "Switching Kernel to ${KERNEL}! Stay patient..." 4 50
|
||||
@ -1074,14 +1073,16 @@ else
|
||||
LOADEROPTS="${LOADEROPTS}"
|
||||
NEXT="8"
|
||||
;;
|
||||
D) staticIPMenu; NEXT="D" ;;
|
||||
c) [ "${ARCOFFLINE}" = "true" ] && ARCOFFLINE='false' || ARCOFFLINE='true'
|
||||
c) ARCOFFLINE=$([ "${ARCOFFLINE}" = "true" ] && echo 'false' || echo 'true')
|
||||
writeConfigKey "arc.offline" "${ARCOFFLINE}" "${USER_CONFIG_FILE}"
|
||||
[ "${ARCOFFLINE}" = "false" ] && exec arc.sh
|
||||
NEXT="c"
|
||||
;;
|
||||
D) staticIPMenu; NEXT="D" ;;
|
||||
f) bootScreen; NEXT="f" ;;
|
||||
W) [ "${RD_COMPRESSED}" = "true" ] && RD_COMPRESSED='false' || RD_COMPRESSED='true'
|
||||
Z) loaderPorts; NEXT="Z" ;;
|
||||
U) loaderPassword; NEXT="U" ;;
|
||||
W) RD_COMPRESSED=$([ "${RD_COMPRESSED}" = "true" ] && echo 'false' || echo 'true')
|
||||
writeConfigKey "rd-compressed" "${RD_COMPRESSED}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
@ -1095,7 +1096,6 @@ else
|
||||
NEXT="u"
|
||||
;;
|
||||
L) greplogs; NEXT="L" ;;
|
||||
U) loaderPassword; NEXT="U" ;;
|
||||
w) resetLoader; NEXT="w" ;;
|
||||
C) cloneLoader; NEXT="C" ;;
|
||||
n) editGrubCfg; NEXT="n" ;;
|
||||
|
@ -3,7 +3,7 @@
|
||||
set -e
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
. "${ARC_PATH}/include/functions.sh"
|
||||
|
||||
# Clear logs for dbgutils addons
|
||||
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
|
||||
|
@ -10,38 +10,34 @@
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
check_vmlinux()
|
||||
{
|
||||
# Use readelf to check if it's a valid ELF
|
||||
# TODO: find a better to way to check that it's really vmlinux
|
||||
# and not just an elf
|
||||
readelf -h $1 > /dev/null 2>&1 || return 1
|
||||
check_vmlinux() {
|
||||
# Use readelf to check if it's a valid ELF
|
||||
# TODO: find a better to way to check that it's really vmlinux
|
||||
# and not just an elf
|
||||
readelf -h $1 >/dev/null 2>&1 || return 1
|
||||
|
||||
cat $1
|
||||
exit 0
|
||||
cat $1
|
||||
exit 0
|
||||
}
|
||||
|
||||
try_decompress()
|
||||
{
|
||||
# The obscure use of the "tr" filter is to work around older versions of
|
||||
# "grep" that report the byte offset of the line instead of the pattern.
|
||||
try_decompress() {
|
||||
# The obscure use of the "tr" filter is to work around older versions of
|
||||
# "grep" that report the byte offset of the line instead of the pattern.
|
||||
|
||||
# Try to find the header ($1) and decompress from here
|
||||
for pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
|
||||
do
|
||||
pos=${pos%%:*}
|
||||
tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
|
||||
check_vmlinux $tmp
|
||||
done
|
||||
# Try to find the header ($1) and decompress from here
|
||||
for pos in $(tr "$1\n$2" "\n$2=" <"$img" | grep -abo "^$2"); do
|
||||
pos=${pos%%:*}
|
||||
tail -c+$pos "$img" | $3 >$tmp 2>/dev/null
|
||||
check_vmlinux $tmp
|
||||
done
|
||||
}
|
||||
|
||||
# Check invocation:
|
||||
me=${0##*/}
|
||||
img=$1
|
||||
if [ $# -ne 1 -o ! -s "$img" ]
|
||||
then
|
||||
echo "Usage: $me <kernel-image>" >&2
|
||||
exit 2
|
||||
if [ $# -ne 1 ] || [ ! -s "$img" ]; then
|
||||
echo "Usage: $me <kernel-image>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Prepare temp files:
|
||||
@ -61,4 +57,4 @@ try_decompress '(\265/\375' xxx unzstd
|
||||
check_vmlinux $img
|
||||
|
||||
# Bail out:
|
||||
echo "$me: Cannot find vmlinux." >&2
|
||||
echo "$me: Cannot find vmlinux." >&2
|
@ -1,8 +1,8 @@
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/consts.sh
|
||||
. ${ARC_PATH}/include/configFile.sh
|
||||
. ${ARC_PATH}/include/addons.sh
|
||||
. "${ARC_PATH}/include/consts.sh"
|
||||
. "${ARC_PATH}/include/configFile.sh"
|
||||
. "${ARC_PATH}/include/addons.sh"
|
||||
|
||||
###############################################################################
|
||||
# Check loader disk
|
||||
@ -581,4 +581,12 @@ function check_port() {
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Unmount new boot loader disk
|
||||
function __umountNewBlDisk() {
|
||||
umount "${TMP_PATH}/sdX1" 2>/dev/null
|
||||
umount "${TMP_PATH}/sdX2" 2>/dev/null
|
||||
umount "${TMP_PATH}/sdX3" 2>/dev/null
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
set -e
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
. "${ARC_PATH}/include/functions.sh"
|
||||
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
. ${ARC_PATH}/include/addons.sh
|
||||
. ${ARC_PATH}/include/modules.sh
|
||||
. "${ARC_PATH}/include/functions.sh"
|
||||
. "${ARC_PATH}/include/addons.sh"
|
||||
. "${ARC_PATH}/include/modules.sh"
|
||||
|
||||
set -o pipefail # Get exit code from process piped
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
. "${ARC_PATH}/include/functions.sh"
|
||||
|
||||
set -o pipefail # Get exit code from process piped
|
||||
|
||||
@ -23,11 +23,11 @@ if [ "${KERNEL}" = "custom" ]; then
|
||||
gzip -dc "${CUSTOM_PATH}/bzImage-${PLATFORM}-${KVERP}.gz" >"${MOD_ZIMAGE_FILE}"
|
||||
else
|
||||
# Extract vmlinux
|
||||
${ARC_PATH}/bzImage-to-vmlinux.sh "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
"${ARC_PATH}/bzImage-to-vmlinux.sh" "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
# Patch boot params and ramdisk check
|
||||
${ARC_PATH}/kpatch "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
"${ARC_PATH}/kpatch" "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
# rebuild zImage
|
||||
${ARC_PATH}/vmlinux-to-bzImage.sh "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
"${ARC_PATH}/vmlinux-to-bzImage.sh" "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
fi
|
||||
|
||||
sync
|
@ -12,7 +12,6 @@ insmod fat
|
||||
insmod ext2
|
||||
insmod ata
|
||||
insmod btrfs
|
||||
insmod ntfs
|
||||
insmod part_msdos
|
||||
insmod part_gpt
|
||||
|
||||
@ -78,7 +77,7 @@ set menu_color_normal=white/black
|
||||
set menu_color_highlight=white/red
|
||||
set color_normal=white/black
|
||||
|
||||
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable"
|
||||
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait nointremap net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable"
|
||||
|
||||
search --set=root --label "ARC3"
|
||||
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user