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
12 changes: 10 additions & 2 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ release in the same week gets `.1`.

| file | what |
|---|---|
| `lemonade-onebit-<tag>-linux-x86_64.tar.zst` | Lemonade (`lemond`, `lemonade`) from our fork with the onebit recipe, and the engine in `1bit/`: `1bit` and every backend: HRX (and the CPU, from the same llama-server), ONNX (ryzenai-server), DwarfStar, and the NPU engine's runtime (no XRT; the NPU route is in progress, [below](#the-npu-engine)). No Vulkan or ROCm llama.cpp since RFC #213 stage 3 |
| `lemonade-onebit-<tag>-linux-x86_64.tar.zst` | Lemonade (`lemond`, `lemonade`, its web app) from our fork with the onebit recipe, and the engine in `1bit/`: `1bit` and every backend: HRX (and the CPU, from the same llama-server), ONNX (ryzenai-server), DwarfStar, and the NPU engine's runtime (no XRT; the NPU route is in progress, [below](#the-npu-engine)). No Vulkan or ROCm llama.cpp since RFC #213 stage 3 |
| `1bit-os-<tag>.img.zst`, `1bit-os-<tag>.efi` | 1bit OS, a Lemonade appliance with the engine as a bootable USB image ([os/README.md](../os/README.md)) |
| `changes.json`, `SHA256SUMS` | what moved upstream since the last release, as data; checksums |

Expand Down Expand Up @@ -136,6 +136,13 @@ amdclang builds them; credited in `NOTICE-BINARY`) packed in `hrx/llama/bin`. Af
- **Libraries found:** `ldd` (with `ROCR_VISIBLE_DEVICES=-1`) finds every library each packed
program and library needs, except the TheRock runtime the package documents (HIP, hipBLAS(Lt),
rocBLAS, HSA, which DwarfStar links).
- **Links inside:** every symlink in the engine tarball and in the Lemonade + onebit tarball is
relative and resolves inside the package (`pack_outside_links`); the `libggml*.so` ->
`.so.0` links stay links. Lemonade's build links its web app's KaTeX fonts to the build
machine's `/usr/share/fonts/truetype/katex`; the package stage and `os/mini/mkimage.sh` copy
every link that points out of the tree as a file (`pack_localize_links`, `scripts/pack-elf.sh`).
- **Web app:** the Lemonade + onebit tarball carries Lemonade's web app
(`bin/resources/web-app/index.html`), the UI `lemond` serves at `/`, as 1bit OS does.

`SHA256SUMS` is written again by the release stage, after `changes.json`, so it covers every file.

Expand Down Expand Up @@ -170,7 +177,8 @@ rehearsal found these only after the build) and stops with a message naming what

