diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ebd64cb..5e86ddca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ pre-releases for test devices only. - **Style "Glass".** A third look next to Classic dark and light: *System → Appearance → Style*. The same pages, elements, sizes and corners – only the material changes: translucent, blurred panes over a soft aurora background, in a slate dark and a misty light theme (neither black nor white), with all eight accent colours (raised where needed so small accent text stays readable). It covers the classic and the desktop view and the login page; users with web access can pick their own style. Web apps follow it through the app SDK (`data-style="glass"` on ``, a glass variant of `/_shareos/theme.css`). UCI: `shareos.ui.style` (`classic` | `glass`). - *Run first-time setup again* moved from the top of *System → General* to its own panel **SETUP WIZARD** under *System → Power & Reset*, with a note that it only shows the wizard again and deletes nothing. +- **DNR-322L rev A: first build, as a devtest image** ([#180](https://github.com/UniqueDroid/ShareOS/issues/180)) – `ShareOS--DNR-322L-rev-Ax-devtest.bin` and `.sysupgrade.tar`, from the build of the pull request, not in the release. The board of the DNS-320 rev A sold as a video recorder: own device tree (flash layout read from a DNR-322L A2: system partition 70 MB, the NUUO partition after it is left alone), own D-Link signature, the installer accepts the 70 MB partition and gives the system 32 MB of it instead of 48. As a devtest image root keeps the password `shareos` (no claiming) and the box offers its device info at `http:///deviceinfo`. **Not tried on hardware yet** – a first test should have a serial console at hand, see `docs/DEVICES.md`. The front has no USB LED, so installation and rescue mode blink the power LED. - **Devtest images for new models.** A model that is being added is built as `ShareOS---devtest.*` until it is tested (status `devtest` in `post-image.sh`, `BOARD_DEVTEST` in `board.sh`): root keeps the password `shareos` instead of being claimed with a button – the buttons of a new model are not known yet – and the overview and the messages say so. The release build refuses such files, so they only come from the build of a pull request. See [docs/DEVICES.md](docs/DEVICES.md#devtest-image-the-first-image-for-a-new-model). - **Device info** (`http:///deviceinfo`, admins, on every model; not in the menu): everything needed to add a model – flash partitions, CPU, memory, device tree, LEDs, sensors, buttons, GPIOs, serial ports, I2C, USB, network, the U-Boot environment (read only) and the kernel log – as a text file to download or copy. MAC addresses and serial numbers are masked for public issues unless asked for. The same report in the rescue system: `shareos-deviceinfo`. diff --git a/CLAUDE.md b/CLAUDE.md index 492bbf94..3fe49142 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ - Tags/releases are created by Jan; prepare the release text and the `CHANGELOG.md` section. - **Every release updates the docs** – see `docs/RELEASE.md` (CHANGELOG, README status/features, TESTEN/TESTING, ENTWICKLUNG/DEVELOPMENT). - Photos for the docs: strip EXIF/GPS and blur serial-number stickers before committing. -- Tests: `tests/` (host: test-update, test-net, test-flash-bin, test-boards, test-rescue, test-raid-wait, test-smart, test-bootlog, test-power, test-notify, test-zabbix-items, test-printer, test-ups, test-ddns, test-mcu-temp, test-mcu-alarm, test-file-jobs, test-ca and test-signature (mbedtls/uci of the firmware through qemu-arm-static, see build.yml), check-acl.py, check-i18n.py; ARM emulator with sudo: run-stack-qemu --check, test-users, test-storage, test-cloud-paperless, test-apps, test-firstinstall, test-transmission, test-media, test-dlna, test-vpn, test-tailscale, test-autobrr, test-syncthing, test-zabbix, test-dnsfilter – these nine need `make sysapps-pack`, test-snapshots, test-sysperms). UI work: `tests/mock-ubus.py`; app SDK in Chromium: `node tests/sdk-storage.js`, desktop view: `node tests/ui-desktop.js` (Playwright). ucode plugin: `tests/check-ucode-order.py` (no hoisting in ucode). Static analysis: `tests/static-analysis.sh` (ShellCheck, ESLint, unused code; `--report` with warnings and complexity) must pass; CodeQL runs on GitHub (`codeql.yml`). +- Tests: `tests/` (host: test-update, test-net, test-flash-bin, test-boards, test-install-ubi, test-rescue, test-raid-wait, test-smart, test-bootlog, test-power, test-notify, test-zabbix-items, test-printer, test-ups, test-ddns, test-mcu-temp, test-mcu-alarm, test-file-jobs, test-ca and test-signature (mbedtls/uci of the firmware through qemu-arm-static, see build.yml), check-acl.py, check-i18n.py; ARM emulator with sudo: run-stack-qemu --check, test-users, test-storage, test-cloud-paperless, test-apps, test-firstinstall, test-transmission, test-media, test-dlna, test-vpn, test-tailscale, test-autobrr, test-syncthing, test-zabbix, test-dnsfilter – these nine need `make sysapps-pack`, test-snapshots, test-sysperms). UI work: `tests/mock-ubus.py`; app SDK in Chromium: `node tests/sdk-storage.js`, desktop view: `node tests/ui-desktop.js` (Playwright). ucode plugin: `tests/check-ucode-order.py` (no hoisting in ucode). Static analysis: `tests/static-analysis.sh` (ShellCheck, ESLint, unused code; `--report` with warnings and complexity) must pass; CodeQL runs on GitHub (`codeql.yml`). - Never `rm -rf` a chroot that still has mounts below it (it would delete the host's /dev). - Apps live in the separate repository UniqueDroid/ShareOS-Apps. - **Everything in the repository and on GitHub is English** – code, comments, UI texts, docs (except the German counterparts in docs/), issue/PR/review replies, release texts, CHANGELOG. Name UI elements by their English names (*Services*, ASLEEP – never *Dienste*, SCHLÄFT). diff --git a/board/dlink/dns320l/dts/kirkwood-dnr322l.dts b/board/dlink/dns320l/dts/kirkwood-dnr322l.dts new file mode 100644 index 00000000..f85f036c --- /dev/null +++ b/board/dlink/dns320l/dts/kirkwood-dnr322l.dts @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Device Tree file for D-Link DNR-322L rev Ax + * + * The board of the DNS-320 rev A ("2 Bay NAS REV-A1": same SoC, LEDs, + * buttons, fan, temperature through the second serial port) sold as a + * network video recorder. What differs is the flash layout: the system + * partition "image" is 70 MB instead of 102 MB, a partition for the NUUO + * software follows it, and the last partitions are where the DNS-320L has + * them. After Alt-F's kirkwood-dnr322l-a.dts; the layout was read from a + * DNR-322L A2 (/proc/mtd under Alt-F 1.0.1, issue #180). + * The memory size from U-Boot (ATAGs) wins anyway – that box reports 256 MB. + */ + +#include + +/ { + model = "D-Link DNR-322L-rev-Ax NAS"; + compatible = "dlink,dnr-322l-a", "dlink,dns-320-a1", "dlink,dns-320", + "dlink,dns-kirkwood", "marvell,kirkwood-88f6281", + "marvell,kirkwood"; + + /* "memory", not "memory@0": the node of kirkwood-dns320.dts has that + * name, so this replaces it instead of adding a second one */ + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; /* 256 MB */ + }; +}; + +&nand { + /* the layout of kirkwood-dnskw.dtsi from "image" on is not this box's */ + /delete-node/ partition@b00000; + /delete-node/ partition@7100000; + /delete-node/ partition@7b00000; + + partition@b00000 { + label = "image"; + reg = <0x0b00000 0x4600000>; + }; + + partition@6f00000 { + label = "mini firmware"; + reg = <0x6f00000 0xa00000>; + }; + + partition@7900000 { + label = "config"; + reg = <0x7900000 0x500000>; + }; + + partition@7e00000 { + label = "my-dlink"; + reg = <0x7e00000 0x200000>; + }; + + /* last, so that the numbers are those of Alt-F (mtd7) */ + partition@5100000 { + label = "nuuo package"; + reg = <0x5100000 0x1e00000>; + }; +}; diff --git a/board/dlink/dns320l/initramfs/init b/board/dlink/dns320l/initramfs/init index 9835b809..ab64e576 100755 --- a/board/dlink/dns320l/initramfs/init +++ b/board/dlink/dns320l/initramfs/init @@ -37,7 +37,7 @@ exec /dev/console 2>&1 # which box: LED names and release file names (/usr/lib/shareos/board.sh) . /usr/lib/shareos/board.sh board_detect -LED=$BOARD_LED_USB +LED=${BOARD_LED_INSTALL:-$BOARD_LED_USB} CMDLINE=$(cat /proc/cmdline) log() { echo "shareos-init: $*"; } diff --git a/board/dlink/dns320l/initramfs/usr/sbin/shareos-firstinstall b/board/dlink/dns320l/initramfs/usr/sbin/shareos-firstinstall index 9179f11b..69a4897e 100755 --- a/board/dlink/dns320l/initramfs/usr/sbin/shareos-firstinstall +++ b/board/dlink/dns320l/initramfs/usr/sbin/shareos-firstinstall @@ -43,6 +43,8 @@ UBOOT_MAX=3145728 . /usr/lib/shareos/board.sh board_detect FWNAME=${BOARD_FWNAME:-$SHAREOS_FWNAME} +# the LED that blinks while this runs (the power LED on boxes without a USB LED) +FI_LED=${BOARD_LED_INSTALL:-$BOARD_LED_USB} VERSION=$SHAREOS_VERSION # messages go to stderr (the console): stdout of some functions is a result @@ -53,8 +55,8 @@ cleanup() { umount $SRC 2>/dev/null; } mtd_by_name() { sed -n "s/^\(mtd[0-9]*\):.*\"$1\"\$/\1/p" /proc/mtd; } led_busy() { - L=/sys/class/leds/$BOARD_LED_USB - led "$BOARD_LED_USB" timer + L=/sys/class/leds/$FI_LED + led "$FI_LED" timer [ -e $L/delay_on ] && echo 120 > $L/delay_on && echo 120 > $L/delay_off } @@ -217,7 +219,7 @@ main() { shareos-install-ubi rootfs.squashfs --yes || fail "installing the system failed" sync log "ShareOS $newver installed – restarting" - led "$BOARD_LED_USB" none + led "$FI_LED" none return 0 } diff --git a/board/dlink/dns320l/initramfs/usr/sbin/shareos-install-ubi b/board/dlink/dns320l/initramfs/usr/sbin/shareos-install-ubi index 2c935ddc..3fa816bb 100755 --- a/board/dlink/dns320l/initramfs/usr/sbin/shareos-install-ubi +++ b/board/dlink/dns320l/initramfs/usr/sbin/shareos-install-ubi @@ -38,10 +38,11 @@ N=${MTD#mtd} SIZE=$(sed -n "s/^$MTD: \([0-9a-f]*\) .*/\1/p" ${SHAREOS_PROC_MTD:-/proc/mtd}) # 0x06400000: DNS-320L, DNS-320 rev B (100 MB, my-dlink follows); 0x06600000: DNS-325 # (102 MB, seen on a rev A1) and, from Alt-F's device trees (kirkwood-dnskw.dtsi), -# DNS-320 rev A (not seen on hardware yet). +# DNS-320 rev A (not seen on hardware yet). 0x04600000: DNR-322L (70 MB, the NUUO +# partition follows; /proc/mtd of a DNR-322L A2, #180). case "$SIZE" in - 06400000|06600000) ;; - *) die "unexpected size 0x$SIZE of 'image' (expected 0x06400000 or 0x06600000), refusing" ;; + 06400000|06600000|04600000) ;; + *) die "unexpected size 0x$SIZE of 'image' (expected 0x06400000, 0x06600000 or 0x04600000), refusing" ;; esac # get the image @@ -60,8 +61,11 @@ esac LEN=$(wc -c < "$FILE") echo "rootfs image: $LEN bytes" -# rootfs volume size: image + room for growth, 48 MiB minimum +# rootfs volume size: image + room for growth, 48 MiB minimum – 32 MiB on the +# 70 MB partition of the DNR-322L, so that about as much is left for +# rootfs_data (settings, web apps) VOL=$((48 * 1024 * 1024)) +[ "$SIZE" != 04600000 ] || VOL=$((32 * 1024 * 1024)) [ $LEN -lt $VOL ] || VOL=$(( (LEN / 1048576 + 8) * 1048576 )) # the running system must not use the partition diff --git a/board/dlink/dns320l/post-image.sh b/board/dlink/dns320l/post-image.sh index 38050fb5..177e93f1 100755 --- a/board/dlink/dns320l/post-image.sh +++ b/board/dlink/dns320l/post-image.sh @@ -36,6 +36,7 @@ DNS-320L-rev-Ax kirkwood-dns320l 0 8 11 1 1 6 0x00800000 release DNS-320-rev-Bx kirkwood-dns320b 0 8 12 1 1 5 0x00800000 release DNS-320-rev-Ax kirkwood-dns320 0 8 7 2 0 4 0x01000000 release DNS-325-rev-Ax kirkwood-dns325 0 8 5 2 0 3 0x01000000 release +DNR-322L-rev-Ax kirkwood-dnr322l 1 8 2 1 1 8 0x01000000 devtest " KVER=$(sed -n 's/^BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="\(.*\)"/\1/p' "$BR2_CONFIG") @@ -45,16 +46,22 @@ KVER=$(sed -n 's/^BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="\(.*\)"/\1/p' "$BR2_CON [ -s "$B/rootfs.squashfs" ] || { echo "post-image: rootfs.squashfs missing"; exit 1; } # Load address of the initramfs (last column of MODELS): the stock U-Boot reads -# the ramdisk partition to 0xf00000 and copies it here before it starts the -# kernel. 0x800000 is what Alt-F uses and what the DNS-320L has booted with. -# On the DNS-325 it is inside memory that is in use: the kernel prints -# "INITRD: ... overlaps in-use memory region - disabling initrd", finds no -# /init and panics in a reboot loop. 0x1000000 booted from flash on a DNS-325 -# rev A1. The DNS-320 rev A (88F6281 and U-Boot of the DNS-325 family) showed -# the same reboot loop with 0x800000 (#96), so it gets 0x1000000 too; the -# DNS-320 rev B (board of the DNS-320L) keeps 0x800000 until tried (a wrong -# address means a reboot loop that needs a serial console). The kernel is the same everywhere, so what is in -# use at 0x800000 depends on the board or its U-Boot (not found yet). +# the ramdisk partition to 0xf00000 ("nand read.e 0xf00000 0x600000 0x300000; +# bootm 0xa00000 0xf00000") and bootm copies it to the load address of its +# header before it starts the kernel. 0x800000 is what Alt-F uses on every +# model – its kernel (4.4) is 4.9 MB unpacked and ends at 0x4d9200. Ours is +# 9.3 MB unpacked (6.18.58: 0x8000..0x957980, with BSS about 0x9a0000): it +# covers 0x800000 itself. A ramdisk there is inside the kernel: "INITRD: +# 0x00800000+... overlaps in-use memory region - disabling initrd", no /init, +# panic, reboot loop (DNS-325; DNS-320 rev A in #96). 0x1000000 is above the +# kernel and above the room its decompressor takes behind it (to about +# 0xc00000) and booted from flash on a DNS-325 rev A1 and a DNS-320 rev A. The +# DNR-322L (U-Boot 3.4.14, the family of those two) gets it too. Should the +# unpacked kernel ever grow by about 4 MB more, 0x1000000 is too low as well. +# The DNS-320L has booted with 0x800000 and this very kernel, so its U-Boot +# (3.6.0) cannot be putting the ramdisk there – concluded, not measured; it +# and the DNS-320 rev B (same board) keep 0x800000 until someone has looked +# (a wrong address means a reboot loop that needs a serial console). # Only the header differs: the data of the initramfs is the same for all. check_size() { diff --git a/board/dlink/dns320l/rootfs-overlay/usr/lib/shareos/board.sh b/board/dlink/dns320l/rootfs-overlay/usr/lib/shareos/board.sh index b3dc7982..032e8900 100644 --- a/board/dlink/dns320l/rootfs-overlay/usr/lib/shareos/board.sh +++ b/board/dlink/dns320l/rootfs-overlay/usr/lib/shareos/board.sh @@ -6,7 +6,7 @@ # sets the BOARD_* variables from the device-tree model. One system image # serves all models; everything that differs between them is described here. # -# BOARD_ID short name: dns320l, dns320b, dns320a, dns325, dns327l, unknown +# BOARD_ID short name: dns320l, dns320b, dns320a, dnr322l, dns325, dns327l, unknown # BOARD_NAME for people # BOARD_FWNAME name in the release files: ShareOS--.bin # BOARD_SIG signature of D-Link firmware files for this box (dns323-fw) @@ -24,6 +24,8 @@ # power cut (set at boot), empty: the MCU does it / none # BOARD_LED_STATUS LED for the status setting (heartbeat/on/off) # BOARD_LED_USB LED for USB activity and the reset/rescue feedback +# BOARD_LED_INSTALL LED that blinks during the first installation and in +# rescue mode; empty: BOARD_LED_USB # BOARD_LED_DISK1, BOARD_LED_DISK2 disk LEDs (left, right) # BOARD_LED_POWER power LED; empty: driven by the MCU (/tmp/sys/power_led) # BOARD_RAM_SMALL 1 on boxes with 128 MB RAM @@ -62,6 +64,20 @@ board_detect() { BOARD_LED_STATUS=dns325:white:usb BOARD_LED_USB=dns325:red:usb BOARD_LED_DISK1=dns325:red:l_hdd BOARD_LED_DISK2=dns325:red:r_hdd BOARD_LED_POWER=dns325:white:power ;; + *DNR-322L*) + # the board of the DNS-320 rev A as a video recorder: 256 MB RAM, a + # smaller system partition, a partition for the NUUO software + BOARD_ID=dnr322l BOARD_NAME="D-Link DNR-322L rev A" BOARD_FWNAME=DNR-322L-rev-Ax + BOARD_SIG=DNR-322 BOARD_MODEL=DNR-322L BOARD_CONTROL=mcu-temp BOARD_RTC=kernel + BOARD_POWER_BACK=gpiochip1:5 + BOARD_LED_STATUS=dns320:blue:usb BOARD_LED_USB=dns320:orange:usb + BOARD_LED_DISK1=dns320:orange:l_hdd BOARD_LED_DISK2=dns320:orange:r_hdd + BOARD_LED_POWER=dns320:blue:power + # the front has the power and disk LEDs only (D-Link manual): installation + # and rescue mode blink the power LED + BOARD_LED_INSTALL=dns320:blue:power + # being added: root / shareos, device info (#180) + BOARD_DEVTEST=1 ;; *DNS-320*) BOARD_ID=dns320a BOARD_NAME="D-Link DNS-320 rev A" BOARD_FWNAME=DNS-320-rev-Ax BOARD_SIG=DNS323D1 BOARD_MODEL=DNS-320 BOARD_CONTROL=mcu-temp BOARD_RTC=kernel @@ -85,7 +101,7 @@ board_detect() { # all variables as KEY=value lines (for /tmp/sys/board.env and shareos-boardinfo) board_env() { for v in ID NAME FWNAME SIG MODEL CONTROL RTC POWER_BUTTON POWER_BACK \ - LED_STATUS LED_USB LED_DISK1 LED_DISK2 LED_POWER RAM_SMALL TESTED DEVTEST; do + LED_STATUS LED_USB LED_INSTALL LED_DISK1 LED_DISK2 LED_POWER RAM_SMALL TESTED DEVTEST; do eval "printf 'BOARD_%s=\"%s\"\n' $v \"\$BOARD_$v\"" done } diff --git a/configs/shareos_dns320l_defconfig b/configs/shareos_dns320l_defconfig index 4daa4f9d..a66ca9a1 100644 --- a/configs/shareos_dns320l_defconfig +++ b/configs/shareos_dns320l_defconfig @@ -47,7 +47,7 @@ BR2_LINUX_KERNEL_XZ=y BR2_LINUX_KERNEL_DTS_SUPPORT=y # one kernel for the Kirkwood models, a zImage with appended DTB per model # (post-image.sh makes a .bin per model) -BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_SHAREOS_PATH)/board/dlink/dns320l/dts/kirkwood-dns320l.dts $(BR2_EXTERNAL_SHAREOS_PATH)/board/dlink/dns320l/dts/kirkwood-dns320b.dts" +BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_SHAREOS_PATH)/board/dlink/dns320l/dts/kirkwood-dns320l.dts $(BR2_EXTERNAL_SHAREOS_PATH)/board/dlink/dns320l/dts/kirkwood-dns320b.dts $(BR2_EXTERNAL_SHAREOS_PATH)/board/dlink/dns320l/dts/kirkwood-dnr322l.dts" BR2_LINUX_KERNEL_INTREE_DTS_NAME="marvell/kirkwood-dns320 marvell/kirkwood-dns325" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y diff --git a/docs/DEVICES.md b/docs/DEVICES.md index ca9aa3cc..41a8de01 100644 --- a/docs/DEVICES.md +++ b/docs/DEVICES.md @@ -15,7 +15,7 @@ temperature sensor, buttons, LEDs, power-off) is described per model in | DNS-320 rev B | `ShareOS--DNS-320-rev-Bx.*` | 128 MB | built, **testers wanted** | | DNS-325 rev A | `ShareOS--DNS-325-rev-Ax.*` | 256 MB | **partly tested** (rev A1, see below), more testers wanted | | DNS-320 rev A | `ShareOS--DNS-320-rev-Ax.*` | 128 MB | **partly tested** (rev A1 with 0.3.0-beta.9: installed, web interface; temperature and fan control with the fix of 0.3.0-beta.11, [#163](https://github.com/UniqueDroid/ShareOS/issues/163)), more testers wanted – up to 0.2.0-beta.16 it restarts in a loop after flashing (initramfs address, [#96](https://github.com/UniqueDroid/ShareOS/issues/96)); use 0.2.0-beta.17 or newer | -| DNR-322L | – | 128 MB | planned | +| DNR-322L rev A | `ShareOS--DNR-322L-rev-Ax-devtest.*` | 256 MB | **devtest image** (root / shareos, device info, see below) from the build of the pull request, **not tried on hardware** ([#180](https://github.com/UniqueDroid/ShareOS/issues/180)) – the board of the DNS-320 rev A as a video recorder; system partition 70 MB, the NUUO partition is left alone. Front (D-Link manual): power button, power and disk LEDs and a USB port for a UPS – **no USB button** – once it is released, a new box is claimed with a short press (under 5 s) of the reset button on the back; the devtest image needs no claiming. There is no USB LED: the first installation and rescue mode blink the **power LED** (fast while installing, slowly in rescue mode). There is a second version, the DNR-322L **rev B** (case like a DNS-320L, a magnifier button on the front). Its board is not known yet – probably the one of the DNS-320L. This build is for rev A only (the rev is on the label underneath): **do not flash it on a rev B**. A boot log of a rev B (serial console or Alt-F's `dmesg`) would show what it needs. A first test needs a serial console at hand (see below) | | DNS-327L | – | 512 MB | planned (own kernel and flash layout) | Not possible: DNS-323, DNS-321, DNS-343 (64 MB RAM, 8 MB flash). @@ -48,7 +48,28 @@ of the fix for 0.2.0-beta.9). | LEDs | `dns320l:*` | `dns325:*` | `dns320:*` | | D-Link signature | `DNS320L` / `DNS320B` | `DNS-325` | `DNS323D1` | -One kernel serves all four: post-image appends the model's device tree to the +The DNR-322L rev A is the DNS-320 rev A in every row; its signature is +`DNR-322`, and its flash is laid out differently (`image` 70 MB, then +`nuuo package` 30 MB, `mini firmware`, `config`, `my-dlink` where the +DNS-320L has them). + +**A model nobody has started yet:** if the kernel starts but cannot find its +initramfs (the address the stock U-Boot copies it to, last column of `MODELS` +in `post-image.sh`), it panics and restarts in a loop – U-Boot only falls +back to the D-Link rescue system when the kernel *image* is damaged, not +when the kernel fails later. Such a loop is ended through a serial console +(start from RAM, flash again). So the first test of a model wants a serial +console at hand; that is how the DNS-325 and the DNS-320 rev A were sorted +out ([#96](https://github.com/UniqueDroid/ShareOS/issues/96)). +What goes wrong there is known by now: the unpacked ShareOS kernel is 9.3 MB +and reaches from 0x8000 past 0x800000, the address Alt-F puts its initramfs +at (its kernel ends at 0x4d9200). U-Boot of the 3.4 series (DNS-325, DNS-320 +rev A, DNR-322L) copies the initramfs to the address in its header, so +0x800000 lands inside the kernel; these models get 0x1000000. Starting the +build from RAM over TFTP takes the same path as starting from flash and tests +the address without writing anything. + +One kernel serves all of them: post-image appends the model's device tree to the kernel (the stock U-Boot passes none) and writes a `.bin` with the model's signature. Initramfs and system are the same; the box finds its model in the device tree at boot (`shareos-boardinfo`). diff --git a/docs/GERAETE.md b/docs/GERAETE.md index 10258eb3..50e5edad 100644 --- a/docs/GERAETE.md +++ b/docs/GERAETE.md @@ -17,7 +17,7 @@ beschrieben. | DNS-320 rev B | `ShareOS--DNS-320-rev-Bx.*` | 128 MB | gebaut, **Tester gesucht** | | DNS-325 rev A | `ShareOS--DNS-325-rev-Ax.*` | 256 MB | **teilweise getestet** (rev A1, siehe unten), weitere Tester gesucht | | DNS-320 rev A | `ShareOS--DNS-320-rev-Ax.*` | 128 MB | **teilweise getestet** (rev A1 mit 0.3.0-beta.9: installiert, Weboberfläche; Temperatur und Lüftersteuerung mit der Korrektur aus 0.3.0-beta.11, [#163](https://github.com/UniqueDroid/ShareOS/issues/163)), weitere Tester gesucht – bis 0.2.0-beta.16 startet sie nach dem Flashen immer wieder neu (Adresse des Initramfs, [#96](https://github.com/UniqueDroid/ShareOS/issues/96)); 0.2.0-beta.17 oder neuer nehmen | -| DNR-322L | – | 128 MB | geplant | +| DNR-322L rev A | `ShareOS--DNR-322L-rev-Ax-devtest.*` | 256 MB | **Devtest-Image** (root / shareos, Geräteinfo, siehe unten) aus dem Build des Pull Requests, **nicht auf Hardware probiert** ([#180](https://github.com/UniqueDroid/ShareOS/issues/180)) – die Platine des DNS-320 rev A als Videorekorder; Systempartition 70 MB, die NUUO-Partition bleibt unberührt. Vorderseite (D-Link-Handbuch): Ein/Aus-Taste, Power- und Festplatten-LEDs und ein USB-Anschluss für eine USV – **keine USB-Taste** – sobald es freigegeben ist, wird eine neue Box mit einem kurzen Druck (unter 5 s) auf die Reset-Taste hinten übernommen; das Devtest-Image braucht kein Übernehmen. Eine USB-LED gibt es nicht: Bei der Erstinstallation und im Rettungsmodus blinkt die **Power-LED** (schnell beim Installieren, langsam im Rettungsmodus). Es gibt eine zweite Version, den DNR-322L **rev B** (Gehäuse wie ein DNS-320L, vorne eine Lupen-Taste). Seine Platine ist noch nicht bekannt – vermutlich die des DNS-320L. Dieser Build ist nur für rev A (die Revision steht auf dem Aufkleber unten): **nicht auf einen rev B flashen**. Ein Boot-Log eines rev B (serielle Konsole oder `dmesg` unter Alt-F) würde zeigen, was er braucht. Ein erster Test braucht eine serielle Konsole in Reichweite (siehe unten) | | DNS-327L | – | 512 MB | geplant (eigener Kernel und eigenes Flash-Layout) | Nicht möglich: DNS-323, DNS-321, DNS-343 (64 MB RAM, 8 MB Flash). @@ -51,7 +51,29 @@ Build der Korrektur für 0.2.0-beta.9). | LEDs | `dns320l:*` | `dns325:*` | `dns320:*` | | D-Link-Signatur | `DNS320L` / `DNS320B` | `DNS-325` | `DNS323D1` | -Ein Kernel für alle vier: post-image hängt den Device-Tree des Modells an den +Der DNR-322L rev A ist in jeder Zeile der DNS-320 rev A; seine Signatur ist +`DNR-322`, und sein Flash ist anders aufgeteilt (`image` 70 MB, dann +`nuuo package` 30 MB, `mini firmware`, `config`, `my-dlink` dort, wo sie der +DNS-320L hat). + +**Ein Modell, das noch niemand gestartet hat:** Startet der Kernel, findet +aber sein Initramfs nicht (die Adresse, an die der Original-U-Boot es kopiert, +letzte Spalte von `MODELS` in `post-image.sh`), bleibt er mit einer Panic +stehen und startet in einer Schleife neu – U-Boot weicht nur dann auf das +D-Link-Rettungssystem aus, wenn das Kernel-*Image* beschädigt ist, nicht wenn +der Kernel später scheitert. So eine Schleife beendet man über eine serielle +Konsole (aus dem RAM starten, neu flashen). Der erste Test eines Modells +braucht deshalb eine serielle Konsole in Reichweite; so wurden der DNS-325 und +der DNS-320 rev A geklärt ([#96](https://github.com/UniqueDroid/ShareOS/issues/96)). +Was dort schiefgeht, ist inzwischen bekannt: Der entpackte ShareOS-Kernel ist +9,3 MB groß und reicht von 0x8000 bis über 0x800000 – die Adresse, an die +Alt-F sein Initramfs legt (dessen Kernel endet bei 0x4d9200). U-Boot der +3.4er-Reihe (DNS-325, DNS-320 rev A, DNR-322L) kopiert das Initramfs an die +Adresse in dessen Kopf, mit 0x800000 also mitten in den Kernel; diese Modelle +bekommen 0x1000000. Der Start aus dem RAM über TFTP geht denselben Weg wie +der Start vom Flash und prüft die Adresse, ohne etwas zu schreiben. + +Ein Kernel für alle: post-image hängt den Device-Tree des Modells an den Kernel (das Original-U-Boot übergibt keinen) und schreibt eine `.bin` mit der Signatur des Modells. Initramfs und System sind gleich; die Box erkennt ihr Modell beim Start am Device-Tree (`shareos-boardinfo`). diff --git a/tests/check-initrd-address.sh b/tests/check-initrd-address.sh index 92db57db..dba9c9a3 100755 --- a/tests/check-initrd-address.sh +++ b/tests/check-initrd-address.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Checks the load address in the header of the initramfs (urootfs) of every -# sysupgrade bundle of a build: 0x01000000 on the DNS-325 and DNS-320 rev A, +# sysupgrade bundle of a build: 0x01000000 on the DNS-325, DNS-320 rev A and DNR-322L rev A, # 0x00800000 on the other models (see post-image.sh). A wrong address means a reboot loop that # needs a serial console, so this runs after every firmware build. # @@ -12,9 +12,9 @@ DIR=${1:?folder with the ShareOS-*.sysupgrade.tar files} pass=0; failed=0 for tar in "$DIR"/ShareOS-*.sysupgrade.tar; do [ -f "$tar" ] || { echo "no sysupgrade bundle in $DIR"; exit 1; } - model=$(basename "$tar" .sysupgrade.tar); model=${model#ShareOS-*-DNS}; model=DNS$model + model=$(basename "$tar" .sysupgrade.tar | sed -E 's/^ShareOS-.*-(DN[SR]-[^-]+-rev-[A-Za-z]+)(-devtest)?$/\1/') case "$model" in - DNS-325-*|DNS-320-rev-A*) want=01000000 ;; + DNS-325-*|DNS-320-rev-A*|DNR-322L-*) want=01000000 ;; *) want=00800000 ;; esac # u-boot image header: magic(4) crc(4) time(4) size(4) load(4) ... diff --git a/tests/test-boards.sh b/tests/test-boards.sh index a320ace9..0101500c 100755 --- a/tests/test-boards.sh +++ b/tests/test-boards.sh @@ -32,6 +32,7 @@ for x in "D-Link DNS-320L-rev-Ax NAS:dns320l:DNS-320L-rev-Ax:DNS320L:mcu" \ "D-Link DNS-320-rev-Bx NAS:dns320b:DNS-320-rev-Bx:DNS320B:mcu" \ "D-Link DNS-320 NAS (Rev A1):dns320a:DNS-320-rev-Ax:DNS323D1:mcu-temp" \ "D-Link DNS-325 NAS (Rev A1):dns325:DNS-325-rev-Ax:DNS-325:hwmon" \ + "D-Link DNR-322L-rev-Ax NAS:dnr322l:DNR-322L-rev-Ax:DNR-322:mcu-temp" \ "D-Link DNS-327L:dns327l:DNS-327L-rev-Ax:DNS327L:mcu"; do IFS=: read -r model id fw sig ctl <<< "$x" box "$model" @@ -41,6 +42,11 @@ box "Some other NAS" check "unknown box: id unknown, no firmware name" "[ \"\$(info id)\" = unknown ] && [ -z \"\$(info fwname)\" ]" box "D-Link DNS-320L-rev-Ax NAS" check "boardinfo prints all keys" "[ \$(info | grep -c '^BOARD_') -ge 16 ] && info | grep -qx 'BOARD_TESTED=\"1\"'" +box "D-Link DNR-322L-rev-Ax NAS" +check "DNR-322L: installation and rescue mode blink the power LED (no USB LED on the front)" "info | grep -qx 'BOARD_LED_INSTALL=\"dns320:blue:power\"'" +check "DNR-322L: devtest (being added)" "[ \"\$(info devtest)\" = 1 ]" +box "D-Link DNS-320L-rev-Ax NAS" +check "other models: no own install LED (the USB LED is used)" "info | grep -qx 'BOARD_LED_INSTALL=\"\"'" box "D-Link DNS-325 NAS (Rev A1)" check "only the DNS-320L counts as tested" "[ \"\$(info tested)\" = 0 ]" @@ -63,6 +69,7 @@ cl() { # model -> root hash after S03claim (fake /etc, /overlay) } if command -v openssl >/dev/null; then check "S03claim: a new DNS-320L gets root locked" "[ \"\$(cl 'D-Link DNS-320L-rev-Ax NAS')\" = '!' ]" + check "S03claim: the DNR-322L (devtest) keeps root / shareos" "case \"\$(cl 'D-Link DNR-322L-rev-Ax NAS')\" in '\$1\$'*) true ;; *) false ;; esac" check "S03claim: an unknown model gets root locked too" "[ \"\$(cl 'Some other NAS')\" = '!' ]" check "S03claim: a devtest box keeps root / shareos" "case \"\$(SHAREOS_BOARD_LIB=$T/board-devtest.sh cl 'Some other NAS')\" in '\$1\$'*) true ;; *) false ;; esac" fi diff --git a/tests/test-flash-bin.sh b/tests/test-flash-bin.sh index 704ee37d..1afdece5 100755 --- a/tests/test-flash-bin.sh +++ b/tests/test-flash-bin.sh @@ -119,7 +119,8 @@ if [ -n "$REAL" ]; then # every model's .bin is accepted on its own model only V=${REAL##*/ShareOS-}; V=${V%-DNS-320L-rev-Ax.bin} for x in "DNS-320L-rev-Ax:D-Link DNS-320L-rev-Ax NAS:DNS320L" "DNS-320-rev-Bx:D-Link DNS-320-rev-Bx NAS:DNS320B" \ - "DNS-320-rev-Ax:D-Link DNS-320 NAS (Rev A1):DNS323D1" "DNS-325-rev-Ax:D-Link DNS-325 NAS (Rev A1):DNS-325"; do + "DNS-320-rev-Ax:D-Link DNS-320 NAS (Rev A1):DNS323D1" "DNS-325-rev-Ax:D-Link DNS-325 NAS (Rev A1):DNS-325" \ + "DNR-322L-rev-Ax:D-Link DNR-322L-rev-Ax NAS:DNR-322"; do IFS=: read -r fw model sig <<< "$x" f="$TOP/output/dns320l/images/ShareOS-$V-$fw.bin" [ -f "$f" ] || continue diff --git a/tests/test-install-ubi.sh b/tests/test-install-ubi.sh index 6098ad2d..39646a6d 100755 --- a/tests/test-install-ubi.sh +++ b/tests/test-install-ubi.sh @@ -22,6 +22,24 @@ mtd 06400000; run check "DNS-320L / 320 rev B (0x06400000): size accepted" "! grep -q 'unexpected size' $T/out && grep -q 'missing' $T/out" mtd 06600000; run check "DNS-325 / 320 rev A (0x06600000): size accepted" "! grep -q 'unexpected size' $T/out && grep -q 'missing' $T/out" +mtd 04600000; run +check "DNR-322L (0x04600000): size accepted" "! grep -q 'unexpected size' $T/out && grep -q 'missing' $T/out" + +# the rootfs volume: 48 MiB, 32 MiB on the 70 MB partition of the DNR-322L. +# Stub flash tools in PATH record what would be written; nothing is written. +mkdir -p $T/bin +for t in ubiformat ubiattach ubimkvol ubiupdatevol ubinfo ubidetach ubiblock; do + printf '#!/bin/sh\necho "%s $*" >> %s/calls\n' "$t" "$T" > $T/bin/$t; chmod +x $T/bin/$t +done +printf 'hsqs' > $T/rootfs.squashfs; head -c 4096 /dev/zero >> $T/rootfs.squashfs +vol() { # size of 'image' -> -s of the rootfs volume + rm -f $T/calls; mtd "$1" + PATH=$T/bin:$PATH SHAREOS_PROC_MTD=$T/mtd sh "$SCRIPT" "$T/rootfs.squashfs" --yes > $T/out 2>&1 + sed -n 's/^ubimkvol .*-N rootfs -s \([0-9]*\).*/\1/p' $T/calls 2>/dev/null +} +check "DNS-320L: rootfs volume 48 MiB" "[ \"\$(vol 06400000)\" = 50331648 ]" +check "DNR-322L: rootfs volume 32 MiB" "[ \"\$(vol 04600000)\" = 33554432 ]" +check "DNR-322L: rootfs_data takes the rest, nothing else is touched" "grep -q '^ubimkvol /dev/ubi0 -N rootfs_data -m' $T/calls && grep -q '^ubiformat /dev/mtd3 ' $T/calls" mtd 06000000; run check "other size refused" "grep -q 'unexpected size 0x06000000' $T/out" mtd 00500000; run