mirror of
https://github.com/fbelavenuto/arpl.git
synced 2025-12-24 06:42:06 +08:00
first commit
This commit is contained in:
1216
files/board/arpl/busybox_defconfig
Normal file
1216
files/board/arpl/busybox_defconfig
Normal file
File diff suppressed because it is too large
Load Diff
BIN
files/board/arpl/grub.bin
Normal file
BIN
files/board/arpl/grub.bin
Normal file
Binary file not shown.
352
files/board/arpl/kernel_defconfig
Normal file
352
files/board/arpl/kernel_defconfig
Normal file
@@ -0,0 +1,352 @@
|
||||
# CONFIG_LOCALVERSION_AUTO is not set
|
||||
CONFIG_KERNEL_XZ=y
|
||||
CONFIG_SYSVIPC=y
|
||||
CONFIG_POSIX_MQUEUE=y
|
||||
CONFIG_AUDIT=y
|
||||
CONFIG_NO_HZ=y
|
||||
CONFIG_HIGH_RES_TIMERS=y
|
||||
CONFIG_PREEMPT_VOLUNTARY=y
|
||||
CONFIG_BSD_PROCESS_ACCT=y
|
||||
CONFIG_TASKSTATS=y
|
||||
CONFIG_TASK_DELAY_ACCT=y
|
||||
CONFIG_TASK_XACCT=y
|
||||
CONFIG_TASK_IO_ACCOUNTING=y
|
||||
CONFIG_LOG_BUF_SHIFT=18
|
||||
CONFIG_CGROUPS=y
|
||||
CONFIG_CGROUP_SCHED=y
|
||||
CONFIG_CGROUP_FREEZER=y
|
||||
CONFIG_CPUSETS=y
|
||||
CONFIG_CGROUP_CPUACCT=y
|
||||
CONFIG_BLK_DEV_INITRD=y
|
||||
CONFIG_KALLSYMS_ALL=y
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_PROFILING=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_IOSF_MBI=y
|
||||
CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
|
||||
CONFIG_MICROCODE_AMD=y
|
||||
CONFIG_X86_MSR=y
|
||||
CONFIG_X86_CPUID=y
|
||||
CONFIG_NUMA=y
|
||||
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
|
||||
# CONFIG_MTRR_SANITIZER is not set
|
||||
CONFIG_EFI=y
|
||||
CONFIG_EFI_STUB=y
|
||||
CONFIG_EFI_MIXED=y
|
||||
CONFIG_HZ_1000=y
|
||||
CONFIG_KEXEC=y
|
||||
CONFIG_CRASH_DUMP=y
|
||||
CONFIG_HIBERNATION=y
|
||||
CONFIG_PM_DEBUG=y
|
||||
CONFIG_PM_TRACE_RTC=y
|
||||
CONFIG_ACPI_VIDEO=y
|
||||
CONFIG_ACPI_DOCK=y
|
||||
CONFIG_ACPI_BGRT=y
|
||||
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
|
||||
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
|
||||
CONFIG_X86_ACPI_CPUFREQ=y
|
||||
CONFIG_IA32_EMULATION=y
|
||||
# CONFIG_VIRTUALIZATION is not set
|
||||
CONFIG_KPROBES=y
|
||||
CONFIG_JUMP_LABEL=y
|
||||
# CONFIG_GCC_PLUGINS is not set
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
CONFIG_PARTITION_ADVANCED=y
|
||||
CONFIG_BINFMT_MISC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
CONFIG_UNIX=y
|
||||
CONFIG_XFRM_USER=y
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_MULTICAST=y
|
||||
CONFIG_IP_ADVANCED_ROUTER=y
|
||||
CONFIG_IP_MULTIPLE_TABLES=y
|
||||
CONFIG_IP_ROUTE_MULTIPATH=y
|
||||
CONFIG_IP_ROUTE_VERBOSE=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
CONFIG_IP_PNP_RARP=y
|
||||
CONFIG_IP_MROUTE=y
|
||||
CONFIG_IP_PIMSM_V1=y
|
||||
CONFIG_IP_PIMSM_V2=y
|
||||
CONFIG_SYN_COOKIES=y
|
||||
# CONFIG_INET_DIAG is not set
|
||||
CONFIG_TCP_CONG_ADVANCED=y
|
||||
# CONFIG_TCP_CONG_BIC is not set
|
||||
# CONFIG_TCP_CONG_WESTWOOD is not set
|
||||
# CONFIG_TCP_CONG_HTCP is not set
|
||||
CONFIG_TCP_MD5SIG=y
|
||||
# CONFIG_IPV6 is not set
|
||||
CONFIG_NETLABEL=y
|
||||
CONFIG_NETFILTER=y
|
||||
# CONFIG_NETFILTER_ADVANCED is not set
|
||||
CONFIG_NF_CONNTRACK=y
|
||||
CONFIG_NF_CONNTRACK_FTP=y
|
||||
CONFIG_NF_CONNTRACK_IRC=y
|
||||
CONFIG_NF_CONNTRACK_SIP=y
|
||||
CONFIG_NF_CT_NETLINK=y
|
||||
CONFIG_NF_NAT=y
|
||||
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
|
||||
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
|
||||
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
|
||||
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
|
||||
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
|
||||
CONFIG_NETFILTER_XT_MATCH_POLICY=y
|
||||
CONFIG_NETFILTER_XT_MATCH_STATE=y
|
||||
CONFIG_IP_NF_IPTABLES=y
|
||||
CONFIG_IP_NF_FILTER=y
|
||||
CONFIG_IP_NF_TARGET_REJECT=y
|
||||
CONFIG_IP_NF_TARGET_MASQUERADE=m
|
||||
CONFIG_IP_NF_MANGLE=y
|
||||
CONFIG_NET_SCHED=y
|
||||
CONFIG_NET_EMATCH=y
|
||||
CONFIG_NET_CLS_ACT=y
|
||||
# CONFIG_WIRELESS is not set
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCIEPORTBUS=y
|
||||
CONFIG_HOTPLUG_PCI=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
CONFIG_DEBUG_DEVRES=y
|
||||
CONFIG_CONNECTOR=y
|
||||
CONFIG_EFI_VARS=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_VIRTIO_BLK=m
|
||||
CONFIG_BLK_DEV_NVME=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_CHR_DEV_SG=y
|
||||
CONFIG_SCSI_CONSTANTS=y
|
||||
CONFIG_SCSI_SPI_ATTRS=y
|
||||
CONFIG_BLK_DEV_3W_XXXX_RAID=m
|
||||
CONFIG_SCSI_HPSA=m
|
||||
CONFIG_SCSI_AIC79XX=m
|
||||
# CONFIG_AIC79XX_DEBUG_ENABLE is not set
|
||||
CONFIG_SCSI_AIC94XX=m
|
||||
CONFIG_SCSI_MVSAS=m
|
||||
CONFIG_SCSI_MVUMI=m
|
||||
CONFIG_SCSI_DPT_I2O=m
|
||||
CONFIG_MEGARAID_LEGACY=m
|
||||
CONFIG_MEGARAID_SAS=m
|
||||
CONFIG_SCSI_MPT2SAS=m
|
||||
CONFIG_SCSI_UFSHCD=m
|
||||
CONFIG_SCSI_BUSLOGIC=m
|
||||
CONFIG_VMWARE_PVSCSI=m
|
||||
CONFIG_SCSI_ISCI=m
|
||||
CONFIG_SCSI_IPS=m
|
||||
CONFIG_SCSI_AM53C974=m
|
||||
CONFIG_SCSI_VIRTIO=m
|
||||
CONFIG_SCSI_DH=y
|
||||
CONFIG_ATA=y
|
||||
CONFIG_SATA_AHCI=y
|
||||
CONFIG_ATA_PIIX=y
|
||||
CONFIG_SATA_MV=m
|
||||
CONFIG_SATA_NV=m
|
||||
CONFIG_SATA_SIL=m
|
||||
CONFIG_SATA_SIS=m
|
||||
CONFIG_SATA_ULI=m
|
||||
CONFIG_SATA_VIA=m
|
||||
CONFIG_PATA_AMD=y
|
||||
CONFIG_PATA_OLDPIIX=y
|
||||
CONFIG_PATA_SCH=y
|
||||
CONFIG_ATA_GENERIC=y
|
||||
CONFIG_MD=y
|
||||
CONFIG_BLK_DEV_MD=y
|
||||
CONFIG_BLK_DEV_DM=y
|
||||
CONFIG_DM_MIRROR=y
|
||||
CONFIG_DM_ZERO=y
|
||||
CONFIG_NETDEVICES=y
|
||||
CONFIG_NETCONSOLE=y
|
||||
CONFIG_VIRTIO_NET=m
|
||||
CONFIG_ET131X=m
|
||||
CONFIG_ACENIC=m
|
||||
CONFIG_AMD_XGBE=m
|
||||
CONFIG_ATL1=m
|
||||
CONFIG_ATL1E=m
|
||||
CONFIG_ATL1C=m
|
||||
CONFIG_ALX=m
|
||||
CONFIG_CNIC=m
|
||||
CONFIG_TIGON3=y
|
||||
CONFIG_BNX2X=m
|
||||
CONFIG_CHELSIO_T1=m
|
||||
CONFIG_CHELSIO_T3=m
|
||||
CONFIG_NET_TULIP=y
|
||||
CONFIG_DL2K=m
|
||||
CONFIG_BE2NET=m
|
||||
CONFIG_E100=y
|
||||
CONFIG_E1000=y
|
||||
CONFIG_E1000E=y
|
||||
CONFIG_IGB=m
|
||||
CONFIG_IGBVF=m
|
||||
CONFIG_IXGB=m
|
||||
CONFIG_IXGBE=m
|
||||
CONFIG_IXGBEVF=m
|
||||
CONFIG_SKGE=m
|
||||
CONFIG_SKY2=y
|
||||
CONFIG_MLX4_EN=m
|
||||
CONFIG_MYRI10GE=m
|
||||
CONFIG_S2IO=m
|
||||
CONFIG_VXGE=m
|
||||
CONFIG_FORCEDETH=m
|
||||
CONFIG_QLCNIC=m
|
||||
CONFIG_NETXEN_NIC=m
|
||||
CONFIG_QED=m
|
||||
CONFIG_BNA=m
|
||||
CONFIG_QCOM_EMAC=m
|
||||
CONFIG_R8169=m
|
||||
CONFIG_SXGBE_ETH=m
|
||||
CONFIG_SIS190=m
|
||||
CONFIG_STMMAC_ETH=m
|
||||
CONFIG_XILINX_AXI_EMAC=m
|
||||
CONFIG_REALTEK_PHY=y
|
||||
# CONFIG_USB_NET_DRIVERS is not set
|
||||
# CONFIG_WLAN is not set
|
||||
CONFIG_VMXNET3=m
|
||||
CONFIG_INPUT_EVDEV=y
|
||||
CONFIG_INPUT_TABLET=y
|
||||
# CONFIG_LEGACY_PTYS is not set
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_SERIAL_8250_NR_UARTS=32
|
||||
CONFIG_SERIAL_8250_EXTENDED=y
|
||||
CONFIG_SERIAL_8250_MANY_PORTS=y
|
||||
CONFIG_SERIAL_8250_SHARE_IRQ=y
|
||||
CONFIG_SERIAL_8250_DETECT_IRQ=y
|
||||
CONFIG_SERIAL_8250_RSA=y
|
||||
CONFIG_VIRTIO_CONSOLE=m
|
||||
CONFIG_HW_RANDOM=y
|
||||
# CONFIG_HW_RANDOM_INTEL is not set
|
||||
# CONFIG_HW_RANDOM_AMD is not set
|
||||
CONFIG_NVRAM=y
|
||||
CONFIG_HPET=y
|
||||
# CONFIG_HPET_MMAP is not set
|
||||
CONFIG_I2C_I801=y
|
||||
CONFIG_WATCHDOG=y
|
||||
CONFIG_REGULATOR=y
|
||||
CONFIG_AGP=y
|
||||
CONFIG_AGP_AMD64=y
|
||||
CONFIG_AGP_INTEL=y
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_VIRTIO_GPU=m
|
||||
CONFIG_FB=y
|
||||
CONFIG_FB_VESA=y
|
||||
CONFIG_FB_EFI=y
|
||||
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
||||
CONFIG_HIDRAW=y
|
||||
CONFIG_HID_GYRATION=y
|
||||
CONFIG_LOGITECH_FF=y
|
||||
CONFIG_HID_NTRIG=y
|
||||
CONFIG_HID_PANTHERLORD=y
|
||||
CONFIG_PANTHERLORD_FF=y
|
||||
CONFIG_HID_PETALYNX=y
|
||||
CONFIG_HID_SAMSUNG=y
|
||||
CONFIG_HID_SONY=y
|
||||
CONFIG_HID_SUNPLUS=y
|
||||
CONFIG_HID_TOPSEED=y
|
||||
CONFIG_HID_PID=y
|
||||
CONFIG_USB_HIDDEV=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
|
||||
CONFIG_USB_MON=y
|
||||
CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_OHCI_HCD=y
|
||||
CONFIG_USB_UHCI_HCD=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_STORAGE_REALTEK=y
|
||||
CONFIG_USB_STORAGE_DATAFAB=y
|
||||
CONFIG_USB_STORAGE_FREECOM=y
|
||||
CONFIG_USB_STORAGE_ISD200=y
|
||||
CONFIG_USB_STORAGE_USBAT=y
|
||||
CONFIG_USB_STORAGE_SDDR09=y
|
||||
CONFIG_USB_STORAGE_SDDR55=y
|
||||
CONFIG_USB_STORAGE_JUMPSHOT=y
|
||||
CONFIG_USB_STORAGE_ALAUDA=y
|
||||
CONFIG_USB_STORAGE_ONETOUCH=y
|
||||
CONFIG_USB_STORAGE_KARMA=y
|
||||
CONFIG_USB_STORAGE_CYPRESS_ATACB=y
|
||||
CONFIG_USB_STORAGE_ENE_UB6250=y
|
||||
CONFIG_USB_UAS=y
|
||||
CONFIG_USB_SERIAL=m
|
||||
CONFIG_USB_ROLE_SWITCH=y
|
||||
CONFIG_USB_ROLES_INTEL_XHCI=m
|
||||
CONFIG_LEDS_TRIGGERS=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
# CONFIG_RTC_HCTOSYS is not set
|
||||
CONFIG_DMADEVICES=y
|
||||
CONFIG_VIRT_DRIVERS=y
|
||||
CONFIG_VBOXGUEST=m
|
||||
CONFIG_VIRTIO_PCI=m
|
||||
# CONFIG_VIRTIO_PCI_LEGACY is not set
|
||||
CONFIG_VIRTIO_BALLOON=m
|
||||
CONFIG_VIRTIO_INPUT=m
|
||||
CONFIG_VIRTIO_MMIO=m
|
||||
CONFIG_VHOST_NET=m
|
||||
CONFIG_ACPI_WMI=y
|
||||
CONFIG_MXM_WMI=y
|
||||
CONFIG_EEEPC_LAPTOP=y
|
||||
# CONFIG_SURFACE_PLATFORMS is not set
|
||||
CONFIG_AMD_IOMMU=y
|
||||
CONFIG_INTEL_IOMMU=y
|
||||
# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set
|
||||
CONFIG_VIRTIO_IOMMU=m
|
||||
CONFIG_MEMORY=y
|
||||
CONFIG_VALIDATE_FS_PARSER=y
|
||||
CONFIG_EXT2_FS=y
|
||||
CONFIG_EXT3_FS=y
|
||||
CONFIG_EXT4_FS_POSIX_ACL=y
|
||||
CONFIG_EXT4_FS_SECURITY=y
|
||||
CONFIG_QUOTA=y
|
||||
CONFIG_QUOTA_NETLINK_INTERFACE=y
|
||||
# CONFIG_PRINT_QUOTA_WARNING is not set
|
||||
CONFIG_QFMT_V2=y
|
||||
CONFIG_AUTOFS4_FS=y
|
||||
CONFIG_MSDOS_FS=y
|
||||
CONFIG_VFAT_FS=y
|
||||
CONFIG_PROC_KCORE=y
|
||||
CONFIG_TMPFS=y
|
||||
CONFIG_TMPFS_POSIX_ACL=y
|
||||
CONFIG_TMPFS_INODE64=y
|
||||
CONFIG_HUGETLBFS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
CONFIG_NFS_V4=y
|
||||
CONFIG_ROOT_NFS=y
|
||||
CONFIG_NLS_DEFAULT="utf8"
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ASCII=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
CONFIG_NLS_UTF8=y
|
||||
CONFIG_SECURITY=y
|
||||
CONFIG_SECURITY_NETWORK=y
|
||||
CONFIG_SECURITY_SELINUX=y
|
||||
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
|
||||
CONFIG_SECURITY_SELINUX_DISABLE=y
|
||||
CONFIG_CRYPTO_AUTHENC=y
|
||||
CONFIG_CRYPTO_RSA=y
|
||||
CONFIG_CRYPTO_CCM=y
|
||||
CONFIG_CRYPTO_GCM=y
|
||||
CONFIG_CRYPTO_SEQIV=y
|
||||
CONFIG_CRYPTO_ECHAINIV=y
|
||||
CONFIG_CRYPTO_CBC=y
|
||||
CONFIG_CRYPTO_CMAC=y
|
||||
CONFIG_CRYPTO_SHA256=y
|
||||
CONFIG_CRYPTO_AES=y
|
||||
CONFIG_ASYMMETRIC_KEY_TYPE=y
|
||||
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
|
||||
CONFIG_X509_CERTIFICATE_PARSER=y
|
||||
CONFIG_PKCS7_MESSAGE_PARSER=y
|
||||
CONFIG_SYSTEM_TRUSTED_KEYRING=y
|
||||
CONFIG_CRC_CCITT=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
CONFIG_DEBUG_KERNEL=y
|
||||
CONFIG_DEBUG_STACK_USAGE=y
|
||||
# CONFIG_SCHED_DEBUG is not set
|
||||
CONFIG_SCHEDSTATS=y
|
||||
CONFIG_BLK_DEV_IO_TRACE=y
|
||||
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
|
||||
CONFIG_EARLY_PRINTK_DBGP=y
|
||||
CONFIG_DEBUG_BOOT_PARAMS=y
|
||||
55
files/board/arpl/make-img.sh
Executable file
55
files/board/arpl/make-img.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# CONFIG_DIR = .
|
||||
# $1 = Target path = ./output/target
|
||||
# BR2_DL_DIR = ./dl
|
||||
# BINARIES_DIR = ./output/images
|
||||
# BUILD_DIR = ./output/build
|
||||
# BASE_DIR = ./output
|
||||
|
||||
set -e
|
||||
|
||||
# Define some constants
|
||||
MY_ROOT="${CONFIG_DIR}/.."
|
||||
IMAGE_FILE="${MY_ROOT}/arpl.img"
|
||||
BOARD_PATH="${CONFIG_DIR}/board/arpl"
|
||||
|
||||
echo "Creating image file"
|
||||
# Create image zeroed
|
||||
dd if="/dev/zero" of="${IMAGE_FILE}" bs=1M count=250 conv=sync 2>/dev/null
|
||||
# Copy grub stage1 to image
|
||||
dd if="${BOARD_PATH}/grub.bin" of="${IMAGE_FILE}" conv=notrunc,sync 2>/dev/null
|
||||
# Create partitions on image
|
||||
echo -e "n\np\n\n\n+100M\nt\n\n0b\nn\np\n\n\n+100M\nn\np\n\n\n\nw" | fdisk "${IMAGE_FILE}" >/dev/null
|
||||
|
||||
# Force umount, ignore errors
|
||||
sudo umount "${BINARIES_DIR}/p1" 2>/dev/null || true
|
||||
sudo umount "${BINARIES_DIR}/p3" 2>/dev/null || true
|
||||
# Force unsetup of loop device
|
||||
sudSetupo losetup -d "/dev/loop8" 2>/dev/null || true
|
||||
# Setup the loop8 loop device
|
||||
sudo losetup -P "/dev/loop8" "${IMAGE_FILE}"
|
||||
# Format partitions
|
||||
sudo mkdosfs -F32 -n ARPL1 "/dev/loop8p1" >/dev/null 2>&1
|
||||
sudo mkfs.ext2 -F -F -L ARPL2 "/dev/loop8p2" >/dev/null 2>&1
|
||||
sudo mkfs.ext4 -F -F -L ARPL3 "/dev/loop8p3" >/dev/null 2>&1
|
||||
|
||||
echo "Mounting image file"
|
||||
mkdir -p "${BINARIES_DIR}/p1"
|
||||
mkdir -p "${BINARIES_DIR}/p3"
|
||||
sudo mount /dev/loop8p1 "${BINARIES_DIR}/p1"
|
||||
sudo mount /dev/loop8p3 "${BINARIES_DIR}/p3"
|
||||
|
||||
echo "Copying files"
|
||||
sudo cp "${BINARIES_DIR}/bzImage" "${BINARIES_DIR}/p1/bzImage-arpl"
|
||||
sudo cp "${BINARIES_DIR}/rootfs.cpio.xz" "${BINARIES_DIR}/p1/initrd-arpl"
|
||||
sudo cp -R "${BOARD_PATH}/p1/"* "${BINARIES_DIR}/p1"
|
||||
sudo cp -R "${BOARD_PATH}/p3/"* "${BINARIES_DIR}/p3"
|
||||
sync
|
||||
|
||||
echo "Unmount image file"
|
||||
sudo umount "${BINARIES_DIR}/p1"
|
||||
sudo umount "${BINARIES_DIR}/p3"
|
||||
rmdir "${BINARIES_DIR}/p1"
|
||||
rmdir "${BINARIES_DIR}/p3"
|
||||
|
||||
sudo losetup --detach /dev/loop8
|
||||
42
files/board/arpl/overlayfs/etc/inittab
Normal file
42
files/board/arpl/overlayfs/etc/inittab
Normal file
@@ -0,0 +1,42 @@
|
||||
# /etc/inittab
|
||||
#
|
||||
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Note: BusyBox init doesn't support runlevels. The runlevels field is
|
||||
# completely ignored by BusyBox init. If you want runlevels, use
|
||||
# sysvinit.
|
||||
#
|
||||
# Format for each entry: <id>:<runlevels>:<action>:<process>
|
||||
#
|
||||
# id == tty to run on, or empty for /dev/console
|
||||
# runlevels == ignored
|
||||
# action == one of sysinit, respawn, askfirst, wait, and once
|
||||
# process == program to run
|
||||
|
||||
# Startup the system
|
||||
::sysinit:/bin/mount -t proc proc /proc
|
||||
::sysinit:/bin/mount -o remount,rw /
|
||||
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
|
||||
::sysinit:/bin/mount -a
|
||||
::sysinit:/bin/mkdir -p /run/lock/subsys
|
||||
::sysinit:/sbin/swapon -a
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
# now run any rc scripts
|
||||
::sysinit:/etc/init.d/rcS
|
||||
|
||||
# Login in terminals
|
||||
::respawn:/sbin/agetty -a root --noclear tty1
|
||||
ttyS0::askfirst:/sbin/agetty -a root ttyS0 115200 vt100
|
||||
::respawn:/usr/bin/ttyd login -f root
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/sbin/swapoff -a
|
||||
::shutdown:/bin/umount -a -r
|
||||
116
files/board/arpl/overlayfs/etc/ssh/sshd_config
Normal file
116
files/board/arpl/overlayfs/etc/ssh/sshd_config
Normal file
@@ -0,0 +1,116 @@
|
||||
# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
|
||||
|
||||
# This is the sshd server system-wide configuration file. See
|
||||
# sshd_config(5) for more information.
|
||||
|
||||
# This sshd was compiled with PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
|
||||
# The strategy used for options in the default sshd_config shipped with
|
||||
# OpenSSH is to specify options with their default value where
|
||||
# possible, but leave them commented. Uncommented options override the
|
||||
# default value.
|
||||
|
||||
#Port 22
|
||||
#AddressFamily any
|
||||
#ListenAddress 0.0.0.0
|
||||
#ListenAddress ::
|
||||
|
||||
#HostKey /etc/ssh/ssh_host_rsa_key
|
||||
#HostKey /etc/ssh/ssh_host_ecdsa_key
|
||||
#HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
|
||||
# Ciphers and keying
|
||||
#RekeyLimit default none
|
||||
|
||||
# Logging
|
||||
#SyslogFacility AUTH
|
||||
#LogLevel INFO
|
||||
|
||||
# Authentication:
|
||||
|
||||
#LoginGraceTime 2m
|
||||
PermitRootLogin yes
|
||||
#StrictModes yes
|
||||
#MaxAuthTries 6
|
||||
#MaxSessions 10
|
||||
|
||||
#PubkeyAuthentication yes
|
||||
|
||||
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
|
||||
# but this is overridden so installations will only check .ssh/authorized_keys
|
||||
AuthorizedKeysFile .ssh/authorized_keys
|
||||
|
||||
#AuthorizedPrincipalsFile none
|
||||
|
||||
#AuthorizedKeysCommand none
|
||||
#AuthorizedKeysCommandUser nobody
|
||||
|
||||
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
|
||||
#HostbasedAuthentication no
|
||||
# Change to yes if you don't trust ~/.ssh/known_hosts for
|
||||
# HostbasedAuthentication
|
||||
#IgnoreUserKnownHosts no
|
||||
# Don't read the user's ~/.rhosts and ~/.shosts files
|
||||
#IgnoreRhosts yes
|
||||
|
||||
# To disable tunneled clear text passwords, change to no here!
|
||||
#PasswordAuthentication yes
|
||||
#PermitEmptyPasswords no
|
||||
|
||||
# Change to no to disable s/key passwords
|
||||
#KbdInteractiveAuthentication yes
|
||||
|
||||
# Kerberos options
|
||||
#KerberosAuthentication no
|
||||
#KerberosOrLocalPasswd yes
|
||||
#KerberosTicketCleanup yes
|
||||
#KerberosGetAFSToken no
|
||||
|
||||
# GSSAPI options
|
||||
#GSSAPIAuthentication no
|
||||
#GSSAPICleanupCredentials yes
|
||||
|
||||
# Set this to 'yes' to enable PAM authentication, account processing,
|
||||
# and session processing. If this is enabled, PAM authentication will
|
||||
# be allowed through the KbdInteractiveAuthentication and
|
||||
# PasswordAuthentication. Depending on your PAM configuration,
|
||||
# PAM authentication via KbdInteractiveAuthentication may bypass
|
||||
# the setting of "PermitRootLogin without-password".
|
||||
# If you just want the PAM account and session checks to run without
|
||||
# PAM authentication, then enable this but set PasswordAuthentication
|
||||
# and KbdInteractiveAuthentication to 'no'.
|
||||
#UsePAM no
|
||||
|
||||
#AllowAgentForwarding yes
|
||||
#AllowTcpForwarding yes
|
||||
#GatewayPorts no
|
||||
#X11Forwarding no
|
||||
#X11DisplayOffset 10
|
||||
#X11UseLocalhost yes
|
||||
#PermitTTY yes
|
||||
#PrintMotd yes
|
||||
#PrintLastLog yes
|
||||
#TCPKeepAlive yes
|
||||
#PermitUserEnvironment no
|
||||
#Compression delayed
|
||||
#ClientAliveInterval 0
|
||||
#ClientAliveCountMax 3
|
||||
#UseDNS no
|
||||
#PidFile /var/run/sshd.pid
|
||||
#MaxStartups 10:30:100
|
||||
#PermitTunnel no
|
||||
#ChrootDirectory none
|
||||
#VersionAddendum none
|
||||
|
||||
# no default banner path
|
||||
#Banner none
|
||||
|
||||
# override default of no subsystems
|
||||
Subsystem sftp /usr/libexec/sftp-server
|
||||
|
||||
# Example of overriding settings on a per-user basis
|
||||
#Match User anoncvs
|
||||
# X11Forwarding no
|
||||
# AllowTcpForwarding no
|
||||
# PermitTTY no
|
||||
# ForceCommand cvs server
|
||||
109
files/board/arpl/overlayfs/opt/arpl/boot.sh
Executable file
109
files/board/arpl/overlayfs/opt/arpl/boot.sh
Executable file
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
. /opt/arpl/include/functions.sh
|
||||
|
||||
# Sanity check
|
||||
loaderIsConfigured || die "Loader is not configured!"
|
||||
|
||||
# Print text centralized, if variable ${COLUMNS} is defined
|
||||
clear
|
||||
TITLE="BOOTING..."
|
||||
if [ -z "${COLUMNS}" ]; then
|
||||
echo -e "\033[1;33m${TITLE}\033[0m"
|
||||
else
|
||||
printf "\033[1;33m%*s\033[0m\n" $(((${#TITLE}+${COLUMNS})/2)) "${TITLE}"
|
||||
fi
|
||||
|
||||
# Check if DSM zImage changed, patch it if necessary
|
||||
ZIMAGE_HASH="`readConfigKey "zimage-hash" "${USER_CONFIG_FILE}"`"
|
||||
if [ "`sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print$1}'`" != "${ZIMAGE_HASH}" ]; then
|
||||
echo -e "\033[1;43mDSM zImage changed\033[0m"
|
||||
/opt/arpl/zimage-patch.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error" \
|
||||
--msgbox "zImage not patched:\n`<"${LOG_FILE}"`" 12 70
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if DSM ramdisk changed, patch it if necessary
|
||||
RAMDISK_HASH="`readConfigKey "ramdisk-hash" "${USER_CONFIG_FILE}"`"
|
||||
if [ "`sha256sum "${ORI_RDGZ_FILE}" | awk '{print$1}'`" != "${RAMDISK_HASH}" ]; then
|
||||
echo -e "\033[1;43mDSM Ramdisk changed\033[0m"
|
||||
/opt/arpl/ramdisk-patch.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error" \
|
||||
--msgbox "Ramdisk not patched:\n`<"${LOG_FILE}"`" 12 70
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Load necessary variables
|
||||
VID="`readConfigKey "vid" "${USER_CONFIG_FILE}"`"
|
||||
PID="`readConfigKey "pid" "${USER_CONFIG_FILE}"`"
|
||||
MODEL="`readConfigKey "model" "${USER_CONFIG_FILE}"`"
|
||||
BUILD="`readConfigKey "build" "${USER_CONFIG_FILE}"`"
|
||||
SN="`readConfigKey "sn" "${USER_CONFIG_FILE}"`"
|
||||
|
||||
declare -A CMDLINE
|
||||
|
||||
# Fixed values
|
||||
CMDLINE['netif_num']=0
|
||||
# Automatic values
|
||||
CMDLINE['syno_hw_version']="${MODEL}"
|
||||
[ -z "${VID}" ] && VID="0x0000" # Sanity check
|
||||
[ -z "${PID}" ] && PID="0x0000" # Sanity check
|
||||
CMDLINE['vid']="${VID}"
|
||||
CMDLINE['pid']="${PID}"
|
||||
CMDLINE['sn']="${SN}"
|
||||
|
||||
# Read cmdline
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
|
||||
done < <(readModelMap "${MODEL}" "builds.${BUILD}.cmdline")
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
|
||||
|
||||
# Check if machine has EFI
|
||||
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
|
||||
# Read EFI bug value
|
||||
EFI_BUG="`readModelKey "${MODEL}" "builds.${BUILD}.efi-bug"`"
|
||||
|
||||
LOADER_DISK="`blkid | grep 'LABEL="ARPL3"' | cut -d3 -f1`"
|
||||
BUS=`udevadm info --query property --name ${LOADER_DISK} | grep ID_BUS | cut -d= -f2`
|
||||
|
||||
# Prepare command line
|
||||
CMDLINE_LINE=""
|
||||
[ ${EFI} -eq 1 ] && CMDLINE_LINE+="withefi "
|
||||
[ "${BUS}" = "ata" ] && CMDLINE_LINE+="synoboot_satadom=1 "
|
||||
CMDLINE_LINE+="console=ttyS0,115200n8 earlyprintk log_buf_len=32M earlycon=uart8250,io,0x3f8,115200n8 elevator=elevator root=/dev/md0 loglevel=15"
|
||||
for KEY in ${!CMDLINE[@]}; do
|
||||
VALUE="${CMDLINE[${KEY}]}"
|
||||
CMDLINE_LINE+=" ${KEY}"
|
||||
[ -n "${VALUE}" ] && CMDLINE_LINE+="=${VALUE}"
|
||||
done
|
||||
# Escape special chars
|
||||
CMDLINE_LINE=`echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g'`
|
||||
|
||||
# Inform user
|
||||
echo -e "Model: \033[1;36m${MODEL}\033[0m"
|
||||
echo -e "Build: \033[1;36m${BUILD}\033[0m"
|
||||
echo -e "Cmdline:\n\033[1;36m${CMDLINE_LINE}\033[0m"
|
||||
echo -e "\033[1;37mLoading DSM kernel...\033[0m"
|
||||
|
||||
# Executes DSM kernel via KEXEC
|
||||
history -a
|
||||
sync
|
||||
if [ "${EFI_BUG}" = "yes" -a ${EFI} -eq 1 ]; then
|
||||
echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m"
|
||||
kexec --noefi -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
else
|
||||
kexec -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
fi
|
||||
/sbin/swapoff -a >/dev/null 2>&1 || true
|
||||
/bin/umount -a -r >/dev/null 2>&1 || true
|
||||
echo -e "\033[1;37mBooting...\033[0m"
|
||||
kexec -e -a >"${LOG_FILE}" 2>&1 || dieLog
|
||||
16
files/board/arpl/overlayfs/opt/arpl/bzImage-to-vmlinux.sh
Executable file
16
files/board/arpl/overlayfs/opt/arpl/bzImage-to-vmlinux.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
read_u8() {
|
||||
dd if=$1 bs=1 skip=$(( $2 )) count=1 2>/dev/null | od -An -tu1 | grep -Eo '[0-9]+'
|
||||
}
|
||||
read_u32() {
|
||||
dd if=$1 bs=1 skip=$(( $2 )) count=4 2>/dev/null | od -An -tu4 | grep -Eo '[0-9]+'
|
||||
}
|
||||
|
||||
set -x
|
||||
setup_size=$(read_u8 $1 0x1f1)
|
||||
payload_offset=$(read_u32 $1 0x248)
|
||||
payload_length=$(read_u32 $1 0x24c)
|
||||
inner_pos=$(( ($setup_size + 1) * 512 ))
|
||||
|
||||
tail -c+$(( $inner_pos + 1 )) $1 | tail -c+$(( $payload_offset + 1 )) | head -c $(( $payload_length )) | head -c $(($payload_length - 4)) | unlzma > $2
|
||||
42
files/board/arpl/overlayfs/opt/arpl/calc_run_size.sh
Executable file
42
files/board/arpl/overlayfs/opt/arpl/calc_run_size.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Calculate the amount of space needed to run the kernel, including room for
|
||||
# the .bss and .brk sections.
|
||||
#
|
||||
# Usage:
|
||||
# objdump -h a.out | sh calc_run_size.sh
|
||||
|
||||
NUM='\([0-9a-fA-F]*[ \t]*\)'
|
||||
OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"${NUM}${NUM}${NUM}${NUM}"'.*/\1\4/p')
|
||||
if [ -z "$OUT" ] ; then
|
||||
echo "Never found .bss or .brk file offset" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OUT=$(echo ${OUT# })
|
||||
sizeA=$(printf "%d" 0x${OUT%% *})
|
||||
OUT=${OUT#* }
|
||||
offsetA=$(printf "%d" 0x${OUT%% *})
|
||||
OUT=${OUT#* }
|
||||
sizeB=$(printf "%d" 0x${OUT%% *})
|
||||
OUT=${OUT#* }
|
||||
offsetB=$(printf "%d" 0x${OUT%% *})
|
||||
|
||||
run_size=$(( ${offsetA} + ${sizeA} + ${sizeB} ))
|
||||
|
||||
# BFD linker shows the same file offset in ELF.
|
||||
if [ "${offsetA}" -ne "${offsetB}" ] ; then
|
||||
# Gold linker shows them as consecutive.
|
||||
endB=$(( ${offsetB} + ${sizeB} ))
|
||||
if [ "$endB" != "$run_size" ] ; then
|
||||
printf "sizeA: 0x%x\n" ${sizeA} >&2
|
||||
printf "offsetA: 0x%x\n" ${offsetA} >&2
|
||||
printf "sizeB: 0x%x\n" ${sizeB} >&2
|
||||
printf "offsetB: 0x%x\n" ${offsetB} >&2
|
||||
echo ".bss and .brk are non-contiguous" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "%d\n" ${run_size}
|
||||
exit 0
|
||||
245
files/board/arpl/overlayfs/opt/arpl/common.php
Executable file
245
files/board/arpl/overlayfs/opt/arpl/common.php
Executable file
@@ -0,0 +1,245 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file contains usual common functions used by patchers
|
||||
*
|
||||
* Most of the functions here are written to be C-like without utilizing any of the PHP's magic. This functionality is
|
||||
* ultimately intended to be rewritten into a dynamic patcher in C. Making this code compatible wtih simple C (e.g.
|
||||
* by not using fancy regexes) will make it slower in PHP but MUCH easier to rewrite into C later on.
|
||||
*/
|
||||
|
||||
function perr(string $txt, $die = false)
|
||||
{
|
||||
fwrite(STDERR, $txt);
|
||||
if ($die) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getELFSectionAddr(string $elf, string $section, int $pos)
|
||||
{
|
||||
$secAddr = exec(
|
||||
sprintf('readelf -S \'%1$s\' | grep -E \'\s%2$s\s\' | awk -F\'%2$s\' \'{ print $2 }\' | awk \'{ print $%3$d }\'', $elf, str_replace('.', '\.', $section), $pos)
|
||||
);
|
||||
if (!$secAddr) {
|
||||
perr("$section section not found in $elf file\n", true);
|
||||
}
|
||||
|
||||
$secAddr = hexdec(substr($secAddr, -8));
|
||||
perr("Found $section at " . decTo32bUFhex($secAddr) . " in $elf\n");
|
||||
|
||||
return $secAddr;
|
||||
}
|
||||
|
||||
function getELFStringLoc(string $elf, string $text)
|
||||
{
|
||||
$strAddr = exec(
|
||||
sprintf(
|
||||
'readelf -p \'.rodata\' \'%s\' | grep \'%s\' | grep -oE \'\[(\s+)?.+\]\' | grep -oE \'[a-f0-9]+\'',
|
||||
$elf, $text
|
||||
)
|
||||
);
|
||||
|
||||
if (!$strAddr) {
|
||||
perr("$text string not found in $elf file's .rodata section\n", true);
|
||||
}
|
||||
|
||||
$secAddr = hexdec(substr($strAddr, -8));
|
||||
perr("Found \"$text\" at " . decTo32bUFhex($secAddr) . " in $elf\n");
|
||||
|
||||
return $secAddr;
|
||||
}
|
||||
|
||||
function getArgFilePath(int $argn)
|
||||
{
|
||||
global $argv;
|
||||
|
||||
$file = realpath($argv[$argn]);
|
||||
if (!is_file($file) || !$file) {
|
||||
perr("Expected a readable file in argument $argn - found none\n", true);
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts decimal value to 32-bit little-endian hex value
|
||||
*/
|
||||
function decTo32bLEhex(int $dec)
|
||||
{
|
||||
$hex = str_pad(dechex($dec), 32 / 8 * 2, 'f', STR_PAD_LEFT); //32-bit hex
|
||||
|
||||
return implode('', array_reverse(str_split($hex, 2))); //make it little-endian
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts decimal value to 32-bit user-friendly (and big-endian) hex value
|
||||
*
|
||||
* This function should really be used for printing
|
||||
*/
|
||||
function decTo32bUFhex(int $dec)
|
||||
{
|
||||
return implode(' ', str_split(str_pad(dechex($dec), 32 / 8 * 2, 'f', STR_PAD_LEFT), 2));
|
||||
}
|
||||
|
||||
function rawToUFhex(string $raw)
|
||||
{
|
||||
$out = '';
|
||||
for($i=0, $iMax = strlen($raw); $i < $iMax; $i++) {
|
||||
$out .= sprintf('%02x', ord($raw[$i]));
|
||||
|
||||
if ($i+1 !== $iMax) {
|
||||
$out .= ' ';
|
||||
}
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert hex values to their binary/raw counterparts as-is
|
||||
*/
|
||||
function hex2raw(string $hex)
|
||||
{
|
||||
$bin = '';
|
||||
for ($i = 0, $iMax = strlen($hex); $i < $iMax; $i += 2) {
|
||||
$bin .= chr(hexdec($hex[$i] . $hex[$i + 1]));
|
||||
}
|
||||
|
||||
return $bin;
|
||||
}
|
||||
|
||||
const DIR_FWD = 1;
|
||||
const DIR_RWD = -1;
|
||||
function findSequence($fp, string $bin, int $pos, int $dir, int $maxToCheck)
|
||||
{
|
||||
if ($maxToCheck === -1) {
|
||||
$maxToCheck = PHP_INT_MAX;
|
||||
}
|
||||
|
||||
$len = strlen($bin);
|
||||
do {
|
||||
fseek($fp, $pos);
|
||||
if (strcmp(fread($fp, $len), $bin) === 0) {
|
||||
return $pos;
|
||||
}
|
||||
|
||||
$pos = $pos + $dir;
|
||||
$maxToCheck--;
|
||||
} while (!feof($fp) && $pos != -1 && $maxToCheck != 0);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates a pattern of bytes $searchSeqNum in a $fp stream starting from $pos seeking up to $maxToCheck
|
||||
*
|
||||
* @param array $searchSeqNum An array containing n elements (where n=length of the searched sequence). Each element can
|
||||
* be a null (denoting "any byte"), singular hex/int value (e.g. 0xF5), or a range in a form
|
||||
* of a two-element array (e.g. [0xF0, 0xF7])
|
||||
*/
|
||||
function findSequenceWithWildcard($fp, array $searchSeqNum, int $pos, int $maxToCheck)
|
||||
{
|
||||
if ($maxToCheck === -1) {
|
||||
$maxToCheck = PHP_INT_MAX;
|
||||
}
|
||||
|
||||
$bufLen = count($searchSeqNum);
|
||||
if ($maxToCheck < $bufLen) {
|
||||
perr("maxToCheck cannot be smaller than search sequence!", true);
|
||||
}
|
||||
|
||||
//Convert all singular value to raw bytes while leaving arrays as numeric (performance reasons). As this loop is
|
||||
//executed once per pattern it can be sub-optimal but more careful with data validation
|
||||
$searchSeq = [];
|
||||
foreach ($searchSeqNum as $idx => $num) {
|
||||
if ($num === null) {
|
||||
$searchSeq[] = null;
|
||||
} elseif (is_array($num) && count($num) == 2 && is_int($num[0]) && is_int($num[1]) && $num[0] >= 0 &&
|
||||
$num[0] <= 255 && $num[1] >= 0 && $num[1] <= 255 && $num[0] < $num[1]) {
|
||||
$searchSeq[] = $num; //Leave them as numeric
|
||||
} elseif (is_int($num) && $num >= 0 && $num <= 255) {
|
||||
$searchSeq[] = chr($num);
|
||||
} else {
|
||||
perr("Found invalid search sequence at index $idx", true);
|
||||
}
|
||||
}
|
||||
|
||||
//$pos denotes start position but it's also used to mark where start of a potential pattern match was found
|
||||
fseek($fp, $pos);
|
||||
do { //This loop is optimized for speed
|
||||
$buf = fread($fp, $bufLen);
|
||||
if (!isset($buf[$bufLen-1])) {
|
||||
break; //Not enough data = no match
|
||||
}
|
||||
|
||||
$successfulLoops = 0;
|
||||
foreach ($searchSeq as $byteIdx => $seekByte) {
|
||||
if ($seekByte === null) { //any character
|
||||
++$successfulLoops;
|
||||
continue;
|
||||
}
|
||||
|
||||
//element in the array can be a range [(int)from,(int)to] or a literal SINGLE byte
|
||||
//if isset finds a second element it will mean for us that it's an array of 2 elements (as we don't expect
|
||||
//a string longer than a single byte)
|
||||
if (isset($seekByte[1])) {
|
||||
$curByteNum = ord($buf[$byteIdx]);
|
||||
if ($curByteNum < $seekByte[0] || $curByteNum > $seekByte[1]) {
|
||||
break;
|
||||
}
|
||||
} elseif($buf[$byteIdx] !== $seekByte) { //If the byte doesn't match literally we know it's not a match
|
||||
break;
|
||||
}
|
||||
|
||||
++$successfulLoops;
|
||||
}
|
||||
if ($successfulLoops === $bufLen) {
|
||||
return $pos;
|
||||
}
|
||||
|
||||
fseek($fp, ++$pos);
|
||||
$maxToCheck--;
|
||||
} while (!feof($fp) && $maxToCheck != 0);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
function getFileMemMapped(string $path)
|
||||
{
|
||||
$fp = fopen('php://memory', 'r+');
|
||||
fwrite($fp, file_get_contents($path)); //poor man's mmap :D
|
||||
|
||||
return $fp;
|
||||
}
|
||||
|
||||
function saveStreamToFile($fp, string $path)
|
||||
{
|
||||
perr("Saving stream to $path ...\n");
|
||||
|
||||
$fp2 = fopen($path, 'w');
|
||||
fseek($fp, 0);
|
||||
while (!feof($fp)) {
|
||||
fwrite($fp2, fread($fp, 8192));
|
||||
}
|
||||
fclose($fp2);
|
||||
|
||||
perr("DONE!\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not call this in time-sensitive code...
|
||||
*/
|
||||
function readAt($fp, int $pos, int $len)
|
||||
{
|
||||
fseek($fp, $pos);
|
||||
return fread($fp, $len);
|
||||
}
|
||||
8
files/board/arpl/overlayfs/opt/arpl/crc32.php
Executable file
8
files/board/arpl/overlayfs/opt/arpl/crc32.php
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
if ($argc < 2 || $argc > 2) {
|
||||
fwrite(STDERR, "Usage: " . $argv[0] . " <file>\n");
|
||||
die();
|
||||
}
|
||||
echo hash_file('crc32b', $argv[1]);
|
||||
?>
|
||||
60
files/board/arpl/overlayfs/opt/arpl/include/addons.sh
Executable file
60
files/board/arpl/overlayfs/opt/arpl/include/addons.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
|
||||
###############################################################################
|
||||
# Return list of available addons
|
||||
# 1 - Platform
|
||||
# 2 - Kernel Version
|
||||
function availableAddons() {
|
||||
while read D; do
|
||||
[ ! -f "${D}/manifest.yml" ] && continue
|
||||
ADDON=`basename ${D}`
|
||||
checkAddonExist "${ADDON}" "${1}" "${2}" || continue
|
||||
SYSTEM=`readConfigKey "system" "${D}/manifest.yml"`
|
||||
[ "${SYSTEM}" = "true" ] && continue
|
||||
DESC="`readConfigKey "description" "${D}/manifest.yml"`"
|
||||
echo -e "${ADDON}\t${DESC}"
|
||||
done < <(find "${ADDONS_PATH}" -maxdepth 1 -type d | sort)
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Check if addon exist
|
||||
# 1 - Addon id
|
||||
# 2 - Platform
|
||||
# 3 - Kernel Version
|
||||
# Return ERROR if not exists
|
||||
function checkAddonExist() {
|
||||
# First check generic files
|
||||
if [ -f "${ADDONS_PATH}/${1}/all.tgz" ]; then
|
||||
return 0 # OK
|
||||
fi
|
||||
# Now check specific platform file
|
||||
if [ -f "${ADDONS_PATH}/${1}/${2}-${3}.tgz" ]; then
|
||||
return 0 # OK
|
||||
fi
|
||||
return 1 # ERROR
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Install Addon into ramdisk image
|
||||
# 1 - Addon id
|
||||
function installAddon() {
|
||||
ADDON="${1}"
|
||||
mkdir -p "${TMP_PATH}/${ADDON}"
|
||||
HAS_FILES=0
|
||||
# First check generic files
|
||||
if [ -f "${ADDONS_PATH}/${ADDON}/all.tgz" ]; then
|
||||
gzip -dc "${ADDONS_PATH}/${ADDON}/all.tgz" | tar xf - -C "${TMP_PATH}/${ADDON}"
|
||||
HAS_FILES=1
|
||||
fi
|
||||
# Now check specific platform files
|
||||
if [ -f "${ADDONS_PATH}/${ADDON}/${PLATFORM}-${KVER}.tgz" ]; then
|
||||
gzip -dc "${ADDONS_PATH}/${ADDON}/${PLATFORM}-${KVER}.tgz" | tar xf - -C "${TMP_PATH}/${ADDON}"
|
||||
HAS_FILES=1
|
||||
fi
|
||||
# If has files to copy, copy it, else return error
|
||||
[ ${HAS_FILES} -ne 1 ] && return 1
|
||||
cp "${TMP_PATH}/${ADDON}/install.sh" "${RAMDISK_PATH}/addons/${ADDON}.sh" 2>"${LOG_FILE}" || dieLog
|
||||
chmod +x "${RAMDISK_PATH}/addons/${ADDON}.sh"
|
||||
[ -d ${TMP_PATH}/${ADDON}/root ] && (cp -R "${TMP_PATH}/${ADDON}/root/"* "${RAMDISK_PATH}/" 2>"${LOG_FILE}" || dieLog)
|
||||
rm -rf "${TMP_PATH}/${ADDON}"
|
||||
return 0
|
||||
}
|
||||
55
files/board/arpl/overlayfs/opt/arpl/include/configFile.sh
Normal file
55
files/board/arpl/overlayfs/opt/arpl/include/configFile.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
###############################################################################
|
||||
# Delete a key in config file
|
||||
# 1 - Path of Key
|
||||
# 2 - Path of yaml config file
|
||||
function deleteConfigKey() {
|
||||
yq eval 'del(.'${1}')' --inplace "${2}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Write to yaml config file
|
||||
# 1 - Path of Key
|
||||
# 2 - Value
|
||||
# 3 - Path of yaml config file
|
||||
function writeConfigKey() {
|
||||
[ "${2}" = "{}" ] && yq eval '.'${1}' = {}' --inplace "${3}" || \
|
||||
yq eval '.'${1}' = "'${2}'"' --inplace "${3}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read key value from yaml config file
|
||||
# 1 - Path of key
|
||||
# 2 - Path of yaml config file
|
||||
# Return Value
|
||||
function readConfigKey() {
|
||||
RESULT=`yq eval '.'${1}' | explode(.)' "${2}"`
|
||||
[ "${RESULT}" == "null" ] && echo "" || echo ${RESULT}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read Entries as map(key=value) from yaml config file
|
||||
# 1 - Path of key
|
||||
# 2 - Path of yaml config file
|
||||
# Returns map of values
|
||||
function readConfigMap() {
|
||||
yq eval '.'${1}' | explode(.) | to_entries | map([.key, .value] | join("=")) | .[]' "${2}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read an array from yaml config file
|
||||
# 1 - Path of key
|
||||
# 2 - Path of yaml config file
|
||||
# Returns array/map of values
|
||||
function readConfigArray() {
|
||||
yq eval '.'${1}'[]' "${2}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read Entries as array from yaml config file
|
||||
# 1 - Path of key
|
||||
# 2 - Path of yaml config file
|
||||
# Returns array of values
|
||||
function readConfigEntriesArray() {
|
||||
yq eval '.'${1}' | explode(.) | to_entries | map([.key])[] | .[]' "${2}"
|
||||
}
|
||||
21
files/board/arpl/overlayfs/opt/arpl/include/consts.sh
Normal file
21
files/board/arpl/overlayfs/opt/arpl/include/consts.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
ARPL_VERSION="0.1-alpha"
|
||||
|
||||
# Define paths
|
||||
TMP_PATH="/tmp"
|
||||
RAMDISK_PATH="${TMP_PATH}/ramdisk"
|
||||
LOG_FILE="${TMP_PATH}/log.txt"
|
||||
|
||||
USER_CONFIG_FILE="${BOOTLOADER_PATH}/user-config.yml"
|
||||
MOD_ZIMAGE_FILE="${BOOTLOADER_PATH}/zImage"
|
||||
MOD_RDGZ_FILE="${BOOTLOADER_PATH}/rd.gz"
|
||||
|
||||
ORI_ZIMAGE_FILE="${SLPART_PATH}/zImage"
|
||||
ORI_RDGZ_FILE="${SLPART_PATH}/rd.gz"
|
||||
|
||||
ADDONS_PATH="${CACHE_PATH}/addons"
|
||||
LKM_PATH="${CACHE_PATH}/lkms"
|
||||
|
||||
MODEL_CONFIG_PATH="/opt/arpl/model-configs"
|
||||
INCLUDE_PATH="/opt/arpl/include"
|
||||
PATCH_PATH="/opt/arpl/patch"
|
||||
148
files/board/arpl/overlayfs/opt/arpl/include/functions.sh
Normal file
148
files/board/arpl/overlayfs/opt/arpl/include/functions.sh
Normal file
@@ -0,0 +1,148 @@
|
||||
|
||||
. /opt/arpl/include/consts.sh
|
||||
. /opt/arpl/include/configFile.sh
|
||||
|
||||
###############################################################################
|
||||
# Read key value from model config file
|
||||
# 1 - Model
|
||||
# 2 - Key
|
||||
# Return Value
|
||||
function readModelKey() {
|
||||
readConfigKey "${2}" "${MODEL_CONFIG_PATH}/${1}.yml"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read Entries as map(key=value) from model config
|
||||
# 1 - Model
|
||||
# 2 - Path of key
|
||||
# Returns map of values
|
||||
function readModelMap() {
|
||||
readConfigMap "${2}" "${MODEL_CONFIG_PATH}/${1}.yml"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read an array from model config
|
||||
# 1 - Model
|
||||
# 2 - Path of key
|
||||
# Returns array/map of values
|
||||
function readModelArray() {
|
||||
readConfigArray "${2}" "${MODEL_CONFIG_PATH}/${1}.yml"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Check if loader is fully configured
|
||||
# Returns 1 if not
|
||||
function loaderIsConfigured() {
|
||||
SN="`readConfigKey "sn" "${USER_CONFIG_FILE}"`"
|
||||
[ -z "${SN}" ] && return 1
|
||||
[ ! -f "${MOD_ZIMAGE_FILE}" ] && return 1
|
||||
[ ! -f "${MOD_RDGZ_FILE}" ] && return 1
|
||||
return 0 # OK
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Just show error message and dies
|
||||
function die() {
|
||||
echo -e "\033[1;41m$@\033[0m"
|
||||
exit 1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Show error message with log content and dies
|
||||
function dieLog() {
|
||||
echo -en "\n\033[1;41mUNRECOVERY ERROR: "
|
||||
cat "${LOG_FILE}"
|
||||
echo -e "\033[0m"
|
||||
sleep 3
|
||||
exit 1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate a number with 6 digits from 1 to 30000
|
||||
function random() {
|
||||
printf "%06d" $(($RANDOM %30000 +1 ))
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate a hexa number from 0x00 to 0xFF
|
||||
function randomhex() {
|
||||
printf "&02X" "$(( $RANDOM %255 +1 ))"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate a random letter
|
||||
function generateRandomLetter() {
|
||||
for i in A B C D E F G H J K L M N P Q R S T V W X Y Z; do
|
||||
echo $i
|
||||
done | sort -R | tail -1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate a random digit (0-9A-Z)
|
||||
function generateRandomValue() {
|
||||
for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F G H J K L M N P Q R S T V W X Y Z; do
|
||||
echo $i
|
||||
done | sort -R | tail -1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate a random serial number for a model
|
||||
# 1 - Model
|
||||
# Returns serial number
|
||||
function generateSerial() {
|
||||
SERIAL="`readModelArray "${1}" "serial.prefix" | sort -R | tail -1`"
|
||||
SERIAL+=`readModelKey "${1}" "serial.middle"`
|
||||
case "`readModelKey "${1}" "serial.suffix"`" in
|
||||
numeric)
|
||||
SERIAL+=$(random)
|
||||
;;
|
||||
alpha)
|
||||
SERIAL+=$(generateRandomLetter)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomLetter)
|
||||
;;
|
||||
esac
|
||||
echo ${SERIAL}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Validate a serial number for a model
|
||||
# 1 - Model
|
||||
# 2 - Serial number to test
|
||||
# Returns 1 if serial number is valid
|
||||
function validateSerial() {
|
||||
PREFIX=`readModelArray "${1}" "serial.prefix"`
|
||||
MIDDLE=`readModelKey "${1}" "serial.middle"`
|
||||
S=${2:0:4}
|
||||
P=${2:4:3}
|
||||
L=${#2}
|
||||
if [ ${L} -ne 13 ]; then
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
echo ${PREFIX} | grep -q ${S}
|
||||
if [ $? -eq 1 ]; then
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
if [ "${MIDDLE}" != "${P}" ]; then
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
echo 1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Check if a item exists into array
|
||||
# 1 - Item
|
||||
# 2.. - Array
|
||||
# Return 0 if exists
|
||||
function arrayExistItem() {
|
||||
EXISTS=1
|
||||
ITEM="${1}"
|
||||
shift
|
||||
for i in "$@"; do
|
||||
[ "${i}" = "${ITEM}" ] || continue
|
||||
EXISTS=0
|
||||
break
|
||||
done
|
||||
return ${EXISTS}
|
||||
}
|
||||
148
files/board/arpl/overlayfs/opt/arpl/init.sh
Executable file
148
files/board/arpl/overlayfs/opt/arpl/init.sh
Executable file
@@ -0,0 +1,148 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /opt/arpl/include/functions.sh
|
||||
|
||||
set -e
|
||||
|
||||
# Wait kernel enumerate the disks
|
||||
CNT=3
|
||||
while true; do
|
||||
[ ${CNT} -eq 0 ] && break
|
||||
LOADER_DISK="`blkid | grep 'LABEL="ARPL3"' | cut -d3 -f1`"
|
||||
[ -n "${LOADER_DISK}" ] && break
|
||||
CNT=$((${CNT}-1))
|
||||
sleep 1
|
||||
done
|
||||
if [ -z "${LOADER_DISK}" ]; then
|
||||
die "Loader disk not found!"
|
||||
fi
|
||||
NUM_PARTITIONS=$(blkid | grep "${LOADER_DISK}" | cut -d: -f1 | wc -l)
|
||||
if [ $NUM_PARTITIONS -ne 3 ]; then
|
||||
die "Loader disk not found!"
|
||||
fi
|
||||
|
||||
# Check partitions and ignore errors
|
||||
fsck.vfat -aw ${LOADER_DISK}1 >/dev/null 2>&1 || true
|
||||
fsck.ext2 -p ${LOADER_DISK}2 >/dev/null 2>&1 || true
|
||||
fsck.ext2 -p ${LOADER_DISK}3 >/dev/null 2>&1 || true
|
||||
# Make folders to mount partitions
|
||||
mkdir -p ${BOOTLOADER_PATH}
|
||||
mkdir -p ${SLPART_PATH}
|
||||
mkdir -p ${CACHE_PATH}
|
||||
# Mount the partitions
|
||||
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}3 ${CACHE_PATH} || die "Can't mount ${CACHE_PATH}"
|
||||
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
# Move/link SSH machine keys to/from cache volume
|
||||
[ ! -d "${CACHE_PATH}/ssh" ] && cp -R "/etc/ssh" "${CACHE_PATH}/ssh"
|
||||
rm -rf "/etc/ssh"
|
||||
ln -s "${CACHE_PATH}/ssh" "/etc/ssh"
|
||||
# Link bash history to cache volume
|
||||
rm -rf ~/.bash_history
|
||||
ln -s ${CACHE_PATH}/.bash_history ~/.bash_history
|
||||
|
||||
# If user config file not exists, initialize it
|
||||
if [ ! -f "${USER_CONFIG_FILE}" ]; then
|
||||
touch "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "lkm" "dev" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "model" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "build" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "keymap" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Get the VID/PID if we are in USB
|
||||
VID="0x0000"
|
||||
PID="0x0000"
|
||||
BUS=`udevadm info --query property --name ${LOADER_DISK} | grep BUS | cut -d= -f2`
|
||||
if [ "${BUS}" = "usb" ]; then
|
||||
VID="0x`udevadm info --query property --name ${LOADER_DISK} | grep ID_VENDOR_ID | cut -d= -f2`"
|
||||
PID="0x`udevadm info --query property --name ${LOADER_DISK} | grep ID_MODEL_ID | cut -d= -f2`"
|
||||
elif [ "${BUS}" != "ata" ]; then
|
||||
die "Loader disk neither USB or DoM"
|
||||
fi
|
||||
|
||||
# Save variables to user config file
|
||||
writeConfigKey "vid" ${VID} "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pid" ${PID} "${USER_CONFIG_FILE}"
|
||||
|
||||
# Shows title
|
||||
clear
|
||||
TITLE="Welcome to Automated Redpill Loader ${ARPL_VERSION}"
|
||||
printf "\033[1;44m%*s\n" $COLUMNS ""
|
||||
printf "\033[1;32m%*s%*s \033[0m\n" $(((${#TITLE}+$COLUMNS)/2)) "${TITLE}" $(((${#TITLE}+$COLUMNS)/2-${#TITLE})) ""
|
||||
printf "\033[1;44m%*s\033[0m\n" $COLUMNS ""
|
||||
|
||||
# Inform user
|
||||
echo -en "Loader disk: \033[1;32m${LOADER_DISK}\033[0m ("
|
||||
if [ "${BUS}" = "usb" ]; then
|
||||
echo -en "\033[1;32mUSB flashdisk\033[0m"
|
||||
else
|
||||
echo -en "\033[1;32mSATA DoM\033[0m"
|
||||
fi
|
||||
echo ")"
|
||||
|
||||
# Check if partition 3 occupies all free space, resize if needed
|
||||
LOADER_DEVICE_NAME=`echo ${LOADER_DISK} | sed 's|/dev/||'`
|
||||
SIZEOFDISK=`cat /sys/block/${LOADER_DEVICE_NAME}/size`
|
||||
ENDSECTOR=$((`fdisk -l ${LOADER_DISK} | awk '/'${LOADER_DEVICE_NAME}3'/{print$3}'`+1))
|
||||
if [ ${SIZEOFDISK} -ne ${ENDSECTOR} ]; then
|
||||
echo -e "\033[1;36mResizing ${LOADER_DISK}3\033[0m"
|
||||
echo -e "d\n\nn\n\n\n\n\nn\nw" | fdisk "${LOADER_DISK}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
resize2fs ${LOADER_DISK}3 >"${LOG_FILE}" 2>&1 || dieLog
|
||||
fi
|
||||
|
||||
# Load keymap name
|
||||
KEYMAP="`readConfigKey "keymap" "${USER_CONFIG_FILE}"`"
|
||||
|
||||
# Loads a keymap if is valid
|
||||
if [ -f /usr/share/keymaps/i386/qwerty/${KEYMAP}.map.gz ]; then
|
||||
echo -e "Loading keymap \033[1;32m${KEYMAP}\033[0m"
|
||||
zcat /usr/share/keymaps/i386/qwerty/${KEYMAP}.map.gz | loadkeys
|
||||
fi
|
||||
|
||||
# Decide if boot automatically
|
||||
BOOT=1
|
||||
if ! loaderIsConfigured; then
|
||||
echo -e "\033[1;33mLoader is not configured!\033[0m"
|
||||
BOOT=0
|
||||
elif grep -q "IWANTTOCHANGETHECONFIG" /proc/cmdline; then
|
||||
echo -e "\033[1;33mUser requested edit settings.\033[0m"
|
||||
BOOT=0
|
||||
fi
|
||||
|
||||
# If is to boot automatically, do it
|
||||
[ ${BOOT} -eq 1 ] && boot.sh
|
||||
|
||||
# Wait for an IP
|
||||
COUNT=0
|
||||
echo -n "Waiting IP."
|
||||
while true; do
|
||||
if [ ${COUNT} -eq 15 ]; then
|
||||
echo "ERROR"
|
||||
break
|
||||
fi
|
||||
COUNT=$((${COUNT}+1))
|
||||
IP=`ip route get 1.1.1.1 2>/dev/null | awk '{print$7}'`
|
||||
if [ -n "${IP}" ]; then
|
||||
echo -en "OK\nAccess \033[1;34mhttp://${IP}:7681\033[0m to configure the loader via web terminal"
|
||||
break
|
||||
fi
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Inform user
|
||||
echo
|
||||
echo -e "Call \033[1;32mmenu.sh\033[0m to configure loader"
|
||||
echo
|
||||
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
|
||||
812
files/board/arpl/overlayfs/opt/arpl/menu.sh
Executable file
812
files/board/arpl/overlayfs/opt/arpl/menu.sh
Executable file
@@ -0,0 +1,812 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /opt/arpl/include/functions.sh
|
||||
. /opt/arpl/include/addons.sh
|
||||
|
||||
# Check partition 3 space, if < 2GiB uses ramdisk
|
||||
RAMCACHE=0
|
||||
LOADER_DISK="`blkid | grep 'LABEL="ARPL3"' | cut -d3 -f1`"
|
||||
LOADER_DEVICE_NAME=`echo ${LOADER_DISK} | sed 's|/dev/||'`
|
||||
if [ `cat /sys/block/${LOADER_DEVICE_NAME}/${LOADER_DEVICE_NAME}3/size` -lt 4194304 ]; then
|
||||
RAMCACHE=1
|
||||
fi
|
||||
|
||||
# Get actual IP
|
||||
IP=`ip route get 1.1.1.1 2>/dev/null | awk '{print$7}'`
|
||||
|
||||
# Define classes for hw detection
|
||||
declare -A CLASSES
|
||||
CLASSES["0100"]="SCSI"
|
||||
CLASSES["0106"]="SATA"
|
||||
CLASSES["0101"]="IDE"
|
||||
CLASSES["0107"]="SAS"
|
||||
CLASSES["0200"]="Ethernet"
|
||||
CLASSES["0300"]="VGA"
|
||||
CLASSES["0c03"]="USB Controller"
|
||||
CLASSES["0c04"]="Fiber Channel"
|
||||
|
||||
# Dirty flag
|
||||
DIRTY=0
|
||||
|
||||
MODEL="`readConfigKey "model" "${USER_CONFIG_FILE}"`"
|
||||
BUILD="`readConfigKey "build" "${USER_CONFIG_FILE}"`"
|
||||
KEYMAP="`readConfigKey "keymap" "${USER_CONFIG_FILE}"`"
|
||||
LKM="`readConfigKey "lkm" "${USER_CONFIG_FILE}"`"
|
||||
SN="`readConfigKey "sn" "${USER_CONFIG_FILE}"`"
|
||||
|
||||
###############################################################################
|
||||
# Mounts backtitle dynamically
|
||||
function backtitle() {
|
||||
BACKTITLE="ARPL ${ARPL_VERSION}"
|
||||
if [ -n "${MODEL}" ]; then
|
||||
BACKTITLE+=" ${MODEL}"
|
||||
else
|
||||
BACKTITLE+=" (no model)"
|
||||
fi
|
||||
if [ -n "${BUILD}" ]; then
|
||||
BACKTITLE+=" ${BUILD}"
|
||||
else
|
||||
BACKTITLE+=" (no build)"
|
||||
fi
|
||||
if [ -n "${SN}" ]; then
|
||||
BACKTITLE+=" ${SN}"
|
||||
else
|
||||
BACKTITLE+=" (no SN)"
|
||||
fi
|
||||
if [ -n "${IP}" ]; then
|
||||
BACKTITLE+=" ${IP}"
|
||||
else
|
||||
BACKTITLE+=" (no IP)"
|
||||
fi
|
||||
if [ -n "${KEYMAP}" ]; then
|
||||
BACKTITLE+=" (${KEYMAP})"
|
||||
else
|
||||
BACKTITLE+=" (us)"
|
||||
fi
|
||||
echo ${BACKTITLE}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Shows available models to user choose one
|
||||
function modelMenu() {
|
||||
ITEMS=""
|
||||
while read M; do
|
||||
M="`basename ${M}`"
|
||||
M="${M::-4}"
|
||||
# Check id model is compatible with CPU
|
||||
COMPATIBLE=1
|
||||
for F in `readModelArray "${M}" "flags"`; do
|
||||
if ! grep -q "^flags.*${F}.*" /proc/cpuinfo; then
|
||||
COMPATIBLE=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ ${COMPATIBLE} -eq 1 ] && ITEMS+="${M} "
|
||||
done < <(find "${MODEL_CONFIG_PATH}" -maxdepth 1 -name \*.yml | sort)
|
||||
dialog --clear --no-items \
|
||||
--backtitle "`backtitle`" \
|
||||
--menu "Choose the model" 0 0 0 \
|
||||
${ITEMS} \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(<${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
# If user change model, clean buildnumber and S/N
|
||||
if [ "${MODEL}" != "${resp}" ]; then
|
||||
MODEL=${resp}
|
||||
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
|
||||
BUILD=""
|
||||
writeConfigKey "build" "${BUILD}" "${USER_CONFIG_FILE}"
|
||||
SN=""
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
# Delete old files
|
||||
rm -f "${MOD_ZIMAGE_FILE}"
|
||||
rm -f "${MOD_RDGZ_FILE}"
|
||||
DIRTY=1
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Shows available buildnumbers from a model to user choose one
|
||||
function buildMenu() {
|
||||
ITEMS="`readConfigEntriesArray "builds" "${MODEL_CONFIG_PATH}/${MODEL}.yml"`"
|
||||
dialog --clear --no-items --backtitle "`backtitle`" \
|
||||
--menu "Choose a build number" 0 0 0 ${ITEMS} 2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(<${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
if [ "${BUILD}" != "${resp}" ]; then
|
||||
BUILD=${resp}
|
||||
writeConfigKey "build" "${BUILD}" "${USER_CONFIG_FILE}"
|
||||
DIRTY=1
|
||||
# Remove old files
|
||||
rm -f "${MOD_ZIMAGE_FILE}"
|
||||
rm -f "${MOD_RDGZ_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Shows menu to user type one or generate randomly
|
||||
function serialMenu() {
|
||||
while true; do
|
||||
dialog --clear --backtitle "`backtitle`" \
|
||||
--menu "Choose a option" 0 0 0 \
|
||||
a "Generate a random serial number" \
|
||||
m "Enter a serial number" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(<${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
if [ "${resp}" = "m" ]; then
|
||||
while true; do
|
||||
dialog --backtitle "`backtitle`" \
|
||||
--inputbox "Please enter a serial number " 0 0 "" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
SERIAL=`cat ${TMP_PATH}/resp`
|
||||
if [ -z "${SERIAL}" ]; then
|
||||
return
|
||||
elif [ `validateSerial ${MODEL} ${SERIAL}` -eq 1 ]; then
|
||||
break
|
||||
fi
|
||||
dialog --backtitle "`backtitle`" \
|
||||
--msgbox "Invalid serial, please type a right one" 0 0
|
||||
done
|
||||
break
|
||||
elif [ "${resp}" = "a" ]; then
|
||||
SERIAL=`generateSerial "${MODEL}"`
|
||||
break
|
||||
fi
|
||||
done
|
||||
SN="${SERIAL}"
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Where the magic happens :D
|
||||
function make() {
|
||||
clear
|
||||
PLATFORM="`readModelKey "${MODEL}" "platform"`"
|
||||
KVER="`readModelKey "${MODEL}" "builds.${BUILD}.kver"`"
|
||||
PAT_URL="`readModelKey "${MODEL}" "builds.${BUILD}.pat.url"`"
|
||||
PAT_HASH="`readModelKey "${MODEL}" "builds.${BUILD}.pat.hash"`"
|
||||
RAMDISK_HASH="`readModelKey "${MODEL}" "builds.${BUILD}.pat.ramdisk-hash"`"
|
||||
ZIMAGE_HASH="`readModelKey "${MODEL}" "builds.${BUILD}.pat.zimage-hash"`"
|
||||
|
||||
# Check if all addon exists
|
||||
while IFS="=" read ADDON PARAM; do
|
||||
[ -z "${KEY}" ] && continue
|
||||
if ! checkAddonExist "${ADDON}" "${PLATFORM}" "${KVER}"; then
|
||||
echo "Addon ${ADDON} not found!"
|
||||
return 1
|
||||
fi
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
|
||||
if [ ${RAMCACHE} -eq 0 ]; then
|
||||
OUT_PATH="${CACHE_PATH}/dl"
|
||||
echo "Cache in disk"
|
||||
else
|
||||
OUT_PATH="${TMP_PATH}/dl"
|
||||
echo "Cache in ram"
|
||||
fi
|
||||
mkdir -p "${OUT_PATH}"
|
||||
|
||||
UNTAR_PAT_PATH="${TMP_PATH}/pat"
|
||||
PAT_FILE="${MODEL}-${BUILD}.pat"
|
||||
PAT_PATH="${OUT_PATH}/${PAT_FILE}"
|
||||
EXTRACTOR_PATH="${CACHE_PATH}/extractor"
|
||||
EXTRACTOR_BIN="syno_extract_system_patch"
|
||||
OLDPAT_URL="https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS3622xs%2B_42218.pat"
|
||||
OLDPAT_PATH="${OUT_PATH}/DS3622xs+-42218.pat"
|
||||
|
||||
if [ -f "${PAT_PATH}" ]; then
|
||||
echo "${PAT_FILE} cached."
|
||||
else
|
||||
echo "Downloading ${PAT_FILE}"
|
||||
curl --insecure -L "${PAT_URL}" -o "${PAT_PATH}" --progress-bar
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error downloading" --aspect 18 \
|
||||
--msgbox "Check internet or cache disk space" 0 0
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "Checking hash of ${PAT_FILE}: "
|
||||
if [ "`sha256sum ${PAT_PATH} | awk '{print$1}'`" != "${PAT_HASH}" ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error" --aspect 18 \
|
||||
--msgbox "Hash of pat not match, try again!" 0 0
|
||||
rm -f ${PAT_PATH}
|
||||
return 1
|
||||
fi
|
||||
echo "OK"
|
||||
|
||||
rm -rf "${UNTAR_PAT_PATH}"
|
||||
mkdir "${UNTAR_PAT_PATH}"
|
||||
echo -n "Disassembling ${PAT_FILE}: "
|
||||
|
||||
header="$(od -bcN2 ${PAT_PATH} | head -1 | awk '{print $3}')"
|
||||
case ${header} in
|
||||
105)
|
||||
echo "Uncompressed tar"
|
||||
isencrypted="no"
|
||||
;;
|
||||
213)
|
||||
echo "Compressed tar"
|
||||
isencrypted="no"
|
||||
;;
|
||||
255)
|
||||
echo "Encrypted"
|
||||
isencrypted="yes"
|
||||
;;
|
||||
*)
|
||||
dialog --backtitle "`backtitle`" --title "Error" --aspect 18 \
|
||||
--msgbox "Could not determine if pat file is encrypted or not, maybe corrupted, try again!" \
|
||||
0 0
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${isencrypted}" = "yes" ]; then
|
||||
# Check existance of extractor
|
||||
if [ -f "${EXTRACTOR_PATH}/${EXTRACTOR_BIN}" ]; then
|
||||
echo "Extractor cached."
|
||||
else
|
||||
# Extractor not exists, get it.
|
||||
mkdir -p "${EXTRACTOR_PATH}"
|
||||
# Check if old pat already downloaded
|
||||
if [ ! -f "${OLDPAT_PATH}" ]; then
|
||||
echo "Downloading old pat to extract synology .pat extractor..."
|
||||
curl --insecure -L "${OLDPAT_URL}" \
|
||||
-o "${OLDPAT_PATH}" --progress-bar
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error downloading" --aspect 18 \
|
||||
--msgbox "Check internet or cache disk space" 0 0
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
# Extract ramdisk from PAT
|
||||
rm -rf "${RAMDISK_PATH}"
|
||||
mkdir -p "${RAMDISK_PATH}"
|
||||
tar -xf "${OLDPAT_PATH}" -C "${RAMDISK_PATH}" rd.gz >"${LOG_FILE}" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error extracting" --textbox "${LOG_FILE}" 0 0
|
||||
fi
|
||||
|
||||
# Extract all files from rd.gz
|
||||
(cd "${RAMDISK_PATH}"; xz -dc < rd.gz | cpio -idm) >/dev/null 2>&1 || true
|
||||
# Copy only necessary files
|
||||
for f in libcurl.so.4 libmbedcrypto.so.5 libmbedtls.so.13 libmbedx509.so.1 libmsgpackc.so.2 libsodium.so libsynocodesign-ng-virtual-junior-wins.so.7; do
|
||||
cp "${RAMDISK_PATH}/usr/lib/${f}" "${EXTRACTOR_PATH}"
|
||||
done
|
||||
cp "${RAMDISK_PATH}/usr/syno/bin/scemd" "${EXTRACTOR_PATH}/${EXTRACTOR_BIN}"
|
||||
rm -rf "${RAMDISK_PATH}"
|
||||
fi
|
||||
# Uses the extractor to untar pat file
|
||||
echo "Extracting..."
|
||||
LD_LIBRARY_PATH=${EXTRACTOR_PATH} "${EXTRACTOR_PATH}/${EXTRACTOR_BIN}" "${PAT_PATH}" "${UNTAR_PAT_PATH}" || true
|
||||
else
|
||||
echo "Extracting..."
|
||||
tar -xf "${PAT_PATH}" -C "${UNTAR_PAT_PATH}" >"${LOG_FILE}" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error extracting" --textbox "${LOG_FILE}" 0 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "Checking hash of zImage: "
|
||||
HASH="`sha256sum ${UNTAR_PAT_PATH}/zImage | awk '{print$1}'`"
|
||||
if [ "${HASH}" != "${ZIMAGE_HASH}" ]; then
|
||||
sleep 1
|
||||
dialog --backtitle "`backtitle`" --title "Error" --aspect 18 \
|
||||
--msgbox "Hash of zImage not match, try again!" 0 0
|
||||
return 1
|
||||
fi
|
||||
echo "OK"
|
||||
writeConfigKey "zimage-hash" "${ZIMAGE_HASH}" "${USER_CONFIG_FILE}"
|
||||
|
||||
echo -n "Checking hash of ramdisk: "
|
||||
HASH="`sha256sum ${UNTAR_PAT_PATH}/rd.gz | awk '{print$1}'`"
|
||||
if [ "${HASH}" != "${RAMDISK_HASH}" ]; then
|
||||
sleep 1
|
||||
dialog --backtitle "`backtitle`" --title "Error" --aspect 18 \
|
||||
--msgbox "Hash of ramdisk not match, try again!" 0 0
|
||||
return 1
|
||||
fi
|
||||
echo "OK"
|
||||
writeConfigKey "ramdisk-hash" "${RAMDISK_HASH}" "${USER_CONFIG_FILE}"
|
||||
|
||||
echo -n "Copying files: "
|
||||
cp "${UNTAR_PAT_PATH}/grub_cksum.syno" "${BOOTLOADER_PATH}"
|
||||
cp "${UNTAR_PAT_PATH}/GRUB_VER" "${BOOTLOADER_PATH}"
|
||||
cp "${UNTAR_PAT_PATH}/grub_cksum.syno" "${SLPART_PATH}"
|
||||
cp "${UNTAR_PAT_PATH}/GRUB_VER" "${SLPART_PATH}"
|
||||
cp "${UNTAR_PAT_PATH}/zImage" "${ORI_ZIMAGE_FILE}"
|
||||
cp "${UNTAR_PAT_PATH}/rd.gz" "${ORI_RDGZ_FILE}"
|
||||
echo "OK"
|
||||
|
||||
/opt/arpl/zimage-patch.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error" --aspect 18 \
|
||||
--msgbox "zImage not patched:\n`<"${LOG_FILE}"`" 0 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
/opt/arpl/ramdisk-patch.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error" --aspect 18 \
|
||||
--msgbox "Ramdisk not patched:\n`<"${LOG_FILE}"`" 0 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Cleaning"
|
||||
rm -rf "${UNTAR_PAT_PATH}"
|
||||
|
||||
echo "Ready!"
|
||||
sleep 3
|
||||
DIRTY=0
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Detect hardware
|
||||
function detectHw() {
|
||||
PLATFORM="`readModelKey "${MODEL}" "platform"`"
|
||||
KVER="`readModelKey "${MODEL}" "builds.${BUILD}.kver"`"
|
||||
# Get modules not needed
|
||||
unset NOTNEEDED
|
||||
declare -A NOTNEEDED
|
||||
while read M; do
|
||||
NOTNEEDED[${M}]="1"
|
||||
done < <(readModelArray "${MODEL}" "builds.${BUILD}.modules-notneeded")
|
||||
unset DEVC DEVN
|
||||
declare -A DEVC
|
||||
declare -A DEVN
|
||||
while read L; do
|
||||
F=` sed -E 's/^([0-9a-z]{2}:[0-9a-z]{2}.[0-9a-z]{1})[^\[]*\[([0-9a-z]{4})\]: (.*)/\1|\2|\3/' <<<"${L}"`
|
||||
PCI="`cut -d'|' -f1 <<<"${F}"`"
|
||||
CLASS="`cut -d'|' -f2 <<<"${F}"`"
|
||||
NAME="`cut -d'|' -f3 <<<"${F}"`"
|
||||
MODULE="`lspci -ks "${PCI}" | awk '/Kernel driver in use/{print$5}'`"
|
||||
[ -z "${MODULE}" ] && continue
|
||||
# If is a virtio module, change id
|
||||
if grep -q "virtio" <<<"$MODULE"; then
|
||||
MODULE="virtio"
|
||||
fi
|
||||
CLASS=${CLASSES[${CLASS}]} # Get class name of module
|
||||
[ -z "${CLASS}" ] && continue # If no class, skip
|
||||
arrayExistItem "${MODULE}" "${!ADDONS[@]}" && continue # Check if module already added
|
||||
[ -n "${NOTNEEDED[${MODULE}]}" ] && continue # Check if module is not necessary
|
||||
# Add module to list
|
||||
DEVC[${MODULE}]="${CLASS}"
|
||||
DEVN[${MODULE}]="${NAME}"
|
||||
done < <(lspci -nn)
|
||||
if [ ${#DEVC[@]} -eq 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --aspect 18 \
|
||||
--msgbox "No device detected or already added!" 0 0
|
||||
return
|
||||
fi
|
||||
for MODULE in ${!DEVC[@]}; do
|
||||
CLASS="${DEVC[${MODULE}]}"
|
||||
NAME="${DEVN[${MODULE}]}"
|
||||
TEXT="Found a ${NAME}\nClass ${CLASS}\nModule ${MODULE}\nAccept?"
|
||||
checkAddonExist "${MODULE}" "${PLATFORM}" "${KVER}" || TEXT+="\n\n\Z1PS: Addon for this module not found\Zn"
|
||||
dialog --backtitle "`backtitle`" --title "Found Hardware" \
|
||||
--colors --yesno "${TEXT}" 12 70
|
||||
[ $? -ne 0 ] && continue
|
||||
dialog --backtitle "`backtitle`" --title "params" \
|
||||
--inputbox "Type a opcional params to module" 0 0 \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
VALUE="`<${TMP_PATH}/resp`"
|
||||
ADDONS["${MODULE}"]="${VALUE}"
|
||||
writeConfigKey "addons.${MODULE}" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
DIRTY=1
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Manage addons/drivers
|
||||
function addonMenu() {
|
||||
# Read 'platform' and kernel version to check if addon exists
|
||||
PLATFORM="`readModelKey "${MODEL}" "platform"`"
|
||||
KVER="`readModelKey "${MODEL}" "builds.${BUILD}.kver"`"
|
||||
# Read addons from user config
|
||||
unset ADDONS
|
||||
declare -A ADDONS
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
NEXT="h"
|
||||
# Loop menu
|
||||
while true; do
|
||||
dialog --backtitle "`backtitle`" --default-item ${NEXT} \
|
||||
--menu "Choose a option" 0 0 0 \
|
||||
h "Detect hardware" \
|
||||
a "Add an addon" \
|
||||
d "Delete addon(s)" \
|
||||
s "Show user addons" \
|
||||
m "Show all available addons" \
|
||||
e "Exit" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
case "`<${TMP_PATH}/resp`" in
|
||||
h)
|
||||
detectHw
|
||||
NEXT='e'
|
||||
;;
|
||||
a) NEXT='a'
|
||||
rm "${TMP_PATH}/menu"
|
||||
while read ADDON DESC; do
|
||||
arrayExistItem "${ADDON}" "${!ADDONS[@]}" && continue # Check if addon has already been added
|
||||
echo "${ADDON} \"${DESC}\"" >> "${TMP_PATH}/menu"
|
||||
done < <(availableAddons "${PLATFORM}" "${KVER}")
|
||||
if [ ! -f "${TMP_PATH}/menu" ] ; then
|
||||
dialog --backtitle "`backtitle`" --msgbox "No available addons to add" 0 0
|
||||
continue
|
||||
fi
|
||||
dialog --backtitle "`backtitle`" --menu "Select an addon" 0 0 0 \
|
||||
--file "${TMP_PATH}/menu" 2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && continue
|
||||
ADDON="`<"${TMP_PATH}/resp"`"
|
||||
[ -z "${ADDON}" ] && continue
|
||||
dialog --backtitle "`backtitle`" --title "params" \
|
||||
--inputbox "Type a opcional params to addon" 0 0 \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
ADDONS[${ADDON}]="`<"${TMP_PATH}/resp"`"
|
||||
writeConfigKey "addons.${ADDON}" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
DIRTY=1
|
||||
;;
|
||||
d) NEXT='d'
|
||||
if [ ${#ADDONS[@]} -eq 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --msgbox "No user addons to remove" 0 0
|
||||
continue
|
||||
fi
|
||||
ITEMS=""
|
||||
for I in "${!ADDONS[@]}"; do
|
||||
ITEMS+="${I} ${I} off "
|
||||
done
|
||||
dialog --backtitle "`backtitle`" --no-tags \
|
||||
--checklist "Select addon to remove" 0 0 0 ${ITEMS} \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && continue
|
||||
ADDON="`<"${TMP_PATH}/resp"`"
|
||||
[ -z "${ADDON}" ] && continue
|
||||
for I in ${ADDON}; do
|
||||
unset ADDONS[${I}]
|
||||
deleteConfigKey "addons.${NAME}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
DIRTY=1
|
||||
;;
|
||||
s) NEXT='s'
|
||||
ITEMS=""
|
||||
for KEY in ${!ADDONS[@]}; do
|
||||
ITEMS+="${KEY}: ${ADDONS[$KEY]}\n"
|
||||
done
|
||||
dialog --backtitle "`backtitle`" --title "User addons" \
|
||||
--msgbox "${ITEMS}" 0 0
|
||||
;;
|
||||
m) NEXT='m'
|
||||
MSG=""
|
||||
while read MODULE DESC; do
|
||||
if arrayExistItem "${MODULE}" "${!ADDONS[@]}"; then
|
||||
MSG+="\Z4${MODULE}\Zn"
|
||||
else
|
||||
MSG+="${MODULE}"
|
||||
fi
|
||||
MSG+=": \Z5${DESC}\Zn\n"
|
||||
done < <(availableAddons "${PLATFORM}" "${KVER}")
|
||||
dialog --backtitle "`backtitle`" --title "Available addons" \
|
||||
--colors --msgbox "${MSG}" 0 0
|
||||
;;
|
||||
e) return ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
function cmdlineMenu() {
|
||||
# Read from user config
|
||||
DT="`readModelKey "${MODEL}" "dt"`"
|
||||
unset CMDLINE
|
||||
declare -A CMDLINE
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
|
||||
# Loop menu
|
||||
while true; do
|
||||
|
||||
echo "a \"Add/edit an cmdline item\"" > "${TMP_PATH}/menu"
|
||||
echo "d \"Delete cmdline item(s)\"" >> "${TMP_PATH}/menu"
|
||||
echo "s \"Show user cmdline\"" >> "${TMP_PATH}/menu"
|
||||
echo "m \"Show model/build cmdline\"" >> "${TMP_PATH}/menu"
|
||||
if [ "${DT}" != "true" ]; then
|
||||
echo "h \"Change maxdisks\"" >> "${TMP_PATH}/menu"
|
||||
echo "u \"Show SATA(s) # ports and drives\"" >> "${TMP_PATH}/menu"
|
||||
fi
|
||||
echo "e \"Exit\"" >> "${TMP_PATH}/menu"
|
||||
|
||||
dialog --backtitle "`backtitle`" --menu "Choose a option" 0 0 0 \
|
||||
--file "${TMP_PATH}/menu" 2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
case "`<${TMP_PATH}/resp`" in
|
||||
a)
|
||||
dialog --backtitle "`backtitle`" --title "User cmdline" \
|
||||
--inputbox "Type a name of cmdline" 0 0 \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
NAME="`sed 's/://g' <"${TMP_PATH}/resp"`"
|
||||
[ -z "${NAME}" ] continue
|
||||
dialog --backtitle "`backtitle`" --title "User cmdline" \
|
||||
--inputbox "Type a value of '${NAME}' cmdline" 0 0 "${CMDLINE[${NAME}]}" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
VALUE="`<"${TMP_PATH}/resp"`"
|
||||
CMDLINE[${NAME}]="${VALUE}"
|
||||
writeConfigKey "cmdline.${NAME}" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
d)
|
||||
if [ ${#CMDLINE[@]} -eq 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --msgbox "No user cmdline to remove" 0 0
|
||||
continue
|
||||
fi
|
||||
ITEMS=""
|
||||
for I in "${!CMDLINE[@]}"; do
|
||||
ITEMS+="${I} ${CMDLINE[${I}]} off "
|
||||
done
|
||||
dialog --backtitle "`backtitle`" \
|
||||
--checklist "Select cmdline to remove" 0 0 0 ${ITEMS} \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && continue
|
||||
RESP=`<"${TMP_PATH}/resp"`
|
||||
[ -z "${RESP}" ] && continue
|
||||
for I in ${RESP}; do
|
||||
unset CMDLINE[${I}]
|
||||
deleteConfigKey "cmdline.${I}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
;;
|
||||
s)
|
||||
ITEMS=""
|
||||
for KEY in ${!CMDLINE[@]}; do
|
||||
ITEMS+="${KEY}: ${CMDLINE[$KEY]}\n"
|
||||
done
|
||||
dialog --backtitle "`backtitle`" --title "User cmdline" \
|
||||
--aspect 18 --msgbox "${ITEMS}" 0 0
|
||||
;;
|
||||
m)
|
||||
ITEMS=""
|
||||
while IFS="=" read KEY VALUE; do
|
||||
ITEMS+="${KEY}: ${VALUE}\n"
|
||||
done < <(readModelMap "${MODEL}" "builds.${BUILD}.cmdline")
|
||||
dialog --backtitle "`backtitle`" --title "Model/build cmdline" \
|
||||
--aspect 18 --msgbox "${ITEMS}" 0 0
|
||||
;;
|
||||
h) MODEL_DISKS="`readModelKey "${MODEL}" "disks"`"
|
||||
dialog --backtitle "`backtitle`" --title "Change max of disks" \
|
||||
--inputbox "${MODEL} disks: ${MODEL_DISKS}\nType the desired number of disks (1-26)" 0 0 \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
VALUE="`<"${TMP_PATH}/resp"`"
|
||||
[ -z "${VALUE}" ] && continue
|
||||
if [ ${VALUE} -ge 1 -a ${VALUE} -le 26 ]; then
|
||||
CMDLINE['maxdisks']="${VALUE}"
|
||||
writeConfigKey "cmdline.maxdisks" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
INTPORTCFG=""
|
||||
for I in `seq 1 ${VALUE}`; do INTPORTCFG+="1"; done
|
||||
INTPORTCFG=`printf "%x" "$((2#${INTPORTCFG}))"`
|
||||
CMDLINE['internalportcfg']="${INTPORTCFG}"
|
||||
writeConfigKey "cmdline.internalportcfg" "${INTPORTCFG}" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
dialog --backtitle "`backtitle`" --msgbox "Invalid number" 0 0
|
||||
fi
|
||||
;;
|
||||
u) TEXT=""
|
||||
for PCI in `lspci -d ::106 | awk '{print$1}'`; do
|
||||
NAME=`lspci -s "${PCI}" | sed "s/\ .*://"`
|
||||
TEXT+="\Zb${NAME}\Zn\nPorts: "
|
||||
unset HOSTPORTS
|
||||
declare -A HOSTPORTS
|
||||
while read LINE; do
|
||||
ATAPORT="`echo ${LINE} | grep -o 'ata[0-9]*'`"
|
||||
PORT=`echo ${ATAPORT} | sed 's/ata//'`
|
||||
HOSTPORTS[${PORT}]=`echo ${LINE} | grep -o 'host[0-9]*$'`
|
||||
done < <(ls -l /sys/class/scsi_host | fgrep "${PCI}")
|
||||
while read PORT; do
|
||||
ls -l /sys/block | fgrep -q "${PCI}/ata${PORT}" && ATTACH=1 || ATTACH=0
|
||||
[ `cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd` -eq 0 ] && DUMMY=1 || DUMMY=0
|
||||
[ ${ATTACH} -eq 1 ] && TEXT+="\Z2\Zb"
|
||||
[ ${DUMMY} -eq 1 ] && TEXT+="\Z1"
|
||||
TEXT+="${PORT}\Zn "
|
||||
done < <(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n)
|
||||
TEXT+="\n"
|
||||
done
|
||||
TEXT+="\nPorts with color \Z1red\Zn as DUMMY, color \Z2\Zbgreen\Zn has drive connected\n"
|
||||
TEXT+="Use this information to mount SataPortMap, DiskIdxMap and sata_remap"
|
||||
dialog --backtitle "`backtitle`" --colors --aspect 18 \
|
||||
--msgbox "${TEXT}" 0 0
|
||||
;;
|
||||
e) return ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
function synoinfoMenu() {
|
||||
# Read synoinfo from user config
|
||||
unset SYNOINFO
|
||||
declare -A SYNOINFO
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
|
||||
# menu loop
|
||||
while true; do
|
||||
dialog --backtitle "`backtitle`" \
|
||||
--menu "Choose a option" 0 0 0 \
|
||||
a "Add/edit an synoinfo item" \
|
||||
d "Delete synoinfo item(s)" \
|
||||
s "Show user synoinfo" \
|
||||
m "Show model/build synoinfo" \
|
||||
e "Exit" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
case "`<${TMP_PATH}/resp`" in
|
||||
a)
|
||||
dialog --backtitle "`backtitle`" --title "User synoinfo" \
|
||||
--inputbox "Type a name of synoinfo variable" 0 0 \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
NAME="`sed 's/://g' <"${TMP_PATH}/resp"`"
|
||||
dialog --backtitle "`backtitle`" --title "User synoinfo" \
|
||||
--inputbox "Type a value of '${NAME}' variable" 0 0 "${SYNOINFO[${NAME}]}" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
VALUE="`<"${TMP_PATH}/resp"`"
|
||||
SYNOINFO[${NAME}]="${VALUE}"
|
||||
writeConfigKey "synoinfo.${NAME}" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
DIRTY=1
|
||||
;;
|
||||
d)
|
||||
if [ ${#SYNOINFO[@]} -eq 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --msgbox "No user synoinfo to remove" 0 0
|
||||
continue
|
||||
fi
|
||||
ITEMS=""
|
||||
for I in "${!SYNOINFO[@]}"; do
|
||||
ITEMS+="${I} ${SYNOINFO[${I}]} off "
|
||||
done
|
||||
dialog --backtitle "`backtitle`" \
|
||||
--checklist "Select synoinfo to remove" 0 0 0 ${ITEMS} \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && continue
|
||||
RESP=`<"${TMP_PATH}/resp"`
|
||||
[ -z "${RESP}" ] && continue
|
||||
for I in ${RESP}; do
|
||||
unset SYNOINFO[${I}]
|
||||
deleteConfigKey "synoinfo.${I}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
DIRTY=1
|
||||
;;
|
||||
s)
|
||||
ITEMS=""
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
ITEMS+="${KEY}: ${SYNOINFO[$KEY]}\n"
|
||||
done
|
||||
dialog --backtitle "`backtitle`" --title "User synoinfo" \
|
||||
--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
|
||||
;;
|
||||
e) return ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Calls boot.sh to boot into DSM kernel/ramdisk
|
||||
function boot() {
|
||||
[ ${DIRTY} -eq 1 ] && dialog --backtitle "`backtitle`" --title "Alert" \
|
||||
--yesno "Config changed, would you like to rebuild the loader?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
make || return
|
||||
fi
|
||||
boot.sh
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Permits user edit the user config
|
||||
function editUserConfig() {
|
||||
while true; do
|
||||
dialog --backtitle "`backtitle`" --title "Edit with caution" \
|
||||
--editbox "${USER_CONFIG_FILE}" 0 0 2>"${TMP_PATH}/userconfig"
|
||||
[ $? -ne 0 ] && return
|
||||
mv "${TMP_PATH}/userconfig" "${USER_CONFIG_FILE}"
|
||||
ERRORS=`yq eval "${USER_CONFIG_FILE}" 2>&1`
|
||||
[ $? -eq 0 ] && break
|
||||
dialog --backtitle "`backtitle`" --title "Invalid YAML format" --msgbox "${ERRORS}" 0 0
|
||||
done
|
||||
OLDMODEL=${MODEL}
|
||||
OLDBUILD=${BUILD}
|
||||
MODEL="`readConfigKey "model" "${USER_CONFIG_FILE}"`"
|
||||
BUILD="`readConfigKey "build" "${USER_CONFIG_FILE}"`"
|
||||
SN="`readConfigKey "sn" "${USER_CONFIG_FILE}"`"
|
||||
|
||||
if [ "${MODEL}" != "${OLDMODEL}" -o "${BUILD}" != "${OLDBUILD}" ]; then
|
||||
# Remove old files
|
||||
rm -f "${MOD_ZIMAGE_FILE}"
|
||||
rm -f "${MOD_RDGZ_FILE}"
|
||||
fi
|
||||
DIRTY=1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Shows available keymaps to user choose one
|
||||
function keymapMenu() {
|
||||
OPTIONS=""
|
||||
while read KM; do
|
||||
OPTIONS+="${KM::-7} "
|
||||
done < <(cd /usr/share/keymaps/i386/qwerty; ls *.map.gz)
|
||||
dialog --backtitle "`backtitle`" --no-items \
|
||||
--menu "Choice a keymap" 0 0 0 ${OPTIONS} \
|
||||
2>/tmp/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=`cat /tmp/resp 2>/dev/null`
|
||||
[ -z "${resp}" ] && return
|
||||
KEYMAP=${resp}
|
||||
writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
|
||||
zcat /usr/share/keymaps/i386/qwerty/${KEYMAP}.map.gz | loadkeys
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
# Main loop
|
||||
NEXT="m"
|
||||
while true; do
|
||||
echo "m \"Choose a model\"" > "${TMP_PATH}/menu"
|
||||
if [ -n "${MODEL}" ]; then
|
||||
echo "n \"Choose a Build Number\"" >> "${TMP_PATH}/menu"
|
||||
echo "s \"Choose a serial number\"" >> "${TMP_PATH}/menu"
|
||||
if [ -n "${BUILD}" ]; then
|
||||
echo "a \"Addons/drivers\"" >> "${TMP_PATH}/menu"
|
||||
echo "x \"Cmdline menu\"" >> "${TMP_PATH}/menu"
|
||||
echo "i \"Synoinfo menu\"" >> "${TMP_PATH}/menu"
|
||||
echo "l \"Switch LKM version: \Z4${LKM}\Zn\"" >> "${TMP_PATH}/menu"
|
||||
echo "d \"Build the loader\"" >> "${TMP_PATH}/menu"
|
||||
fi
|
||||
fi
|
||||
loaderIsConfigured && echo "b \"Boot the loader\" " >> "${TMP_PATH}/menu"
|
||||
echo "u \"Edit user config file manually\"" >> "${TMP_PATH}/menu"
|
||||
echo "k \"Choose a keymap\" " >> "${TMP_PATH}/menu"
|
||||
[ ${RAMCACHE} -eq 0 -a -d "${CACHE_PATH}/dl" ] && echo "c \"Clean disk cache\"" >> "${TMP_PATH}/menu"
|
||||
echo "e \"Exit\"" >> "${TMP_PATH}/menu"
|
||||
dialog --clear --default-item ${NEXT} --backtitle "`backtitle`" --colors \
|
||||
--menu "Choose the option" 0 0 0 --file "${TMP_PATH}/menu" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && break
|
||||
case `<"${TMP_PATH}/resp"` in
|
||||
m) modelMenu; NEXT="n" ;;
|
||||
n) buildMenu; NEXT="s" ;;
|
||||
s) serialMenu; NEXT="a" ;;
|
||||
a) addonMenu; NEXT="x" ;;
|
||||
x) cmdlineMenu; NEXT="i" ;;
|
||||
i) synoinfoMenu; NEXT="l" ;;
|
||||
l) [ "${LKM}" = "dev" ] && LKM='prod' || LKM='dev'
|
||||
writeConfigKey "lkm" "${LKM}" "${USER_CONFIG_FILE}"
|
||||
NEXT="d"
|
||||
;;
|
||||
d) make; NEXT="b" ;;
|
||||
b) boot ;;
|
||||
u) editUserConfig; NEXT="u" ;;
|
||||
k) keymapMenu ;;
|
||||
c) dialog --backtitle "`backtitle`" --title "Cleaning" --aspect 18 \
|
||||
--prgbox "rm -rfv \"${CACHE_PATH}/dl\"" 0 0 ;;
|
||||
e) break ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
echo -e "Call \033[1;32mmenu.sh\033[0m to return to menu"
|
||||
@@ -0,0 +1,82 @@
|
||||
id: "DS1621+"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
SMBusHddDynamicPower: 1
|
||||
syno_hdd_powerup_seq: 0
|
||||
HddHotplug: 0
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
synoboot2:
|
||||
syno_ttyS0: "serial,0x3f8"
|
||||
syno_ttyS1: "serial,0x2f8"
|
||||
platform: "v1000"
|
||||
serial:
|
||||
prefix:
|
||||
- "2080"
|
||||
middle: "S7R"
|
||||
suffix: "alpha"
|
||||
disks: 6
|
||||
dt: true
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS1621%2B_42218.pat"
|
||||
hash: "19f56827ba8bf0397d42cd1d6f83c447f092c2c1bbb70d8a2ad3fbd427e866df"
|
||||
ramdisk-hash: "73512c7bceb34cf7f7f93c2703db60496da0e27274fc45e5aefa0366c9734d6e"
|
||||
zimage-hash: "f4648d0dd6b29ef6149b0ff46afe1fe32f81730aa79af72f37ffd3647c76f586"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DS1621%2B_42661.pat"
|
||||
hash: "381077302a89398a9fb5ec516217578d6f33b0219fe95135e80fd93cddbf88c4"
|
||||
ramdisk-hash: "8fd5eb40fb088af97d3beee85b6275c2ceb368b08453eb5a5d00d42cc7d578d1"
|
||||
zimage-hash: "d939b5937be00a644aae64c33633619a7c310433e60a515c77bbef00b0a7e6b6"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
@@ -0,0 +1,60 @@
|
||||
id: "DS2422+"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
SMBusHddDynamicPower: 1
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
synoboot2:
|
||||
syno_ttyS0: "serial,0x3f8"
|
||||
syno_ttyS1: "serial,0x2f8"
|
||||
platform: "v1000"
|
||||
serial:
|
||||
prefix:
|
||||
- "0000"
|
||||
middle: "XXX"
|
||||
suffix: "numeric"
|
||||
disks: 12
|
||||
dt: true
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS2422%2B_42218.pat"
|
||||
hash: "415c54934d483a2557500bc3a2e74588a0cec1266e1f0d9a82a7d3aace002471"
|
||||
ramdisk-hash: "2b5b8dd90b2e6020ffccc2719d8bc16d9935421754a8c088d6b31dbca4e4ff7b"
|
||||
zimage-hash: "38281a90036fffcb41cd17f05a6c7e9a1d5740a78c135980fb0c3a6d0ca1485f"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
@@ -0,0 +1,81 @@
|
||||
id: "DS3615xs"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
esataportcfg: "0x0"
|
||||
usbportcfg: "0x8700"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
cmdline: &cmdline
|
||||
syno_hdd_powerup_seq: 0
|
||||
HddHotplug: 0
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
|
||||
platform: "bromolow"
|
||||
serial:
|
||||
prefix:
|
||||
- "1130"
|
||||
- "1230"
|
||||
- "1330"
|
||||
- "1430"
|
||||
middle: "LWN"
|
||||
suffix: "numeric"
|
||||
disks: 12
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "3.10.108"
|
||||
rd-compressed: false
|
||||
efi-bug: yes
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS3615xs_42218.pat"
|
||||
hash: "dddd26891815ddca02d0d53c1d42e8b39058b398a4cc7b49b80c99f851cf0ef7"
|
||||
ramdisk-hash: "4c90c3c7ee25b5fcc651552e80a9364d22823c863c834c5f43e3344a3a68af78"
|
||||
zimage-hash: "d29b695612710376734cb5c5b5ae4f2d8afc49ffd640387e1c86010f6c7d2c8a"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "3.10.108"
|
||||
rd-compressed: false
|
||||
efi-bug: yes
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DS3615xs_42661.pat"
|
||||
hash: "1e95d8c63981bcf42ea2eaedfbc7acc4248ff16d129344453b7479953f9ad145"
|
||||
ramdisk-hash: "8ee5df65bcfd25c3d1999262153dcff625714d98789bc8065e217773f8d070d8"
|
||||
zimage-hash: "3017542c92232cb5477b0e11d82d708a9909320350b1740aab58359e85f82351"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-42661-disable-disabled-ports.patch"
|
||||
@@ -0,0 +1,86 @@
|
||||
id: "DS3617xs"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- xhci_pci
|
||||
- xhci_hcd
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
# maxdisks: "15"
|
||||
# internalportcfg: "0x78FF"
|
||||
esataportcfg: "0x00"
|
||||
usbportcfg: "0x8700"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
syno_hdd_powerup_seq: 0
|
||||
HddHotplug: 0
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
|
||||
platform: "broadwell"
|
||||
serial:
|
||||
prefix:
|
||||
- "1130"
|
||||
- "1230"
|
||||
- "1330"
|
||||
- "1430"
|
||||
middle: "ODN"
|
||||
suffix: "numeric"
|
||||
disks: 12
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS3617xs_42218.pat"
|
||||
hash: "d65ee4ed5971e38f6cdab00e1548183435b53ba49a5dca7eaed6f56be939dcd2"
|
||||
ramdisk-hash: "1b2e86fbf4006f6aa40dcd674ad449feed8b0b8317a71e2bb8bb986a74e08c57"
|
||||
zimage-hash: "28a75e0b680517d39374260eb981b8ca9ace8810b121a30b8036fa09cfcb77fc"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DS3617xs_42661.pat"
|
||||
hash: "0a5a243109098587569ab4153923f30025419740fb07d0ea856b06917247ab5c"
|
||||
ramdisk-hash: "da3c2a170fea24052d817cbc4bb5b610a5b05288758d746b60a294ed614239fb"
|
||||
zimage-hash: "9598f66b75e5b303e571241696e02fe7c0add80f13564f8c6b8c0daaf3cb3018"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-42661-disable-disabled-ports.patch"
|
||||
@@ -0,0 +1,91 @@
|
||||
id: "DS3622xs+"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- r8168
|
||||
- r8169
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
esataportcfg: "0x00"
|
||||
support_bde_internal_10g: "no"
|
||||
support_disk_compatibility : "no"
|
||||
support_memory_compatibility : "no"
|
||||
supportraidgroup: "no"
|
||||
supportssdcache: "no"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
syno_hdd_powerup_seq: 0
|
||||
HddHotplug: 0
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
|
||||
platform: "broadwellnk"
|
||||
serial:
|
||||
prefix:
|
||||
- "2030"
|
||||
- "2040"
|
||||
- "20C0"
|
||||
- "2150"
|
||||
middle: "SQR"
|
||||
suffix: "alpha"
|
||||
disks: 12
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS3622xs%2B_42218.pat"
|
||||
hash: "f38329b8cdc5824a8f01fb1e377d3b1b6bd23da365142a01e2158beff5b8a424"
|
||||
ramdisk-hash: "a95d4ab06189460f3b3d13a33e421887b5f3ea09a10535ae0d4c92beb7ff631d"
|
||||
zimage-hash: "06964b68e5ccdedd4363dff3986f99686d3c9cb5225e8e4c3d840a1d9cd1330b"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DS3622xs%2B_42661.pat"
|
||||
hash: "53d0a4f1667288b6e890c4fdc48422557ff26ea8a2caede0955c5f45b560cccd"
|
||||
ramdisk-hash: "df8a055d6bc901229f0ba53ed5b4fe024bdf9a1b42f0c32483adefcdac14db4d"
|
||||
zimage-hash: "e073dd84054f652811e0ae1932af2c7cdbd5fb6e5f18f265097072b8af4605e8"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-42661-disable-disabled-ports.patch"
|
||||
89
files/board/arpl/overlayfs/opt/arpl/model-configs/DS918+.yml
Normal file
89
files/board/arpl/overlayfs/opt/arpl/model-configs/DS918+.yml
Normal file
@@ -0,0 +1,89 @@
|
||||
id: "DS918+"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
esataportcfg: "0x00"
|
||||
support_led_brightness_adjustment: ""
|
||||
support_leds_lp3943: ""
|
||||
buzzeroffen: "0xffff"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
syno_hdd_powerup_seq: 0
|
||||
HddHotplug: 0
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
|
||||
platform: "apollolake"
|
||||
serial:
|
||||
prefix:
|
||||
- "1780"
|
||||
- "1790"
|
||||
- "1860"
|
||||
- "1980"
|
||||
middle: "PDN"
|
||||
suffix: "numeric"
|
||||
disks: 4
|
||||
flags:
|
||||
- "fma"
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS918%2B_42218.pat"
|
||||
hash: "a403809ab2cd476c944fdfa18cae2c2833e4af36230fa63f0cdee31a92bebba2"
|
||||
ramdisk-hash: "4b7a7a271a3b2158d9193a4f0e75c59590949ad7b4e26d546f46cc2ee8504d51"
|
||||
zimage-hash: "338ba514066da01d0c1f770418916b9b96f5355d88a7b55b398d2726db591fdb"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DS918%2B_42661.pat"
|
||||
hash: "4e8a9d82a8a1fde5af9a934391080b7bf6b91811d9583acb73b90fb6577e22d7"
|
||||
ramdisk-hash: "ef8c87b6e68226339e5623d048252f5be3089c0831e41298a4695f2bfa65f00e"
|
||||
zimage-hash: "9ce0d3452f08afaf95d52292ff20cbac6d69e17d5b9953377e4ac90c9ac7397d"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-42661-disable-disabled-ports.patch"
|
||||
81
files/board/arpl/overlayfs/opt/arpl/model-configs/DS920+.yml
Normal file
81
files/board/arpl/overlayfs/opt/arpl/model-configs/DS920+.yml
Normal file
@@ -0,0 +1,81 @@
|
||||
id: "DS920+"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
intel_iommu: "igfx_off"
|
||||
HddEnableDynamicPower: 1
|
||||
synoboot2:
|
||||
syno_ttyS0: "serial,0x3f8"
|
||||
syno_ttyS1: "serial,0x2f8"
|
||||
vender_format_version: 2
|
||||
platform: "geminilake"
|
||||
serial:
|
||||
prefix:
|
||||
- "2030"
|
||||
- "2040"
|
||||
- "20C0"
|
||||
- "2150"
|
||||
middle: "SBR"
|
||||
suffix: "alpha"
|
||||
disks: 4
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS920%2B_42218.pat"
|
||||
hash: "73053911bd118b432d5a2036dc62d518eed83b78b32c1eb23696d59725a14892"
|
||||
ramdisk-hash: "e39890f4bef2e5e4eea956996b0dd92d081c6d9e7c393331131e65bbad1a17a9"
|
||||
zimage-hash: "74d513aaa3e30d8aa4f80e202d94a68a552e9c0472f8470e133ad29080556f55"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DS920%2B_42661.pat"
|
||||
hash: "8076950fdad2ca58ea9b91a12584b9262830fe627794a0c4fc5861f819095261"
|
||||
ramdisk-hash: "c8ad44826c87e065a3b05f354a639c0a86cb2fa47b88e11949604d53f3e80048"
|
||||
zimage-hash: "1d0e5b76e08e3483f6bf06d23b5978ec498b855bde23db1f96f343db4c43337d"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
@@ -0,0 +1,64 @@
|
||||
id: "DVA1622"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
|
||||
synoinfo: &synoinfo
|
||||
buzzeroffen: "0xffff"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
intel_iommu: "igfx_off"
|
||||
HddEnableDynamicPower: 1
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
synoboot2:
|
||||
syno_ttyS0: "serial,0x3f8"
|
||||
syno_ttyS1: "serial,0x2f8"
|
||||
platform: "geminilake"
|
||||
serial:
|
||||
prefix:
|
||||
- "2030"
|
||||
- "2040"
|
||||
- "20C0"
|
||||
- "2150"
|
||||
middle: "SBR"
|
||||
suffix: "alpha"
|
||||
disks: 2
|
||||
dt: true
|
||||
builds:
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DVA1622_42661.pat"
|
||||
hash: "f1484cf302627072ca393293cd73e61dc9e09d479ef028b216eae7c12f7b7825"
|
||||
ramdisk-hash: "6290945ba61f652aec83725f81f5a47bd5e4cdbeb86241c33825154140e164ec"
|
||||
zimage-hash: "1d0e5b76e08e3483f6bf06d23b5978ec498b855bde23db1f96f343db4c43337d"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
@@ -0,0 +1,88 @@
|
||||
id: "DVA3221"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
esataportcfg: "0x00"
|
||||
support_bde_internal_10g: "no"
|
||||
support_disk_compatibility: "no"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
syno_hdd_powerup_seq: 0
|
||||
HddHotplug: 0
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
|
||||
platform: "denverton"
|
||||
serial:
|
||||
prefix:
|
||||
- "2030"
|
||||
- "2040"
|
||||
- "20C0"
|
||||
- "2150"
|
||||
middle: "SJR"
|
||||
suffix: "alpha"
|
||||
flags:
|
||||
- "fma"
|
||||
disks: 4
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DVA3221_42218.pat"
|
||||
hash: "01f101d7b310c857e54b0177068fb7250ff722dc9fa2472b1a48607ba40897ee"
|
||||
ramdisk-hash: "0825958923a5e67d967389769cff5fb7a04a25b98a2826c4c1e8aa7b8146dc8b"
|
||||
zimage-hash: "ef97f2d64f3f7f8c5e3f4e8fee613d385d7888826f56e119f1885a722c95c7cc"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_DVA3221_42661.pat"
|
||||
hash: "ed3207db40b7bac4d96411378558193b7747ebe88f0fc9c26c59c0b5c688c359"
|
||||
ramdisk-hash: "0ff061f453bc9888b16c59baaf3617bfa6ee42044122eb1dd0eaaa18b3832381"
|
||||
zimage-hash: "5222b5efaf7af28ff3833fd37f13100c30acba1ee201a15b2ee360e66e75b48e"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-42661-disable-disabled-ports.patch"
|
||||
@@ -0,0 +1,88 @@
|
||||
id: "FS6400"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
- r8168
|
||||
- mpt3sas
|
||||
synoinfo: &synoinfo
|
||||
# support_bde_internal_10g: "no"
|
||||
# support_disk_compatibility: "no"
|
||||
# esataportcfg: "0x00"
|
||||
# usbportcfg: "0x10000"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
# SMBusHddDynamicPower: 1
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
synoboot2:
|
||||
syno_ttyS0: "serial,0x3f8"
|
||||
syno_ttyS1: "serial,0x2f8"
|
||||
platform: "purley"
|
||||
serial:
|
||||
prefix:
|
||||
- "1960"
|
||||
middle: "PSN"
|
||||
suffix: "numeric"
|
||||
disks: 24
|
||||
dt: true
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_FS6400_42218.pat"
|
||||
hash: "0e5e15398fb50d21ac52e0fbae199d5bacebc52f04933be5825c710f9de874ea"
|
||||
ramdisk-hash: "eebaf0236230956fc1a9d8ca8c8f86143da959b631cad9c311152a4e644d17a0"
|
||||
zimage-hash: "cbed16da4970c41e9b9c6797c57c70b12f55ab497756cb050247d1c155c8a8f6"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_FS6400_42661.pat"
|
||||
hash: "94a84725e8b24dfb448429068c046e05084ead3a210f8710979e0992904673e7"
|
||||
ramdisk-hash: "6ceff751e7132dd8cc80ff64ee23b7e3b3986d85d7d9132b4cb4b0d50f223b1f"
|
||||
zimage-hash: "2326a556eec4c48b9887bad7eecab268e43dc0e036bed8ddf6fbba466d713cde"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-42661-disable-disabled-ports.patch"
|
||||
@@ -0,0 +1,84 @@
|
||||
id: "RS4021xs+"
|
||||
modules-notneeded: &modules-notneeded
|
||||
- ahci
|
||||
- i40e
|
||||
- ixgbe
|
||||
- igb
|
||||
- e1000e
|
||||
- dca
|
||||
- etxhci_hcd
|
||||
- xhci_hcd
|
||||
- ehci-pci
|
||||
- uhci_hcd
|
||||
synoinfo: &synoinfo
|
||||
support_bde_internal_10g: "no"
|
||||
support_disk_compatibility: "no"
|
||||
supportraidgroup: "no"
|
||||
esataportcfg: "0x00"
|
||||
rss_server: "http://example.com/null.xml"
|
||||
rss_server_ssl: "https://example.com/null.xml"
|
||||
rss_server_v2: "https://example.com/autoupdate/v2/getList"
|
||||
update_server: "http://example.com/"
|
||||
update_server_ssl: "https://example.com/"
|
||||
small_info_path: "https://example.com/null"
|
||||
updateurl: "http://example.com/"
|
||||
myds_region_api_base_url: "https://example.com"
|
||||
security_version_server: "https://example.com/smallupdate"
|
||||
cmdline: &cmdline
|
||||
syno_hdd_powerup_seq: 0
|
||||
HddHotplug: 0
|
||||
vender_format_version: 2
|
||||
syno_port_thaw: 1
|
||||
syno_hdd_detect: 0
|
||||
|
||||
platform: "broadwellnk"
|
||||
serial:
|
||||
prefix:
|
||||
- "0000"
|
||||
middle: "XXX"
|
||||
suffix: "numeric"
|
||||
disks: 16
|
||||
builds:
|
||||
42218:
|
||||
ver: "7.0.1"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_RS4021xs%2B_42218.pat"
|
||||
hash: "7afca3970ac7324d7431c1484d4249939bedd4c18ac34187f894c43119edf3a1"
|
||||
ramdisk-hash: "3510afe5b3dfe3662bfe054c1728c8794911da431718b533cd03d2a2c061ffd5"
|
||||
zimage-hash: "b4cc62e9953f226960de98b65887e17dd6df5fa0ad28f665e0b4660dbd5f2fa8"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-common-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-common-disable-disabled-ports.patch"
|
||||
|
||||
42661:
|
||||
ver: "7.1.0"
|
||||
kver: "4.4.180"
|
||||
rd-compressed: false
|
||||
efi-bug: no
|
||||
modules-notneeded: *modules-notneeded
|
||||
cmdline:
|
||||
<<: *cmdline
|
||||
synoinfo:
|
||||
<<: *synoinfo
|
||||
pat:
|
||||
url: "https://global.download.synology.com/download/DSM/release/7.1/42661-1/DSM_RS4021xs%2B_42661.pat"
|
||||
hash: "496b64e431dafa34cdebb92da8ac736bf1610fe157f03df7e6d11152d60991f5"
|
||||
ramdisk-hash: "143e475fe73c0adb3377361402b4baad21448476e844e55e16d1ed51ffc4c971"
|
||||
zimage-hash: "e073dd84054f652811e0ae1932af2c7cdbd5fb6e5f18f265097072b8af4605e8"
|
||||
patch:
|
||||
- "ramdisk-common-disable-root-pwd.patch"
|
||||
- "ramdisk-common-init-script.patch"
|
||||
- "ramdisk-42661-post-init-script.patch"
|
||||
- "ramdisk-common-network-hosts.patch"
|
||||
- "ramdisk-42661-disable-disabled-ports.patch"
|
||||
141
files/board/arpl/overlayfs/opt/arpl/patch-boot_params-check.php
Executable file
141
files/board/arpl/overlayfs/opt/arpl/patch-boot_params-check.php
Executable file
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* A quick tool for patching the boot_params check in the DSM kernel image
|
||||
* This lets you tinker with the initial ramdisk contents without disabling mount() features and modules loading
|
||||
*
|
||||
* The overall pattern we need to find is:
|
||||
* - an CDECL function
|
||||
* - does "LOCK OR [const-ptr],n" 4x
|
||||
* - values of ORs are 1/2/4/8 respectively
|
||||
* - [const-ptr] is always the same
|
||||
*
|
||||
* Usage: php patch-boot_params-check.php vmlinux vmlinux-mod
|
||||
*/
|
||||
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
if ($argc < 2 || $argc > 3) {
|
||||
perr("Usage: " . $argv[0] . " <inFile> [<outFile>]\n", true);
|
||||
}
|
||||
|
||||
$file = getArgFilePath(1);
|
||||
perr("\nGenerating patch for $file\n");
|
||||
|
||||
//The function will reside in init code part. We don't care we may potentially search beyond as we expect it to be found
|
||||
$codeAddr = getELFSectionAddr($file, '.init.text', 3);
|
||||
|
||||
//Finding a function boundary is non-trivial really as patters can vary, we can have multiple exit points, and in CISC
|
||||
// there are many things which may match e.g. "PUSH EBP". Implementing even a rough disassembler is pointless.
|
||||
//However, we can certainly cheat here as we know with CDECL a non-empty function will always contain one or more
|
||||
// PUSH (0x41) R12-R15 (0x54-57) sequences. Then we can search like a 1K forward for these characteristic LOCK OR.
|
||||
const PUSH_R12_R15_SEQ = [0x41, [0x54, 0x57]];
|
||||
const PUSH_R12_R15_SEQ_LEN = 2;
|
||||
const LOCK_OR_LOOK_AHEAD = 1024;
|
||||
const LOCK_OR_PTR_SEQs = [
|
||||
[0xF0, 0x80, null, null, null, null, null, 0x01],
|
||||
[0xF0, 0x80, null, null, null, null, null, 0x02],
|
||||
[0xF0, 0x80, null, null, null, null, null, 0x04],
|
||||
[0xF0, 0x80, null, null, null, null, null, 0x08],
|
||||
];
|
||||
const LOCK_OR_PTR_SEQs_NUM = 4; //how many sequences we are expecting
|
||||
const LOCK_OR_PTR_SEQ_LEN = 8; //length of a single sequence
|
||||
|
||||
$fp = getFileMemMapped($file); //Read the whole file to memory to make fseet/fread much faster
|
||||
$pos = $codeAddr; //Start from where code starts
|
||||
$orsPos = null; //When matched it will contain our resulting file offsets to LOCK(); OR BYTE PTR [rip+...],0x calls
|
||||
perr("Looking for f() candidates...\n");
|
||||
do {
|
||||
$find = findSequenceWithWildcard($fp, PUSH_R12_R15_SEQ, $pos, -1);
|
||||
if ($find === -1) {
|
||||
break; //no more "functions" left
|
||||
}
|
||||
|
||||
perr("\rAnalyzing f() candidate @ " . decTo32bUFhex($pos));
|
||||
|
||||
//we found something looking like PUSH R12-R15, now find the ORs
|
||||
$orsPos = []; //file offsets where LOCK() calls should start
|
||||
$orsPosNum = 0; //Number of LOCK(); OR ptr sequences found
|
||||
$seqPos = $pos;
|
||||
foreach (LOCK_OR_PTR_SEQs as $idx => $seq) {
|
||||
$find = findSequenceWithWildcard($fp, $seq, $seqPos, LOCK_OR_LOOK_AHEAD);
|
||||
if ($find === -1) {
|
||||
break; //Seq not found - there's no point to look further
|
||||
}
|
||||
|
||||
$orsPos[] = $find;
|
||||
++$orsPosNum;
|
||||
$seqPos = $find + LOCK_OR_PTR_SEQ_LEN; //Next search will start after the current sequence code
|
||||
}
|
||||
|
||||
//We can always move forward by the function token length (obvious) but if we couldn't find any LOCK-OR tokens
|
||||
// we can skip the whole look ahead distance. We CANNOT do that if we found even a single token because the next one
|
||||
// might have been just after the look ahead distance
|
||||
if ($orsPosNum !== LOCK_OR_PTR_SEQs_NUM) {
|
||||
$pos += PUSH_R12_R15_SEQ_LEN;
|
||||
if ($orsPosNum === 0) {
|
||||
$pos += LOCK_OR_LOOK_AHEAD;
|
||||
}
|
||||
continue; //Continue the main search loop to find next function candidate
|
||||
}
|
||||
|
||||
//We found LOCK(); OR ptr sequences so we can print some logs and collect ptrs (as this is quite expensive)
|
||||
$seqPtrsDist = [];
|
||||
perr("\n[?] Found possible f() @ " . decTo32bUFhex($pos) . "\n");
|
||||
$ptrOffset = null;
|
||||
$equalJumps = 0;
|
||||
foreach (LOCK_OR_PTR_SEQs as $idx => $seq) {
|
||||
//data will have the following bytes:
|
||||
// [0-LOCK()] [1-OR()] [2-BYTE-PTR] [3-OFFS-b3] [4-OFFS-b2] [5-OFFS-b1] [6-OFFS-b1] [7-NUMBER]
|
||||
$seqData = readAt($fp, $orsPos[$idx], LOCK_OR_PTR_SEQ_LEN);
|
||||
$newPtrOffset = //how far it "jumps"
|
||||
$orsPos[$idx] +
|
||||
(unpack('V', $seqData[3] . $seqData[4] . $seqData[5] . $seqData[6])[1]); //u32 bit LE
|
||||
|
||||
if($ptrOffset === null) {
|
||||
$ptrOffset = $newPtrOffset; //Save the first one to compare in the next loop
|
||||
++$equalJumps;
|
||||
} elseif ($ptrOffset === $newPtrOffset) {
|
||||
++$equalJumps;
|
||||
}
|
||||
|
||||
perr(
|
||||
"\t[+] Found LOCK-OR#$idx sequence @ " . decTo32bUFhex($orsPos[$idx]) . " => " .
|
||||
rawToUFhex($seqData) . " [RIP+(dec)$newPtrOffset]\n"
|
||||
);
|
||||
}
|
||||
if ($equalJumps !== 4) {
|
||||
perr("\t[-] LOCK-OR PTR offset mismatch - $equalJumps/" . LOCK_OR_PTR_SEQs_NUM . " matched\n");
|
||||
//If the pointer checking failed we can at least move beyond the last LOCK-OR found as we know there's no valid
|
||||
// sequence of LOCK-ORs there
|
||||
$pos = $orsPos[3];
|
||||
continue;
|
||||
}
|
||||
|
||||
perr("\t[+] All $equalJumps LOCK-OR PTR offsets equal - match found!\n");
|
||||
break;
|
||||
} while(!feof($fp));
|
||||
|
||||
if ($orsPos === null) { //There's a small chance no candidates with LOCK ORs were found
|
||||
perr("Failed to find matching sequences", true);
|
||||
}
|
||||
|
||||
//Patch offsets
|
||||
foreach ($orsPos as $seqFileOffset) {
|
||||
//The offset will point at LOCK(), we need to change the OR (0x80 0x0d) to AND (0x80 0x25) so the two bytes after
|
||||
$seqFileOffset = $seqFileOffset+2;
|
||||
|
||||
perr("Patching OR to AND @ file offset (dec)$seqFileOffset\n");
|
||||
fseek($fp, $seqFileOffset);
|
||||
fwrite($fp, "\x25"); //0x0d is OR, 0x25 is AND
|
||||
}
|
||||
|
||||
if (!isset($argv[2])) {
|
||||
perr("No output file specified - discarding data\n");
|
||||
exit;
|
||||
}
|
||||
|
||||
saveStreamToFile($fp, $argv[2]);
|
||||
fclose($fp);
|
||||
85
files/board/arpl/overlayfs/opt/arpl/patch-ramdisk-check.php
Executable file
85
files/board/arpl/overlayfs/opt/arpl/patch-ramdisk-check.php
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* A quick tool for patching the ramdisk check in the DSM kernel image
|
||||
* This lets you tinker with the initial ramdisk contents without disabling mount() features and modules loading
|
||||
*
|
||||
* Usage: php patch-ramdisk-check.php vmlinux vmlinux-mod
|
||||
*/
|
||||
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
if ($argc < 2 || $argc > 3) {
|
||||
perr("Usage: " . $argv[0] . " <inFile> [<outFile>]\n", true);
|
||||
}
|
||||
|
||||
$file = getArgFilePath(1);
|
||||
perr("\nGenerating patch for $file\n");
|
||||
|
||||
//Strings (e.g. error for printk()) reside in .rodata - start searching there to save time
|
||||
$rodataAddr = getELFSectionAddr($file, '.rodata', 2);
|
||||
|
||||
//Locate the precise location of "ramdisk error" string
|
||||
$rdErrAddr = getELFStringLoc($file, '3ramdisk corrupt');
|
||||
|
||||
|
||||
//offsets will be 32 bit in ASM and in LE
|
||||
$errPrintAddr = $rodataAddr + $rdErrAddr;
|
||||
$errPrintCAddrLEH = decTo32bLEhex($errPrintAddr - 1); //Somehow rodata contains off-by-one sometimes...
|
||||
$errPrintAddrLEH = decTo32bLEhex($errPrintAddr);
|
||||
perr("LE arg addr: " . $errPrintCAddrLEH . "\n");
|
||||
|
||||
$fp = getFileMemMapped($file); //Read the whole file to memory to make fseet/fread much faster
|
||||
|
||||
//Find the printk() call argument
|
||||
$printkPos = findSequence($fp, hex2raw($errPrintCAddrLEH), 0, DIR_FWD, -1);
|
||||
if ($printkPos === -1) {
|
||||
perr("printk pos not found!\n", true);
|
||||
}
|
||||
perr("Found printk arg @ " . decTo32bUFhex($printkPos) . "\n");
|
||||
|
||||
//double check if it's a MOV reg,VAL (where reg is EAX/ECX/EDX/EBX/ESP/EBP/ESI/EDI)
|
||||
fseek($fp, $printkPos - 3);
|
||||
$instr = fread($fp, 3);
|
||||
if (strncmp($instr, "\x48\xc7", 2) !== 0) {
|
||||
perr("Expected MOV=>reg before printk error, got " . bin2hex($instr) . "\n", true);
|
||||
}
|
||||
$dstReg = ord($instr[2]);
|
||||
if ($dstReg < 192 || $dstReg > 199) {
|
||||
perr("Expected MOV w/reg operand [C0-C7], got " . bin2hex($instr[2]) . "\n", true);
|
||||
}
|
||||
$movPos = $printkPos - 3;
|
||||
perr("Found printk MOV @ " . decTo32bUFhex($movPos) . "\n");
|
||||
|
||||
//now we should seek a reasonable amount (say, up to 32 bytes) for a sequence of CALL x => TEST EAX,EAX => JZ
|
||||
$testPos = findSequence($fp, "\x85\xc0", $movPos, DIR_RWD, 32);
|
||||
if ($testPos === -1) {
|
||||
perr("Failed to find TEST eax,eax\n", true);
|
||||
}
|
||||
|
||||
$jzPos = $testPos + 2;
|
||||
fseek($fp, $jzPos);
|
||||
$jz = fread($fp, 2);
|
||||
if ($jz[0] !== "\x74") {
|
||||
perr("Failed to find JZ\n", true);
|
||||
}
|
||||
|
||||
$jzp = "\xEB" . $jz[1];
|
||||
perr('OK - patching ' . bin2hex($jz) . " (JZ) to " . bin2hex($jzp) . " (JMP) @ $jzPos\n");
|
||||
fseek($fp, $jzPos); //we should be here already
|
||||
perr("Patched " . fwrite($fp, $jzp) . " bytes in memory\n");
|
||||
|
||||
if (!isset($argv[2])) {
|
||||
perr("No output file specified - discarding data\n");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!isset($argv[2])) {
|
||||
perr("No output file specified - discarding data\n");
|
||||
exit;
|
||||
}
|
||||
|
||||
saveStreamToFile($fp, $argv[2]);
|
||||
fclose($fp);
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# WARNING: this file is also embedded in the post-init patcher, so don't go to crazy with the syntax/tools as it must
|
||||
# be able to execute in the initramfs/preboot environment (so no bashism etc)
|
||||
# All comments will be stripped, functions here should NOT start with brp_ as they're not part of the builder
|
||||
|
||||
|
||||
if [ -z ${SED_PATH+x} ]; then
|
||||
echo "Your SED_PATH variable is not set/is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
##$1 from, $2 to, $3 file to path
|
||||
_replace_in_file()
|
||||
{
|
||||
if grep -q "$1" "$3"; then
|
||||
$SED_PATH -i "$3" -e "s#$1#$2#"
|
||||
fi
|
||||
}
|
||||
|
||||
# Replace/remove/add values in .conf K=V file
|
||||
#
|
||||
# Args: $1 name, $2 new_val, $3 path
|
||||
_set_conf_kv()
|
||||
{
|
||||
# Delete
|
||||
if [ -z "$2" ]; then
|
||||
$SED_PATH -i "$3" -e "s/^$1=.*$//"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# Replace
|
||||
if grep -q "^$1=" "$3"; then
|
||||
$SED_PATH -i "$3" -e "s\"^$1=.*\"$1=\\\"$2\\\"\""
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Add if doesn't exist
|
||||
echo "$1=\"$2\"" >> $3
|
||||
}
|
||||
16
files/board/arpl/overlayfs/opt/arpl/patch/iosched-trampoline.sh
Executable file
16
files/board/arpl/overlayfs/opt/arpl/patch/iosched-trampoline.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/sh
|
||||
# This script is saved to /sbin/modprobe which is a so called UMH (user-mode-helper) for kmod (kernel/kmod.c)
|
||||
# The kmod subsystem in the kernel is used to load modules from kernel. We exploit it a bit to load RP as soon as
|
||||
# possible (which turns out to be via init/main.c => load_default_modules => load_default_elevator_module
|
||||
# When the kernel is booted with "elevator=elevator" it will attempt to load a module "elevator-iosched"... and the rest
|
||||
# should be obvious from the code below. DO NOT print anything here (kernel doesn't attach STDOUT)
|
||||
for arg in "$@"
|
||||
do
|
||||
if [ "$arg" = "elevator-iosched" ]; then
|
||||
insmod /usr/lib/modules/rp.ko
|
||||
rm /usr/lib/modules/rp.ko
|
||||
rm /sbin/modprobe
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
exit 1
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/usr/syno/web/webman/get_state.cgi
|
||||
+++ b/usr/syno/web/webman/get_state.cgi
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
-DisabledPortDisks="$(/usr/syno/bin/synodiskport -portthawlist)"
|
||||
+DisabledPortDisks=""
|
||||
partition="$(/usr/syno/bin/synodiskport -installable_disk_list)"
|
||||
|
||||
upnpmodelname="$(/bin/get_key_value /etc.defaults/synoinfo.conf upnpmodelname)"
|
||||
@@ -0,0 +1,31 @@
|
||||
--- a/usr/sbin/init.post
|
||||
+++ b/usr/sbin/init.post
|
||||
@@ -31,7 +31,28 @@
|
||||
OptPrjQuota="$(GetPQMountOpt "${RootMountPath}")"
|
||||
# shellcheck disable=SC2046
|
||||
Mount "${RootMountPath}" /tmpRoot -o barrier=1 ${OptPrjQuota}
|
||||
+############################################################################################
|
||||
+SED_PATH='/tmpRoot/usr/bin/sed'
|
||||
|
||||
+@@@CONFIG-MANIPULATORS-TOOLS@@@
|
||||
+
|
||||
+@@@CONFIG-GENERATED@@@
|
||||
+
|
||||
+UPSTART="/tmpRoot/usr/share/init"
|
||||
+
|
||||
+if ! echo; then
|
||||
+ _replace_in_file '^start on' '#start on' $UPSTART/tty.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/syno_poweroff_task.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/burnin_loader.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/udevtrigger.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/bs-poweroff.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/udevd.conf
|
||||
+else
|
||||
+ _replace_in_file '^#start on' 'start on' $UPSTART/tty.conf
|
||||
+fi
|
||||
+
|
||||
+/addons/addons.sh sys
|
||||
+############################################################################################
|
||||
Mkdir -p /tmpRoot/initrd
|
||||
|
||||
Umount /proc >/dev/null 2>&1
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/usr/syno/web/webman/get_state.cgi
|
||||
+++ b/usr/syno/web/webman/get_state.cgi
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
-DisabledPortDisks=`/usr/syno/bin/synodiskport -portthawlist`
|
||||
+DisabledPortDisks=""
|
||||
partition=`/usr/syno/bin/synodiskport -installable_disk_list`
|
||||
|
||||
product=`/bin/get_key_value /etc.defaults/synoinfo.conf product`
|
||||
@@ -0,0 +1,10 @@
|
||||
diff --git a/etc/passwd b/etc/passwd
|
||||
index 6a0344d..cf95fbd 100644
|
||||
--- a/etc/passwd
|
||||
+++ b/etc/passwd
|
||||
@@ -1,4 +1,4 @@
|
||||
-root:x:0:0::/root:/bin/ash
|
||||
+root::0:0::/root:/bin/ash
|
||||
system:x:1:1::/usr/syno/synoman:/usr/bin/nologin
|
||||
daemon:x:2:2::/:/bin/sh
|
||||
lp:x:7:7::/var/spool/lpd:/bin/sh
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/linuxrc.syno.impl
|
||||
+++ b/linuxrc.syno.impl
|
||||
@@ -155,6 +155,8 @@ fi
|
||||
# insert basic USB modules for detect f401/FDT
|
||||
echo "Insert basic USB modules..."
|
||||
SYNOLoadModules $USB_MODULES
|
||||
+SYNOLoadModules "usb-storage"
|
||||
+/addons/addons.sh rd
|
||||
|
||||
# insert Etron USB3.0 drivers
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--- /etc/hosts
|
||||
+++ /etc/hosts
|
||||
@@ -2,3 +2,5 @@
|
||||
# that require network functionality will fail.
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
+127.0.0.1 update7.synology.com
|
||||
+127.0.0.1 dataupdate7.synology.com
|
||||
@@ -0,0 +1,32 @@
|
||||
--- a/usr/sbin/init.post
|
||||
+++ b/usr/sbin/init.post
|
||||
@@ -18,6 +18,29 @@ if [ "$UniqueRD" = "nextkvmx64" ]; then
|
||||
fi
|
||||
Mount "$RootDevice" /tmpRoot -o barrier=1
|
||||
|
||||
+############################################################################################
|
||||
+SED_PATH='/tmpRoot/usr/bin/sed'
|
||||
+
|
||||
+@@@CONFIG-MANIPULATORS-TOOLS@@@
|
||||
+
|
||||
+@@@CONFIG-GENERATED@@@
|
||||
+
|
||||
+UPSTART="/tmpRoot/usr/share/init"
|
||||
+
|
||||
+if ! echo; then
|
||||
+ _replace_in_file '^start on' '#start on' $UPSTART/tty.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/syno_poweroff_task.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/burnin_loader.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/udevtrigger.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/bs-poweroff.conf
|
||||
+ _replace_in_file "console output" "console none" $UPSTART/udevd.conf
|
||||
+else
|
||||
+ _replace_in_file '^#start on' 'start on' $UPSTART/tty.conf
|
||||
+fi
|
||||
+
|
||||
+/addons/addons.sh sys
|
||||
+############################################################################################
|
||||
+
|
||||
Mkdir -p /tmpRoot/initrd
|
||||
|
||||
Umount /proc >/dev/null 2>&1
|
||||
126
files/board/arpl/overlayfs/opt/arpl/ramdisk-patch.sh
Executable file
126
files/board/arpl/overlayfs/opt/arpl/ramdisk-patch.sh
Executable file
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /opt/arpl/include/functions.sh
|
||||
. /opt/arpl/include/addons.sh
|
||||
|
||||
# Sanity check
|
||||
[ -f "${ORI_RDGZ_FILE}" ] || die "${ORI_RDGZ_FILE} not found!"
|
||||
|
||||
echo -n "Patching Ramdisk"
|
||||
|
||||
# Remove old rd.gz patched
|
||||
rm -f "${MOD_RDGZ_FILE}"
|
||||
|
||||
# Unzipping ramdisk
|
||||
echo -n "."
|
||||
rm -rf "${RAMDISK_PATH}" # Force clean
|
||||
mkdir -p "${RAMDISK_PATH}"
|
||||
(cd "${RAMDISK_PATH}"; xz -dc < "${ORI_RDGZ_FILE}" | cpio -idm) >/dev/null 2>&1
|
||||
|
||||
# Check if DSM buildnumber changed
|
||||
. "${RAMDISK_PATH}/etc/VERSION"
|
||||
|
||||
MODEL="`readConfigKey "model" "${USER_CONFIG_FILE}"`"
|
||||
BUILD="`readConfigKey "build" "${USER_CONFIG_FILE}"`"
|
||||
LKM="`readConfigKey "lkm" "${USER_CONFIG_FILE}"`"
|
||||
|
||||
if [ ${BUILD} -ne ${buildnumber} ]; then
|
||||
echo -e "\033[A\n\033[1;32mBuild number changed from \033[1;31m${BUILD}\033[1;32m to \033[1;31m${buildnumber}\033[0m"
|
||||
echo -n "Patching Ramdisk."
|
||||
# Update new buildnumber
|
||||
BUILD=${buildnumber}
|
||||
writeConfigKey "build" "${BUILD}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
echo -n "."
|
||||
# Read model data
|
||||
PLATFORM="`readModelKey "${MODEL}" "platform"`"
|
||||
KVER="`readModelKey "${MODEL}" "builds.${BUILD}.kver"`"
|
||||
RD_COMPRESSED="`readModelKey "${MODEL}" "builds.${BUILD}.rd-compressed"`"
|
||||
|
||||
# Sanity check
|
||||
[ -z "${PLATFORM}" -o -z "${KVER}" ] && die "ERROR: Configuration for model ${MODEL} and buildnumber ${BUILD} not found."
|
||||
|
||||
declare -A SYNOINFO
|
||||
declare -A ADDONS
|
||||
|
||||
# Read more config
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
|
||||
done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo")
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
|
||||
while IFS="=" read KEY VALUE; do
|
||||
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
|
||||
# Patches
|
||||
while read f; do
|
||||
echo -n "."
|
||||
echo "Patching with ${f}" >"${LOG_FILE}" 2>&1
|
||||
(cd "${RAMDISK_PATH}" && patch -p1 < "${PATCH_PATH}/${f}") >>"${LOG_FILE}" 2>&1 || dieLog
|
||||
done < <(readModelArray "${MODEL}" "builds.${BUILD}.patch")
|
||||
|
||||
# Patch /etc/synoinfo.conf
|
||||
echo -n "."
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
sed -i "s|^${KEY}=.*|${KEY}=\"${SYNOINFO[${KEY}]}\"|" "${RAMDISK_PATH}/etc/synoinfo.conf" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
done
|
||||
|
||||
# Patch /sbin/init.post
|
||||
echo -n "."
|
||||
grep -v -e '^[\t ]*#' -e '^$' "${PATCH_PATH}/config-manipulators.sh" > "${TMP_PATH}/rp.txt"
|
||||
sed -e "/@@@CONFIG-MANIPULATORS-TOOLS@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "${RAMDISK_PATH}/sbin/init.post"
|
||||
rm "${TMP_PATH}/rp.txt"
|
||||
touch "${TMP_PATH}/rp.txt"
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc/synoinfo.conf'" >> "${TMP_PATH}/rp.txt"
|
||||
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc.defaults/synoinfo.conf'" >> "${TMP_PATH}/rp.txt"
|
||||
done
|
||||
sed -e "/@@@CONFIG-GENERATED@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "${RAMDISK_PATH}/sbin/init.post"
|
||||
rm "${TMP_PATH}/rp.txt"
|
||||
|
||||
# Copying LKM to /usr/lib/modules/rp.ko
|
||||
echo -n "."
|
||||
cp "${LKM_PATH}/rp-${PLATFORM}-${KVER}-${LKM}.ko" "${RAMDISK_PATH}/usr/lib/modules/rp.ko"
|
||||
|
||||
# Copying fake modprobe
|
||||
echo -n "."
|
||||
cp "${PATCH_PATH}/iosched-trampoline.sh" "${RAMDISK_PATH}/usr/sbin/modprobe"
|
||||
|
||||
# Addons
|
||||
# Check if model needs Device-tree dynamic patch
|
||||
DT="`readModelKey "${MODEL}" "dt"`"
|
||||
[ "${DT}" = "true" ] && ADDONS['qjs-dtb']="" # Add system addon "qjs-dtb"
|
||||
mkdir -p "${RAMDISK_PATH}/addons"
|
||||
echo -n "."
|
||||
#/proc/sys/kernel/syno_install_flag
|
||||
echo "#!/bin/sh" > "${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo 'export INSMOD="/sbin/insmod"' >> "${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo >> "${RAMDISK_PATH}/addons/addons.sh"
|
||||
for ADDON in ${!ADDONS[@]}; do
|
||||
PARAMS=${ADDONS[${ADDON}]}
|
||||
if ! installAddon ${ADDON}; then
|
||||
echo "ADDON ${ADDON} not found!" | tee "${LOG_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >> "${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
done
|
||||
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
# Reassembly ramdisk
|
||||
echo -n "."
|
||||
if [ "${RD_COMPRESSED}" == "true" ]; then
|
||||
(cd "${RAMDISK_PATH}" && find . | cpio -o -H newc -R root:root | xz -9 --format=lzma > "${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || dieLog
|
||||
else
|
||||
(cd "${RAMDISK_PATH}" && find . | cpio -o -H newc -R root:root > "${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || dieLog
|
||||
fi
|
||||
|
||||
# Clean
|
||||
rm -rf "${RAMDISK_PATH}"
|
||||
|
||||
# Update SHA256 hash
|
||||
RAMDISK_HASH="`sha256sum ${ORI_RDGZ_FILE} | awk '{print$1}'`"
|
||||
writeConfigKey "ramdisk-hash" "${RAMDISK_HASH}" "${USER_CONFIG_FILE}"
|
||||
echo
|
||||
63
files/board/arpl/overlayfs/opt/arpl/vmlinux-to-bzImage.sh
Executable file
63
files/board/arpl/overlayfs/opt/arpl/vmlinux-to-bzImage.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /opt/arpl/include/functions.sh
|
||||
|
||||
#zImage_head 16494
|
||||
#payload(
|
||||
# vmlinux.bin x
|
||||
# padding 0xf00000-x
|
||||
# vmlinux.bin size 4
|
||||
#) 0xf00004
|
||||
#zImage_tail(
|
||||
# unknown 72
|
||||
# run_size 4
|
||||
# unknown 30
|
||||
# vmlinux.bin size 4
|
||||
# unknown 114460
|
||||
#) 114570
|
||||
#crc32 4
|
||||
|
||||
# Adapted from: scripts/Makefile.lib
|
||||
# Usage: size_append FILE [FILE2] [FILEn]...
|
||||
# Output: LE HEX with size of file in bytes (to STDOUT)
|
||||
file_size_le () {
|
||||
printf $(
|
||||
dec_size=0;
|
||||
for F in "${@}"; do
|
||||
fsize=$(stat -c "%s" ${F});
|
||||
dec_size=$(expr ${dec_size} + ${fsize});
|
||||
done;
|
||||
printf "%08x\n" ${dec_size} |
|
||||
sed 's/\(..\)/\1 /g' | {
|
||||
read ch0 ch1 ch2 ch3;
|
||||
for ch in ${ch3} ${ch2} ${ch1} ${ch0}; do
|
||||
printf '%s%03o' '\' $((0x${ch}));
|
||||
done;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
size_le () {
|
||||
printf $(
|
||||
printf "%08x\n" "${@}" |
|
||||
sed 's/\(..\)/\1 /g' | {
|
||||
read ch0 ch1 ch2 ch3;
|
||||
for ch in ${ch3} ${ch2} ${ch1} ${ch0}; do
|
||||
printf '%s%03o' '\' $((0x${ch}));
|
||||
done;
|
||||
}
|
||||
)
|
||||
}
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
VMLINUX_MOD=${1}
|
||||
ZIMAGE_MOD=${2}
|
||||
gzip -cd "${SCRIPT_DIR}/zImage_template.gz" > "${ZIMAGE_MOD}"
|
||||
|
||||
dd if="${VMLINUX_MOD}" of="${ZIMAGE_MOD}" bs=16494 seek=1 conv=notrunc >"${LOG_FILE}" 2>&1 || dieLog
|
||||
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=15745134 seek=1 conv=notrunc >"${LOG_FILE}" 2>&1 || dieLog
|
||||
|
||||
RUN_SIZE=$(objdump -h ${VMLINUX_MOD} | sh "${SCRIPT_DIR}/calc_run_size.sh")
|
||||
size_le $RUN_SIZE | dd of=$ZIMAGE_MOD bs=15745210 seek=1 conv=notrunc >"${LOG_FILE}" 2>&1 || dieLog
|
||||
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=15745244 seek=1 conv=notrunc >"${LOG_FILE}" 2>&1 || dieLog
|
||||
# cksum $ZIMAGE_MOD # https://blog.box.com/crc32-checksums-the-good-the-bad-and-the-ugly
|
||||
size_le $(($((16#$(php "${SCRIPT_DIR}/crc32.php" "${ZIMAGE_MOD}"))) ^ 0xFFFFFFFF)) | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append >"${LOG_FILE}" 2>&1 || dieLog
|
||||
BIN
files/board/arpl/overlayfs/opt/arpl/zImage_template.gz
Normal file
BIN
files/board/arpl/overlayfs/opt/arpl/zImage_template.gz
Normal file
Binary file not shown.
28
files/board/arpl/overlayfs/opt/arpl/zimage-patch.sh
Executable file
28
files/board/arpl/overlayfs/opt/arpl/zimage-patch.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /opt/arpl/include/functions.sh
|
||||
|
||||
# Sanity check
|
||||
[ -f "${ORI_ZIMAGE_FILE}" ] || die "${ORI_ZIMAGE_FILE} not found!"
|
||||
|
||||
echo -n "Patching zImage"
|
||||
|
||||
rm -f "${MOD_ZIMAGE_FILE}"
|
||||
echo -n "."
|
||||
# Extract vmlinux
|
||||
/opt/arpl/bzImage-to-vmlinux.sh "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
echo -n "."
|
||||
# Patch boot params
|
||||
/opt/arpl/patch-boot_params-check.php "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod1" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
echo -n "."
|
||||
# Patch ramdisk check
|
||||
/opt/arpl/patch-ramdisk-check.php "${TMP_PATH}/vmlinux-mod1" "${TMP_PATH}/vmlinux-mod2" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
echo -n "."
|
||||
# rebuild zImage
|
||||
/opt/arpl/vmlinux-to-bzImage.sh "${TMP_PATH}/vmlinux-mod2" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
|
||||
echo -n "."
|
||||
# Update HASH of new DSM zImage
|
||||
HASH="`sha256sum ${ORI_ZIMAGE_FILE} | awk '{print$1}'`"
|
||||
writeConfigKey "zimage-hash" "${HASH}" "${USER_CONFIG_FILE}"
|
||||
echo
|
||||
31
files/board/arpl/overlayfs/root/.bashrc
Normal file
31
files/board/arpl/overlayfs/root/.bashrc
Normal file
@@ -0,0 +1,31 @@
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
|
||||
# Note: PS1 and umask are already set in /etc/profile. You should not
|
||||
# need this unless you want different defaults for root.
|
||||
PS1='\u@\h:\w# '
|
||||
# umask 022
|
||||
|
||||
# You may uncomment the following lines if you want `ls' to be colorized:
|
||||
export LS_OPTIONS='--color=auto'
|
||||
alias ls='ls $LS_OPTIONS'
|
||||
alias ll='ls $LS_OPTIONS -l'
|
||||
|
||||
# Save history in realtime
|
||||
shopt -s histappend
|
||||
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
|
||||
|
||||
export EDITOR="/bin/nano"
|
||||
export BOOTLOADER_PATH="/mnt/p1"
|
||||
export SLPART_PATH="/mnt/p2" # Synologic partition
|
||||
export CACHE_PATH="/mnt/p3"
|
||||
export PATH="${PATH}:/opt/arpl"
|
||||
|
||||
if [ ! -f ${HOME}/.initialized ]; then
|
||||
touch ${HOME}/.initialized
|
||||
/opt/arpl/init.sh
|
||||
fi
|
||||
cd /opt/arpl
|
||||
if tty | grep -q "/dev/pts" && [ -z "${SSH_TTY}" ]; then
|
||||
/opt/arpl/menu.sh
|
||||
exit
|
||||
fi
|
||||
17
files/board/arpl/overlayfs/root/.profile
Normal file
17
files/board/arpl/overlayfs/root/.profile
Normal file
@@ -0,0 +1,17 @@
|
||||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
BIN
files/board/arpl/overlayfs/usr/bin/yq
Executable file
BIN
files/board/arpl/overlayfs/usr/bin/yq
Executable file
Binary file not shown.
BIN
files/board/arpl/p1/EFI/BOOT/BOOTX64.EFI
Normal file
BIN
files/board/arpl/p1/EFI/BOOT/BOOTX64.EFI
Normal file
Binary file not shown.
19
files/board/arpl/p1/EFI/BOOT/SynoBootLoader.conf
Executable file
19
files/board/arpl/p1/EFI/BOOT/SynoBootLoader.conf
Executable file
@@ -0,0 +1,19 @@
|
||||
serial --unit=1 --speed=115200
|
||||
terminal serial
|
||||
default 1
|
||||
timeout 3
|
||||
verbose
|
||||
hiddenmenu
|
||||
fallback 0
|
||||
|
||||
title SYNOLOGY_1
|
||||
root (hd0,0)
|
||||
kernel /zImage root=/dev/md0
|
||||
initrd /rd.gz
|
||||
|
||||
title SYNOLOGY_2
|
||||
root (hd0,1)
|
||||
cksum /grub_cksum.syno
|
||||
vender /vender show
|
||||
kernel /zImage root=/dev/md0
|
||||
initrd /rd.gz
|
||||
0
files/board/arpl/p1/EFI/BOOT/SynoBootLoader.efi
Executable file
0
files/board/arpl/p1/EFI/BOOT/SynoBootLoader.efi
Executable file
3
files/board/arpl/p1/EFI/BOOT/grub.cfg
Normal file
3
files/board/arpl/p1/EFI/BOOT/grub.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
set root=(hd0,msdos1)
|
||||
set prefix=($root)'/grub'
|
||||
configfile $prefix/grub.cfg
|
||||
BIN
files/board/arpl/p1/grub/fonts/unicode.pf2
Normal file
BIN
files/board/arpl/p1/grub/fonts/unicode.pf2
Normal file
Binary file not shown.
73
files/board/arpl/p1/grub/grub.cfg
Normal file
73
files/board/arpl/p1/grub/grub.cfg
Normal file
@@ -0,0 +1,73 @@
|
||||
insmod echo
|
||||
insmod terminal
|
||||
insmod test
|
||||
|
||||
terminal_input console
|
||||
terminal_output console
|
||||
|
||||
set default="0"
|
||||
set timeout="3"
|
||||
set timeout_style="menu"
|
||||
|
||||
insmod loadenv
|
||||
if [ -s $prefix/grubenv ]; then
|
||||
set have_grubenv=true
|
||||
load_env
|
||||
fi
|
||||
if [ "${next_entry}" ] ; then
|
||||
set default="${next_entry}"
|
||||
set next_entry=
|
||||
save_env next_entry
|
||||
fi
|
||||
|
||||
insmod usb_keyboard
|
||||
insmod part_msdos
|
||||
insmod ext2
|
||||
insmod fat
|
||||
insmod linux
|
||||
insmod gzio
|
||||
|
||||
set gfxmode=auto
|
||||
if [ "${grub_platform}" = "efi" ]; then
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
else
|
||||
insmod vbe
|
||||
insmod vga
|
||||
fi
|
||||
|
||||
insmod font
|
||||
if loadfont ${prefix}/fonts/unicode.pf2; then
|
||||
insmod gfxterm
|
||||
set gfxmode=auto
|
||||
set gfxpayload=keep
|
||||
terminal_output gfxterm
|
||||
fi
|
||||
|
||||
insmod serial
|
||||
if serial --unit=0 --speed=115200; then
|
||||
terminal_input --append serial_com0
|
||||
terminal_output --append serial_com0
|
||||
fi
|
||||
|
||||
insmod search
|
||||
search --set=root --label "ARPL1"
|
||||
if [ -s /zImage -a -s /rd.gz ]; then
|
||||
menuentry 'Boot DSM' --id boot {
|
||||
echo "Loading kernel..."
|
||||
linux /bzImage-arpl console=ttyS0,115200n8
|
||||
echo "Loading initramfs..."
|
||||
initrd /initrd-arpl
|
||||
echo "Booting..."
|
||||
}
|
||||
else
|
||||
set timeout="1"
|
||||
fi
|
||||
|
||||
menuentry 'Configure loader' --id config {
|
||||
echo "Loading kernel..."
|
||||
linux /bzImage-arpl console=ttyS0,115200n8 IWANTTOCHANGETHECONFIG
|
||||
echo "Loading initramfs..."
|
||||
initrd /initrd-arpl
|
||||
echo "Booting..."
|
||||
}
|
||||
2
files/board/arpl/p1/grub/grubenv
Executable file
2
files/board/arpl/p1/grub/grubenv
Executable file
@@ -0,0 +1,2 @@
|
||||
# GRUB Environment Block
|
||||
#######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
|
||||
BIN
files/board/arpl/p1/grub/i386-pc/acpi.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/acpi.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/adler32.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/adler32.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/affs.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/affs.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/afs.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/afs.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/ahci.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/ahci.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/all_video.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/all_video.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/aout.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/aout.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/archelp.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/archelp.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/at_keyboard.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/at_keyboard.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/ata.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/ata.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/backtrace.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/backtrace.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/bfs.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/bfs.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/biosdisk.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/biosdisk.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/bitmap.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/bitmap.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/bitmap_scale.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/bitmap_scale.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/blocklist.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/blocklist.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/boot.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/boot.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/bsd.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/bsd.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/bswap_test.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/bswap_test.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/btrfs.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/btrfs.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/bufio.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/bufio.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cat.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cat.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cbfs.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cbfs.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cbls.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cbls.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cbmemc.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cbmemc.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cbtable.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cbtable.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cbtime.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cbtime.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/chain.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/chain.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cmdline_cat_test.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cmdline_cat_test.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cmosdump.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cmosdump.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cmostest.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cmostest.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cmp.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cmp.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cmp_test.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cmp_test.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/configfile.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/configfile.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cpio.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cpio.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cpio_be.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cpio_be.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cpuid.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cpuid.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/crc64.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/crc64.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/crypto.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/crypto.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cryptodisk.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cryptodisk.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/cs5536.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/cs5536.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/ctz_test.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/ctz_test.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/date.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/date.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/datehook.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/datehook.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/datetime.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/datetime.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/disk.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/disk.mod
Normal file
Binary file not shown.
BIN
files/board/arpl/p1/grub/i386-pc/diskfilter.mod
Normal file
BIN
files/board/arpl/p1/grub/i386-pc/diskfilter.mod
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user