Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,15 @@ jobs:
path: artifacts
merge-multiple: true

# a model that is being added (status "devtest" in post-image.sh) keeps
# the root password "shareos" – its files never go into a release
- name: No devtest images
run: |
if ls artifacts/*-devtest.* >/dev/null 2>&1; then
echo "::error::devtest images in the build: $(cd artifacts && ls *-devtest.* | tr '\n' ' ') – set the model to 'release' in board/dlink/dns320l/post-image.sh and BOARD_DEVTEST=0 in board.sh when it is tested, or take it out"
exit 1
fi

- name: Sign the images
env:
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changes per release (newest first). The section of a version is added to its
GitHub release automatically when the release is built. Test versions are
pre-releases for test devices only.

## 0.3.0-beta.17

- **Devtest images for new models.** A model that is being added is built as `ShareOS-<version>-<model>-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://<box>/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`.

## 0.3.0-beta.16

From the first test on a DNR-322L ([#180](https://github.com/UniqueDroid/ShareOS/issues/180), Marco):
Expand Down
1 change: 1 addition & 0 deletions board/dlink/dns320l/initramfs/init
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ rescue() {
ShareOS rescue system – $*
$how
shareos-install-ubi <rootfs.squashfs> install the system into flash
shareos-deviceinfo > /tmp/info.txt hardware facts for a new model (scp)
reboot

EOF
Expand Down
2 changes: 2 additions & 0 deletions board/dlink/dns320l/mk-initramfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ usr/bin/pk_verify
FILES="
etc/passwd etc/group etc/shadow etc/shells etc/shareos-release
usr/lib/shareos/board.sh
usr/sbin/shareos-boardinfo
usr/sbin/shareos-deviceinfo
usr/share/udhcpc/default.script
etc/ssl/certs/ca-certificates.crt
etc/shareos/release.pub
Expand Down
25 changes: 17 additions & 8 deletions board/dlink/dns320l/post-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ INITRD_MAX=3145728
# uImage per model (zImage + its device tree, U-Boot passes none), an initramfs
# header per model (load address, see below) and a .bin with the D-Link
# signature of the model (legacy/alt-f/mkfw.sh).
# firmware name device tree product custom model sub nver type initramfs address
# Last column: "release", or "devtest" for a model that is being added – its
# files are named ShareOS-<version>-<name>-devtest.* (BOARD_DEVTEST=1 in
# board.sh: root keeps the password "shareos", the web interface offers the
# device info), and the release job refuses them.
# firmware name device tree product custom model sub nver type initramfs address status
MODELS="
DNS-320L-rev-Ax kirkwood-dns320l 0 8 11 1 1 6 0x00800000
DNS-320-rev-Bx kirkwood-dns320b 0 8 12 1 1 5 0x00800000
DNS-320-rev-Ax kirkwood-dns320 0 8 7 2 0 4 0x01000000
DNS-325-rev-Ax kirkwood-dns325 0 8 5 2 0 3 0x01000000
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
"

KVER=$(sed -n 's/^BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="\(.*\)"/\1/p' "$BR2_CONFIG")
Expand Down Expand Up @@ -66,13 +70,18 @@ check_size() {
T=$(mktemp -d)
trap 'rm -rf "$T"' EXIT

echo "$MODELS" | while read -r NAME DTB PROD CUST MODEL SUB NVER TYPE INITRD_ADDR; do
echo "$MODELS" | while read -r NAME DTB PROD CUST MODEL SUB NVER TYPE INITRD_ADDR STATUS; do
[ -n "$NAME" ] || continue
case "$STATUS" in
release) FILE=$NAME ;;
devtest) FILE=$NAME-devtest ;;
*) echo "post-image: status of $NAME is '$STATUS', not release or devtest" >&2; exit 1 ;;
esac
ZIMAGE="$B/zImage.$DTB"
[ -f "$ZIMAGE" ] || { echo "post-image: $ZIMAGE missing"; exit 1; }
UIMAGE="$B/uImage.$NAME"
UROOTFS="$B/urootfs.$NAME"
OUT="ShareOS-${VERSION}-${NAME}.bin"
OUT="ShareOS-${VERSION}-${FILE}.bin"

"$MKIMAGE" -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 \
-n "ShareOS-${VERSION}, kernel ${KVER}" -d "$ZIMAGE" "$UIMAGE" >/dev/null
Expand Down Expand Up @@ -105,7 +114,7 @@ echo "$MODELS" | while read -r NAME DTB PROD CUST MODEL SUB NVER TYPE INITRD_ADD
# and for a netboot via TFTP (U-Boot loads uImage + urootfs, the initramfs
# fetches rootfs.squashfs). Published in GitHub Releases with its .sha256.
# The bundle names its model in shareos-release (SHAREOS_FWNAME).
SU="ShareOS-${VERSION}-${NAME}.sysupgrade.tar"
SU="ShareOS-${VERSION}-${FILE}.sysupgrade.tar"
P="$T/su-$NAME"; mkdir -p "$P"
cp "$UIMAGE" "$P/uImage"; cp "$UROOTFS" "$P/urootfs"
ln -f "$B/rootfs.squashfs" "$P/rootfs.squashfs" 2>/dev/null || cp "$B/rootfs.squashfs" "$P/rootfs.squashfs"
Expand Down
5 changes: 4 additions & 1 deletion board/dlink/dns320l/rootfs-overlay/etc/init.d/S03claim
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
# console and the browser terminal stay closed until then.
#
# Not touched: boxes with their own root password, the development boot over
# TFTP (shareos.netroot) and the rescue system (initramfs, has its own root).
# TFTP (shareos.netroot), the rescue system (initramfs, has its own root) and
# a model that is being added (BOARD_DEVTEST in board.sh): its testers sign in
# with root / shareos before the buttons of the box are known.
#
[ "$1" = start ] || exit 0
grep -q 'shareos.netroot' /proc/cmdline 2>/dev/null && exit 0
[ "$(shareos-boardinfo devtest 2>/dev/null)" = 1 ] && exit 0
[ -e /overlay/claim ] || exit 0
[ "$(uci -q get shareos.setup.done)" = 1 ] && { rm -f /overlay/claim; exit 0; }

Expand Down
11 changes: 9 additions & 2 deletions board/dlink/dns320l/rootfs-overlay/usr/lib/shareos/board.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@
# BOARD_LED_POWER power LED; empty: driven by the MCU (/tmp/sys/power_led)
# BOARD_RAM_SMALL 1 on boxes with 128 MB RAM
# BOARD_TESTED 1 when tested on real hardware
# BOARD_DEVTEST 1 on a model that is being added (devtest image): root
# keeps the password "shareos" (no claiming), the web
# interface says so and offers the device info
# (#/deviceinfo); its files are named …-devtest and are
# never part of a release. Only set in the case of
# such a model – an unknown model (no device tree, the
# emulator) is claimed as usual.

board_detect() {
model=$( { tr -d '\000' < ${SHAREOS_ROOT:-}/proc/device-tree/model; } 2>/dev/null)
BOARD_POWER_BUTTON= BOARD_POWER_BACK= BOARD_LED_POWER= BOARD_RAM_SMALL=0 BOARD_TESTED=0
BOARD_POWER_BUTTON= BOARD_POWER_BACK= BOARD_LED_POWER= BOARD_RAM_SMALL=0 BOARD_TESTED=0 BOARD_DEVTEST=0
case "$model" in
*DNS-320L*)
BOARD_ID=dns320l BOARD_NAME="D-Link DNS-320L rev A" BOARD_FWNAME=DNS-320L-rev-Ax
Expand Down Expand Up @@ -78,7 +85,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; do
LED_STATUS LED_USB LED_DISK1 LED_DISK2 LED_POWER RAM_SMALL TESTED DEVTEST; do
eval "printf 'BOARD_%s=\"%s\"\n' $v \"\$BOARD_$v\""
done
}
Expand Down
145 changes: 145 additions & 0 deletions board/dlink/dns320l/rootfs-overlay/usr/sbin/shareos-deviceinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#!/bin/sh
#
# shareos-deviceinfo – what a new model needs to be added to ShareOS
#
# shareos-deviceinfo report as text; MAC addresses and serial
# numbers masked, for a public issue
# shareos-deviceinfo --full the same without masking
#
# Runs in the system and in the rescue system (initramfs, BusyBox only), and
# only reads: /proc, /sys, the kernel log and the U-Boot environment in flash
# (read with dd, never written). The web interface shows it at #/deviceinfo.
# Tests: SHAREOS_ROOT=<fake root> for the files; the programs come from PATH.
#
R=${SHAREOS_ROOT:-}
FULL=0
[ "$1" = --full ] && FULL=1

sec() { printf '\n### %s\n' "$1"; }
show() { # <title> <file>: the file, or "(not there)"
sec "$1"
if [ -r "$R$2" ]; then tr -d '\000' < "$R$2"; echo; else echo "(not there)"; fi
}
run() { # <title> <command…>: its output, or why there is none
t=$1; shift
sec "$t"
command -v "$1" >/dev/null 2>&1 || { echo "($1 not there)"; return; }
"$@" 2>&1
}
list() { # <title> <folder>: the names in it
sec "$1"
if [ -d "$R$2" ]; then ls "$R$2"; else echo "(not there)"; fi
}

# the U-Boot environment: the partition whose name has "env" in it, read
# with dd (variables are NUL-separated "name=value" after a 4-byte CRC)
uboot_env() {
sec "U-Boot environment (flash, read only)"
n=$(sed -n 's/^mtd\([0-9]*\):.*"[^"]*env[^"]*".*/\1/p' "$R/proc/mtd" 2>/dev/null | head -n 1)
if [ -z "$n" ] || [ ! -r "$R/dev/mtd$n" ]; then echo "(no environment partition found)"; return; fi
echo "(mtd$n)"
dd if="$R/dev/mtd$n" bs=65536 count=2 2>/dev/null | tr '\000' '\n' |
grep -a -o '[A-Za-z_][A-Za-z0-9_.-]*=[[:print:]]*' | head -n 200
}

hwmon() {
sec "hwmon sensors"
found=0
for h in "$R"/sys/class/hwmon/hwmon*; do
[ -d "$h" ] || continue
found=1
echo "${h##*/}: $(cat "$h/name" 2>/dev/null)"
for f in "$h"/temp*_input "$h"/fan*_input "$h"/pwm[0-9] "$h"/in*_input; do
[ -r "$f" ] && echo " ${f##*/} = $(cat "$f" 2>/dev/null)"
done
done
[ $found = 1 ] || echo "(none)"
}

gpio() {
sec "GPIO chips"
found=0
for c in "$R"/sys/class/gpio/gpiochip*; do
[ -d "$c" ] || continue
found=1
echo "${c##*/}: label=$(cat "$c/label" 2>/dev/null) base=$(cat "$c/base" 2>/dev/null) ngpio=$(cat "$c/ngpio" 2>/dev/null)"
done
[ $found = 1 ] || echo "(none)"
}

leds() {
sec "LEDs (current trigger)"
found=0
for l in "$R"/sys/class/leds/*; do
[ -d "$l" ] || continue
found=1
t=$(cat "$l/trigger" 2>/dev/null)
case "$t" in *\[*\]*) t=${t#*[}; t=${t%%]*} ;; esac
echo "${l##*/}: $t"
done
[ $found = 1 ] || echo "(none)"
}

usb() {
sec "USB devices"
found=0
for d in "$R"/sys/bus/usb/devices/*; do
[ -r "$d/idVendor" ] || continue
found=1
echo "${d##*/}: $(cat "$d/idVendor"):$(cat "$d/idProduct") $(cat "$d/manufacturer" 2>/dev/null) $(cat "$d/product" 2>/dev/null)"
done
[ $found = 1 ] || echo "(none)"
}

net() {
sec "network interfaces"
for i in "$R"/sys/class/net/*; do
[ -d "$i" ] || continue
n=${i##*/}
[ "$n" = lo ] && continue
echo "$n: address=$(cat "$i/address" 2>/dev/null) carrier=$(cat "$i/carrier" 2>/dev/null) speed=$(cat "$i/speed" 2>/dev/null) driver=$(basename "$(readlink "$i/device/driver" 2>/dev/null)" 2>/dev/null)"
done
}

report() {
echo "ShareOS device info – $(date -u '+%Y-%m-%d %H:%M UTC' 2>/dev/null)"
[ $FULL = 1 ] && echo "NOT MASKED: contains MAC addresses and serial numbers" \
|| echo "MAC addresses and serial numbers are masked."
show "ShareOS version" /etc/shareos-release
run "detected board (board.sh)" shareos-boardinfo
show "device-tree model" /proc/device-tree/model
show "device-tree compatible" /proc/device-tree/compatible
show "kernel command line" /proc/cmdline
run "kernel" uname -a
show "CPU" /proc/cpuinfo
run "memory" free
show "flash partitions (/proc/mtd)" /proc/mtd
show "partitions" /proc/partitions
uboot_env
list "LEDs" /sys/class/leds
leds
list "hwmon" /sys/class/hwmon
hwmon
gpio
show "input devices (buttons)" /proc/bus/input/devices
show "interrupts" /proc/interrupts
sec "serial ports"; ls "$R"/dev/ttyS* 2>/dev/null || echo "(none)"
show "serial ports (driver)" /proc/tty/driver/serial
list "I2C devices" /sys/bus/i2c/devices
usb
net
run "eth0" ifconfig eth0
run "kernel log" dmesg
}

