Skip to content

About

Ugreen NAS « HAL » pour Hardware Abstraction Layer — une couche de code qui ne fait qu'une chose, parler au matériel spécifique UGREEN (LED, boutons, capteurs, watchdog)

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ugreen-hal

English | Français

A Hardware Abstraction Layer for porting UGREEN NASync NAS devices (DXP series) to FreeBSD/ZFS, with the long-term goal of contributing to both zVault and XigmaNAS rather than building a competing firmware from scratch.

Note

This repository is deliberately scoped narrowly: it is not a rewrite of a complete NAS firmware, but the documentation and porting work for the UGREEN-specific hardware (front/bay LEDs, sensors, buttons, watchdog) that neither zVault (a TrueNAS CORE fork) nor XigmaNAS know about natively. The core (src/cli/) stays distribution-agnostic FreeBSD; thin per-distribution layers (integrations/zvault/, integrations/xigmanas/) get added once it is validated. The repository name reflects this choice.

1. Why this project

UGOS, the proprietary firmware shipped on UGREEN NASync NAS devices, is based on Linux/Debian. This project’s goals are:

  • Replace UGOS with a proven FreeBSD + ZFS stack, by building on existing distributions (zVault, a community fork of TrueNAS CORE, and XigmaNAS, a long-running FreeBSD/ZFS NAS project) rather than starting a firmware from scratch.

  • Precisely document UGREEN hardware (networking, storage, LEDs, buttons, supervision) from direct, reproducible observations — not assumptions.

  • Port the missing UGREEN-specific components to FreeBSD (first and foremost: the front/bay LED controller, driven over SMBus).

  • Publish the result as open source, with the ultimate goal of upstream contributions to both zVault and XigmaNAS.

2. Reference hardware

Development and testing are carried out on a UGREEN NASync DXP2800 (Intel N100, 2 bays), chosen for simpler hardware support than the DXP4800 Plus (no Aquantia AQC113 network controller, whose FreeBSD driver is still immature). See docs/hardware-notes.adoc for the detailed hardware findings.

3. Status

Sprint 0 is complete: the repository is public, the SMBus protocol of the LED controller is fully reverse-documented, and contact has been established with the zVault team (Community#37).

A first userland utility (src/cli/ugreen-led-ctl) exists, builds, and has now been exercised on a real DXP2800 (under Linux, as a proving ground ahead of FreeBSD). Reading LED state is validated with certainty: a real 11-byte frame was captured from the chip and its checksum verified independently, byte for byte. Writing is not yet working: neither our own code nor the original upstream reference tool, compiled and run on the same unit, can make a write stick — a mystery not yet resolved, cross-referenced with a matching report on different (AMD-based) hardware in the upstream project’s issue tracker. See docs/journal.adoc and docs/protocol-i2c-leds.adoc for the full account. Validating the driver under FreeBSD/zVault remains the next milestone (sprint 3.3).

Note

The detailed technical documentation under docs/ is currently written in French. An English translation may be considered once the project is further along.

4. Repository layout

Path Contents

docs/hardware-notes.adoc

Raw hardware findings, model by model (chipsets, buses, observed Linux drivers, FreeBSD equivalents).

docs/protocol-i2c-leds.adoc

Complete, reverse-engineered specification of the UGREEN LED controller’s SMBus protocol, with a FreeBSD porting skeleton.

docs/journal.adoc

Dated log of observations, decisions, and milestones.

docs/plan-firmware-freebsd-ugreen-nas.adoc

Reference project plan: phases, sprints, architecture, risks.

docs/catalogue-nas-ugreen.adoc

Comparison catalogue of available UGREEN NAS models, used to plan hardware purchases.

docs/prise-de-contact.adoc

Ready-to-publish outreach messages for the zVault and XigmaNAS communities, with their delivery status.

docs/essai-terrain.adoc

Field checklist to work through in front of the NAS: readings to take, commands to run, and an error-reading grid for the first LED driver attempt.

docs/reseau-banc.adoc

Bringing up the WiFi bridge (GL.iNet Flint) that connects the test NAS to the network, and SSH access from the workstation.

src/cli/

The HAL core: FreeBSD userland utilities in C, knowing only smbus(4)/gpio(4) — never zVault or XigmaNAS. Currently ugreen-led-ctl.

integrations/

Thin per-distribution integration layers (zvault/, xigmanas/), added once the core is validated (upcoming).

qemu/

Local FreeBSD build bench (QEMU, amd64). Compiles src/cli/ against real FreeBSD headers and produces a binary that runs on the NAS. Cannot emulate the LED controller — that is physical hardware.

scripts/

Supporting tooling, written in Crystal or shell: prepare-usb.cr (interactive USB stick preparation), backup-nas.sh (cloning the internal eMMC before any firmware work), systemrescue-restore.sh (restores a live SystemRescue session after a reboot, fetchable in one line via curl), nas-connect.cr/nas-led-test.cr (drive the test fleet by short name, identical test protocol across units), led-probe/ (native Crystal rewrite of the test protocol, no Python/pip dependency).

tests/

Automated tests (upcoming).

.github/workflows/ci.yml

Continuous integration on FreeBSD (via vmactions/freebsd-vm): validates every AsciiDoc document and builds src/cli/.

CLAUDE.md

Pointer file for Claude Code (project context lives in the AsciiDoc docs above).

5. Language policy

The HAL core (src/cli/) is written in C, and deliberately so: it is meant to be proposed upstream to FreeBSD, zVault and XigmaNAS, whose base systems and review processes are C. A kernel-side driver, should one become necessary, could not be written in anything else.

Supporting tooling that runs on the developer’s machine (scripts/) is written in Crystal where it earns its keep, and in shell otherwise. Crystal is available on FreeBSD (lang/crystal), but shipping a language runtime onto a NAS appliance to drive four LEDs would be disproportionate, and would close the door on upstream contribution.

6. License

BSD-2-Clause — see LICENSE.

7. Contributing

8. Author

Philippe Nénert — ALOLI sas.

About

Ugreen NAS « HAL » pour Hardware Abstraction Layer — une couche de code qui ne fait qu'une chose, parler au matériel spécifique UGREEN (LED, boutons, capteurs, watchdog)

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages