Compare commits

...

18 Commits

Author SHA1 Message Date
Fabio Belavenuto
415ee7e75d Merge pull request #53 from fbelavenuto/dev
Various commits
2022-07-22 16:58:46 -03:00
Fabio Belavenuto
2fe9b3237e Modules compiled with DSM toolchain 2022-07-22 16:58:08 -03:00
Fabio Belavenuto
81c0e00b76 Little fixes 2022-07-22 15:59:00 -03:00
Fabio Belavenuto
1b766e4974 Docker: using DSM toolchain 2022-07-22 15:50:43 -03:00
Fabio Belavenuto
690af5115d Re-added Addon external download 2022-07-22 08:11:37 -03:00
Fabio Belavenuto
a6ec7c0c46 Merge pull request #50 from fbelavenuto/dev
Adding module firmwares
2022-07-21 17:24:21 -03:00
Fabio Belavenuto
37fe50a1c5 Adding module firmwares 2022-07-21 17:22:38 -03:00
Fabio Belavenuto
ce5f427837 Merge pull request #49 from fbelavenuto/dev
Synoinfo entries unified
2022-07-21 16:50:16 -03:00
Fabio Belavenuto
5dc0b6e705 Synoinfo entries unified:
Synoinfo entries from model config file are copyed to user config file when the user choose a build.
2022-07-21 16:49:04 -03:00
Fabio Belavenuto
ea67f64d31 Merge pull request #48 from fbelavenuto/dev
Fixing custom MAC address
2022-07-21 14:26:12 -03:00
Fabio Belavenuto
722c03a506 Fixing custom MAC address 2022-07-21 14:21:25 -03:00
Fabio Belavenuto
678c7b6591 Merge pull request #47 from fbelavenuto/dev
Update modules set DIRTY flag
2022-07-21 11:22:12 -03:00
Fabio Belavenuto
8f7318f90f Cosmetics
Update module sets DIRTY flag
2022-07-21 11:21:24 -03:00
Fabio Belavenuto
7b2a7b210a Added DS2422+ 42661 build 2022-07-19 14:22:40 -03:00
Fabio Belavenuto
14362aae17 Added option to boot into junior mode 2022-07-19 13:54:51 -03:00
Fabio Belavenuto
0e16f96fad Added option to boot into junior mode 2022-07-19 13:53:03 -03:00
Fabio Belavenuto
159b7172b0 Merge pull request #43 from fbelavenuto/dev
Removing no more necessary php
2022-07-19 12:44:47 -03:00
Fabio Belavenuto
75c637a6e4 Removing no more necessary php 2022-07-19 12:44:03 -03:00
30 changed files with 244 additions and 107 deletions

View File