# MAC addresses keep their last two bytes; serial numbers, ethaddr lines
# and the like keep nothing
mask() {
sed -E \
-e 's/(([0-9A-Fa-f]{2}[:-]){4})([0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2})/xx:xx:xx:xx:\3/g' \
-e 's/^([A-Za-z0-9_]*([Ss]erial|SERIAL|SN|_sn)[A-Za-z0-9_]*=).*/\1(masked)/' \
-e 's/^(sn=).*/\1(masked)/' \
-e 's/(Serial[[:space:]]*:[[:space:]]*).*/\1(masked)/'
}

if [ $FULL = 1 ]; then report; else report | mask; fi
29 changes: 29 additions & 0 deletions docs/DEVICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,32 @@ touched.
device tree, D-Link signature from `legacy/alt-f/mkfw.sh`).
3. A case in `board_detect` of `board.sh` (model text, LEDs, control,
buttons) and in `tests/test-boards.sh`.

### Devtest image: the first image for a new model

A model that is being added is built as a **devtest image** until it has been
tested: status `devtest` in its `MODELS` line (files
`ShareOS-<version>-<name>-devtest.bin` / `.sysupgrade.tar`) and
`BOARD_DEVTEST=1` in its case of `board.sh`. Its testers get the files from the
build of the pull request (Actions → artifact), never from a release – the
release job refuses devtest files.

On such a box:

- root keeps the password **shareos** – no claiming with a button (the buttons
of a new model are not known yet). Web interface and SSH: `root` / `shareos`.
Use it only in your own network.
- The overview and the messages say that it is a test image and link to the
**device info**: `http://<box>/deviceinfo` (also open for admins on every
other model). It collects what is needed to add the model – flash partitions,
CPU, memory, device tree, LEDs, sensors, buttons (input devices), GPIOs,
serial ports, I2C, USB, network, the U-Boot environment (read from flash,
never written) and the kernel log – and offers it as a text file. MAC
addresses and serial numbers are masked unless *Show MAC addresses and serial
numbers* is ticked: attach the masked file to the issue of the model.
- In the rescue system (SSH after a TFTP or rescue boot) the same report:
`shareos-deviceinfo > /tmp/info.txt`, then copy it with `scp`
(`--full`: without masking).

When the model works: status `release`, `BOARD_DEVTEST=0`, and it goes into
the next release with the normal claiming.
30 changes: 30 additions & 0 deletions docs/GERAETE.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,33 @@ kann. Die Daten auf den Platten werden nie angefasst.
(Firmware-Name, Device-Tree, D-Link-Signatur aus `legacy/alt-f/mkfw.sh`).
3. Ein Fall in `board_detect` von `board.sh` (Modelltext, LEDs, Steuerung,
Tasten) und in `tests/test-boards.sh`.

### Devtest-Image: das erste Image für ein neues Modell

Ein Modell, das hinzukommt, wird bis zum Test als **Devtest-Image** gebaut:
Status `devtest` in seiner `MODELS`-Zeile (Dateien
`ShareOS-<version>-<name>-devtest.bin` / `.sysupgrade.tar`) und
`BOARD_DEVTEST=1` in seinem Fall von `board.sh`. Seine Tester bekommen die
Dateien aus dem Build des Pull Requests (Actions → Artefakt), nie aus einem
Release – der Release-Job lehnt Devtest-Dateien ab.

Auf so einer Box:

