feat: Add UNVR support (#11)

* Move partition mounts to PARTLABEL instead of paths
* Add dual firmware building support, specify the build type using the BOARD env var when using make
* Update to Unifi 4.0.5 pre-release firmware
* Move ulcmd init to be our "user interface" setup script, will handle LEDs on the UNVR4 in the future
* Update README with updated instructions
* Add udev rules to support /dev/boot which is what Unifi uses for some stupid reason for their emmc. This is required for systemd to mount correctly after chroot.
* Fixup small bugs found along the way
This commit is contained in:
Chris Blake 2024-06-15 18:53:44 -05:00 committed by GitHub
parent 8e2262e121
commit 3f90bd2357
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 210 additions and 79 deletions

View file

@ -1,72 +1,107 @@
# UNVR-NAS # UNVR-NAS
Firmware builder to convert your Unifi NVR Pro into an OpenMediaVault NAS appliance. Firmware builder to convert your Unifi NVR/Unifi NVR Pro into an OpenMediaVault NAS appliance.
**This repo is still under heavy development and should be considered early alpha!** **This repo is still under heavy development and should be considered early alpha!**
## Supported Devices ## Supported Devices
* UNVR **(Currently Untested!)**
* UNVR Pro * UNVR Pro
Note that the 1U UNVR is not currently supported as I do not have a unit to test on. PR's are welcome!
## Usage ## Usage
1. Download the required UNVRPro firmware, and place it in the unifi-firmware directory. Please see the README.md in that directory for more information. 1. Download the required UNVR firmware for your device, and place it in the unifi-firmware directory. Please see the README.md in that directory for more information.
2. Make sure your system has the required packages installed for this repo, which are: 2. Make sure your system has the required packages installed for this repo, which are:
`docker-ce losetup wget sudo make qemu-user-static squashfs-tools` `docker-ce losetup wget sudo make qemu-user-static squashfs-tools`
3. Run the tool, and sit back and wait for it to do it's thing. Depending on your computer, this may take around an hour or so. Also note near the end there will be some scary errors during debootstrap, but this is expected. 3. Run make with your board name set, and sit back and wait for the firmware image to build. Depending on your computer, this may take around an hour or so.
`make` For the UNVR: `BOARD=UNVR make`
4. Once done, you will have a built disk image in ./output For the UNVR Pro: `BOARD=UNVRPRO make`
* Also note that near the end of the image build process there will be some red text errors, but this is expected. This is due to the openmediavault install not being able to talk to systemd, as it's a debootstrap environment.
4. Once done, you will have a compressed disk image in ./output
## Installation ## Installation
Note that currently the install process requires UART to modify the u-boot env for booting. In the future, if I can get the latest kernel GPL source, this will not be required. Note that currently the install process requires UART to modify the u-boot env for booting. In the future, if I can get the latest kernel GPL source, this will not be required.
1. MAKE SURE your UNVR Pro is running the same Unifi firmware as referenced in the README.md in the unifi-firmware directory. 1. MAKE SURE your UNVR/UNVR Pro is running the same Unifi firmware as referenced in the README.md in the unifi-firmware directory.
* **Failure to do this can cause issues from the installation process not working, to the touch screen not working!** * **Failure to do this can cause issues from the installation process not working, to the touch screen not working!**
1. Build the firmware image (follow the Usage section), and then throw it on an HDD/SSD formatted to ext4. Put said HDD in the UNVR Pro as the only hard drive.
2. Hook up UART to the UNVR Pro (4 pin header on the PCB near the DC Power Backup port). 2. Build the firmware image (follow the Usage section), and then throw it on an HDD/SSD formatted to ext4. Put said HDD in the UNVR/UNVR Pro as the only hard drive.
3. Boot the UNVR Pro, and press Escape twice when prompted to get to the u-boot shell. You only have 2 seconds to do this!
4. Run the following commands to update the kernel cmdline and save the changes: 3. Hook up UART to the UNVR/UNVR Pro:
On the UNVR, UART is located on the PCB behind the SFP+ cage, near the middle of the board (4 pins).
On the UNVR Pro, UART is located on the PCB near the DC Power Backup port (4 pins).
4. Boot the UNVR/UNVR Pro, and in your UART console press Escape (Esc) twice when prompted to get to the u-boot shell. You only have 2 seconds to do this!
5. Run the following commands to update the kernel cmdline and save the changes:
``` ```
setenv rootfs /dev/boot2 setenv rootfs PARTLABEL=rootfs
setenv bootargsextra boot=local rw setenv bootargsextra boot=local rw
saveenv saveenv
``` ```
5. Boot into recovery. This can be done using the command below, or by unplugging the UNVR Pro, and holding the reset button for 10~ seconds as you power it back up. 6. Boot into recovery. This can be done using the command below, or by unplugging the UNVR/UNVR Pro, and holding the reset button for 10~ seconds as you power it back up.
`run bootcmdrecovery` `run bootcmdrecovery`
6. Once recovery is booted, login with `ubnt:ubnt` or `root:ubnt`. Note this can be done either via UART, or by telnet to the IP address your UNVR Pro display reports. 7. Once recovery is booted, login with `ubnt:ubnt` or `root:ubnt`. Note this can be done either via UART shell, or if you want you can telnet into the IP address of your UNVR/UNVR Pro in recovery if you have it networked.
7. Mount your HDD with the firmware image, backup the Unifi firmware, your u-boot env partitions, and then flash our custom firmware to the EMMC. (below command example assumes your ext4 disk partition is at /dev/sda1)
8. Mount your HDD with the firmware image and then flash our custom firmware to the EMMC/Storage. (Note the examples below expect your HDD with the firmware to be at /dev/sda)
* UNVR:
* Mount your disk to /mnt
``` ```
mount /dev/sda1 /mnt mount /dev/sda1 /mnt
cd /mnt ```
dd if=/dev/boot of=/mnt/unvrpro-emmc-backup.bin bs=4M
dd if=/dev/mtd1 of=/mnt/unvrpro-mtd1-uboot-env.bin * Write the UNVR-NAS firmware image to the EMMC/Storage
dd if=/dev/mtd2 of=/mnt/unvrpro-mtd2-uboot-env-redundant.bin
gunzip debian-UNVRPRO.img.gz Note that if you have an older UNVR with the internal USB drive, you will need to replace `/dev/boot` with the path of your USB drive!
dd if=./debian-UNVRPRO.img of=/dev/boot bs=4M
```
gunzip /mnt/debian-UNVR.img.gz
dd if=/mnt/debian-UNVR.img of=/dev/boot bs=4M
sync sync
reboot reboot
``` ```
8. At this point you can remove the HDD/SSD you used, and enjoy Debian 12 with OpenMediaVault on your UNVR Pro! Default login for OpenMediaVault is `admin:openmediavault`. SSH login information is `debian:debian`. Please note that first boot may take a bit as cloud-init runs to finish the setup. * UNVR Pro:
* Mount your disk to /mnt
```
mount /dev/sda1 /mnt
```
* Write the UNVR-NAS firmware image to the EMMC/Storage
```
gunzip /mnt/debian-UNVRPRO.img.gz
dd if=/mnt/debian-UNVRPRO.img of=/dev/boot bs=4M
sync
reboot
```
9. At this point you can remove the HDD/SSD you used, and enjoy Debian 12 with OpenMediaVault on your UNVR/UNVR Pro! Default login for OpenMediaVault is `admin:openmediavault`. SSH login information is `debian:debian`. Please note that first boot may take a bit as cloud-init runs to finish the setup.
## Removal ## Removal
To restore back to the factory UNVR-Pro firmware, you can do the following steps: To restore back to the factory UNVR/UNVR Pro firmware, you can do the following steps:
1. Hold the "reset" button on the front while powering on to boot into recovery 1. Hold the "reset" button on the front while powering on to boot into recovery
2. Once the display shows it's in recovery, telnet to the IP address shown on the touch screen. At the login prompt, login with `ubnt:ubnt` or `root:ubnt`. 2. Once the device is in recovery mode, telnet to the IP address if the device (the UNVR Pro will display this on the touch screen). At the login prompt, login with `ubnt:ubnt` or `root:ubnt`.
3. Erase the uboot env, to remove our custom boot commands. This SHOULD be mtd1/mtd2, but **PLEASE VERIFY** first with `cat /proc/mtd` to prevent bricking your device! **DO NOT SKIP THIS STEP!** The output should match below, if not, **PLEASE DO NOT CONTINUE!** 3. Erase the uboot env, to remove our custom boot commands. This SHOULD be mtd1/mtd2, but **PLEASE VERIFY** first with `cat /proc/mtd` to prevent bricking your device! **DO NOT SKIP THIS STEP!** The output should match below, if not, **PLEASE DO NOT CONTINUE!**
``` ```
@ -90,6 +125,8 @@ To restore back to the factory UNVR-Pro firmware, you can do the following steps
5. Next, erase the EMMC so all partitions are wiped: 5. Next, erase the EMMC so all partitions are wiped:
Note that if you have an older UNVR with the internal USB drive, you will need to replace `/dev/boot` with the path of your USB drive!
``` ```
/sbin/parted -s -- /dev/boot mklabel gpt /sbin/parted -s -- /dev/boot mklabel gpt
``` ```
@ -100,11 +137,8 @@ To restore back to the factory UNVR-Pro firmware, you can do the following steps
* Installation is Hard * Installation is Hard
* Need to simplify the install process, this should be much easier once I can get latest GPL kernel source (no more uboot env stuff) * Need to simplify the install process, this should be much easier once I can get latest GPL kernel source (no more uboot env stuff)
* OpenMediaVault
* BTRFS is in TESTING
* Building an out-of-tree module for this using an OLD Unifi GPL release from https://github.com/fabianishere/udm-kernel
* Reset Button * Reset Button
* Only works to reboot the system * Only works to reboot the system, may wire this up to reset the WebUI password in OpenMediaVault down the road
## Disclaimer ## Disclaimer

View file

@ -7,9 +7,9 @@ image boot.ext4 {
} }
image rootfs.ext4 { image rootfs.ext4 {
name = "debian" name = "rootfs"
ext4 { ext4 {
label = "root" label = "rootfs"
use-mke2fs = true # Needed to prevent resize issues... use-mke2fs = true # Needed to prevent resize issues...
} }
size = 3G size = 3G

View file

@ -1,2 +1,2 @@
/dev/boot1 /boot ext4 defaults 0 1 PARTLABEL=boot /boot ext4 defaults,ro 0 1
/dev/boot2 / ext4 defaults 0 1 PARTLABEL=rootfs / ext4 defaults 0 1

View file

@ -1 +1,2 @@
# Used on UNVRPRO for ulcmd
/usr/lib/ubnt-fw /usr/lib/ubnt-fw

View file

@ -1,11 +1,11 @@
[Unit] [Unit]
Description=Daemon for MCU based LCM control Description=Unifi LED/ULCMD contoller
Requires=ubnt-init.service Requires=ubnt-init.service
Requires=mock-ubnt-api.service Requires=mock-ubnt-api.service
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/ulcmd ExecStart=/usr/lib/init/boot/ubnt-ulcmd.sh
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
RestartSec=2s RestartSec=2s

View file

@ -0,0 +1,26 @@
#!/bin/bash
# ULCMD wrapper, used to start ulcmd on the UNVR Pro, or setup the status LED on the UNVR-4
case "$(ubnteeprom -systeminfo -key shortname)" in
"UNVRPRO")
# Is ulcmd running already? if so, assume it was not done via systemd so let's
# kill and respawn as this is our systemd entry script for the service, and we
# need to have it foregrounded as we act as the "daemon" here.
if ! pidof -q ulcmd; then
killall ulcmd
fi
# Restart ulcmd
exec ulcmd
;;
"UNVR4")
# TODO: LED setup (2=white, 1=blue) against /sys/class/leds/ulogo_ctrl
# Start our "daemon" loop so systemd stays happy
while true; do
sleep 3600
done
;;
*)
exit 1
;;
esac