@@ -6,11 +6,15 @@ It is still in alpha stage, with little documentation, but it is functional. I'm
I tried to make the system as user-friendly as possible, to make life easier. The loader automatically detects which device is being used, SATADom or USB, detecting its VID and PID correctly. redpill-lkm has been edited to allow booting the kernel without setting the variables related to network interfaces so the loader (and user) doesn't have to worry about that. The Jun's code that makes the zImage and Ramdisk patch is embedded, if there is a change in "zImage" or "rd.gz" by some update, the loader re-applies the patches. Builds 42218 and 42661 up to update5 are working. Automatic updates should still be disabled as we are not sure if this technique will work forever. The most important kernel modules are built into the DSM ramdisk image for automatic peripheral detection. I tried to make the system as user-friendly as possible, to make life easier. The loader automatically detects which device is being used, SATADom or USB, detecting its VID and PID correctly. redpill-lkm has been edited to allow booting the kernel without setting the variables related to network interfaces so the loader (and user) doesn't have to worry about that. The Jun's code that makes the zImage and Ramdisk patch is embedded, if there is a change in "zImage" or "rd.gz" by some update, the loader re-applies the patches. Builds 42218 and 42661 up to update5 are working. Automatic updates should still be disabled as we are not sure if this technique will work forever. The most important kernel modules are built into the DSM ramdisk image for automatic peripheral detection.
# Use
To use this project, download the latest image available and burn it to a USB stick or SATA disk-on-module. Set the PC to boot from the burned media and follow the informations on the screen. When booting, the user can call the "menu.sh" command from the computer itself, access via SSH or use the virtual terminal (ttyd) by typing the address provided on the screen (http://(ip):7681). The loader will automatically increase the size of the last partition and use this space as cache if it is larger than 2GiB. To use this project, download the latest image available and burn it to a USB stick or SATA disk-on-module. Set the PC to boot from the burned media and follow the informations on the screen. When booting, the user can call the "menu.sh" command from the computer itself, access via SSH or use the virtual terminal (ttyd) by typing the address provided on the screen (http://(ip):7681). The loader will automatically increase the size of the last partition and use this space as cache if it is larger than 2GiB.
### It is highly recommended to use an SSD for the loader in the case of the option via DoM or a fast USB flash drive
The menu system is dynamic and I hope it is intuitive enough that the user can use it without any problems. Its allows you to choose a model, the existing buildnumber for the chosen model, type or randomly create a serial number, add/remove addons, add/remove/view "cmdline" and "synoinfo" entries, choose the LKM version, create the loader, boot, manually edit the configuration file, choose a keymap, update and exit. The menu system is dynamic and I hope it is intuitive enough that the user can use it without any problems. Its allows you to choose a model, the existing buildnumber for the chosen model, type or randomly create a serial number, add/remove addons, add/remove/view "cmdline" and "synoinfo" entries, choose the LKM version, create the loader, boot, manually edit the configuration file, choose a keymap, update and exit.
Changing addons and synoinfo entries require re-creating the loader, cmdline entries do not. You can view the "cmdline" and "synoinfo" entries defined for the chosen model, with user-defined entries having higher priority. Changing addons and synoinfo entries require re-creating the loader, cmdline entries do not.
There is no need to configure the VID/PID (if using a USB stick) or define the MAC Addresses of the network interfaces. If the user wants to modify the MAC Address of any interface, he must manually add "cmdline" entries in the corresponding menu (set "netif_num" according to "mac1..4" entries). There is no need to configure the VID/PID (if using a USB stick) or define the MAC Addresses of the network interfaces. If the user wants to modify the MAC Address of any interface, he must manually add "cmdline" entries in the corresponding menu (set "netif_num" according to "mac1..4" entries).
@@ -20,7 +24,8 @@ Another important point is that the loader detects whether or not the CPU has th
I developed a simple patch to no longer display the DUMMY port error on models without device-tree, the user will be able to install without having to worry about it. I developed a simple patch to no longer display the DUMMY port error on models without device-tree, the user will be able to install without having to worry about it.
# Thanks
All code was based on the work of TTG, pocopico, jumkey and others involved in continuing TTG's original redpill-load project. All code was based on the work of TTG, pocopico, jumkey and others involved in continuing TTG's original redpill-load project.
More information will be added in the future. More information will be added in the future.

5
TODO
View File

@@ -24,5 +24,6 @@ Concluidos:
- Melhorar opções de HD, talvez criar um menu a parte - Melhorar opções de HD, talvez criar um menu a parte
- Implementar update do bzimage e ramdisk online - Implementar update do bzimage e ramdisk online
- Mudar addons para colocar pacote completo na partição 3 e detectar dinâmicamente durante o boot do júnior - Mudar addons para colocar pacote completo na partição 3 e detectar dinâmicamente durante o boot do júnior
- Acertar flag DIRTY ao atualizar módulos, etc
https://kb.synology.com/en-me/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have - Consertar MAC custom
- Mudar synoinfo para ler do modelo e preencher no user_config, para usuário poder deletar entradas do modelo

View File

@@ -12,15 +12,6 @@ tasks:
cmds: cmds:
- ./build.sh - ./build.sh
compile-lkms:
cmds:
- ./compile-lkm.sh
compile-addons:
dir: addons
cmds:
- ./compile-addons.sh {{.CLI_ARGS}}
compile-kpatch: compile-kpatch:
dir: kpatch dir: kpatch
cmds: cmds:

View File

@@ -1 +1 @@
0.3-alpha3 0.3-alpha4

View File

@@ -3,20 +3,17 @@ ARG PLATFORMS="@@@PLATFORMS@@@"
ARG TOOLKIT_VER="@@@TOOLKIT_VER@@@" ARG TOOLKIT_VER="@@@TOOLKIT_VER@@@"
# Copy downloaded toolkits # Copy downloaded toolkits
ADD cache /cache ADD cache/$TOOLKIT_VER /cache
# Extract toolkits # Extract toolkits
RUN for V in ${PLATFORMS}; do \ RUN for V in ${PLATFORMS}; do \
echo "${V}" | while IFS=':' read PLATFORM KVER; do \ echo "${V}" | while IFS=':' read PLATFORM KVER; do \
echo -e "${PLATFORM}\t${KVER}" >> /opt/platforms && \
echo "Extracting ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" && \ echo "Extracting ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" && \
mkdir "/opt/${PLATFORM}" && \ mkdir "/opt/${PLATFORM}" && \
tar -xaf "/cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" -C "/opt/${PLATFORM}" --strip-components=10 \ tar -xaf "/cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" -C "/opt/${PLATFORM}" --strip-components=9 \
"usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-${TOOLKIT_VER}/build" && \ "usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-${TOOLKIT_VER}" && \
echo -e "${PLATFORM}\t${KVER}" >> /opt/platforms && \ echo "Extracting ${PLATFORM}-toolchain.txz" && \
if [ ! -d "/opt/linux-${KVER}" ]; then \ tar -xaf "/cache/${PLATFORM}-toolchain.txz" -C "/opt/${PLATFORM}" --strip-components=1; \
mkdir "/opt/linux-${KVER}" && \
echo "Extracting linux-${KVER}.tar.xz" && \
tar -xaf "/cache/linux-${KVER}.tar.xz" -C "/opt/linux-${KVER}" --strip-components=1; \
fi; \
done; \ done; \
done done

View File

@@ -6,50 +6,75 @@ function trap_cancel() {
sleep 2 || exit 1 sleep 2 || exit 1
} }
trap trap_cancel SIGINT SIGTERM trap trap_cancel SIGINT SIGTERM
cd `dirname $0` cd `dirname $0`
# Read platforms/kerver version ###############################################################################
echo "Reading platforms" function prepare() {
declare -A PLATFORMS declare -A URLS
while read PLATFORM KVER; do
PLATFORMS[${PLATFORM}]="${KVER}"
done <../PLATFORMS
# Download toolkits URLS["apollolake"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/Intel%20x86%20Linux%204.4.180%20%28Apollolake%29/apollolake-${GCCLIB_VER}_x86_64-GPL.txz"
mkdir -p cache URLS["broadwell"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/Intel%20x86%20Linux%204.4.180%20%28Broadwell%29/broadwell-${GCCLIB_VER}_x86_64-GPL.txz"
URLS["broadwellnk"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/Intel%20x86%20Linux%204.4.180%20%28Broadwellnk%29/broadwellnk-${GCCLIB_VER}_x86_64-GPL.txz"
URLS["bromolow"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/Intel%20x86%20linux%203.10.108%20%28Bromolow%29/bromolow-${GCCLIB_VER}_x86_64-GPL.txz"
URLS["denverton"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/Intel%20x86%20Linux%204.4.180%20%28Denverton%29/denverton-${GCCLIB_VER}_x86_64-GPL.txz"
URLS["geminilake"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/Intel%20x86%20Linux%204.4.180%20%28GeminiLake%29/geminilake-${GCCLIB_VER}_x86_64-GPL.txz"
URLS["v1000"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/Intel%20x86%20Linux%204.4.180%20%28V1000%29/v1000-${GCCLIB_VER}_x86_64-GPL.txz"
# Read platforms/kerver version
echo "Reading platforms"
declare -A PLATFORMS
while read PLATFORM KVER; do
PLATFORMS[${PLATFORM}]="${KVER}"
done <../PLATFORMS
# Download toolkits
mkdir -p cache
for PLATFORM in ${!PLATFORMS[@]}; do
KVER="${PLATFORMS[${PLATFORM}]}"
echo -n "Checking cache/${TOOLKIT_VER}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz... "
if [ ! -f "cache/${TOOLKIT_VER}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" ]; then
URL="https://global.download.synology.com/download/ToolChain/toolkit/${TOOLKIT_VER}/${PLATFORM}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz"
echo "Downloading ${URL}"
curl -L "${URL}" -o "cache/${TOOLKIT_VER}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz"
else
echo "OK"
fi
echo -n "Checking cache/${TOOLKIT_VER}/${PLATFORM}-toolchain.txz... "
if [ ! -f "cache/${TOOLKIT_VER}/${PLATFORM}-toolchain.txz" ]; then
URL=${URLS["${PLATFORM}"]}
echo "Downloading ${URL}"
curl -L "${URL}" -o "cache/${TOOLKIT_VER}/${PLATFORM}-toolchain.txz"
else
echo "OK"
fi
done
# Generate Dockerfile
echo "Generating Dockerfile"
cp Dockerfile.template Dockerfile
VALUE=""
for PLATFORM in ${!PLATFORMS[@]}; do
VALUE+="${PLATFORM}:${PLATFORMS[${PLATFORM}]} "
done
sed -i "s|@@@PLATFORMS@@@|${VALUE::-1}|g" Dockerfile
sed -i "s|@@@TOOLKIT_VER@@@|${TOOLKIT_VER}|g" Dockerfile
}
# 7.0
TOOLKIT_VER="7.0" TOOLKIT_VER="7.0"
for PLATFORM in ${!PLATFORMS[@]}; do TOOLCHAIN_VER="7.0-41890"
KVER="${PLATFORMS[${PLATFORM}]}" GCCLIB_VER="gcc750_glibc226"
echo -n "Checking cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz... " prepare
if [ ! -f "cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" ]; then echo "Building ${TOOLKIT_VER}"
URL="https://global.download.synology.com/download/ToolChain/toolkit/${TOOLKIT_VER}/${PLATFORM}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" docker image rm fbelavenuto/syno-compiler:${TOOLKIT_VER} >/dev/null 2>&1
echo "Downloading ${URL}" docker buildx build . --load --tag fbelavenuto/syno-compiler:${TOOLKIT_VER}
curl -L "${URL}" -o "cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz"
else
echo "OK"
fi
# echo -n "Checking cache/linux-${KVER}.tar.xz... "
# if [ ! -f "cache/linux-${KVER}.tar.xz" ]; then
# URL="https://cdn.kernel.org/pub/linux/kernel/v${KVER:0:1}.x/linux-${KVER}.tar.xz"
# echo "Downloading ${URL}"
# curl -L "${URL}" -o "cache/linux-${KVER}.tar.xz"
# else
# echo "OK"
# fi
done
# Generate Dockerfile # 7.1
echo "Generating Dockerfile" TOOLKIT_VER="7.1"
cp Dockerfile.template Dockerfile TOOLCHAIN_VER="7.1-42661"
VALUE="" GCCLIB_VER="gcc850_glibc226"
for PLATFORM in ${!PLATFORMS[@]}; do prepare
VALUE+="${PLATFORM}:${PLATFORMS[${PLATFORM}]} " echo "Building ${TOOLKIT_VER}"
done docker image rm fbelavenuto/syno-compiler:${TOOLKIT_VER} >/dev/null 2>&1
sed -i "s|@@@PLATFORMS@@@|${VALUE::-1}|g" Dockerfile docker buildx build . --load --tag fbelavenuto/syno-compiler:${TOOLKIT_VER} --tag fbelavenuto/syno-compiler:latest
sed -i "s|@@@TOOLKIT_VER@@@|${TOOLKIT_VER}|g" Dockerfile
# Build
echo "Building... Drink a coffee and wait!"
docker image rm fbelavenuto/syno-compiler >/dev/null 2>&1
docker buildx build . --load --tag fbelavenuto/syno-compiler

View File

@@ -1,5 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
function export-vars {
# Validate
if [ -z "${1}" ]; then
echo "Use: export-vars <platform>"
exit 1
fi
export CROSS_COMPILE="/opt/${1}/bin/x86_64-pc-linux-gnu-"
export CFLAGS="-I/opt/${1}/include"
export LDFLAGS="-I/opt/${1}/lib"
export LD_LIBRARY_PATH="/opt/${1}/lib"
export ARCH=x86_64
}
function compile-module { function compile-module {
# Validate # Validate
if [ -z "${1}" ]; then if [ -z "${1}" ]; then
@@ -19,7 +34,9 @@ function compile-module {
fi fi
echo "Compiling module for ${PLATFORM}-${KVER}..." echo "Compiling module for ${PLATFORM}-${KVER}..."
cp -R /input /tmp cp -R /input /tmp
make -C "/opt/${PLATFORM}" M="/tmp/input" PLATFORM=${PLATFORM^^} modules export-vars ${PLATFORM}
make -C "/opt/${PLATFORM}/build" M="/tmp/input" \
${PLATFORM^^}-Y=y ${PLATFORM^^}-M=m modules
while read F; do while read F; do
strip -g "${F}" strip -g "${F}"
echo "Copying `basename ${F}`" echo "Copying `basename ${F}`"
@@ -34,11 +51,13 @@ function compile-lkm {
exit 1 exit 1
fi fi
cp -R /input /tmp cp -R /input /tmp
make -C "/tmp/input" LINUX_SRC="/opt/${PLATFORM}" dev-v7 export-vars ${PLATFORM}
export LINUX_SRC="/opt/${PLATFORM}/build"
make -C "/tmp/input" dev-v7
strip -g "/tmp/input/redpill.ko" strip -g "/tmp/input/redpill.ko"
mv "/tmp/input/redpill.ko" "/output/redpill-dev.ko" mv "/tmp/input/redpill.ko" "/output/redpill-dev.ko"
make -C "/tmp/input" LINUX_SRC="/opt/${PLATFORM}" clean make -C "/tmp/input" clean
make -C "/tmp/input" LINUX_SRC="/opt/${PLATFORM}" prod-v7 make -C "/tmp/input" prod-v7
strip -g "/tmp/input/redpill.ko" strip -g "/tmp/input/redpill.ko"
mv "/tmp/input/redpill.ko" "/output/redpill-prod.ko" mv "/tmp/input/redpill.ko" "/output/redpill-prod.ko"
} }
@@ -71,10 +90,10 @@ if [ $# -lt 1 ]; then
exit 1 exit 1
fi fi
case $1 in case $1 in
bash) shift; bash -l $@ ;; bash) shift && bash -l $@ ;;
shell) export-vars $2 && shift 2 && bash -l $@ ;;
compile-module) compile-module $2 ;; compile-module) compile-module $2 ;;
compile-lkm) compile-lkm $2 ;; compile-lkm) compile-lkm $2 ;;
# compile-drivers) compile-drivers ;; # compile-drivers) compile-drivers ;;
*) echo "Command not recognized: $1" ;; *) echo "Command not recognized: $1" ;;
esac esac

