fix: improvements across the board

* Update README.md, make sure the disclaimer is seen before install instructions.
* update ustorage to have temp readings on some samsung ssds (stupid samsung)
* Patch and support ulcmd relying on output from ubnteeprom
* Move away from ubnthal FINALLY now that we patched ulcmd (hacky but works!)
* added README.md to ubnteeprom, since I expect at somepoint folks will fork/use it for other projects.
* Added our own kernel module to force mtd's RO, which does a better job than ubnthal did :)
This commit is contained in:
Chris Blake 2024-06-16 13:50:44 -05:00
parent 7858593f11
commit 116b6591a9
11 changed files with 173 additions and 18 deletions

View file

@ -6,10 +6,10 @@ scripts_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
# Make our temp builddir outside of the world of mounts for SPEEDS
kernel_builddir=$(mktemp -d)
tar -xzf ${root_path}/downloads/${kernel_filename} -C ${kernel_builddir}
tar -xzf "${root_path}/downloads/${kernel_filename}" -C ${kernel_builddir}
# Exports baby
export PATH=${build_path}/toolchain/${toolchain_bin_path}:${PATH}
export PATH="${build_path}/toolchain/${toolchain_bin_path}":${PATH}
export GCC_COLORS=auto
export CROSS_COMPILE=${toolchain_cross_compile}
export ARCH=arm64
@ -18,7 +18,7 @@ export ARCH=arm64
cd ${kernel_builddir}/${kernel_filename%.tar.gz}
# If we have patches, apply them
if [[ -d ${root_path}/patches/kernel/ ]]; then
if [[ -d "${root_path}/patches/kernel/" ]]; then
for file in ${root_path}/patches/kernel/*.patch; do
echo "Applying kernel patch ${file}"
patch -p1 < ${file}
@ -26,7 +26,7 @@ if [[ -d ${root_path}/patches/kernel/ ]]; then
fi
# Apply overlay if it exists
if [[ -d ${root_path}/overlay/${kernel_overlay_dir}/ ]]; then
if [[ -d "${root_path}/overlay/${kernel_overlay_dir}/" ]]; then
echo "Applying ${kernel_overlay_dir} overlay"
cp -R ${root_path}/overlay/${kernel_overlay_dir}/* ./
fi
@ -52,3 +52,10 @@ mv defconfig ${build_path}/kernel/kernel_config
#cp ./arch/arm64/boot/Image.gz ${build_path}/kernel
#mv uImage ${build_path}/kernel
mv ./modules-dir ${build_path}/kernel/kernel-modules
# Now that the kernel is done, build our out of tree modules! :)
module_builddir=$(mktemp -d)
cp ${root_path}/tools/mtd-lock/* "${module_builddir}"
cd "${module_builddir}"
make -C ${kernel_builddir}/${kernel_filename%.tar.gz} M=$PWD
cp "${module_builddir}/ubnt-mtd-lock.ko" ${build_path}/kernel

View file

@ -24,9 +24,10 @@ chroot "${build_path}/rootfs" /debootstrap/debootstrap --second-stage
mv -f "${build_path}/fw-extract/${BOARD}-rootfs/lib/modules" "${build_path}/rootfs/lib"
cp "${build_path}/fw-extract/${firmware_filename%.bin}/kernel.bin" "${build_path}/rootfs/boot/uImage"
# Now, for the old kernel we built, pull in btrfs + depends modules (we do depmod in bootstrap)
# Now, for the old kernel we built, pull in our extra modules we need! (depmod is done in bootstrap)
cp "${build_path}/kernel/kernel-modules/lib/modules/4.19.152-alpine-unvr/kernel/lib/zstd/zstd_compress.ko" "${build_path}/rootfs/lib/modules/4.19.152-alpine-unvr/extra/"
cp "${build_path}/kernel/kernel-modules/lib/modules/4.19.152-alpine-unvr/kernel/fs/btrfs/btrfs.ko" "${build_path}/rootfs/lib/modules/4.19.152-alpine-unvr/extra/"
cp "${build_path}/kernel/ubnt-mtd-lock.ko" "${build_path}/rootfs/lib/modules/4.19.152-alpine-unvr/extra/"
# Copy over our overlay if we have one
if [[ -d ${root_path}/overlay/${fs_overlay_dir}/ ]]; then
@ -52,6 +53,8 @@ if [ "${BOARD}" == "UNVRPRO" ]; then
libssl.so.1.1 libcrypto.so.1.1 libabsl*.so.20200923 libatomic.so.1; do
cp -H ${build_path}/fw-extract/${BOARD}-rootfs/usr/lib/aarch64-linux-gnu/${file} "${build_path}/rootfs/usr/lib/ubnt-fw/"
done
# Now for the REAL JANK! patch ulcmd so it doesn't rely on /proc/ubnthal, so we can use our userspace tool ubnteeprom
sed -i 's|/proc/ubnthal/system.info|/tmp/.ubnthal_system_info|g' "${build_path}/rootfs/usr/bin/ulcmd"
else
# Remove our ld.so.conf.d as it's not needed for UVNR
rm "${build_path}/rootfs/etc/ld.so.conf.d/ubnt.conf"