View file

@ -1,4 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
import os
from functools import lru_cache from functools import lru_cache
""" """

View file

@ -0,0 +1,42 @@
# Support for Ubiquiti /dev/boot devices with udev
ACTION=="remove", GOTO="persistent_emmc"
SUBSYSTEM!="block", GOTO="persistent_emmc"
KERNEL!="boot*", GOTO="persistent_emmc"
# For partitions import parent disk ID_* information, except ID_FS_*.
#
# This is particularly important on media where a filesystem superblock and
# partition table are found on the same level, e.g. common Linux distro ISO
# installation media.
#
# In the case where a partition device points to the same filesystem that
# was detected on the parent disk, the ID_FS_* information is already
# present on the partition devices as well as the parent, so no need to
# propagate it. In the case where the partition device points to a different
# filesystem, merging the parent ID_FS_ properties would lead to
# inconsistencies, so we avoid doing so.
ENV{DEVTYPE}=="partition", \
IMPORT{parent}="ID_[!F]*", IMPORT{parent}="ID_", \
IMPORT{parent}="ID_F[!S]*", IMPORT{parent}="ID_F", \
IMPORT{parent}="ID_FS[!_]*", IMPORT{parent}="ID_FS"
# probe filesystem metadata of disks
KERNEL!="sr*|mmcblk[0-9]boot[0-9]", IMPORT{builtin}="blkid"
# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
# by-path
ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
# by-partlabel/by-partuuid links (partition metadata)
IMPORT{builtin}="blkid"
ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
LABEL="persistent_emmc"