View File

@@ -0,0 +1,33 @@
#!/bin/sh
#
# Start/stop dhcpcd
#
DAEMON=/usr/sbin/dhcpcd
CONFIG=/etc/dhcpcd.conf
PIDFILE=/var/run/dhcpcd/pid
[ -f $CONFIG ] || exit 0
case "$1" in
start)
echo "Starting dhcpcd..."
start-stop-daemon -S -x "$DAEMON" -p "$PIDFILE" -- -f "$CONFIG"
;;
stop)
echo "Stopping dhcpcd..."
start-stop-daemon -K -x "$DAEMON" -p "$PIDFILE" -o
;;
reload|force-reload)
echo "Reloading dhcpcd configuration..."
"$DAEMON" -s reload
;;
restart)
"$0" stop
sleep 1 # Prevent race condition: ensure dhcpcd stops before start.
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
exit 1
esac

View File

@@ -76,13 +76,15 @@ EFI_BUG="`readModelKey "${MODEL}" "builds.${BUILD}.efi-bug"`"
LOADER_DISK="`blkid | grep 'LABEL="ARPL3"' | cut -d3 -f1`" LOADER_DISK="`blkid | grep 'LABEL="ARPL3"' | cut -d3 -f1`"
BUS=`udevadm info --query property --name ${LOADER_DISK} | grep ID_BUS | cut -d= -f2` BUS=`udevadm info --query property --name ${LOADER_DISK} | grep ID_BUS | cut -d= -f2`
if [ "${BUS}" = "ata" ]; then if [ "${BUS}" = "ata" ]; then
SIZE=$((`df -BM | awk '/\/mnt\/p3/{print$2}' | tr 'M' ' '`+300)) LOADER_DEVICE_NAME=`echo ${LOADER_DISK} | sed 's|/dev/||'`
SIZE=$((`cat /sys/block/${LOADER_DEVICE_NAME}/size`/2048+10))
# Read SATADoM type # Read SATADoM type
DOM="`readModelKey "${MODEL}" "dom"`" DOM="`readModelKey "${MODEL}" "dom"`"
fi fi
# Prepare command line # Prepare command line
CMDLINE_LINE="" CMDLINE_LINE=""
grep -q "force_junior" /proc/cmdline && CMDLINE_LINE+="force_junior "
[ ${EFI} -eq 1 ] && CMDLINE_LINE+="withefi " [ ${EFI} -eq 1 ] && CMDLINE_LINE+="withefi "
[ "${BUS}" = "ata" ] && CMDLINE_LINE+="synoboot_satadom=${DOM} dom_szmax=${SIZE} " [ "${BUS}" = "ata" ] && CMDLINE_LINE+="synoboot_satadom=${DOM} dom_szmax=${SIZE} "
CMDLINE_LINE+="console=ttyS0,115200n8 earlyprintk log_buf_len=32M earlycon=uart8250,io,0x3f8,115200n8 elevator=elevator root=/dev/md0 loglevel=15" CMDLINE_LINE+="console=ttyS0,115200n8 earlyprintk log_buf_len=32M earlycon=uart8250,io,0x3f8,115200n8 elevator=elevator root=/dev/md0 loglevel=15"
@@ -101,18 +103,19 @@ echo -e "Cmdline:\n\033[1;36m${CMDLINE_LINE}\033[0m"
# Wait for an IP # Wait for an IP
COUNT=0 COUNT=0
echo -n "IP: " echo -n "IP"
while true; do while true; do
IP=`ip route get 1.1.1.1 2>/dev/null | awk '{print$7}'` IP=`ip route get 1.1.1.1 2>/dev/null | awk '{print$7}'`
if [ -n "${IP}" ]; then if [ -n "${IP}" ]; then
echo -e "\033[1;32m${IP}\033[0m" echo -e ": \033[1;32m${IP}\033[0m"
break break
elif [ ${COUNT} -eq 15 ]; then elif [ ${COUNT} -eq 15 ]; then
echo -e "\033[1;31mERROR\033[0m" echo -e ": \033[1;31mERROR\033[0m"
break break
fi fi
COUNT=$((${COUNT}+1)) COUNT=$((${COUNT}+1))
sleep 1 sleep 1
echo -n "."
done done
echo -e "\033[1;37mLoading DSM kernel...\033[0m" echo -e "\033[1;37mLoading DSM kernel...\033[0m"

