mirror of
https://github.com/fbelavenuto/arpl.git
synced 2025-12-24 14:52:05 +08:00
Compare commits
30 Commits
v0.4-alpha
...
v0.4-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a01291188 | ||
|
|
fe8258b8a8 | ||
|
|
ebf1bf2e24 | ||
|
|
15194a396c | ||
|
|
a62bba0eff | ||
|
|
6253ab9b20 | ||
|
|
8fe3c41ce4 | ||
|
|
e097941014 | ||
|
|
67f1ee8066 | ||
|
|
f74d889ce3 | ||
|
|
9ac8279c2b | ||
|
|
f5220d1468 | ||
|
|
7898b54980 | ||
|
|
2ad2825c46 | ||
|
|
8b9b1439b3 | ||
|
|
da89a97182 | ||
|
|
19ec462570 | ||
|
|
8cc750a527 | ||
|
|
c5ec8f7d24 | ||
|
|
82acaabe26 | ||
|
|
dc7076709c | ||
|
|
eeec01864f | ||
|
|
dc102f5af7 | ||
|
|
d4c342c0fd | ||
|
|
8fff3377be | ||
|
|
bb130cdc23 | ||
|
|
6c2f0b936e | ||
|
|
fe7fbf4821 | ||
|
|
e669a94738 | ||
|
|
6d9c217b7d |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: fbelavenuto
|
||||
46
.github/workflows/main.yml
vendored
46
.github/workflows/main.yml
vendored
@@ -2,8 +2,8 @@ name: Build image
|
||||
|
||||
on:
|
||||
push:
|
||||
# branches:
|
||||
# - main
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch:
|
||||
@@ -54,25 +54,25 @@ jobs:
|
||||
rm -rf .buildroot/board/arpl/p1
|
||||
rm -rf .buildroot/board/arpl/p3
|
||||
# Get latest LKMs
|
||||
# echo "Getting latest LKMs"
|
||||
# TAG=`curl -s https://api.github.com/repos/fbelavenuto/redpill-lkm/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||
# curl -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/rp-lkms.zip" -o /tmp/rp-lkms.zip
|
||||
# rm -rf files/board/arpl/p3/lkms/*
|
||||
# unzip /tmp/rp-lkms.zip -d files/board/arpl/p3/lkms
|
||||
# # Get latest addons and install its
|
||||
# echo "Getting latest Addons"
|
||||
# TAG=`curl -s https://api.github.com/repos/fbelavenuto/arpl-addons/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||
# curl -L "https://github.com/fbelavenuto/arpl-addons/releases/download/${TAG}/addons.zip" -o /tmp/addons.zip
|
||||
# mkdir -p /tmp/addons
|
||||
# unzip /tmp/addons.zip -d /tmp/addons
|
||||
# DEST_PATH="files/board/arpl/p3/addons"
|
||||
# echo "Installing addons to ${DEST_PATH}"
|
||||
# for PKG in `ls /tmp/addons/*.addon`; do
|
||||
# ADDON=`basename ${PKG} | sed 's|.addon||'`
|
||||
# mkdir -p "${DEST_PATH}/${ADDON}"
|
||||
# echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}"
|
||||
# tar xaf "${PKG}" -C "${DEST_PATH}/${ADDON}"
|
||||
# done
|
||||
echo "Getting latest LKMs"
|
||||
TAG=`curl -s https://api.github.com/repos/fbelavenuto/redpill-lkm/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||
curl -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/rp-lkms.zip" -o /tmp/rp-lkms.zip
|
||||
rm -rf files/board/arpl/p3/lkms/*
|
||||
unzip /tmp/rp-lkms.zip -d files/board/arpl/p3/lkms
|
||||
# Get latest addons and install its
|
||||
echo "Getting latest Addons"
|
||||
TAG=`curl -s https://api.github.com/repos/fbelavenuto/arpl-addons/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||
curl -L "https://github.com/fbelavenuto/arpl-addons/releases/download/${TAG}/addons.zip" -o /tmp/addons.zip
|
||||
mkdir -p /tmp/addons
|
||||
unzip /tmp/addons.zip -d /tmp/addons
|
||||
DEST_PATH="files/board/arpl/p3/addons"
|
||||
echo "Installing addons to ${DEST_PATH}"
|
||||
for PKG in `ls /tmp/addons/*.addon`; do
|
||||
ADDON=`basename ${PKG} | sed 's|.addon||'`
|
||||
mkdir -p "${DEST_PATH}/${ADDON}"
|
||||
echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}"
|
||||
tar xaf "${PKG}" -C "${DEST_PATH}/${ADDON}"
|
||||
done
|
||||
# Copy files
|
||||
echo "Copying files"
|
||||
sed 's/^ARPL_VERSION=.*/ARPL_VERSION="'${VERSION}'"/' -i files/board/arpl/overlayfs/opt/arpl/include/consts.sh
|
||||
@@ -87,12 +87,13 @@ jobs:
|
||||
#qemu-img convert -O vmdk arpl.img arpl.vmdk
|
||||
qemu-img convert -O vmdk -o adapter_type=lsilogic arpl.img -o subformat=monolithicFlat arpl.vmdk
|
||||
|
||||
# Zip image
|
||||
# Zip image and generate checksum
|
||||
- name: Pack
|
||||
shell: bash
|
||||
run: |
|
||||
zip -9 "arpl-${{ steps.build.outputs.VERSION }}.img.zip" arpl.img
|
||||
zip -9 "arpl-${{ steps.build.outputs.VERSION }}.vmdk.zip" arpl*.vmdk
|
||||
(cd .buildroot/output/images && sha256sum bzImage rootfs.cpio.xz) >> sha256sum
|
||||
|
||||
# Upload artifact
|
||||
- name: Upload
|
||||
@@ -114,3 +115,4 @@ jobs:
|
||||
arpl-${{ steps.build.outputs.VERSION }}.vmdk.zip
|
||||
.buildroot/output/images/bzImage
|
||||
.buildroot/output/images/rootfs.cpio.xz
|
||||
sha256sum
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,7 +4,7 @@ arpl*.img
|
||||
arpl*.vmdk
|
||||
*.zip
|
||||
.buildroot
|
||||
test.sh
|
||||
test*.sh
|
||||
docker/Dockerfile
|
||||
docker/cache
|
||||
*.bak
|
||||
|
||||
@@ -110,9 +110,10 @@ CONFIG_PCIEPORTBUS=y
|
||||
CONFIG_HOTPLUG_PCI=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
CONFIG_FW_LOADER_USER_HELPER=y
|
||||
CONFIG_FW_LOADER_COMPRESS=y
|
||||
CONFIG_DEBUG_DEVRES=y
|
||||
CONFIG_CONNECTOR=y
|
||||
CONFIG_SYSFB_SIMPLEFB=y
|
||||
CONFIG_EFI_VARS=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_VIRTIO_BLK=m
|
||||
@@ -359,9 +360,6 @@ CONFIG_AGP=y
|
||||
CONFIG_AGP_AMD64=y
|
||||
CONFIG_AGP_INTEL=y
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_I915=m
|
||||
CONFIG_DRM_VMWGFX=m
|
||||
CONFIG_DRM_VIRTIO_GPU=m
|
||||
CONFIG_FB=y
|
||||
CONFIG_FIRMWARE_EDID=y
|
||||
CONFIG_FB_TILEBLITTING=y
|
||||
@@ -369,8 +367,6 @@ CONFIG_FB_VGA16=m
|
||||
CONFIG_FB_UVESA=m
|
||||
CONFIG_FB_VESA=y
|
||||
CONFIG_FB_EFI=y
|
||||
CONFIG_FB_NVIDIA=m
|
||||
CONFIG_FB_I740=m
|
||||
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
||||
CONFIG_HIDRAW=y
|
||||
CONFIG_HID_GYRATION=y
|
||||
@@ -444,8 +440,6 @@ CONFIG_AUTOFS4_FS=y
|
||||
CONFIG_MSDOS_FS=y
|
||||
CONFIG_VFAT_FS=y
|
||||
CONFIG_PROC_KCORE=y
|
||||
CONFIG_TMPFS_POSIX_ACL=y
|
||||
CONFIG_TMPFS_INODE64=y
|
||||
CONFIG_HUGETLBFS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
|
||||
@@ -45,8 +45,6 @@ sudo cp "${BINARIES_DIR}/rootfs.cpio.xz" "${BINARIES_DIR}/p3/initrd-arpl"
|
||||
sudo cp -R "${BOARD_PATH}/p1/"* "${BINARIES_DIR}/p1"
|
||||
sudo cp -R "${BOARD_PATH}/p3/"* "${BINARIES_DIR}/p3"
|
||||
sync
|
||||
cp "${BINARIES_DIR}/bzImage" ~/bzImage-arpl
|
||||
cp "${BINARIES_DIR}/rootfs.cpio.xz" ~/initrd-arpl
|
||||
|
||||
echo "Unmount image file"
|
||||
sudo umount "${BINARIES_DIR}/p1"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
obey pam restrictions = yes
|
||||
map to guest = Bad User
|
||||
usershare allow guests = yes
|
||||
dfree command = /usr/bin/df
|
||||
|
||||
[arpl]
|
||||
browseable = yes
|
||||
public = yes
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
ARPL_VERSION="0.4-alpha5"
|
||||
ARPL_VERSION="0.4-alpha11"
|
||||
|
||||
# Define paths
|
||||
TMP_PATH="/tmp"
|
||||
|
||||
@@ -180,6 +180,12 @@ 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
|
||||
|
||||
# Check memory
|
||||
RAM=`free -m | awk '/Mem:/{print$2}'`
|
||||
if [ ${RAM} -le 3500 ]; then
|
||||
echo -e "\033[1;33mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of memory.\033[0m\n"
|
||||
fi
|
||||
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
mkdir -p "${LKM_PATH}"
|
||||
mkdir -p "${MODULES_PATH}"
|
||||
|
||||
Binary file not shown.
@@ -287,8 +287,8 @@ function addonMenu() {
|
||||
[ -z "${URL}" ] && continue
|
||||
clear
|
||||
echo "Downloading ${URL}"
|
||||
curl --insecure -L "${URL}" -o "${TMP_PATH}/addon.tgz" --progress-bar
|
||||
if [ $? -ne 0 ]; then
|
||||
STATUS=`curl --insecure -w "%{http_code}" -L "${URL}" -o "${TMP_PATH}/addon.tgz" --progress-bar`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error downloading" --aspect 18 \
|
||||
--msgbox "Check internet, URL or cache disk space" 0 0
|
||||
return 1
|
||||
@@ -546,8 +546,8 @@ function extractDsmFiles() {
|
||||
echo "${PAT_FILE} cached."
|
||||
else
|
||||
echo "Downloading ${PAT_FILE}"
|
||||
curl --insecure -L "${PAT_URL}" -o "${PAT_PATH}" --progress-bar
|
||||
if [ $? -ne 0 ]; then
|
||||
STATUS=`curl --insecure -w "%{http_code}" -L "${PAT_URL}" -o "${PAT_PATH}" --progress-bar`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error downloading" --aspect 18 \
|
||||
--msgbox "Check internet or cache disk space" 0 0
|
||||
return 1
|
||||
@@ -599,9 +599,8 @@ function extractDsmFiles() {
|
||||
# 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
|
||||
STATUS=`curl --insecure -w "%{http_code}" -L "${OLDPAT_URL}" -o "${OLDPAT_PATH}" --progress-bar`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Error downloading" --aspect 18 \
|
||||
--msgbox "Check internet or cache disk space" 0 0
|
||||
return 1
|
||||
@@ -684,14 +683,14 @@ function make() {
|
||||
|
||||
[ ! -f "${ORI_ZIMAGE_FILE}" -o ! -f "${ORI_RDGZ_FILE}" ] && extractDsmFiles
|
||||
|
||||
/opt/arpl/zimage-patch.sh | tee -a "${LOG_FILE}"
|
||||
/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 | tee -a "${LOG_FILE}"
|
||||
/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
|
||||
@@ -798,20 +797,33 @@ function updateMenu() {
|
||||
fi
|
||||
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
|
||||
--infobox "Downloading last version ${TAG}" 0 0
|
||||
curl --insecure -s -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/bzImage" -o /tmp/bzImage
|
||||
if [ $? -ne 0 ]; then
|
||||
# Download checksum
|
||||
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/sha256sum" -o /tmp/sha256sum`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
|
||||
--msgbox "Error downloading checksums" 0 0
|
||||
continue
|
||||
fi
|
||||
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/bzImage" -o /tmp/bzImage`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
|
||||
--msgbox "Error downloading bzImage" 0 0
|
||||
continue
|
||||
fi
|
||||
curl --insecure -s -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/rootfs.cpio.xz" -o /tmp/rootfs.cpio.xz
|
||||
if [ $? -ne 0 ]; then
|
||||
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/rootfs.cpio.xz" -o /tmp/rootfs.cpio.xz`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
|
||||
--msgbox "Error downloading rootfs.cpio.xz" 0 0
|
||||
continue
|
||||
fi
|
||||
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
|
||||
--infobox "Installing new files" 0 0
|
||||
(cd /tmp && sha256sum --status -c sha256sum)
|
||||
if [ $? -ne 0 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
|
||||
--msgbox "Checksum do not match!" 0 0
|
||||
continue
|
||||
fi
|
||||
mv /tmp/bzImage "${ARPL_BZIMAGE_FILE}"
|
||||
mv /tmp/rootfs.cpio.xz "${ARPL_RAMDISK_FILE}"
|
||||
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
|
||||
@@ -832,8 +844,8 @@ function updateMenu() {
|
||||
fi
|
||||
dialog --backtitle "`backtitle`" --title "Update addons" --aspect 18 \
|
||||
--infobox "Downloading last version" 0 0
|
||||
curl --insecure -s -L "https://github.com/fbelavenuto/arpl-addons/releases/download/${TAG}/addons.zip" -o /tmp/addons.zip
|
||||
if [ $? -ne 0 ]; then
|
||||
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl-addons/releases/download/${TAG}/addons.zip" -o /tmp/addons.zip`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Update addons" --aspect 18 \
|
||||
--msgbox "Error downloading new version" 0 0
|
||||
continue
|
||||
@@ -867,8 +879,8 @@ function updateMenu() {
|
||||
fi
|
||||
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
|
||||
--infobox "Downloading last version" 0 0
|
||||
curl --insecure -s -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/rp-lkms.zip" -o /tmp/rp-lkms.zip
|
||||
if [ $? -ne 0 ]; then
|
||||
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/rp-lkms.zip" -o /tmp/rp-lkms.zip`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
|
||||
--msgbox "Error downloading last version" 0 0
|
||||
continue
|
||||
@@ -905,8 +917,8 @@ function updateMenu() {
|
||||
for P in ${!PLATFORMS[@]}; do
|
||||
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
|
||||
--infobox "Downloading ${P} modules" 0 0
|
||||
curl --insecure -s -L "https://github.com/fbelavenuto/arpl-modules/releases/download/${TAG}/${P}.tgz" -o "/tmp/${P}.tgz"
|
||||
if [ $? -ne 0 ]; then
|
||||
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl-modules/releases/download/${TAG}/${P}.tgz" -o "/tmp/${P}.tgz"`
|
||||
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
|
||||
--msgbox "Error downloading ${P}.tgz" 0 0
|
||||
continue
|
||||
@@ -926,6 +938,10 @@ function updateMenu() {
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
if [ "x$1" = "xb" -a -n "${MODEL}" -a -n "${BUILD}" -a loaderIsConfigured ]; then
|
||||
make
|
||||
boot
|
||||
fi
|
||||
# Main loop
|
||||
NEXT="m"
|
||||
while true; do
|
||||
|
||||
@@ -3,7 +3,6 @@ synoinfo: &synoinfo
|
||||
support_disk_compatibility: "no"
|
||||
support_memory_compatibility: "no"
|
||||
supportraidgroup: "no"
|
||||
supportssdcache: "no"
|
||||
esataportcfg: "0x00"
|
||||
support_bde_internal_10g: "no"
|
||||
support_oob_ctl: "no"
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
. /opt/arpl/include/functions.sh
|
||||
. /opt/arpl/include/addons.sh
|
||||
|
||||
set -o pipefail # Get exit code from process piped
|
||||
|
||||
# Sanity check
|
||||
[ -f "${ORI_RDGZ_FILE}" ] || die "${ORI_RDGZ_FILE} not found!"
|
||||
[ -f "${ORI_RDGZ_FILE}" ] || (die "${ORI_RDGZ_FILE} not found!" | tee -a "${LOG_FILE}")
|
||||
|
||||
echo -n "Patching Ramdisk"
|
||||
|
||||
@@ -39,7 +41,7 @@ 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."
|
||||
[ -z "${PLATFORM}" -o -z "${KVER}" ] && (die "ERROR: Configuration for model ${MODEL} and buildnumber ${BUILD} not found." | tee -a "${LOG_FILE}")
|
||||
|
||||
declare -A SYNOINFO
|
||||
declare -A ADDONS
|
||||
@@ -109,6 +111,8 @@ echo -n "."
|
||||
mkdir -p "${RAMDISK_PATH}/addons"
|
||||
echo "#!/bin/sh" > "${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo 'echo "addons.sh called with params ${@}"' >> "${RAMDISK_PATH}/addons/addons.sh"
|
||||
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
# Required eudev and dtbpatch/maxdisks
|
||||
installAddon eudev
|
||||
echo "/addons/eudev.sh \${1} " >> "${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
@@ -123,12 +127,11 @@ fi
|
||||
for ADDON in ${!ADDONS[@]}; do
|
||||
PARAMS=${ADDONS[${ADDON}]}
|
||||
if ! installAddon ${ADDON}; then
|
||||
echo "ADDON ${ADDON} not found!" | tee "${LOG_FILE}"
|
||||
echo "ADDON ${ADDON} not found!" | tee -a "${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"
|
||||
|
||||
# Build modules dependencies
|
||||
/opt/arpl/depmod -a -b ${RAMDISK_PATH} 2>/dev/null
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
. /opt/arpl/include/functions.sh
|
||||
|
||||
set -o pipefail # Get exit code from process piped
|
||||
|
||||
# Sanity check
|
||||
[ -f "${ORI_ZIMAGE_FILE}" ] || die "${ORI_ZIMAGE_FILE} not found!"
|
||||
[ -f "${ORI_ZIMAGE_FILE}" ] || (die "${ORI_ZIMAGE_FILE} not found!" | tee -a "${LOG_FILE}")
|
||||
|
||||
echo -n "Patching zImage"
|
||||
|
||||
@@ -17,7 +19,6 @@ echo -n "."
|
||||
echo -n "."
|
||||
# rebuild zImage
|
||||
/opt/arpl/vmlinux-to-bzImage.sh "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
|
||||
echo -n "."
|
||||
# Update HASH of new DSM zImage
|
||||
HASH="`sha256sum ${ORI_ZIMAGE_FILE} | awk '{print$1}'`"
|
||||
|
||||
BIN
files/board/arpl/overlayfs/usr/lib/libdevmapper.so.1.02
Executable file
BIN
files/board/arpl/overlayfs/usr/lib/libdevmapper.so.1.02
Executable file
Binary file not shown.
12
files/board/arpl/overlayfs/usr/sbin/arpl-reboot.sh
Executable file
12
files/board/arpl/overlayfs/usr/sbin/arpl-reboot.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env ash
|
||||
|
||||
function use() {
|
||||
echo "Use: ${0} junior|config"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -z "${1}" ] && use
|
||||
[ "${1}" != "junior" -a "${1}" != "config" ] && use
|
||||
echo "Rebooting to ${1} mode"
|
||||
grub-editenv /mnt/p1/grub/grubenv set next_entry="${1}"
|
||||
reboot
|
||||
BIN
files/board/arpl/overlayfs/usr/sbin/grub-editenv
Executable file
BIN
files/board/arpl/overlayfs/usr/sbin/grub-editenv
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,9 @@
|
||||
version: 1
|
||||
name: misc
|
||||
description: "Fix missing HW features dependencies"
|
||||
description: "Miscellaneous functions"
|
||||
all:
|
||||
install-script: "install.sh"
|
||||
copy: "all"
|
||||
available-for:
|
||||
bromolow-3.10.108:
|
||||
apollolake-4.4.180:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -27,6 +27,17 @@ BR2_PACKAGE_CPIO=y
|
||||
BR2_PACKAGE_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT=y
|
||||
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_BROADCOM_TIGON3=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_CXGB4_T4=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_CXGB4_T5=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_INTEL_E100=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_INTEL_ICE=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_MICROCHIP_VSC85XX_PHY=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_QLOGIC_4X=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RTL_815X=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169=y
|
||||
BR2_PACKAGE_ACPID=y
|
||||
BR2_PACKAGE_KBD=y
|
||||
BR2_PACKAGE_LSHW=y
|
||||
@@ -60,6 +71,4 @@ BR2_TARGET_ROOTFS_CPIO_XZ=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_E2FSPROGS=y
|
||||
BR2_PACKAGE_HOST_MKPASSWD=y
|
||||
BR2_PACKAGE_R8168=n
|
||||
BR2_PACKAGE_R8125=y
|
||||
|
||||
@@ -75,10 +75,10 @@ cp -Ru files/* .buildroot/
|
||||
|
||||
cd .buildroot
|
||||
echo "Generating default config"
|
||||
make BR2_EXTERNAL=../external arpl_defconfig
|
||||
make BR2_EXTERNAL=../external -j`nproc` arpl_defconfig
|
||||
echo "Version: ${VERSION}"
|
||||
echo "Building... Drink a coffee and wait!"
|
||||
make BR2_EXTERNAL=../external
|
||||
make BR2_EXTERNAL=../external -j`nproc`
|
||||
cd -
|
||||
#qemu-img convert -O vmdk -o adapter_type=lsilogic -o compat6 arpl.img arpl.vmdk
|
||||
qemu-img convert -O vmdk -o adapter_type=lsilogic arpl.img -o subformat=monolithicFlat arpl.vmdk
|
||||
|
||||
115
kpatch/main.c
115
kpatch/main.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Fabio Belavenuto <belavenuto@gmail.com>
|
||||
* Copyright (c) 2022 Fabio Belavenuto <belavenuto@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -28,11 +28,8 @@
|
||||
* - values of ORs are 1/2/4/8 respectively
|
||||
* - [const-ptr] is always the same
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* Added patch for CMOS_WRITE by Fabio Belavenuto
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -44,22 +41,25 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <gelf.h>
|
||||
|
||||
const int DIR_FWD = 1;
|
||||
const int DIR_RWD = -1;
|
||||
|
||||
/* Variables */
|
||||
int fd;
|
||||
int verbose = 1, read_only = 0;
|
||||
Elf *elfHandle;
|
||||
GElf_Ehdr elfExecHeader;
|
||||
uint64_t orPos[4], fileSize, rodataAddr, rodataOffs, initTextOffs;
|
||||
int fd, verbose = 1, read_only = 0;
|
||||
Elf *elfHandle;
|
||||
GElf_Ehdr elfExecHeader;
|
||||
uint64_t orPos[4], fileSize, rodataAddr, rodataOffs, initTextOffs;
|
||||
unsigned char *fileData;
|
||||
|
||||
/*****************************************************************************/
|
||||
void errorMsg(char *message) {
|
||||
fprintf(stderr, "%s\n", message);
|
||||
void errorMsg(char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -125,8 +125,8 @@ void patchBootParams() {
|
||||
uint64_t newPtrOffset, ptrOffset;
|
||||
int n;
|
||||
|
||||
printf("Patching boot params.\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
|
||||
printf("Found .init.text at %lX\n", initTextOffs);
|
||||
while (initTextOffs < fileSize) {
|
||||
addr = findPUSH_R12_R15_SEQ(initTextOffs);
|
||||
if (addr == -1)
|
||||
@@ -160,8 +160,8 @@ void patchBootParams() {
|
||||
} else if (ptrOffset == newPtrOffset) {
|
||||
++ec;
|
||||
}
|
||||
printf("\t[+] Found LOCK-OR#$idx sequence @ %lX => %02X %02X %02X %02X %02X %02X %02X %02X [RIP+%lX]\n",
|
||||
pos, fileData[pos], fileData[pos+1], fileData[pos+2], fileData[pos+3], fileData[pos+4],
|
||||
printf("\t[+] Found LOCK-OR#%d sequence @ %lX => %02X %02X %02X %02X %02X %02X %02X %02X [RIP+%lX]\n",
|
||||
n, pos, fileData[pos], fileData[pos+1], fileData[pos+2], fileData[pos+3], fileData[pos+4],
|
||||
fileData[pos+5], fileData[pos+6], fileData[pos+7], newPtrOffset);
|
||||
}
|
||||
if (ec != 4) {
|
||||
@@ -175,7 +175,7 @@ void patchBootParams() {
|
||||
break;
|
||||
}
|
||||
if (addr == -1) {
|
||||
errorMsg("\nFailed to find matching sequences");
|
||||
errorMsg("\nFailed to find matching sequences\n");
|
||||
} else {
|
||||
//Patch offsets
|
||||
for (n = 0; n < 4; n++) {
|
||||
@@ -197,11 +197,10 @@ uint32_t changeEndian(uint32_t num) {
|
||||
|
||||
/*****************************************************************************/
|
||||
uint64_t findSeq(const char* seq, int len, uint32_t pos, int dir, uint64_t max) {
|
||||
uint64_t i;
|
||||
uint64_t i = pos;
|
||||
|
||||
i = pos;
|
||||
do {
|
||||
if (strncmp((const char*)fileData+i, seq, len) == 0) {
|
||||
if (memcmp((const char*)fileData+i, seq, len) == 0) {
|
||||
return i;
|
||||
}
|
||||
i += dir;
|
||||
@@ -216,9 +215,9 @@ void patchRamdiskCheck() {
|
||||
uint64_t printkPos, testPos, jzPos;
|
||||
const char str[] = "3ramdisk corrupt";
|
||||
|
||||
printf("Patching ramdisk check\n");
|
||||
printf("Patching ramdisk check.\n");
|
||||
for (pos = rodataOffs; pos < fileSize; pos++) {
|
||||
if (strncmp(str, (const char*)(fileData + pos), 16) == 0) {
|
||||
if (memcmp(str, (const char*)(fileData + pos), 16) == 0) {
|
||||
pos -= rodataOffs;
|
||||
break;
|
||||
}
|
||||
@@ -227,17 +226,15 @@ void patchRamdiskCheck() {
|
||||
printf("LE arg addr: %08lX\n", errPrintAddr);
|
||||
printkPos = findSeq((const char*)&errPrintAddr, 4, 0, DIR_FWD, -1);
|
||||
if (printkPos == -1) {
|
||||
errorMsg("printk pos not found!");
|
||||
errorMsg("printk pos not found!\n");
|
||||
}
|
||||
//double check if it's a MOV reg,VAL (where reg is EAX/ECX/EDX/EBX/ESP/EBP/ESI/EDI)
|
||||
printkPos -= 3;
|
||||
if (strncmp((const char*)fileData+printkPos, "\x48\xc7", 2) != 0) {
|
||||
printf("Expected MOV=>reg before printk error, got %02X %02X\n", fileData[printkPos], fileData[printkPos+1]);
|
||||
errorMsg("");
|
||||
if (memcmp((const char*)fileData+printkPos, "\x48\xc7", 2) != 0) {
|
||||
errorMsg("Expected MOV=>reg before printk error, got %02X %02X\n", fileData[printkPos], fileData[printkPos+1]);
|
||||
}
|
||||
if (fileData[printkPos+2] < 0xC0 || fileData[printkPos+2] > 0xC7) {
|
||||
printf("Expected MOV w/reg operand [C0-C7], got %02X\n", fileData[printkPos+2]);
|
||||
errorMsg("");
|
||||
errorMsg("Expected MOV w/reg operand [C0-C7], got %02X\n", fileData[printkPos+2]);
|
||||
}
|
||||
printf("Found printk MOV @ %08lX\n", printkPos);
|
||||
|
||||
@@ -256,6 +253,54 @@ void patchRamdiskCheck() {
|
||||
fileData[jzPos] = 0xEB;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void patchCmosWrite() {
|
||||
uint64_t pos, errPrintAddr;
|
||||
uint64_t pr_errPos, testPos, callPos;
|
||||
const char str[] = "3smpboot: %s: this boot have memory training";
|
||||
|
||||
printf("Patching call to rtc_cmos_write.\n");
|
||||
for (pos = rodataOffs; pos < fileSize; pos++) {
|
||||
if (memcmp(str, (const char*)(fileData + pos), 16) == 0) {
|
||||
pos -= rodataOffs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
errPrintAddr = rodataAddr + pos - 1;
|
||||
printf("LE arg addr: %08lX\n", errPrintAddr);
|
||||
pr_errPos = findSeq((const char*)&errPrintAddr, 4, 0, DIR_FWD, -1);
|
||||
if (pr_errPos == -1) {
|
||||
printf("pr_err pos not found - ignoring.\n"); // Some kernels do not have the call, exit without error
|
||||
return;
|
||||
}
|
||||
//double check if it's a MOV reg,VAL (where reg is EAX/ECX/EDX/EBX/ESP/EBP/ESI/EDI)
|
||||
pr_errPos -= 3;
|
||||
if (memcmp((const char*)fileData+pr_errPos, "\x48\xc7", 2) != 0) {
|
||||
errorMsg("Expected MOV=>reg before pr_err error, got %02X %02X\n", fileData[pr_errPos], fileData[pr_errPos+1]);
|
||||
}
|
||||
if (fileData[pr_errPos+2] < 0xC0 || fileData[pr_errPos+2] > 0xC7) {
|
||||
errorMsg("Expected MOV w/reg operand [C0-C7], got %02X\n", fileData[pr_errPos+2]);
|
||||
}
|
||||
printf("Found pr_err MOV @ %08lX\n", pr_errPos);
|
||||
|
||||
// now we should seek a reasonable amount (say, up to 64 bytes) for a sequence of
|
||||
// MOV ESI, 0x48 => MOV EDI, 0xFF => MOV EBX, EAX
|
||||
testPos = findSeq("\xBE\x48\x00\x00\x00\xBF\xFF\x00\x00\x00\x89\xC3", 12, pr_errPos, DIR_RWD, 64);
|
||||
if (testPos == -1) {
|
||||
printf("Failed to find MOV ESI, 0x48 => MOV EDI, 0xFF => MOV EBX, EAX\n");
|
||||
return;
|
||||
}
|
||||
printf("Found MOV ESI, 0x48 => MOV EDI, 0xFF => MOV EBX, EAX @ %08lX\n", testPos);
|
||||
callPos = testPos + 12;
|
||||
if (fileData[callPos] != 0xE8) {
|
||||
errorMsg("Failed to find CALL\n");
|
||||
}
|
||||
printf("OK - patching %02X (CALL) to 0x90.. (NOPs) @ %08lX\n",
|
||||
fileData[callPos], callPos);
|
||||
for(uint64_t i = 0; i < 5; i++)
|
||||
fileData[callPos+i] = 0x90;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int main(int argc, char *argv[]) {
|
||||
struct stat fileInf;
|
||||
@@ -264,7 +309,7 @@ int main(int argc, char *argv[]) {
|
||||
char *sectionName;
|
||||
|
||||
if (argc != 3) {
|
||||
errorMsg("Use: kpatch <vmlinux> <output>");
|
||||
errorMsg("Use: kpatch <vmlinux> <output>\n");
|
||||
}
|
||||
|
||||
if (elf_version(EV_CURRENT) == EV_NONE)
|
||||
@@ -281,13 +326,13 @@ int main(int argc, char *argv[]) {
|
||||
switch(elf_kind(elfHandle)) {
|
||||
case ELF_K_NUM:
|
||||
case ELF_K_NONE:
|
||||
errorMsg("file type unknown");
|
||||
errorMsg("file type unknown\n");
|
||||
break;
|
||||
case ELF_K_COFF:
|
||||
errorMsg("COFF binaries not supported");
|
||||
errorMsg("COFF binaries not supported\n");
|
||||
break;
|
||||
case ELF_K_AR:
|
||||
errorMsg("AR archives not supported");
|
||||
errorMsg("AR archives not supported\n");
|
||||
break;
|
||||
case ELF_K_ELF:
|
||||
break;
|
||||
@@ -319,8 +364,12 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
close(fd);
|
||||
|
||||
printf("Found .init.text offset @ %lX\n", initTextOffs);
|
||||
printf("Found .rodata address @ %lX\n", rodataAddr);
|
||||
printf("Found .rodata offset @ %lX\n", rodataOffs);
|
||||
patchBootParams();
|
||||
patchRamdiskCheck();
|
||||
patchCmosWrite();
|
||||
if ((fd = open(argv[2], O_WRONLY | O_CREAT, 0644)) == -1) {
|
||||
errorNum();
|
||||
}
|
||||
@@ -328,6 +377,6 @@ int main(int argc, char *argv[]) {
|
||||
errorNum();
|
||||
}
|
||||
close(fd);
|
||||
printf("\n");
|
||||
printf("Finish!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user