- root behält das Passwort **shareos** – kein Beanspruchen per Taste (die
Tasten eines neuen Modells sind noch nicht bekannt). Weboberfläche und SSH:
`root` / `shareos`. Nur im eigenen Netz benutzen.
- Übersicht und Nachrichten sagen, dass es ein Testimage ist, und verlinken die
**Geräteinfo**: `http://<box>/deviceinfo` (für Admins auch auf jedem anderen
Modell offen). Sie sammelt, was zum Hinzufügen des Modells gebraucht wird –
Flash-Partitionen, CPU, Speicher, Device-Tree, LEDs, Sensoren, Tasten
(Eingabegeräte), GPIOs, serielle Schnittstellen, I2C, USB, Netzwerk, die
U-Boot-Umgebung (aus dem Flash gelesen, nie geschrieben) und das
Kernel-Protokoll – und bietet sie als Textdatei an. MAC-Adressen und
Seriennummern sind maskiert, solange *Show MAC addresses and serial numbers*
nicht angehakt ist: die maskierte Datei ans Issue des Modells hängen.
- Im Rettungssystem (SSH nach einem TFTP- oder Rescue-Start) derselbe Bericht:
`shareos-deviceinfo > /tmp/info.txt`, dann mit `scp` kopieren
(`--full`: ohne Maskierung).

Wenn das Modell läuft: Status `release`, `BOARD_DEVTEST=0`, und es kommt mit
dem normalen Beanspruchen ins nächste Release.
4 changes: 3 additions & 1 deletion docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Releasing ShareOS

1. Everything for the release is merged into `main` (CI green).
1. Everything for the release is merged into `main` (CI green). Models with
the status `devtest` (see [DEVICES.md](DEVICES.md#devtest-image-the-first-image-for-a-new-model))
stop the release job – set them to `release` when tested, or take them out.
2. **Docs are up to date in the same merge:**
- `CHANGELOG.md`: section `## <version>` with the changes (it is attached to the GitHub release automatically)
- `README.md`: status and feature list
Expand Down
8 changes: 8 additions & 0 deletions docs/TESTEN.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,14 @@ Braucht ein Tailscale-Konto (kostenlos), ein Handy oder einen Rechner mit Tailsc
5. Konto ohne persönlichen Ordner: Teilen meldet „no personal folder“; das Geteilte wird verworfen und kommt bei der nächsten Anmeldung nicht wieder.
6. Dateidialog einer App für ein Konto **ohne** *Dateien* (z. B. Webpad → *Öffnen*): Die Ordnerauswahl zeigt zuerst *App-Daten*, dann *Mein Ordner* und die Freigaben des Benutzers; Freigaben nur zum Lesen sind markiert und fehlen beim Speichern. Die App legt ihre eigenen Dateien weiter in *App-Daten* ab.

## 14zz. Geräteinfo, Devtest-Images (0.3.0-beta.17)

1. Auf einer beliebigen Box als Admin angemeldet: `http://<box>/deviceinfo` öffnen. Die Seite *DEVICE INFO* öffnet sich (klassische Ansicht: unter *System*, ohne Reiter; Desktop-Ansicht: im Fenster *Settings*). Sie zeigt Modell, `/proc/mtd`, CPU, LEDs, hwmon-Sensoren, Eingabegeräte, die U-Boot-Umgebung und das Kernel-Protokoll. MAC-Adressen lauten `xx:xx:xx:xx:..:..`, Seriennummern `(masked)`.
2. *Show MAC addresses and serial numbers* anhaken: Der Bericht wird neu gelesen, vollständig, oben steht „NOT MASKED“. *Download* speichert `shareos-deviceinfo-<modell>-<datum>-full.txt`, *Copy* legt ihn in die Zwischenablage (nur über HTTPS oder auf localhost – sonst sagt die Seite, man soll *Download* nehmen).
3. Über SSH: `shareos-deviceinfo | head -40` und `shareos-deviceinfo --full | grep ethaddr`. Es wird nichts geschrieben: `md5sum /dev/mtd*` vorher und nachher gleich.
4. Rettungssystem (TFTP-Start mit `shareos.rescue`): Die Startmeldung nennt `shareos-deviceinfo`; `shareos-deviceinfo > /tmp/info.txt` geht dort auch, `scp root@<box>:/tmp/info.txt .` holt ihn ab.
5. Devtest-Image (nur mit einem Modell im Status `devtest`, z. B. einem Pull Request für ein neues Modell): nach dem Flashen geht `root` / `shareos` im Browser und über SSH ohne Tastendruck; die Übersicht zeigt den gelben Hinweis *Test image for a new model* mit dem Link, *Messages* dasselbe innerhalb von 10 Minuten.

## 14zy. Plattenwechsel (0.3.0-beta.16)

Braucht eine zweite Platte (Schacht oder USB-Gehäuse), die gelöscht werden darf. **Nicht auf einer Box mit Daten, die du ohne Sicherung nicht verlieren darfst.**
Expand Down
Loading
Loading