9 Commits
Author SHA1 Message Date
Herman van HazendonkandClaude Opus 4.8 d4eb428efd env: default BPWPE_REAP_ON_NAV off on Pre 3 (cold-spawn latency too high)
Reaping the WebProcess every navigation cold-spawns a fresh one, which on the single-core Adreno-205
Pre 3 takes ~15-20s before the page starts — worse UX than the memory it saves. Keep the feature in the
backend (env-gated) but default it OFF for the Pre 3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 14:40:13 +02:00
Herman van HazendonkandClaude Opus 4.8 34eb247c6a env: device-profile enables BPWPE_REAP_ON_NAV for the Pre 3
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 10:02:38 +02:00
Herman van HazendonkandClaude Opus 4.8 7eed25ac6b env: stripped-ipk assembler inherits all bring-up fixes + libEGL on WebProcess + ustar
build-ipk-pre3-stripped.sh now starts from the fully-fixed base ipk (libaffinity, viewport-fixed
BrowserServer-atlas, patched libepoxy, device-profile, wrapper, postinst self-heal), swaps the
feature-stripped WebKit libs, and adds libEGL.so.1 --add-needed to the STRIPPED WPEWebProcess (the base
one is replaced) so the Adreno subdriver resolves. Repacks ustar. Result installs clean like the full one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 09:01:35 +02:00
Herman van HazendonkandClaude Opus 4.8 0e7db39a43 env: build-ipk-pre3.sh bakes in all Pre 3 bring-up fixes + self-healing postinst
The Pre 3 ipk now installs clean with no manual repair. Over the reused TouchPad engine it bakes:
libaffinity.so.0, the rebuilt BrowserServer-atlas (viewport BPWPE_SCREEN_W/H fix), the patched
libepoxy.so.0 (EGL 1.4 clamp for Adreno 205), WPEWebProcess with libEGL.so.1 --add-needed (subdriver
symbol scope), device-profile-pre3 + wrapper (sourced, -platform dropped for Qt4). Adds a postinst
self-heal that strips the octal-mode suffix webOS 2.2.4 busybox-tar appends to filenames, and repacks
data.tar.gz as ustar to minimise that mangling in the first place.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 08:55:26 +02:00
Herman van HazendonkandClaude Opus 4.8 40d1ec562f env: device-profile sets BPWPE_SCREEN_W/H=480/800 for the Pre 3 viewport fix
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 08:38:37 +02:00
Herman van HazendonkandClaude Opus 4.8 9316e9b597 env: Pre 3 feature-stripped engine build + stripped-ipk assembler
- build-webkit-252-pre3.sh: fresh WPE 2.52 build in a SEPARATE dir (_b_pre3), keeping the working
  engine's JIT/DFG/WASM/graphics-core config IDENTICAL (so the softfp JIT patch + ~3x speedup carry
  over) and dropping only the heavy features: video/media-source/media-stream/web-audio/webrtc/
  web-codecs/media-recorder/encrypted-media -> USE_GSTREAMER=OFF, plus webgl/avif/jpegxl/speech/gamepad.
  Installs via DESTDIR so the TouchPad staging is never touched.
- build-ipk-pre3-stripped.sh: assembles the stripped ipk — swaps libWPEWebKit (prefix-patched) +
  injected bundle + WPEWebProcess/WPENetworkProcess (patchelf'd) in ABI lockstep into the reuse
  deviceroot, then drops the dead GStreamer/media plugins to reclaim flash. Patched cross-engine is
  UNVERIFIED on-device; the reuse ipk stays the safe fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 02:56:17 +02:00
Herman van HazendonkandClaude Opus 4.8 ecf3824f7c docs: note reused engine is symbol- not feature-stripped; point to prebuilt Pre 3 ipk
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 02:45:22 +02:00
Herman van HazendonkandClaude Opus 4.8 5afde9c811 env: build-ipk-pre3.sh — assemble a full Pre 3 ipk by reusing a TouchPad ipk's engine
Reuses an existing tenderloin ipk's engine bundle (libWPEWebKit/WPEWebProcess/GStreamer/
BrowserServer-atlas/adapter — same ABI), swaps in the pre3-lowmem app front-end, bakes in
deviceroot/atlas/device-profile, patches the boot wrapper to source it, and repacks. Output is
structurally identical to the TouchPad ipk (Path A). Engine is symbol-stripped (67MB) but not
feature-stripped; note added to PRE3-PORT.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 02:44:51 +02:00
Herman van HazendonkandClaude Opus 4.8 2a7314f7d6 env: HP Pre 3 low-memory device profile + engine-swap upstart + port runbook
- device-profile-pre3: RAM/core/buffer overrides for a 512MB single-core phone
  (JSC_forceRAMSize=96MB, NICOSIA threads=1, BPWPE_FORCE_SIMPLE=1, SIMPLE_SCREENS=1,
  MEM_LIMIT=160, NO_STRIP=0). Sourced by the boot wrapper LAST so it overrides the
  TouchPad Phase-1 tuning; the TouchPad ships no such file (no-op).