View File

@@ -1,5 +1,5 @@
ARPL_VERSION="0.3-alpha3" ARPL_VERSION="0.3-alpha4"
# Define paths # Define paths
TMP_PATH="/tmp" TMP_PATH="/tmp"

View File

@@ -34,7 +34,6 @@ mount ${LOADER_DISK}1 ${BOOTLOADER_PATH} || die "Can't mount ${BOOTLOADER_PATH}"
mount ${LOADER_DISK}2 ${SLPART_PATH} || die "Can't mount ${SLPART_PATH}" mount ${LOADER_DISK}2 ${SLPART_PATH} || die "Can't mount ${SLPART_PATH}"
mount ${LOADER_DISK}3 ${CACHE_PATH} || die "Can't mount ${CACHE_PATH}" mount ${LOADER_DISK}3 ${CACHE_PATH} || die "Can't mount ${CACHE_PATH}"
mkdir -p "${ADDONS_PATH}"
# Move/link SSH machine keys to/from cache volume # Move/link SSH machine keys to/from cache volume
[ ! -d "${CACHE_PATH}/ssh" ] && cp -R "/etc/ssh" "${CACHE_PATH}/ssh" [ ! -d "${CACHE_PATH}/ssh" ] && cp -R "/etc/ssh" "${CACHE_PATH}/ssh"
rm -rf "/etc/ssh" rm -rf "/etc/ssh"
@@ -59,6 +58,14 @@ if [ ! -f "${USER_CONFIG_FILE}" ]; then
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}" writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
fi fi
# Set custom MAC if defined
MAC1=`readConfigKey "cmdline.mac1" "${USER_CONFIG_FILE}"`
if [ -n "${MAC1}" ]; then
MAC="${MAC1:0:2}:${MAC1:2:2}:${MAC1:4:2}:${MAC1:6:2}:${MAC1:8:2}:${MAC1:10:2}"
ip link set dev eth0 address ${MAC} >/dev/null 2>&1 && \
(/etc/init.d/S41dhcpcd restart >/dev/null 2>&1 &) || true
fi
# Get the VID/PID if we are in USB # Get the VID/PID if we are in USB
VID="0x0000" VID="0x0000"
PID="0x0000" PID="0x0000"
@@ -148,3 +155,7 @@ echo
echo -e "User config is on \033[1;32m${USER_CONFIG_FILE}\033[0m" echo -e "User config is on \033[1;32m${USER_CONFIG_FILE}\033[0m"
echo -e "Default SSH Root password is \033[1;31mRedp1lL-1s-4weSomE\033[0m" echo -e "Default SSH Root password is \033[1;31mRedp1lL-1s-4weSomE\033[0m"
echo echo
mkdir -p "${ADDONS_PATH}"
mkdir -p "${LKM_PATH}"
mkdir -p "${MODULES_PATH}"