View file

@ -21,6 +21,17 @@ if [ ! -d /sys/module/loop ]; then
exit 1 exit 1
fi fi
# Did we have a board set?
if [ -z "${BOARD}" ]; then
echo "Error: BOARD is not set, so we don't know what we are building for! Exiting..."
echo "Please review the README.md on usage!"
exit 1
elif [ -z "${firmware_filename}" ]; then
# Board is set, make sure it's a board we support
echo "Error: Invalid BOARD value of ${BOARD}. Please review the README.md on usage!"
exit 1
fi
# Validate FW is downloaded # Validate FW is downloaded
if ! [ -f "${root_path}/unifi-firmware/${firmware_filename}" ]; then if ! [ -f "${root_path}/unifi-firmware/${firmware_filename}" ]; then
echo "Error: File ${firmware_filename} does not exist in ./unifi-firmware! Exiting..." echo "Error: File ${firmware_filename} does not exist in ./unifi-firmware! Exiting..."

View file

@ -15,11 +15,11 @@ else
fi fi
# Extract the goodies # Extract the goodies
${scripts_path}/ubnt-fw-parse.py "${root_path}/unifi-firmware/${firmware_filename}" "${build_path}/fw-extract" ${scripts_path}/ubnt-fw-parse.py "${root_path}/unifi-firmware/${firmware_filename}" "${build_path}/fw-extract/${firmware_filename%.bin}"
# Extract the squashfs rootfs # Extract the squashfs rootfs
echo "Extracting unifi rootfs as root..." echo "Extracting unifi rootfs as root..."
sudo unsquashfs -f -d "${build_path}/fw-extract/rootfs" "${build_path}/fw-extract/rootfs.bin" sudo unsquashfs -f -d "${build_path}/fw-extract/${BOARD}-rootfs" "${build_path}/fw-extract/${firmware_filename%.bin}/rootfs.bin"
# Always build to pickup changes/updates/improvements # Always build to pickup changes/updates/improvements
debug_msg "Building ${docker_tag}" debug_msg "Building ${docker_tag}"