- wrapper-BrowserServer: source "$ATLAS/device-profile" just before exec.
- upstart-browser-pre3: engine job with BROWSERSERVER_NAME=browser so the WPE server
  listens on /tmp/yapserver.browser (the stock-mime adapter's socket) for the Mojo
  engine-swap path.
- PRE3-PORT.md: full runbook — the two paths (Enyo smoke test vs Mojo engine swap),
  what changed across the pre3-lowmem branches, build/deploy/test steps, risks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 02:36:19 +02:00
7 changed files with 449 additions and 0 deletions

No files matched your search

+148
View File
@@ -0,0 +1,148 @@
# Atlas WPE on the HP Pre 3 (webOS 2.2.4) — low-memory port
Goal: a **modern browser (WPE WebKit 2.52, real JS + OAuth2)** on the HP Pre 3 — 512 MB RAM,
single-core 1.4 GHz (MSM8x55), Adreno 205, 480×800, webOS 2.2.4 (mantaray). The bottleneck is **RAM**,
not CPU. Everything below exists to (a) never allocate the multi-screen-tall pan buffer, (b) keep a
single WebProcess with a low memory cap, and (c) avoid running a heavyweight tablet UI on top.
Feasibility was confirmed against the extracted rootfs
(`/home/herrie/webos/Pre3/nova-cust-image-mantaray.rootfs`): it has **Enyo 1.0**, the stock
`BrowserAdapter.so` + `BrowserServer` (so the NPAPI/yap plumbing exists), and `media/internal`. The
engine binaries are largely self-contained (bundled glibc/libs), so the TouchPad-built WPE engine is
expected to run on 2.2.4; the true unknowns are the GPU driver (Adreno 205 vs 220) and whether stock
LunaSysMgr 2.2.4 composites the NPAPI card the same way — both only testable on-device.
---
## Two paths
**Path B — engine swap under the stock Mojo browser (RECOMMENDED end state).**
Keep the stock webOS phone browser UI (`com.palm.app.browser`, already 480×800, already the default-
browser slot, lightweight Mojo) and swap ONLY the engine underneath it to WPE. No Enyo app on the
device. This is the right long-term phone experience and what you proposed.
Why it works (verified): the stock Mojo UI only speaks the **NPAPI JS contract** to the adapter plugin;
the yap wire protocol is internal to the adapter+server pair (they ship together), so yap divergence is
irrelevant. The Atlas adapter already implements ~95% of the NPAPI methods/callbacks the stock
framework `webview` widget uses. The only required change is registering the adapter under the stock
mime/socket.
**Path A — Enyo Atlas app, low-memory profile (good FIRST smoke test).**
Ship the existing Atlas Enyo app with a global low-memory profile. Use this first because
Atlas-app + Atlas-adapter + Atlas-server is the **known-good** combination (it works on the TouchPad),
so if it renders on the Pre 3 you've proven *the WPE engine runs on 2.2.4 hardware* — independent of
the Mojo NPAPI-contract unknown. Then move to Path B for the production UI.
Suggested order: **smoke-test with A → switch to B.**
---
## What changed (all on `pre3-lowmem` branches; nothing merged to master/main)
| Repo | Branch | Change |
|------|--------|--------|
| `atlas-browser-app` | `pre3-lowmem` | Global low-memory profile: hardware autodetect (`AtlasEngineOverride.js` sets `window.__atlasLowMem` from screen size/model), every card born `simpleMode`, `lowMemoryMode` pref + Preferences toggle, single-card "open in new card", `css/phone.css` (480×800). |
| `atlas-wpe-backend` | `pre3-lowmem` | `bpwpe_force_low_mem()` — forces viewport-only rendering for **every** page (no `atlas-simple:` marker needed) when low-RAM or forced. **Essential for Path B** (Mojo UI can't send the marker). No-op on the TouchPad. Rebased on top of the now-committed Spotify-UA/cache work on `master`, so the branch has both. |
| `BrowserAdapter` | `pre3-lowmem` | Optional `-DATLAS_STOCK_BROWSER` build → registers stock mime `application/x-palm-browser` + client name `browser`. **Path B enabler.** Default build unchanged. |
| `atlas-wpe-env` | `pre3-lowmem` | `device-profile-pre3` (RAM/core/buffer overrides), wrapper sources `$ATLAS/device-profile` last, `upstart-browser-pre3` (BROWSERSERVER_NAME=browser), this doc. |
### Engine tuning applied on the Pre 3 (`ipk-build/pull/device-profile-pre3`)
- `JSC_forceRAMSize=96MB` (TouchPad 192) · `WEBKIT_NICOSIA_PAINTING_THREADS=1` (single core)
- `BPWPE_FORCE_SIMPLE=1` + `BPWPE_SIMPLE_SCREENS=1` → exact-viewport (mult=1) buffers
- `BPWPE_MEM_LIMIT=160` (TouchPad 480) · `BPWPE_NO_STRIP=0` (strip wins for viewport-sized rendering)
- RGB565 tiles + `MALLOC_ARENA_MAX=2` kept from Phase-1.
---
## Build
> **Already built (2026-07-28) → `~/webos/Pre3/atlas-pre3-build/`** (see its `DEPLOY-README.md`):
> the Path-A app ipk (`org.webosports.app.atlas_0.9.7_all.ipk`) and the Path-B stock adapter
> (`BrowserAdapter-stock-pre3.so`, mime `application/x-palm-browser`, verified). **Reuse the TouchPad
> engine as-is** — Pre 3 and TouchPad share ABI (ARMv7 softfp cortex-a8; adapter is classic armv6), so
> `libWPEWebKit`/`WPEWebProcess`/GStreamer/`BrowserServer-atlas` need **no rebuild**. Path B renders
> viewport-only via the adapter's `atlas-simple:` prepend + `device-profile` env, so even the server is
> reused. The steps below are only if you want to rebuild from scratch.
>
> **Engine note:** the reused engine is **symbol-stripped (67 MB) but NOT feature-stripped** — it still
> carries video / WebRTC / WebAudio + the full GStreamer stack. The Phase-3 feature-strip
> (`-DENABLE_VIDEO=OFF -DENABLE_WEB_RTC=OFF -DENABLE_WEB_AUDIO=OFF -DUSE_AVIF=OFF -DUSE_JPEGXL=OFF`,
> `GPU_PROCESS=OFF`) reclaims RAM/flash but needs the ~40-min WebKit rebuild in a separate build dir;
> it is not in the reuse ipk.
>
> **The prebuilt full Pre 3 ipk is `~/webos/Pre3/atlas-pre3-build/org.webosports.app.atlas_0.9.7_pre3.ipk`**
> (built by `build-ipk-pre3.sh`).
All builds are ARM cross-builds run from `atlas-wpe-env` (see the existing scripts). Check out the
`pre3-lowmem` branch in each repo first.
```sh
for r in atlas-browser-app atlas-wpe-backend BrowserAdapter atlas-wpe-env; do
git -C ~/Documents/GitHub/$r checkout pre3-lowmem
done
```
> **Backend note:** the Spotify-UA + cache-on-tmpfs work is now committed on `atlas-wpe-backend/master`,
> and `pre3-lowmem` is rebased on top of it — so the branch contains **both** that work and the
> force-simple change. Just check it out. (The force-simple commit adds `bpwpe_force_low_mem()` near
> `lunaConfInt` and one call in `openUrl()`; it composes with the WIP's simple-mode prewarm teardown.)
1. **Engine server** (both paths) — includes the backend force-simple change:
`./build-browserserver-atlas.sh` then link (see repo). Produces `BrowserServer-atlas`.
2. **Adapter**:
- Path A: `./deploy-adapter.sh` as usual → `BrowserAdapterAtlas.so` (mime `x-atlas-browser`).
- Path B: build the adapter with **`-DATLAS_STOCK_BROWSER`** added to its CXXFLAGS → a `.so` that
registers `application/x-palm-browser`. Install it as the device's
`/usr/lib/BrowserPlugins/BrowserAdapter.so` (back up the stock one first).
3. **App front-end** (Path A only): `palm-package ~/Documents/GitHub/atlas-browser-app`, or the full
`build-ipk-atlas.sh`. No compile step. (No rename needed for the smoke test — keep the
`org.webosports.app.atlas` id; Path B is what takes over `com.palm.app.browser`.)
> The stripped "Phase-3" engine (drop video/webrtc/webaudio/avif/jpegxl, `GPU_PROCESS=OFF`) is an
> **optimization, not required for the first test** — the current engine is self-contained and should
> run. When you want it, fork `build-webkit-252.sh` to a separate build dir + staging prefix and start
> from the LIVE `_b/CMakeCache.txt` flags (see the env map notes), then apply the drops. It buys the
> most headroom for the marginal heavy-SPA cases.
---
## Deploy + test
### Path A (Enyo smoke test)
1. Install the Atlas ipk (or drop the app front-end into its cryptofs app dir).
2. Deploy the engine deviceroot to the Pre 3; ship `device-profile-pre3` as `$ATLAS/device-profile`
next to the wrapper; install `BrowserAdapterAtlas.so` → `/usr/lib/BrowserPlugins/`; install the
`atlas` upstart job (BROWSERSERVER_NAME=atlas).
3. `killall LunaSysMgr`; launch Atlas.
4. **Expect:** the app opens phone-sized; `[Atlas] lowMemory autodetect=true` in the log; pages render
viewport-only (no tall-buffer pan); an OAuth2 login (e.g. Google) completes. This proves the engine
on 2.2.4.
### Path B (engine swap — production phone browser)
1. Leave the stock `com.palm.app.browser` app **as-is**.
2. Back up `/usr/lib/BrowserPlugins/BrowserAdapter.so`, install the `-DATLAS_STOCK_BROWSER` adapter in
its place.
3. Deploy the engine deviceroot (with `device-profile`), install `upstart-browser-pre3` as
`/etc/event.d/browser-wpe` (BROWSERSERVER_NAME=browser → `/tmp/yapserver.browser`), adjust its `cd`
path to where you put the engine. Make sure the **stock** BrowserServer isn't also grabbing that
socket.
4. `killall LunaSysMgr`; open the stock Web app.
5. **Expect:** the stock UI renders modern pages via WPE. Watch `/media/ram/bs-atlas.log` for the
Connect handshake and `low-memory device/env -> forcing simple`.
**Path-B risks to watch (from the NPAPI compat review):**
- *Renders-but-blank* → the shared-buffer/offscreen paint handshake (`asyncCmdConnect 0x1000`
sharedBufferKey/size ↔ `Painted 0x2000` blit) between the stock widget's offscreen path and the WPE
backend. This is the deepest coupling; validate visually first.
- *Navigation stalls at start* → the widget gates the first `openURL` on `adapterInitialized` +
`serverConnected` firing in order.
- *Preferences clear / text-select errors* → 4 NPAPI methods not yet exposed (`clearCache`,
`clearCookies`, `ignoreMetaRefreshTags`, `setUserSelect`); non-fatal, listed as a follow-up in the
BrowserAdapter commit. Add them to `names[]`/`methods[]` when convenient.
---
## Reality check
OAuth2 flows, normal pages, and light SPAs are very achievable on 512 MB with this profile. A single
**heavy** SPA (WhatsApp/Teams/Gmail full, ~300 MB+ resident) may still OOM regardless — that's a
hardware limit, not a tuning gap. The stripped Phase-3 engine widens the margin but won't erase it.
+82
View File
@@ -0,0 +1,82 @@
#!/bin/bash
# Assemble the FEATURE-STRIPPED Pre 3 ipk: take the reuse Pre 3 ipk's deviceroot (app + device-profile +
# already-patched WebProcess launch paths) and swap in the stripped WebKit artifacts built by
# build-webkit-252-pre3.sh, then drop the now-dead GStreamer/media plugins to reclaim flash.
#
# ABI lockstep: feature-strip changes WebKit struct layouts, so libWPEWebKit + libWPEInjectedBundle +
# WPEWebProcess + WPENetworkProcess are ALL swapped together from _b_pre3 (a mismatched injected bundle =
# WebProcess SIGBUS — see redeploy-webkit.sh). libWPEWebKit is prefix-patched (host staging -> /var/atlas252)
# exactly like redeploy-webkit.sh; the WebProcess stubs get the same patchelf interp/rpath as deploy-252.sh.
#
# Run AFTER build-webkit-252-pre3.sh build completes. Output: *_pre3-stripped.ipk
# NOTE: the patched cross-engine is UNVERIFIED on-device — keep the reuse ipk as the safe fallback.
set -euo pipefail
ENV_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
WPE="${WPE:-$HOME/webos/wpe}"
. "${WPE_ENV:-$WPE/env-glibc-gcc125.sh}"; S="$STAGING"
: "${TARGET:=arm-unknown-linux-gnueabi}"; STRIP_BIN="${STRIP:-$TARGET-strip}"
BP="$WPE/build/wpewebkit-2.52.4/_b_pre3"
DEST="$WPE/pre3-destroot"
BASE_IPK="${BASE_IPK:-/home/herrie/webos/Pre3/atlas-pre3-build/org.webosports.app.atlas_0.9.7_pre3.ipk}"
OUT="${OUT:-/home/herrie/webos/Pre3/atlas-pre3-build}"
APPNAME=org.webosports.app.atlas
CRYPTO_DR="/media/cryptofs/apps/usr/palm/applications/$APPNAME/deviceroot"
DEVPATH="$CRYPTO_DR/wpe-252"; PREFIX_LINK="/var/atlas252"
BUILT_LIB="$BP/lib/libWPEWebKit-2.0.so.1.9.8"
[ -f "$BUILT_LIB" ] || { echo "stripped lib not built yet: $BUILT_LIB (run build-webkit-252-pre3.sh build)"; exit 1; }
[ -f "$BASE_IPK" ] || { echo "base ipk missing: $BASE_IPK (run build-ipk-pre3.sh)"; exit 1; }
W=$(mktemp -d); trap 'rm -rf "$W"' EXIT
echo "=== 1. unpack base (reuse) ipk ==="
( cd "$W" && ar x "$BASE_IPK" && mkdir data ctl && tar xzf data.tar.gz -C data && tar xzf control.tar.gz -C ctl )
DR="$W/data/usr/palm/applications/$APPNAME/deviceroot/wpe-252"
echo "=== 2. swap libWPEWebKit (prefix-patch + strip) ==="
TMP="$W/libwpe.so"; cp -f "$BUILT_LIB" "$TMP"; "$STRIP_BIN" --strip-unneeded "$TMP" || true
ATLAS_HOST_PREFIX="$S" PREFIX_LINK="$PREFIX_LINK" python3 - "$TMP" <<'PY'
import sys, os
host=os.environ['ATLAS_HOST_PREFIX'].encode(); dev=os.environ['PREFIX_LINK'].encode()
pad=b''
while len(dev+pad)<len(host): pad+=b'/.'
devp=(dev+pad)[:len(host)]; assert len(devp)==len(host)
f=sys.argv[1]; d=open(f,'rb').read(); n=d.count(host); open(f,'wb').write(d.replace(host,devp))
print(f" prefix-patched {n} occurrences -> {devp.decode()}")
PY
cp -f "$TMP" "$DR/lib/libWPEWebKit-2.0.so.1"
echo "=== 3. swap injected bundle + WebProcess/NetworkProcess (ABI lockstep) ==="
IB_SRC=$(find "$BP" "$DEST" -name libWPEInjectedBundle.so 2>/dev/null | head -1)
cp -f "$IB_SRC" "$DR/lib/wpe-webkit-2.0/injected-bundle/libWPEInjectedBundle.so"
"$STRIP_BIN" --strip-unneeded "$DR/lib/wpe-webkit-2.0/injected-bundle/libWPEInjectedBundle.so" || true
RP="$DEVPATH/lib:/usr/lib:/lib"
for name in WPEWebProcess WPENetworkProcess; do
SRC=$(find "$BP" "$DEST" -name "$name" -type f 2>/dev/null | head -1)
[ -n "$SRC" ] || { echo " WARN: $name not found in build output"; continue; }
cp -f "$SRC" "$DR/libexec/wpe-webkit-2.0/$name"
"$STRIP_BIN" --strip-unneeded "$DR/libexec/wpe-webkit-2.0/$name" || true
patchelf --set-interpreter "$DEVPATH/lib/ld-linux.so.3" --force-rpath --set-rpath "$RP" "$DR/libexec/wpe-webkit-2.0/$name"
# WebProcess needs libEGL.so.1 as a direct NEEDED so the Adreno subdriver's eglSubDriverWait resolves
# in the global scope (same bring-up fix as the full build; the base ipk's WebProcess is replaced here).
[ "$name" = WPEWebProcess ] && patchelf --add-needed libEGL.so.1 "$DR/libexec/wpe-webkit-2.0/$name"
echo " patched $name"
done
echo "=== 4. drop dead GStreamer/media plugins + libs (video/webrtc gone) ==="
BEFORE=$(du -sm "$DR" | cut -f1)
rm -rf "$DR/lib/gstreamer-1.0" "$DR/libexec/gstreamer-1.0" 2>/dev/null || true
rm -f "$DR"/lib/libgst*.so* "$DR"/lib/libav*.so* "$DR"/lib/libswscale*.so* "$DR"/lib/libswresample*.so* \
"$DR"/lib/libavcodec*.so* "$DR"/lib/libavformat*.so* "$DR"/lib/libavutil*.so* \
"$DR"/lib/libvpx*.so* "$DR"/lib/libopus*.so* "$DR"/lib/libwebrtc*.so* 2>/dev/null || true
AFTER=$(du -sm "$DR" | cut -f1)
echo " deviceroot ${BEFORE}MB -> ${AFTER}MB"
echo "=== 5. repack ==="
VER=$(grep -oE '^Version: .*' "$W/ctl/control" | awk '{print $2}')
sed -i -E "s/graphics bring-up\)\./graphics bring-up; feature-stripped engine)./" "$W/ctl/control"
( cd "$W/data" && tar --format=ustar -czf "$W/data.tar.gz" --owner=0 --group=0 ./* )
( cd "$W/ctl" && tar --format=ustar -czf "$W/control.tar.gz" --owner=0 --group=0 ./* )
echo "2.0" > "$W/debian-binary"
IPK="$OUT/${APPNAME}_${VER}_pre3-stripped.ipk"; rm -f "$IPK"
( cd "$W" && ar rc "$IPK" debian-binary control.tar.gz data.tar.gz )
echo "=== done: $IPK ($(stat -c%s "$IPK") bytes) ==="
+77
View File
@@ -0,0 +1,77 @@
#!/bin/bash
# Build a complete, installable HP Pre 3 Atlas ipk from an existing TouchPad ("tenderloin") ipk's engine
# bundle (same ABI) + the on-device fixes found during Pre 3 bring-up baked in. Produces a drop that
# installs clean via Preware with no manual repair. See PRE3-PORT.md and the pre3-graphics-bringup notes.
#
# Bakes in, over the reused deviceroot:
# - pre3-lowmem app front-end (low-memory profile + phone CSS)
# - libaffinity.so.0 (webOS-3.0.5 system lib, absent on 2.2.4) -> $D/lib
# - rebuilt BrowserServer-atlas (viewport fix: BPWPE_SCREEN_W/H) -> $D/
# - patched libepoxy.so.0 (EGL 1.4 version clamp for Adreno 205) -> $D/lib
# - WPEWebProcess --add-needed libEGL.so.1 (EGL subdriver global symbol scope) -> $D/libexec/...
# - device-profile-pre3 (RAM/core/buffer/screen tuning) + wrapper sources it, minus -platform (Qt4)
# - postinst SELF-HEAL: rename any files whose name got the octal mode appended by 2.2.4 busybox-tar
# Result: $OUT/org.webosports.app.atlas_<ver>_pre3.ipk
set -euo pipefail
ENV_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
REPOS="${REPOS:-$(dirname "$ENV_DIR")}"
TP_IPK="${TP_IPK:-/home/herrie/webos/wpe/ipk-build/org.webosports.app.atlas_0.9.6_all.ipk}"
APPSRC="${APPSRC:-$REPOS/atlas-browser-app}"
PROFILE="${PROFILE:-$ENV_DIR/ipk-build/pull/device-profile-pre3}"
OUT="${OUT:-/home/herrie/webos/Pre3/atlas-pre3-build}"
# engine-fix artifacts (overridable)
BS_ATLAS="${BS_ATLAS:-/home/herrie/webos/wpe/browserserver-wpe/obj/BrowserServer-atlas}"
LIBEPOXY="${LIBEPOXY:-/home/herrie/webos/wpe/build/libepoxy-1.5.10/_b/src/libepoxy.so.0.0.0}"
LIBAFFINITY="${LIBAFFINITY:-/home/herrie/webos/touchpad-kernel/doctor305/nova-cust-image-topaz.rootfs/usr/lib/libaffinity.so.0.0.0}"
APPNAME=org.webosports.app.atlas
for f in "$TP_IPK" "$APPSRC/appinfo.json" "$PROFILE" "$BS_ATLAS" "$LIBEPOXY" "$LIBAFFINITY"; do
[ -e "$f" ] || { echo "missing: $f" >&2; exit 1; }; done
command -v patchelf >/dev/null || { echo "patchelf required" >&2; exit 1; }
VER=$(grep -oE '"version"[[:space:]]*:[[:space:]]*"[0-9.]+"' "$APPSRC/appinfo.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1); : "${VER:=0.9.7}"
W=$(mktemp -d); trap 'rm -rf "$W"' EXIT
echo "=== 1. unpack TouchPad ipk (reused engine) ==="
( cd "$W" && ar x "$TP_IPK" && mkdir data ctl && tar xzf data.tar.gz -C data && tar xzf control.tar.gz -C ctl )
APP="$W/data/usr/palm/applications/$APPNAME"; D="$APP/deviceroot/wpe-252"
[ -d "$D" ] || { echo "no engine deviceroot" >&2; exit 1; }
echo "=== 2. pre3-lowmem app front-end ==="
for item in appinfo.json css db depends.js index.html source images icon-1024x1024.png icon-256x256.png icon-48x48.png icon-64x64.png icon.png; do
rm -rf "$APP/${item:?}"; [ -e "$APPSRC/$item" ] && cp -a "$APPSRC/$item" "$APP/"
done
echo "=== 3. bake engine fixes ==="
install -m644 "$LIBAFFINITY" "$D/lib/libaffinity.so.0"
install -m755 "$BS_ATLAS" "$D/BrowserServer-atlas"
install -m644 "$LIBEPOXY" "$D/lib/libepoxy.so.0"
# WPEWebProcess: add libEGL.so.1 as a direct NEEDED so the Adreno subdriver's eglSubDriverWait resolves.
patchelf --add-needed libEGL.so.1 "$D/libexec/wpe-webkit-2.0/WPEWebProcess"
echo " WPEWebProcess NEEDED libEGL: $(readelf -d "$D/libexec/wpe-webkit-2.0/WPEWebProcess" | grep -c 'libEGL.so.1')"
echo "=== 4. device-profile + wrapper (source it, drop Qt5 -platform) ==="
cp -a "$PROFILE" "$APP/deviceroot/atlas/device-profile"
WRAP="$APP/deviceroot/atlas/BrowserServer"
grep -q 'device-profile' "$WRAP" || awk '/^exec .*BrowserServer-atlas/ && !d { print "[ -r \"$ATLAS/device-profile\" ] && . \"$ATLAS/device-profile\""; d=1 } {print}' "$WRAP" > "$WRAP.n" && mv "$WRAP.n" "$WRAP"
sed -i 's/ -platform Minimal//' "$WRAP"; chmod 755 "$WRAP"
echo "=== 5. postinst self-heal (2.2.4 busybox-tar mode-in-name corruption) ==="
PI="$W/ctl/postinst"
if ! grep -q 'busybox-tar mode-in-name' "$PI"; then
# insert the repair right after DR= is defined, before anything uses the files
awk '{print} /^DR=/ && !d { print ""; print "# self-heal: webOS 2.2.4 ipkg/busybox-tar can append a file'\''s octal mode to its name"; print "# (libX.so -> libX.so0000775). Strip the trailing 7-digit mode so sonames resolve."; print "for _f in $(find \"$DR\" -regex \".*0000[0-7][0-7][0-7]\" 2>/dev/null); do mv \"$_f\" \"${_f%???????}\" 2>/dev/null; done"; d=1 }' "$PI" > "$PI.n" && mv "$PI.n" "$PI"; chmod 755 "$PI"
fi
echo "=== 6. control ==="
sed -i -E "s/^Version: .*/Version: $VER/" "$W/ctl/control"
sed -i -E "s/for webOS \(HP TouchPad\)\./for webOS (HP Pre 3, 512MB — low-memory + graphics bring-up)./" "$W/ctl/control"
echo "=== 7. repack (ustar: least busybox mangling; postinst self-heals the rest) ==="
mkdir -p "$OUT"
( cd "$W/data" && tar --format=ustar -czf "$W/data.tar.gz" --owner=0 --group=0 ./* )
( cd "$W/ctl" && tar --format=ustar -czf "$W/control.tar.gz" --owner=0 --group=0 ./* )
echo "2.0" > "$W/debian-binary"
IPK="$OUT/${APPNAME}_${VER}_pre3.ipk"; rm -f "$IPK"
( cd "$W" && ar rc "$IPK" debian-binary control.tar.gz data.tar.gz )
echo "=== done: $IPK ($(stat -c%s "$IPK") bytes) ==="
+68
View File
@@ -0,0 +1,68 @@
#!/bin/bash
# WPE WebKit 2.52.4 — HP Pre 3 FEATURE-STRIPPED variant (fresh build in a SEPARATE dir _b_pre3).
#
# Config = the working TouchPad engine's JIT / graphics-core / wasm flags kept IDENTICAL (so we inherit
# the ~3x DFG JIT + the softfp CCallHelpers patch that lives in Source/), with ONLY the heavy features
# dropped: video / media-source / media-stream / web-audio / webrtc / web-codecs / media-recorder /
# encrypted-media -> USE_GSTREAMER=OFF entirely; plus webgl / avif / jpegxl / speech-synth / gamepad.
# GPU_PROCESS already OFF. This is what the README calls the Phase-3 strip.
#
# Kept ON to match the proven build (do NOT change — softfp JIT is delicate): ENABLE_JIT, ENABLE_DFG_JIT,
# ENABLE_WEBASSEMBLY, ENABLE_C_LOOP=OFF, USE_SKIA=OFF, ENABLE_WPE_LEGACY_API=ON, USE_WOFF2=ON.
#
# Build dir _b_pre3 is separate from the working _b, and install goes to a DESTDIR destroot, so the
# TouchPad engine / staging-glibc-252 is never touched.
#
# ./build-webkit-252-pre3.sh configure # fresh cmake in _b_pre3 (~2-3 min; validates the config)
# ./build-webkit-252-pre3.sh build # ninja -j24 + DESTDIR install (long; run in background)
set -u
WPE="${WPE:-$HOME/webos/wpe}"; L="$WPE/logs"; mkdir -p "$L"
. "${WPE_ENV:-$WPE/env-glibc-gcc125.sh}"; S="$STAGING"
V=2.52.4
B="$WPE/build/wpewebkit-$V"
BP="$B/_b_pre3"
DESTROOT="$WPE/pre3-destroot"
STAGE="${1:-configure}"
[ -d "$B/Source" ] || { echo "ERROR: $B not extracted (softfp/single-process patches live here)"; exit 1; }
if [ "$STAGE" = configure ]; then
rm -rf "$BP"; mkdir -p "$BP"; cd "$BP"
nice -n 10 cmake .. -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="${WPE_CMAKE_TC:-$WPE/cmake-toolchain-glibc-gcc125.cmake}" \
-DCMAKE_INSTALL_PREFIX="$S" -DCMAKE_BUILD_TYPE=Release -DPORT=WPE \
-DUNIFDEF_EXECUTABLE="$WPE/hostbin/unifdef" \
`# --- JIT / core: IDENTICAL to the working engine ---` \
-DENABLE_C_LOOP=OFF -DENABLE_JIT=ON -DENABLE_DFG_JIT=ON -DENABLE_FTL_JIT=OFF \
-DENABLE_WEBASSEMBLY=ON -DENABLE_SAMPLING_PROFILER=OFF \
-DUSE_GBM=OFF -DUSE_LIBDRM=OFF -DUSE_SKIA=OFF -DENABLE_WPE_LEGACY_API=ON -DENABLE_GPU_PROCESS=OFF \
-DUSE_WOFF2=ON -DUSE_LIBWPE=ON \
`# --- heavy features DROPPED for the 512MB Pre 3 ---` \
-DENABLE_VIDEO=OFF -DENABLE_MEDIA_SOURCE=OFF -DENABLE_MEDIA_STREAM=OFF -DENABLE_WEB_AUDIO=OFF \
-DENABLE_WEB_RTC=OFF -DUSE_GSTREAMER_WEBRTC=OFF -DUSE_GSTREAMER=OFF \
-DENABLE_WEB_CODECS=OFF -DENABLE_MEDIA_RECORDER=OFF -DENABLE_MEDIA_CAPTURE=OFF -DENABLE_MEDIA_SESSION=OFF \
-DENABLE_ENCRYPTED_MEDIA=OFF -DENABLE_THUNDER=OFF -DENABLE_SPEECH_SYNTHESIS=OFF \
-DENABLE_WEBGL=OFF -DENABLE_WEBGL2=OFF -DENABLE_GAMEPAD=OFF \
-DUSE_AVIF=OFF -DUSE_JPEGXL=OFF -DUSE_OPENJPEG=OFF -DUSE_LCMS=OFF \
`# --- misc off (match build-webkit-252.sh) ---` \
-DENABLE_WEBDRIVER=OFF -DENABLE_INTROSPECTION=OFF -DENABLE_DOCUMENTATION=OFF \
-DENABLE_BUBBLEWRAP_SANDBOX=OFF -DENABLE_SPELLCHECK=OFF -DUSE_ATK=OFF -DENABLE_ACCESSIBILITY=OFF \
-DUSE_LIBHYPHEN=OFF -DUSE_SYSTEMD=OFF -DUSE_LIBBACKTRACE=OFF -DUSE_SYSTEM_SYSPROF_CAPTURE=NO \
-DENABLE_MINIBROWSER=OFF -DENABLE_WEBXR=OFF -DENABLE_JOURNALD_LOG=OFF \
> "$L/webkit-252-pre3.cfg" 2>&1
rc=$?; echo "cmake configure rc=$rc"; tail -25 "$L/webkit-252-pre3.cfg"
echo "--- key flags in _b_pre3 ---"
grep -E "^(ENABLE_JIT|ENABLE_DFG_JIT|ENABLE_C_LOOP|ENABLE_WEBASSEMBLY|ENABLE_VIDEO|ENABLE_WEB_RTC|ENABLE_WEB_AUDIO|USE_GSTREAMER|ENABLE_WEBGL|USE_AVIF|USE_JPEGXL|ENABLE_MEDIA_STREAM):" CMakeCache.txt 2>/dev/null | sort
exit $rc
else
cd "$BP"
export RUBYOPT="-r$WPE/ruby-compat.rb"
nice -n 10 ninja -j 24 > "$L/webkit-252-pre3.make" 2>&1
rc=$?
if [ $rc -eq 0 ]; then
rm -rf "$DESTROOT"; mkdir -p "$DESTROOT"
nice -n 10 env DESTDIR="$DESTROOT" ninja install >> "$L/webkit-252-pre3.make" 2>&1; rc=$?
fi
echo "ninja+install rc=$rc"; tail -25 "$L/webkit-252-pre3.make"
[ $rc -eq 0 ] && { echo "=== stripped libWPEWebKit ==="; ls -la "$BP"/lib/libWPEWebKit-2.0.so.1* 2>/dev/null; }
exit $rc
fi
+47
View File
@@ -0,0 +1,47 @@
# Atlas WPE engine — HP Pre 3 (mantaray) low-memory device profile.
#
# Sourced by wrapper-BrowserServer near the very end, AFTER the TouchPad Phase-1 tuning block, so
# these values OVERRIDE it. Ship this file as "$ATLAS/device-profile" (the wrapper sources
# "$ATLAS/device-profile" if it exists — see wrapper-BrowserServer). On the TouchPad no such file is
# installed, so the TouchPad runs its Phase-1 values unchanged.
#
# HP Pre 3: 512MB RAM, single-core 1.4GHz (MSM8x55), Adreno 205, 480x800. The two big deltas vs the
# TouchPad (1GB, dual-core) are HALF the RAM and ONE core.
# JS heap budget: ~96MB (down from the TouchPad's ~192MB) so JSC sizes its heaps for a 512MB device.
export JSC_forceRAMSize=100663296
# Single core: raster on one thread (the TouchPad uses 2). A 2nd painting thread on a 1-core device
# just adds contention.
export WEBKIT_NICOSIA_PAINTING_THREADS=1
# Force viewport-only ("simple") rendering for EVERY page — no tall pan buffer. This is what makes the
# device usable on 512MB, and it works for the STOCK Mojo browser too (it can't send the atlas-simple:
# URL marker; the backend's bpwpe_force_low_mem() honours this env). See atlas-wpe-backend.
export BPWPE_FORCE_SIMPLE=1
# Exact-viewport buffer (mult=1) rather than the 2-screen simple default — minimum footprint.
export BPWPE_SIMPLE_SCREENS=1
# Real panel size. webOS 2.2.4 reports the legacy-compat logical size (320x480) in luna.conf, but the
# Pre 3 panel is physically 480x800 — without this the browser viewport is square (480x480) and pages lay
# out in half the height. The backend (BrowserPageWPE) honours these over luna.conf.
export BPWPE_SCREEN_W=480
export BPWPE_SCREEN_H=800
# Reap the WebProcess on every top-level navigation so a long-lived card doesn't accumulate memory across
# a session and thrash under pressure. Costs one cold WebProcess spawn per navigation; worth it on 512MB.
# Pairs with the DOCUMENT_VIEWER cache model + bf-cache disable the low-memory path enables in the backend.
export BPWPE_REAP_ON_NAV=0
# WebProcess memory-pressure cap ~160MB (TouchPad default is 480). Kept above a single heavy page's
# working set but low enough to trigger cache eviction / GC before the device OOMs.
export BPWPE_MEM_LIMIT=160
# Re-ENABLE the scroll-strip readback. The TouchPad disables it (BPWPE_NO_STRIP=1) because it renders a
# tall pan buffer where a full-buffer readback wins; with viewport-sized rendering the small-delta strip
# path is the faster one (per the wrapper's own note: "The strip only wins for viewport-sized rendering").
export BPWPE_NO_STRIP=0
# RGB565 tiles (16bpp) and MALLOC_ARENA_MAX=2 from the Phase-1 block are already correct for low memory
# and are intentionally NOT overridden here.
+23
View File
@@ -0,0 +1,23 @@
# WPE engine server for the HP Pre 3 ENGINE-SWAP path (Path B): the WPE-backed BrowserServer-atlas
# takes over the STOCK browser socket so the unmodified webOS Mojo browser (com.palm.app.browser)
# drives it. The key difference vs the TouchPad `atlas` job is BROWSERSERVER_NAME=browser, which makes
# the server listen on /tmp/yapserver.browser — the socket the stock adapter mime (application/x-palm-
# browser, built with -DATLAS_STOCK_BROWSER) connects to.
#
# Deploy as /etc/event.d/browser-wpe (or replace the stock BrowserServer launch). Adjust the cd path to
# wherever the Pre 3 engine deviceroot is installed (this template assumes an internal-storage layout).
start on stopped fontconfig_cache
stop on started start_update
description "WPE BrowserServer (stock-socket engine swap, Pre 3)"
script
export BROWSERSERVER_NAME=browser
# Engine deviceroot on the Pre 3. The wrapper (wrapper-BrowserServer) derives $D=$DR/wpe-252 from its
# own location and sources $ATLAS/device-profile (device-profile-pre3) for the low-memory tuning.
cd /media/internal/atlas-engine/atlas
rm -f /tmp/yapserver.browser*
exec ./BrowserServer
end script
respawn
respawn limit 0 0
+4
View File
@@ -130,6 +130,10 @@ export ATLAS_CAMERA_NO_DECODEBIN=1 # getUserMedia: skip decodebin3 in th
# would be looked up under /media/internal (which we no longer populate).
export WEBKIT_EXEC_PATH=$D/libexec/wpe-webkit-2.0
export WEBKIT_INJECTED_BUNDLE_PATH=$D/lib/wpe-webkit-2.0/injected-bundle
# Optional per-DEVICE tuning override, sourced LAST so it wins over the Phase-1 block above. The Pre 3
# (mantaray) package ships "$ATLAS/device-profile" (= ipk-build/pull/device-profile-pre3) to lower the
# RAM/core/buffer knobs for a 512MB single-core phone. The TouchPad ships no such file -> no-op.
[ -r "$ATLAS/device-profile" ] && . "$ATLAS/device-profile"
# Deadlock watchdog: the default 15000ms aborts BS when the main thread stalls in a
# memory-pressure GC / swap-in under heavy accumulated state (idle "random crash" — confirmed
# via core: YapServerDeadlockPriv::deadlockThreadTimerCallback -> abort). A slow GC recovers in