View File

@@ -104,9 +104,14 @@ function buildMenu() {
if [ "${BUILD}" != "${resp}" ]; then if [ "${BUILD}" != "${resp}" ]; then
BUILD=${resp} BUILD=${resp}
writeConfigKey "build" "${BUILD}" "${USER_CONFIG_FILE}" writeConfigKey "build" "${BUILD}" "${USER_CONFIG_FILE}"
DIRTY=1 # Delete synoinfo and reload model/build synoinfo
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
while IFS="=" read KEY VALUE; do
writeConfigKey "synoinfo.${KEY}" "${VALUE}" "${USER_CONFIG_FILE}"
done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo")
# Remove old files # Remove 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}"
DIRTY=1
fi fi
} }
@@ -168,6 +173,7 @@ function addonMenu() {
d "Delete addon(s)" \ d "Delete addon(s)" \
s "Show user addons" \ s "Show user addons" \
m "Show all available addons" \ m "Show all available addons" \
o "Download a external addon" \
e "Exit" \ e "Exit" \
2>${TMP_PATH}/resp 2>${TMP_PATH}/resp
[ $? -ne 0 ] && return [ $? -ne 0 ] && return
@@ -238,6 +244,30 @@ function addonMenu() {
dialog --backtitle "`backtitle`" --title "Available addons" \ dialog --backtitle "`backtitle`" --title "Available addons" \
--colors --msgbox "${MSG}" 0 0 --colors --msgbox "${MSG}" 0 0
;; ;;
o)
TEXT="please enter the complete URL to download.\n"
dialog --backtitle "`backtitle`" --aspect 18 --colors --inputbox "${TEXT}" 0 0 \
2>${TMP_PATH}/resp
[ $? -ne 0 ] && continue
URL="`<"${TMP_PATH}/resp"`"
[ -z "${URL}" ] && continue
clear
echo "Downloading ${URL}"
curl --insecure -L "${URL}" -o "${TMP_PATH}/addon.tgz" --progress-bar
if [ $? -ne 0 ]; then
dialog --backtitle "`backtitle`" --title "Error downloading" --aspect 18 \
--msgbox "Check internet, URL or cache disk space" 0 0
return 1
fi
ADDON="`untarAddon "${TMP_PATH}/addon.tgz"`"
if [ -n "${ADDON}" ]; then
dialog --backtitle "`backtitle`" --title "Success" --aspect 18 \
--msgbox "Addon '${ADDON}' added to loader" 0 0
else
dialog --backtitle "`backtitle`" --title "Invalid addon" --aspect 18 \
--msgbox "File format not recognized!" 0 0
fi
;;
e) return ;; e) return ;;
esac esac
done done
@@ -315,6 +345,11 @@ function cmdlineMenu() {
writeConfigKey "cmdline.mac1" "${MAC1}" "${USER_CONFIG_FILE}" writeConfigKey "cmdline.mac1" "${MAC1}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.netif_num" "1" "${USER_CONFIG_FILE}" writeConfigKey "cmdline.netif_num" "1" "${USER_CONFIG_FILE}"
fi fi
/etc/init.d/S30arpl-mac restart 2>&1 | dialog --backtitle "`backtitle`" \
--title "User cmdline" --progressbox "Changing mac" 20 70
/etc/init.d/S41dhcpcd restart 2>&1 | dialog --backtitle "`backtitle`" \
--title "User cmdline" --progressbox "Renewing IP" 20 70
IP=`ip route get 1.1.1.1 2>/dev/null | awk '{print$7}'`
;; ;;
s) s)
ITEMS="" ITEMS=""
@@ -381,8 +416,7 @@ function synoinfoMenu() {
if [ "${DT}" != "true" ]; then if [ "${DT}" != "true" ]; then
echo "x \"Set maxdisks manually\"" >> "${TMP_PATH}/menu" echo "x \"Set maxdisks manually\"" >> "${TMP_PATH}/menu"
fi fi
echo "s \"Show user synoinfo\"" >> "${TMP_PATH}/menu" echo "s \"Show synoinfo entries\"" >> "${TMP_PATH}/menu"
echo "m \"Show model/build synoinfo\"" >> "${TMP_PATH}/menu"
echo "e \"Exit\"" >> "${TMP_PATH}/menu" echo "e \"Exit\"" >> "${TMP_PATH}/menu"
# menu loop # menu loop
@@ -392,13 +426,13 @@ function synoinfoMenu() {
[ $? -ne 0 ] && return [ $? -ne 0 ] && return
case "`<${TMP_PATH}/resp`" in case "`<${TMP_PATH}/resp`" in
a) a)
dialog --backtitle "`backtitle`" --title "User synoinfo" \ dialog --backtitle "`backtitle`" --title "Synoinfo entries" \
--inputbox "Type a name of synoinfo variable" 0 0 \ --inputbox "Type a name of synoinfo entry" 0 0 \
2>${TMP_PATH}/resp 2>${TMP_PATH}/resp
[ $? -ne 0 ] && continue [ $? -ne 0 ] && continue
NAME="`sed 's/://g' <"${TMP_PATH}/resp"`" NAME="`sed 's/://g' <"${TMP_PATH}/resp"`"
dialog --backtitle "`backtitle`" --title "User synoinfo" \ dialog --backtitle "`backtitle`" --title "Synoinfo entries" \
--inputbox "Type a value of '${NAME}' variable" 0 0 "${SYNOINFO[${NAME}]}" \ --inputbox "Type a value of '${NAME}' entry" 0 0 "${SYNOINFO[${NAME}]}" \
2>${TMP_PATH}/resp 2>${TMP_PATH}/resp
[ $? -ne 0 ] && continue [ $? -ne 0 ] && continue
VALUE="`<"${TMP_PATH}/resp"`" VALUE="`<"${TMP_PATH}/resp"`"
@@ -408,7 +442,7 @@ function synoinfoMenu() {
;; ;;
d) d)
if [ ${#SYNOINFO[@]} -eq 0 ]; then if [ ${#SYNOINFO[@]} -eq 0 ]; then
dialog --backtitle "`backtitle`" --msgbox "No user synoinfo to remove" 0 0 dialog --backtitle "`backtitle`" --msgbox "No synoinfo entries to remove" 0 0
continue continue
fi fi
ITEMS="" ITEMS=""
@@ -416,7 +450,7 @@ function synoinfoMenu() {
ITEMS+="${I} ${SYNOINFO[${I}]} off " ITEMS+="${I} ${SYNOINFO[${I}]} off "
done done
dialog --backtitle "`backtitle`" \ dialog --backtitle "`backtitle`" \
--checklist "Select synoinfo to remove" 0 0 0 ${ITEMS} \ --checklist "Select synoinfo entry to remove" 0 0 0 ${ITEMS} \
2>"${TMP_PATH}/resp" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && continue [ $? -ne 0 ] && continue
RESP=`<"${TMP_PATH}/resp"` RESP=`<"${TMP_PATH}/resp"`
@@ -441,15 +475,7 @@ function synoinfoMenu() {
for KEY in ${!SYNOINFO[@]}; do for KEY in ${!SYNOINFO[@]}; do
ITEMS+="${KEY}: ${SYNOINFO[$KEY]}\n" ITEMS+="${KEY}: ${SYNOINFO[$KEY]}\n"
done done
dialog --backtitle "`backtitle`" --title "User synoinfo" \ dialog --backtitle "`backtitle`" --title "Synoinfo entries" \
--aspect 18 --msgbox "${ITEMS}" 0 0
;;
m)
ITEMS=""
while IFS="=" read KEY VALUE; do
ITEMS+="${KEY}: ${VALUE}\n"
done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo")
dialog --backtitle "`backtitle`" --title "Model/build synoinfo" \
--aspect 18 --msgbox "${ITEMS}" 0 0 --aspect 18 --msgbox "${ITEMS}" 0 0
;; ;;
e) return ;; e) return ;;
@@ -777,13 +803,13 @@ function updateMenu() {
unzip /tmp/addons.zip -d /tmp/addons >/dev/null 2>&1 unzip /tmp/addons.zip -d /tmp/addons >/dev/null 2>&1
dialog --backtitle "`backtitle`" --title "Update addons" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update addons" --aspect 18 \
--infobox "Installing new addons" 0 0 --infobox "Installing new addons" 0 0
DEST_PATH="/mnt/p3/addons"
for PKG in `ls /tmp/addons/*.addon`; do for PKG in `ls /tmp/addons/*.addon`; do
ADDON=`basename ${PKG} | sed 's|.addon||'` ADDON=`basename ${PKG} | sed 's|.addon||'`
rm -rf "${DEST_PATH}/${ADDON}" rm -rf "${ADDONS_PATH}/${ADDON}"
mkdir -p "${DEST_PATH}/${ADDON}" mkdir -p "${ADDONS_PATH}/${ADDON}"
tar xaf "${PKG}" -C "${DEST_PATH}/${ADDON}" >/dev/null 2>&1 tar xaf "${PKG}" -C "${ADDONS_PATH}/${ADDON}" >/dev/null 2>&1
done done
DIRTY=1
dialog --backtitle "`backtitle`" --title "Update addons" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update addons" --aspect 18 \
--msgbox "Addons updated with success!" 0 0 --msgbox "Addons updated with success!" 0 0
;; ;;
@@ -809,6 +835,7 @@ function updateMenu() {
--infobox "Extracting last version" 0 0 --infobox "Extracting last version" 0 0
rm -rf "${LKM_PATH}/"* rm -rf "${LKM_PATH}/"*
unzip /tmp/rp-lkms.zip -d "${LKM_PATH}" >/dev/null 2>&1 unzip /tmp/rp-lkms.zip -d "${LKM_PATH}" >/dev/null 2>&1
DIRTY=1
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
--msgbox "LKMs updated with success!" 0 0 --msgbox "LKMs updated with success!" 0 0
;; ;;
@@ -845,6 +872,7 @@ function updateMenu() {
rm "${MODULES_PATH}/${P}.tgz" rm "${MODULES_PATH}/${P}.tgz"
mv "/tmp/${P}.tgz" "${MODULES_PATH}/${P}.tgz" mv "/tmp/${P}.tgz" "${MODULES_PATH}/${P}.tgz"
done done
DIRTY=1
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
--msgbox "Modules updated with success!" 0 0 --msgbox "Modules updated with success!" 0 0
;; ;;

View File

@@ -47,3 +47,21 @@ builds:
- "ramdisk-common-disable-root-pwd.patch" - "ramdisk-common-disable-root-pwd.patch"
- "ramdisk-common-init-script.patch" - "ramdisk-common-init-script.patch"
- "ramdisk-common-post-init-script.patch" - "ramdisk-common-post-init-script.patch"
42661:
ver: "7.1.0"
kver: "4.4.180"
rd-compressed: false
efi-bug: no
cmdline:
<<: *cmdline
synoinfo:
<<: *synoinfo
pat:
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DS2422%2B_42661.pat"
hash: "c38fee0470c592b679ab52a64eac76b2a3912fb2e6aba65a65abb5aa05a98d4c"
ramdisk-hash: "bb109132e96b1e26d5e3d44557944f7518168d8cb18e35d6254c0dfe7fb19382"
zimage-hash: "d939b5937be00a644aae64c33633619a7c310433e60a515c77bbef00b0a7e6b6"
patch:
- "ramdisk-common-disable-root-pwd.patch"
- "ramdisk-common-init-script.patch"
- "ramdisk-42661-post-init-script.patch"

View File

@@ -44,10 +44,7 @@ RD_COMPRESSED="`readModelKey "${MODEL}" "builds.${BUILD}.rd-compressed"`"
declare -A SYNOINFO declare -A SYNOINFO
declare -A ADDONS declare -A ADDONS
# Read more config # Read synoinfo and addons from config
while IFS="=" read KEY VALUE; do
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo")
while IFS="=" read KEY VALUE; do while IFS="=" read KEY VALUE; do
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}" [ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}") done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
@@ -92,6 +89,8 @@ for F in `ls "${TMP_PATH}/modules/"*.ko`; do
# [ -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] || mv "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}" # [ -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] || mv "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}"
cp "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}" cp "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}"
done done
mkdir -p "${RAMDISK_PATH}/usr/lib/firmware"
gzip -dc "${CACHE_PATH}/modules/firmware.tgz" | tar xf - -C "${RAMDISK_PATH}/usr/lib/firmware"
# Clean # Clean
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
@@ -116,7 +115,6 @@ ADDONS['eudev']=""
echo -n "." echo -n "."
mkdir -p "${RAMDISK_PATH}/addons" mkdir -p "${RAMDISK_PATH}/addons"
echo "#!/bin/sh" > "${RAMDISK_PATH}/addons/addons.sh" echo "#!/bin/sh" > "${RAMDISK_PATH}/addons/addons.sh"
echo 'export INSMOD="/sbin/insmod"' >> "${RAMDISK_PATH}/addons/addons.sh"
echo 'echo "addons.sh called with params ${@}"' >> "${RAMDISK_PATH}/addons/addons.sh" echo 'echo "addons.sh called with params ${@}"' >> "${RAMDISK_PATH}/addons/addons.sh"
for ADDON in ${!ADDONS[@]}; do for ADDON in ${!ADDONS[@]}; do
PARAMS=${ADDONS[${ADDON}]} PARAMS=${ADDONS[${ADDON}]}

View File

@@ -6,7 +6,7 @@ terminal_input console
terminal_output console terminal_output console
set default="0" set default="0"
set timeout="3" set timeout="5"
set timeout_style="menu" set timeout_style="menu"
insmod loadenv insmod loadenv
@@ -60,6 +60,13 @@ if [ -s /zImage -a -s /rd.gz ]; then
initrd /initrd-arpl initrd /initrd-arpl
echo "Booting..." echo "Booting..."
} }
menuentry 'Force re-install DSM' --id junior {
echo "Loading kernel..."
linux /bzImage-arpl console=ttyS0,115200n8 quiet force_junior
echo "Loading initramfs..."
initrd /initrd-arpl
echo "Booting..."
}
else else
set timeout="1" set timeout="1"
fi fi