- **bumps, build:** TheRock in `/opt/rocm-therock`, or `-DONEBIT_HRX_TOOLCHAIN=<dir>` in
`WEEKLY_CMAKE_ARGS`; `hipcc` for DwarfStar, in TheRock or `/opt/rocm`, or `ROCM_PATH`.
- **package:** `patchelf` (`scripts/package-linux.sh`); a readable kernel image for 1bit OS,
- **package:** `patchelf` (`scripts/package-linux.sh`); `node` and `npm` for Lemonade's web app
(`LEMONADE_WEB_APP=1 scripts/build-lemonade.sh`; its `npm ci` needs the network); a readable kernel image for 1bit OS,
`/boot/vmlinuz-$(uname -r)` or `VMLINUZ=<copy>` (Ubuntu's `/boot/vmlinuz-*` is root-only).
The image's licences step copies from the submodules of the run's own checkout (`<workdir>/src`,
checked out by the build stage), so run `os/mini/mkimage.sh` from there, not from a plain
Expand Down
8 changes: 8 additions & 0 deletions os/mini/mkimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ lem=$(cd "$lem" && pwd)
[ -d "$lem/bin/resources/web-app" ] || echo " warning: no web app in $lem (build it with LEMONADE_WEB_APP=1 scripts/build-lemonade.sh)"
# lemond reads resources/ beside itself
mkdir -p "$root/opt/lemonade"; cp -a "$lem/bin" "$root/opt/lemonade/bin"
# Lemonade's build links the web app's KaTeX fonts to the build machine's fonts-katex
# (/usr/share/fonts/truetype/katex), which the image does not have: every link out of the tree
# becomes a copy of its target (scripts/pack-elf.sh), the links inside it stay
# shellcheck source=scripts/pack-elf.sh
. "$src/scripts/pack-elf.sh"
pack_localize_links "$root/opt/lemonade/bin"
n=$(pack_outside_links "$root/opt/lemonade/bin" | wc -l)
[ "$n" = 0 ] || { echo "symlinks out of /opt/lemonade/bin in the image:"; pack_outside_links "$root/opt/lemonade/bin"; exit 1; }
copy_libs "$lem/bin/lemond" "$lem/bin/lemonade"
# HTTPS for Lemonade's downloads (models, backends) when the stick has a network
mkdir -p "$root/etc/ssl/certs"; cp -L /etc/ssl/certs/ca-certificates.crt "$root/etc/ssl/certs/"
Expand Down
18 changes: 12 additions & 6 deletions os/mini/vmtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
# Lemonade's own settings for a network-facing server: "host": "0.0.0.0" in its config.json (QEMU's
# port forward reaches the guest's network address, not its loopback) and LEMONADE_API_KEY in its
# environment file. Then over SSH and HTTP: the system is up, the stick's data partition is mounted,
# Lemonade's web app loads, Lemonade refuses a request without the key, lists the stick's model in
# /api/v1/models, and answers a chat request with it. The VM has no Radeon GPU, so Lemonade serves
# that chat with its llamacpp CPU backend (its own choice); the onebit entry for the same model
# needs an AMD GPU or NPU for Lemonade to run it (the recipe's backends are hrx and npu), so the
# test only reports what Lemonade does with it. Prints VMTEST PASS or FAIL. On a
# machine without TheRock, LLAMA_SERVER (mkimage.sh) makes a CPU-only test image.
# Lemonade's web app loads and serves its KaTeX font as a file, Lemonade refuses a request without
# the key, lists the stick's model in /api/v1/models, and answers a chat request with it. The VM
# has no Radeon GPU, so Lemonade serves that chat with its llamacpp CPU backend (its own choice);
# the onebit entry for the same model needs an AMD GPU or NPU for Lemonade to run it (the recipe's
# backends are hrx and npu), so the test only reports what Lemonade does with it. Prints VMTEST
# PASS or FAIL. On a machine without TheRock, LLAMA_SERVER (mkimage.sh) makes a CPU-only test image.
set -euo pipefail
out=${1:?usage: vmtest.sh <out> [engine build dir] [model.gguf]}
build=${2:-$HOME/.cache/1bit-os/src/build}
Expand Down Expand Up @@ -75,6 +75,12 @@ fi
for i in $(seq 60); do curl -sf "${auth[@]}" "$api/api/v1/health" >/dev/null && break; sleep 2; done
code=$(curl -s -o "$out/ui.html" -w '%{http_code} %{content_type}' "$api/")
if [ "${code%% *}" = 200 ] && grep -qi '<html' "$out/ui.html"; then echo "Lemonade web app: HTTP $code"; else echo "Lemonade web app: HTTP $code"; ok=0; fi
# the web app's math fonts are files on the stick, not links to the build machine's fonts-katex
# (os/mini/mkimage.sh, pack_localize_links)
code=$(curl -s -o "$out/katex.woff2" -w '%{http_code}' "$api/KaTeX_Main-Regular.woff2")
if [ "$code" = 200 ] && [ "$(head -c 4 "$out/katex.woff2")" = wOF2 ]; then
echo "Lemonade web app font KaTeX_Main-Regular.woff2: HTTP 200, $(stat -c %s "$out/katex.woff2") bytes (woff2)"
else echo "Lemonade web app font KaTeX_Main-Regular.woff2: HTTP $code, not a woff2 font"; ok=0; fi
code=$(curl -s -o /dev/null -w '%{http_code}' "$api/api/v1/models")
if [ "$code" = 401 ]; then echo "Lemonade without the API key: HTTP 401"; else echo "Lemonade without the API key: HTTP $code (expected 401)"; ok=0; fi
models=$(curl -s "${auth[@]}" "$api/api/v1/models" | python3 -c 'import json,sys; print(" ".join(m["id"] + "(" + m.get("recipe", "?") + ")" for m in json.load(sys.stdin)["data"]))' 2>/dev/null || true)
Expand Down
37 changes: 37 additions & 0 deletions scripts/pack-elf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
# touches a GPU), except PACK_EXTERNAL_LIBS, the TheRock runtime
# the package documents as a requirement (HIP, hipBLAS(Lt),
# rocBLAS, HSA: DwarfStar's ds4 links them)
# pack_localize_links <dir> every symlink under <dir> that is absolute or resolves outside
# <dir> becomes a copy of what it points to; links inside the tree
# (libggml.so -> libggml.so.0) stay links. Lemonade's build links
# its web app's KaTeX fonts to the build machine's fonts-katex
# (/usr/share/fonts/truetype/katex), which a package or 1bit OS
# does not have (2026-10-21 rehearsal). Fails on a dangling one
# pack_outside_links <dir> prints "<link> -> <target>" for each symlink under <dir> that is
# absolute, resolves outside <dir>, or dangles

PACK_BUNDLE_LIBS=${PACK_BUNDLE_LIBS:-'libomp.so libomp.so.*'}
PACK_EXTERNAL_LIBS=${PACK_EXTERNAL_LIBS:-'libamdhip64.so* libhipblas.so* libhipblaslt.so* librocblas.so* libhsa-runtime64.so* librocm_smi64.so* librocsolver.so* libroctx64.so*'}
Expand Down Expand Up @@ -100,3 +108,32 @@ pack_missing_libs() {
[ -z "$miss" ] || echo "${f#"$1"/}:$miss"
done < <(find "$1" -type f -print0)
}

# a symlink is "inside" when its target is relative and resolves to an existing path under the
# tree's top (followed through any chain of links)
_pack_link_inside() { # <top (physical)> <link>
local t
case "$(readlink -- "$2")" in /*) return 1 ;; esac
t=$(readlink -e -- "$2") || return 1
case "$t" in "$1"/*) return 0 ;; *) return 1 ;; esac
}

pack_localize_links() {
local top l tmp bad=0
top=$(cd "$1" && pwd -P)
while IFS= read -r -d '' l; do
_pack_link_inside "$top" "$l" && continue
if [ ! -e "$l" ]; then echo "pack_localize_links: dangling ${l#"$1"/} -> $(readlink -- "$l")" >&2; bad=1; continue; fi
tmp="$l.pack-tmp"
cp -rL --preserve=mode,timestamps -- "$l" "$tmp" && rm -f -- "$l" && mv -- "$tmp" "$l" || bad=1
done < <(find "$1" -type l -print0)
return $bad
}

pack_outside_links() {
local top l
top=$(cd "$1" && pwd -P)
while IFS= read -r -d '' l; do
_pack_link_inside "$top" "$l" || echo "${l#"$1"/} -> $(readlink -- "$l")"
done < <(find "$1" -type l -print0)
}
38 changes: 37 additions & 1 deletion scripts/weekly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ package_checks() { # package_checks <linux tarball>
# every library each program loads is packed beside it (scripts/pack-elf.sh), except the TheRock
# runtime the package documents (HIP, hipBLAS(Lt), rocBLAS, HSA); ldd runs with
# ROCR_VISIBLE_DEVICES=-1, so nothing touches a GPU
links_ok "$t" "$(basename "$1")" || bad=1
local missing; missing=$(pack_missing_libs "$t")
if [ -z "$missing" ]; then echo "ok every library is packed (ldd: nothing missing beyond TheRock's runtime)"
else echo "FAIL libraries ldd cannot find in $(basename "$1"):"; echo "$missing"; bad=1; fi
Expand Down Expand Up @@ -334,6 +335,29 @@ package_checks() { # package_checks <linux tarball>
return $bad
}

# every symlink in a package stays inside it (scripts/pack-elf.sh pack_outside_links): no absolute
# link and none that resolves outside the tree or dangles; the .so -> .so.0 links in
# hrx/llama/bin are relative and stay. Lemonade's web app linked its KaTeX fonts to the build
# machine's /usr/share/fonts/truetype/katex (2026-10-21 rehearsal)
links_ok() { # links_ok <unpacked dir> <name>
local out; out=$(pack_outside_links "$1")
if [ -z "$out" ]; then echo "ok every symlink in $2 resolves inside it"; return 0; fi
echo "FAIL symlinks in $2 that are absolute, point outside it or dangle:"; echo "$out"; return 1
}
# the Lemonade + onebit tarball: its links stay inside it, and it carries Lemonade's web app (the UI
# lemond serves at /, built with LEMONADE_WEB_APP=1), as 1bit OS does
lemonade_package_checks() { # lemonade_package_checks <tarball>
local t rc=0 n
t=$(mktemp -d)
tar -C "$t" -xf "$1" --use-compress-program=unzstd
links_ok "$t" "$(basename "$1")" || rc=1
n=$(find "$t" -path '*/bin/resources/web-app/index.html' -type f | wc -l)
if [ "$n" != 0 ]; then echo "ok Lemonade's web app: bin/resources/web-app/index.html and $(find "$t" -path '*/bin/resources/web-app/*' -type f | wc -l) files in $(basename "$1")"
else echo "FAIL no Lemonade web app (bin/resources/web-app/index.html) in $(basename "$1")"; rc=1; fi
rm -rf "$t"
return $rc
}

TAG_FILE=$W/tag
stage_package() {
local tag=${WEEKLY_TAG:-v$(date +%G.%V)} n=0
Expand All @@ -352,14 +376,20 @@ stage_package() {
package_checks "$W/engine-pkg/1bit-$tag-linux-x86_64.tar.zst" > "$LOGS/package-checks.log" 2>&1 ||
{ cat "$LOGS/package-checks.log"; return 1; }
say "package $tag: Lemonade + onebit, with the engine"
guard "$SRC/scripts/build-lemonade.sh" "$W/lemonade" > "$LOGS/lemonade-build.log" 2>&1
# with Lemonade's web app (node and npm, preflight), the UI lemond serves at /
LEMONADE_WEB_APP=1 guard "$SRC/scripts/build-lemonade.sh" "$W/lemonade" > "$LOGS/lemonade-build.log" 2>&1
rm -rf "$W/lemonade/1bit" && mkdir -p "$W/lemonade/1bit"
zstd -dc "$W/engine-pkg/1bit-$tag-linux-x86_64.tar.zst" | tar -C "$W/lemonade/1bit" --strip-components=1 -xf -
install -m 755 "$SRC/scripts/lemond-onebit.sh" "$W/lemonade/lemond-onebit"
# links out of the tree (the web app's KaTeX fonts -> the build machine's fonts-katex) become
# copies of their targets; the links inside it stay links
pack_localize_links "$W/lemonade/bin"
# the S flag: member names only; GNU tar otherwise rewrites symlink targets too, and every
# libggml*.so.0 -> libggml*.so.0.18.0 link in 1bit/hrx/llama/bin pointed into a directory that is not there
tar -C "$W/lemonade" --transform "s,^,lemonade-onebit-$tag/,S" -cf - bin 1bit lemond-onebit | zstd -q -T4 -19 \
-o "$OUT/lemonade-onebit-$tag-linux-x86_64.tar.zst"
lemonade_package_checks "$OUT/lemonade-onebit-$tag-linux-x86_64.tar.zst" >> "$LOGS/package-checks.log" 2>&1 ||
{ cat "$LOGS/package-checks.log"; return 1; }
say "package $tag: 1bit OS"
rm -rf "$W/os"
guard "$SRC/os/mini/mkimage.sh" "$W/os" "$BUILD" > "$LOGS/os.log" 2>&1
Expand Down Expand Up @@ -417,6 +447,12 @@ preflight() {
# scripts/package-linux.sh rewrites RPATHs with patchelf
command -v patchelf > /dev/null ||
{ echo "preflight: patchelf is not installed (scripts/package-linux.sh needs it): apt install patchelf"; bad=1; }
# Lemonade's web app (LEMONADE_WEB_APP=1 scripts/build-lemonade.sh): node and npm, and
# the network for its `npm ci`
for d in node npm; do
command -v "$d" > /dev/null ||
{ echo "preflight: no $d on PATH (Lemonade's web app in the Lemonade + onebit package): install Node.js with npm"; bad=1; }
done
# os/mini/mkimage.sh reads the kernel image; on Ubuntu /boot/vmlinuz-* is root-only
kver=${KVER:-$(uname -r)}
vmlinuz=${VMLINUZ:-/boot/vmlinuz-$kver}
Expand Down
Loading