View file

@ -67,7 +67,7 @@ sudo rm -f ${build_path}/rootfs/placeholder ${build_path}/rootfs/boot/placeholde
# SAFETY NET - trap it, even tho we have makefile with set -e # SAFETY NET - trap it, even tho we have makefile with set -e
debug_msg "Docker: debootstraping..." debug_msg "Docker: debootstraping..."
trap "sudo umount ${build_path}/rootfs/boot; sudo umount ${build_path}/rootfs; sudo losetup -d ${boot_loop_dev}; sudo losetup -d ${rootfs_loop_dev}" SIGINT SIGTERM trap "sudo umount ${build_path}/rootfs/boot; sudo umount ${build_path}/rootfs; sudo losetup -d ${boot_loop_dev}; sudo losetup -d ${rootfs_loop_dev}" SIGINT SIGTERM
docker run --ulimit nofile=1024 --rm --privileged --cap-add=ALL -v /dev:/dev -v "${root_path}:/repo:Z" -it ${docker_tag} /repo/scripts/docker/run_debootstrap.sh docker run --ulimit nofile=1024 --rm --privileged --cap-add=ALL -v /dev:/dev -v "${root_path}:/repo:Z" -e BOARD="${BOARD}" -it ${docker_tag} /repo/scripts/docker/run_debootstrap.sh
debug_msg "Note: You might be asked for your password for losetup and umount since we are cleaning up mounts..." debug_msg "Note: You might be asked for your password for losetup and umount since we are cleaning up mounts..."
debug_msg "Cleaning up..." debug_msg "Cleaning up..."