Binary file not shown.

View File

@@ -37,12 +37,11 @@ BR2_PACKAGE_NVME=y
BR2_PACKAGE_PCIUTILS=y BR2_PACKAGE_PCIUTILS=y
BR2_PACKAGE_SMARTMONTOOLS=y BR2_PACKAGE_SMARTMONTOOLS=y
BR2_PACKAGE_USBUTILS=y BR2_PACKAGE_USBUTILS=y
BR2_PACKAGE_PHP=y
BR2_PACKAGE_PHP_SAPI_CLI=y
BR2_PACKAGE_DTC=y BR2_PACKAGE_DTC=y
BR2_PACKAGE_DTC_PROGRAMS=y BR2_PACKAGE_DTC_PROGRAMS=y
BR2_PACKAGE_LIBCURL=y BR2_PACKAGE_LIBCURL=y
BR2_PACKAGE_LIBCURL_CURL=y BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_PCRE2=y
BR2_PACKAGE_DHCPCD=y BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_OPENSSH=y BR2_PACKAGE_OPENSSH=y
# BR2_PACKAGE_OPENSSH_CLIENT is not set # BR2_PACKAGE_OPENSSH_CLIENT is not set

View File

@@ -49,6 +49,7 @@ if [ -d ../arpl-addons ]; then
echo "${D}" echo "${D}"
(cd ${D} && tar caf "${MODULES_DIR}/${D}.tgz" *.ko) (cd ${D} && tar caf "${MODULES_DIR}/${D}.tgz" *.ko)
done done
(cd firmware && tar caf "${MODULES_DIR}/firmware.tgz" *)
cd - cd -
else else
TAG=`curl -s https://api.github.com/repos/fbelavenuto/arpl-modules/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'` TAG=`curl -s https://api.github.com/repos/fbelavenuto/arpl-modules/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
@@ -56,6 +57,7 @@ else
FILE="${PLATFORM}-${KVER}" FILE="${PLATFORM}-${KVER}"
curl -L "https://github.com/fbelavenuto/arpl-modules/releases/download/${TAG}/${FILE}.tgz" -o "${MODULES_DIR}/${FILE}.tgz" curl -L "https://github.com/fbelavenuto/arpl-modules/releases/download/${TAG}/${FILE}.tgz" -o "${MODULES_DIR}/${FILE}.tgz"
done < PLATFORMS done < PLATFORMS
curl -L "https://github.com/fbelavenuto/arpl-modules/releases/download/${TAG}/firmware.tgz" -o "${MODULES_DIR}/firmware.tgz"
fi fi
# Copy files # Copy files