Skip to content

Commit

Permalink
fix something
Browse files Browse the repository at this point in the history
  • Loading branch information
wjz304 committed Jul 5, 2024
1 parent 0f03990 commit 95f74c6
Show file tree
Hide file tree
Showing 27 changed files with 2,766 additions and 2,676 deletions.
9 changes: 0 additions & 9 deletions fbsize/Makefile

This file was deleted.

Binary file removed fbsize/fbsize
Binary file not shown.
99 changes: 0 additions & 99 deletions fbsize/main.c

This file was deleted.

38 changes: 20 additions & 18 deletions files/initrd/opt/rr/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,20 @@ else
CMDLINE["syno_hdd_detect"]="0"
CMDLINE["syno_hdd_powerup_seq"]="0"
fi
CMDLINE['panic']="${KERNELPANIC:-0}"
CMDLINE['console']="ttyS0,115200n8"
# CMDLINE['no_console_suspend']="1"
CMDLINE['consoleblank']="600"
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['no_console_suspend']="1"
CMDLINE['root']="/dev/md0"
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
CMDLINE['rootwait']=""
CMDLINE['loglevel']="15"
CMDLINE['log_buf_len']="32M"
CMDLINE["HddHotplug"]="1"
CMDLINE["vender_format_version"]="2"
CMDLINE['panic']="${KERNELPANIC:-0}"

# if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ ! "${BUS}" = "mmc" ] && [ ! "${EMMCBOOT}" = "true" ]; then
# [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+=","
Expand All @@ -173,16 +175,6 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
CMDLINE["SASmodel"]="1"
fi

if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
if grep -q "^flags.*x2apic.*" /proc/cpuinfo; then
eval $(grep -o "RR_CMDLINE=.*$" "${USER_GRUB_CONFIG}")
[ -z "${RR_CMDLINE}" ] && RR_CMDLINE="bzImage-rr"
echo "${RR_CMDLINE}" | grep -q 'nox2apic' || sed -i "s|${RR_CMDLINE}|${RR_CMDLINE} nox2apic|" "${USER_GRUB_CONFIG}"
fi
else
grep -q ' nox2apic' "${USER_GRUB_CONFIG}" && sed -i "s| nox2apic||" "${USER_GRUB_CONFIG}"
fi

while IFS=': ' read KEY VALUE; do
[ -n "${KEY}" ] && CMDLINE["network.${KEY}"]="${VALUE}"
done <<<$(readConfigMap "network" "${USER_CONFIG_FILE}")
Expand All @@ -201,15 +193,25 @@ done
CMDLINE_LINE=$(echo "${CMDLINE_LINE}" | sed 's/^ //') # Remove leading space
echo -e "$(TEXT "Cmdline:\n")\033[1;36m${CMDLINE_LINE}\033[0m"

# Save command line to grubenv
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
if grep -q "^flags.*x2apic.*" /proc/cpuinfo; then
checkCmdline "rr_cmdline" "nox2apic" || addCmdline "rr_cmdline" "nox2apic"
fi
else
checkCmdline "rr_cmdline" "nox2apic" && delCmdline "rr_cmdline" "nox2apic"
fi
DIRECT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
if [ "${DIRECT}" = "true" ]; then
CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars
grub-editenv ${USER_GRUBENVFILE} set dsm_cmdline="${CMDLINE_DIRECT}"
echo -e "\033[1;33m$(TEXT "Reboot to boot directly in DSM")\033[0m"
grub-editenv ${USER_GRUBENVFILE} set next_entry="direct"
echo -e "\033[1;33m$(TEXT "Reboot to boot directly in DSM")\033[0m"
reboot
exit 0
else
grub-editenv ${USER_GRUBENVFILE} unset dsm_cmdline
grub-editenv ${USER_GRUBENVFILE} unset next_entry
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep -v lo) || true
echo "$(printf "$(TEXT "Detected %s network cards.")" "$(echo ${ETHX} | wc -w)")"
echo -en "$(TEXT "Checking Connect.")"
Expand Down
Binary file removed files/initrd/opt/rr/fbsize
Binary file not shown.
43 changes: 42 additions & 1 deletion files/initrd/opt/rr/include/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function _sort_netif() {
function getBus() {
BUS=""
# xvd
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | grep -q "xen" && echo "xen")
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | grep -q "xen" && echo "xen")
# usb/ata(sata/ide)/scsi
[ -z "${BUS}" ] && BUS=$(udevadm info --query property --name "${1}" 2>/dev/null | grep ID_BUS | cut -d= -f2 | sed 's/ata/sata/')
# usb/sata(sata/ide)/nvme
Expand Down Expand Up @@ -304,6 +304,47 @@ function getLogo() {
return 0
}

###############################################################################
# check Cmdline
# 1 - key name
# 2 - key string
function checkCmdline() {
return $(grub-editenv ${USER_GRUBENVFILE} list 2>/dev/null | grep "^${1}=" | cut -d'=' -f2- | grep -q "${2}")
}

###############################################################################
# get logo of model
# 1 - key name
# 2 - key string
function setCmdline() {
[ -z "${1}" ] && return 1
if [ -n "${2}" ]; then
grub-editenv ${USER_GRUBENVFILE} set "${1}=${2}"
else
grub-editenv ${USER_GRUBENVFILE} unset "${1}"
fi
}

###############################################################################
# get logo of model
# check Cmdline
# 1 - key name
# 2 - key string
function addCmdline() {
local CMDLINE="$(grub-editenv ${USER_GRUBENVFILE} list 2>/dev/null | grep "^${1}=" | cut -d'=' -f2-)"
[ -n "${CMDLINE}" ] && CMDLINE="${CMDLINE} ${2}" || CMDLINE="${2}"
setCmdline "${1}" "${CMDLINE}"
}

###############################################################################
# get logo of model
# 1 - model
function delCmdline() {
local CMDLINE="$(grub-editenv ${USER_GRUBENVFILE} list 2>/dev/null | grep "^${1}=" | cut -d'=' -f2-)"
CMDLINE="$(echo "${CMDLINE}" | sed "s/ *${2}//; s/^[[:space:]]*//;s/[[:space:]]*$//")"
setCmdline "${1}" "${CMDLINE}"
}

###############################################################################
# Rebooting
# 1 - mode
Expand Down
Loading

0 comments on commit 95f74c6

Please sign in to comment.