View file

@ -14,7 +14,7 @@ fi
mkdir -p ${build_path}/final mkdir -p ${build_path}/final
# Kick off the docker to do the magics for us, since we need genimage # Kick off the docker to do the magics for us, since we need genimage
docker run --rm -v "${root_path}:/repo:Z" -it ${docker_tag} /repo/scripts/docker/run_mkimage_final.sh docker run --rm -v "${root_path}:/repo:Z" -e BOARD="${BOARD}" -it ${docker_tag} /repo/scripts/docker/run_mkimage_final.sh
# Just create our final dir and move bits over # Just create our final dir and move bits over
TIMESTAMP=`date +%Y%m%d-%H%M` TIMESTAMP=`date +%Y%m%d-%H%M`

View file

@ -69,6 +69,7 @@ jq --null-input --compact-output \
omv-confdbadm update "conf.system.network.interface" - omv-confdbadm update "conf.system.network.interface" -
# Set hostname # Set hostname
omv-confdbadm update "conf.system.network.dns" "{\"hostname\": \"unvr-nas\"}" omv-confdbadm update "conf.system.network.dns" "{\"hostname\": \"unvr-nas\"}"
sed -i "s|myhostname = .*|myhostname = unvr-nas|g" /etc/postfix/main.cf
# Cleanup stuff we don't want floating around # Cleanup stuff we don't want floating around
apt-get autoclean || true apt-get autoclean || true

View file

@ -14,15 +14,15 @@ export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true export DEBCONF_NONINTERACTIVE_SEEN=true
# CD into our rootfs mount, and starts the fun! # CD into our rootfs mount, and starts the fun!
cd ${build_path}/rootfs cd "${build_path}/rootfs"
debootstrap --no-check-gpg --foreign --arch=${deb_arch} --include=apt-transport-https ${deb_release} ${build_path}/rootfs ${deb_mirror} debootstrap --no-check-gpg --foreign --arch=${deb_arch} --include=apt-transport-https ${deb_release} "${build_path}/rootfs" ${deb_mirror}
cp /usr/bin/qemu-aarch64-static usr/bin/ cp /usr/bin/qemu-aarch64-static usr/bin/
chroot ${build_path}/rootfs /debootstrap/debootstrap --second-stage chroot "${build_path}/rootfs" /debootstrap/debootstrap --second-stage
# Copy over our kernel modules and kernel from the FS image # Copy over our kernel modules and kernel from the FS image
# Note that in the future, we wanna use our own kernel, but the current GPL is way too old!!!!! # Note that in the future, we wanna use our own kernel, but the current GPL is way too old!!!!!
mv -f "${build_path}/fw-extract/rootfs/lib/modules" "${build_path}/rootfs/lib" mv -f "${build_path}/fw-extract/${BOARD}-rootfs/lib/modules" "${build_path}/rootfs/lib"
cp "${build_path}/fw-extract/kernel.bin" "${build_path}/rootfs/boot/uImage" 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 btrfs + depends modules (we do depmod 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/lib/zstd/zstd_compress.ko" "${build_path}/rootfs/lib/modules/4.19.152-alpine-unvr/extra/"
@ -34,31 +34,32 @@ if [[ -d ${root_path}/overlay/${fs_overlay_dir}/ ]]; then
cp -R ${root_path}/overlay/${fs_overlay_dir}/* ./ cp -R ${root_path}/overlay/${fs_overlay_dir}/* ./
fi fi
# Apply our part UUIDs to fstab
#sed -i "s|BOOTUUIDPLACEHOLDER|$(blkid -o value -s UUID ${build_path}/boot.ext4)|g" ${build_path}/rootfs/etc/fstab
#sed -i "s|ROOTUUIDPLACEHOLDER|$(blkid -o value -s UUID ${build_path}/rootfs.ext4)|g" ${build_path}/rootfs/etc/fstab
# Hostname # Hostname
echo "${distrib_name}" > ${build_path}/rootfs/etc/hostname echo "unvr-nas" > "${build_path}/rootfs/etc/hostname"
echo "127.0.1.1 ${distrib_name}" >> ${build_path}/rootfs/etc/hosts echo "127.0.1.1 unvr-nas" >> "${build_path}/rootfs/etc/hosts"
# Console settings # Console settings
echo "console-common console-data/keymap/policy select Select keymap from full list echo "console-common console-data/keymap/policy select Select keymap from full list
console-common console-data/keymap/full select us console-common console-data/keymap/full select us
" > ${build_path}/rootfs/debconf.set " > "${build_path}/rootfs/debconf.set"
# Copy over stuff for ulcmd, this is hacky, but that's this ENTIRE repo for you # Copy over stuff for ulcmd on UNVRPRO. this is hacky, but that's this ENTIRE repo for you
mv "${build_path}/fw-extract/rootfs/usr/bin/ulcmd" "${build_path}/rootfs/usr/bin/ulcmd" # LCD controller if [ "${BOARD}" == "UNVRPRO" ]; then
mv "${build_path}/fw-extract/rootfs/usr/share/firmware" "${build_path}/rootfs/usr/share/" # LCD panel firmwares mv "${build_path}/fw-extract/${BOARD}-rootfs/usr/bin/ulcmd" "${build_path}/rootfs/usr/bin/ulcmd" # LCD controller
mkdir -p "${build_path}/rootfs/usr/lib/ubnt-fw/" # Home for ulcmd libraries mv "${build_path}/fw-extract/${BOARD}-rootfs/usr/share/firmware" "${build_path}/rootfs/usr/share/" # LCD panel firmwares
for file in libgrpc++.so.1 libgrpc.so.10 libprotobuf.so.23 \ mkdir -p "${build_path}/rootfs/usr/lib/ubnt-fw/" # Home for ulcmd libraries
for file in libgrpc++.so.1 libgrpc.so.10 libprotobuf.so.23 \
libssl.so.1.1 libcrypto.so.1.1 libabsl*.so.20200923 libatomic.so.1; do libssl.so.1.1 libcrypto.so.1.1 libabsl*.so.20200923 libatomic.so.1; do
cp -H ${build_path}/fw-extract/rootfs/usr/lib/aarch64-linux-gnu/${file} "${build_path}/rootfs/usr/lib/ubnt-fw/" cp -H ${build_path}/fw-extract/${BOARD}-rootfs/usr/lib/aarch64-linux-gnu/${file} "${build_path}/rootfs/usr/lib/ubnt-fw/"
done done
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"
fi
# Copy over bluetooth firmware files # Copy over bluetooth firmware files
mkdir -p "${build_path}/rootfs/lib/firmware" mkdir -p "${build_path}/rootfs/lib/firmware"
cp -R "${build_path}/fw-extract/rootfs/lib/firmware/csr8x11" "${build_path}/rootfs/lib/firmware/" # LCD panel firmwares cp -R "${build_path}/fw-extract/${BOARD}-rootfs/lib/firmware/csr8x11" "${build_path}/rootfs/lib/firmware/" # LCD panel firmwares
# Install our bccmd we compiled (less we use from unifi the better) # Install our bccmd we compiled (less we use from unifi the better)
cp -R "${build_path}/packages/bluez/bccmd" "${build_path}/rootfs/usr/bin" cp -R "${build_path}/packages/bluez/bccmd" "${build_path}/rootfs/usr/bin"
@ -69,9 +70,9 @@ cp -R "${build_path}/packages/ubnteeprom/ubnteeprom" "${build_path}/rootfs/usr/b
chmod +x "${build_path}/rootfs/usr/bin/ubnteeprom" chmod +x "${build_path}/rootfs/usr/bin/ubnteeprom"
# Kick off bash setup script within chroot # Kick off bash setup script within chroot
cp ${docker_scripts_path}/bootstrap/001-bootstrap ${build_path}/rootfs/bootstrap cp "${docker_scripts_path}/bootstrap/001-bootstrap" "${build_path}/rootfs/bootstrap"
chroot ${build_path}/rootfs /bootstrap chroot "${build_path}/rootfs" /bootstrap
rm ${build_path}/rootfs/bootstrap rm "${build_path}/rootfs/bootstrap"
# Final cleanup # Final cleanup
rm ${build_path}/rootfs/usr/bin/qemu-aarch64-static rm "${build_path}/rootfs/usr/bin/qemu-aarch64-static"

View file

@ -21,8 +21,8 @@ genimage \
--inputpath "${build_path}/final" \ --inputpath "${build_path}/final" \
--outputpath "${build_path}/final" \ --outputpath "${build_path}/final" \
--config "${build_path}/genimage.cfg" --config "${build_path}/genimage.cfg"
mv ${build_path}/final/emmc.img ${build_path}/final/debian-UNVRPRO.img mv ${build_path}/final/emmc.img ${build_path}/final/debian-${BOARD}.img
gzip ${build_path}/final/debian-UNVRPRO.img gzip ${build_path}/final/debian-${BOARD}.img
rm -rf /tmp/genimage-initial-tmppath # Cleanup rm -rf /tmp/genimage-initial-tmppath # Cleanup
# Cleanup # Cleanup

View file

@ -6,9 +6,17 @@ build_path="${root_path}/BuildEnv"
# Docker image name # Docker image name
docker_tag=unvr-nas:builder docker_tag=unvr-nas:builder
# Expected UNVR Firmware and hash # Expected UNVR Firmware(s) and hash(s)
firmware_filename="f449-UNVRPRO-4.0.3-fdec2c4f-1855-4eb6-8711-e22f8f904922.bin" UNVR_firmware_filename="7f7c-UNVR-4.0.5-1d4b9c7d-926b-4ef4-88c6-23978c2455a8.bin"
firmware_md5="5dcdc03bdec1524767007fcd12e81777" UNVR_firmware_md5="3bab9336619125e7fe6e4af7484a79dc"
UNVRPRO_firmware_filename="b0a3-UNVRPRO-4.0.5-f221e29e-3405-4cb9-8d13-0f117d9cc3a1.bin"
UNVRPRO_firmware_md5="f6aec555fa79c4e083168ec2aac4a71a"
# Render our board out
fwfnvar="${BOARD}_firmware_filename"
firmware_filename="${!fwfnvar}"
fwmd5var="${BOARD}_firmware_md5"
firmware_md5="${!fwmd5var}"
# Toolchain # Toolchain
toolchain_url="https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz" toolchain_url="https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz"

View file

@ -26,7 +26,7 @@ var UBNTDeviceMap = []UBNTSysMap{
name: "UniFi-NVR-4", name: "UniFi-NVR-4",
shortname: "UNVR4", shortname: "UNVR4",
cpu: "AL324V2", cpu: "AL324V2",
sysid: "ea16", sysid: "ea16", // USB drive (non emmc) variant
}, },
{ {
name: "UniFi-NVR-4", name: "UniFi-NVR-4",

View file

@ -1,6 +1,12 @@
# unifi-firmware # unifi-firmware
Please place the UNVR-Pro firmware in this directory. Please place the UNVR/UNVR Pro firmware in this directory.
Name: f449-UNVRPRO-4.0.3-fdec2c4f-1855-4eb6-8711-e22f8f904922.bin * UNVR:
MD5Sum: 5dcdc03bdec1524767007fcd12e81777 * Name: [7f7c-UNVR-4.0.5-1d4b9c7d-926b-4ef4-88c6-23978c2455a8.bin](https://community.ui.com/releases/UniFi-OS-Network-Video-Recorders-4-0-5/7c734ca2-72e2-4747-96a0-e3a376cf96aa)
* MD5Sum: 3bab9336619125e7fe6e4af7484a79dc
* UNVR Pro:
* Name: [b0a3-UNVRPRO-4.0.5-f221e29e-3405-4cb9-8d13-0f117d9cc3a1.bin](https://community.ui.com/releases/UniFi-OS-Network-Video-Recorders-4-0-5/7c734ca2-72e2-4747-96a0-e3a376cf96aa)
* MD5Sum: f6aec555fa79c4e083168ec2aac4a71a