Release Vulpes OS Preview 26 with Gecko 161.0 and Tundra 0.2.0
This commit is contained in:
parent
3a1fba4efe
commit
e241a42d2f
4 changed files with 1305 additions and 331 deletions
14
tundra/devices/sargo/engine-lock.json
Normal file
14
tundra/devices/sargo/engine-lock.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"version": "161.0",
|
||||
"runtime": "engines/161.0/firefox",
|
||||
"archive": "https://archive.mozilla.org/pub/firefox/releases/161.0/linux-aarch64/en-US/firefox-161.0.tar.xz",
|
||||
"sha512": "a4689c3cdd88e240db36c6cca06a1c3411568a4a0c1c6ce9944d939e8c7ad78cb42eaea049bffecfc4b49fa6f55467f64529775c471a6736d0fad30fa733da63",
|
||||
"checksumSource": "https://archive.mozilla.org/pub/firefox/releases/161.0/SHA512SUMS",
|
||||
"channel": "release",
|
||||
"sourceArchive": "https://archive.mozilla.org/pub/firefox/releases/161.0/source/firefox-161.0.source.tar.xz",
|
||||
"localChanges": [
|
||||
"distribution/policies.json: pin engine; no automatic update"
|
||||
],
|
||||
"gaiaPorted": false,
|
||||
"architecture": "aarch64"
|
||||
}
|
||||
106
tundra/devices/sargo/native-root.sh
Normal file
106
tundra/devices/sargo/native-root.sh
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
# Called by rescue PID 1 only after the read-only storage check succeeds.
|
||||
set -eu
|
||||
BUILD_EPOCH=1795212545
|
||||
APPLY_NATIVE_CONFIG=1
|
||||
SYSTEM_IMAGE=/volume/tundra/images/c3017c3decc0824ed4a64124b5f7c47a7ceac5d116419bfd4fecdc4bdffd70b0.ext4
|
||||
SYSTEM_IMAGE_SHA=c3017c3decc0824ed4a64124b5f7c47a7ceac5d116419bfd4fecdc4bdffd70b0
|
||||
SYSTEM_IMAGE_BYTES=2684354560
|
||||
STATE_IMAGE=/volume/tundra/data/54b47c1b-1a3a-47b9-bace-11badc025f82.ext4
|
||||
STATE_UUID=54b47c1b-1a3a-47b9-bace-11badc025f82
|
||||
STATE_BYTES=2147483648
|
||||
# A kernel fallback date must not precede the build; RTC is not modified.
|
||||
if [ "$(date +%s)" -lt "${BUILD_EPOCH:-0}" ]; then date -s "@$BUILD_EPOCH"; fi
|
||||
trap 'echo TUNDRA_NATIVE_SETUP_FAILED; while :; do /bin/busybox sleep 5; done' EXIT
|
||||
: "${SYSTEM_IMAGE:?A bundled system image is required}"
|
||||
LOWER=/run/tundra-system
|
||||
if [ -n "${SYSTEM_IMAGE:-}" ]; then
|
||||
test -f "$SYSTEM_IMAGE" && test ! -L "$SYSTEM_IMAGE"
|
||||
test "$(stat -c %s "$SYSTEM_IMAGE")" = "$SYSTEM_IMAGE_BYTES"
|
||||
mkdir -p /run/tundra-system
|
||||
mount -t ext4 -o loop,ro,noload "$SYSTEM_IMAGE" /run/tundra-system
|
||||
LOWER=/run/tundra-system
|
||||
fi
|
||||
test -f "$LOWER/etc/systemd/system/tundra.target"
|
||||
UPPER=/run/native-upper
|
||||
WORK=/run/native-work
|
||||
if [ -n "${STATE_IMAGE:-}" ]; then
|
||||
test -f "$STATE_IMAGE" && test ! -L "$STATE_IMAGE"
|
||||
test "$(stat -c %s "$STATE_IMAGE")" = "$STATE_BYTES"
|
||||
blkid "$STATE_IMAGE" | grep -F "UUID=\"$STATE_UUID\"" >/dev/null
|
||||
repaired=0
|
||||
e2fsck -p "$STATE_IMAGE" || repaired=$?
|
||||
test "$repaired" -le 1
|
||||
mkdir -p /run/tundra-state
|
||||
mount -t ext4 -o loop,rw,nosuid,nodev "$STATE_IMAGE" /run/tundra-state
|
||||
# A data layer belongs to one immutable system image. Refuse accidental reuse.
|
||||
test "$(cat /run/tundra-state/system.sha256)" = "$SYSTEM_IMAGE_SHA"
|
||||
UPPER=/run/tundra-state/upper
|
||||
WORK=/run/tundra-state/work
|
||||
fi
|
||||
mkdir -p "$UPPER" "$WORK" /newroot
|
||||
chmod 755 "$UPPER"
|
||||
mount -t overlay overlay -o "lowerdir=$LOWER,upperdir=$UPPER,workdir=$WORK" /newroot
|
||||
if [ -z "${SYSTEM_IMAGE:-}" ] || [ "${APPLY_NATIVE_CONFIG:-0}" = 1 ]; then
|
||||
# Only the selected upper layer is edited; the system image stays read-only.
|
||||
if [ -n "${STATE_IMAGE:-}" ]; then
|
||||
mkdir -p /run/tundra-identity
|
||||
for identity in machine-id passwd group shadow gshadow; do
|
||||
if [ -s "/newroot/etc/$identity" ]; then
|
||||
cp -p "/newroot/etc/$identity" "/run/tundra-identity/$identity"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -f /newroot/etc/tundra/hardware-enabled /newroot/etc/systemd/system/tundra.target.wants/ofono.service /newroot/etc/systemd/system/tundra.target.wants/tundra-audio.service /newroot/etc/tundra/network-enabled /newroot/etc/systemd/system/tundra.target.wants/NetworkManager.service /newroot/etc/systemd/system/tundra.target.wants/tundra-wifi.service
|
||||
tar -xJf /native-config.tar -C /newroot
|
||||
if [ -d /run/tundra-identity ]; then
|
||||
for identity in /run/tundra-identity/*; do
|
||||
[ -f "$identity" ] && cp -p "$identity" /newroot/etc/
|
||||
done
|
||||
chmod 644 /newroot/etc/machine-id
|
||||
fi
|
||||
fi
|
||||
if [ -f /shared-ui.tar ]; then tar -xJf /shared-ui.tar -C /newroot; fi
|
||||
ENGINE=/volume/tundra/engines/p26-161
|
||||
test -x "$ENGINE/firefox/firefox"
|
||||
grep -qx 'Milestone=161.0' "$ENGINE/firefox/platform.ini"
|
||||
mkdir -p /newroot/opt/vulpes/engines/161.0/firefox
|
||||
mount --bind "$ENGINE/firefox" /newroot/opt/vulpes/engines/161.0/firefox
|
||||
mount --bind "$ENGINE/engine-lock.json" /newroot/opt/vulpes/engine-lock.json
|
||||
# A previous successful session must never count as proof of this boot.
|
||||
for log in test.json home.png session.pid gecko.log server.log compositor.log network-gecko.json wifi-ui.json; do
|
||||
rm -f "/newroot/opt/vulpes/logs/$log"
|
||||
done
|
||||
mkdir -p /newroot/reference /newroot/run /newroot/root/.ssh
|
||||
if [ -z "${SYSTEM_IMAGE:-}" ]; then
|
||||
: > /newroot/reference/android-rootfs.img
|
||||
mount --bind /volume/var/lib/lxc/android/android-rootfs.img /newroot/reference/android-rootfs.img
|
||||
else
|
||||
test -s /newroot/reference/android-rootfs.img
|
||||
fi
|
||||
mkdir -p /newroot/reference
|
||||
test -s /volume/tundra/hardware/vendor.img
|
||||
: > /newroot/reference/vendor.img
|
||||
mount --bind /volume/tundra/hardware/vendor.img /newroot/reference/vendor.img
|
||||
mount -o remount,bind,ro /newroot/reference/vendor.img
|
||||
test -s /volume/tundra/hardware/modem.img
|
||||
: > /newroot/reference/modem.img
|
||||
mount --bind /volume/tundra/hardware/modem.img /newroot/reference/modem.img
|
||||
mount -o remount,bind,ro /newroot/reference/modem.img
|
||||
mkdir -p /newroot/etc/tundra
|
||||
printf '%s\n' '{"images":{"vendor.img":{"source":"vendor_a.img","sha256":"d584429873c88db741b81144b55977bbd8126b3e877445901bee6a0bda7fe4d0","bytes":805306368},"modem.img":{"source":"modem_a.img","sha256":"fd0624b37ac1d80c064a9763c7e2d2d6f94c3fd5e4617965b735ad411a473d0a","bytes":115343360}}}' > /newroot/etc/tundra/hardware-images.json
|
||||
mkdir -p /newroot/usr/libexec /newroot/etc/systemd/system/tundra.target.wants
|
||||
mkdir -p /newroot/usr/share/doc/qbootctl
|
||||
cp /qbootctl-copyright /newroot/usr/share/doc/qbootctl/copyright
|
||||
cp /sbin/tundra-qbootctl /newroot/usr/libexec/tundra-qbootctl
|
||||
cp /standalone-boot-success.py /newroot/usr/libexec/tundra-mark-boot-success.py
|
||||
cp /standalone-boot-success.service /newroot/etc/systemd/system/tundra-boot-success.service
|
||||
ln -sf ../tundra-boot-success.service /newroot/etc/systemd/system/tundra.target.wants/tundra-boot-success.service
|
||||
# Installed lower layers stay reachable for the overlay/loop driver until reboot.
|
||||
mkdir -p /newroot/reference/tundra-volume
|
||||
mount --move /volume /newroot/reference/tundra-volume
|
||||
# Public boot: no USB maintenance account or shared SSH key.
|
||||
for fs in dev proc sys run; do mount --move "/$fs" "/newroot/$fs"; done
|
||||
# A static watchdog survives switch_root without needing the old /bin or /proc.
|
||||
exec switch_root /newroot /sbin/init --unit=tundra.target
|
||||
57
tundra/devices/sargo/prepare-update.py
Normal file
57
tundra/devices/sargo/prepare-update.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Extract the upgrade payload from the clean installation image (Linux)."""
|
||||
import argparse
|
||||
import gzip
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tarfile
|
||||
import tempfile
|
||||
|
||||
def pack(tree, destination):
|
||||
# A canonical uncompressed tar has the same digest with any gzip implementation.
|
||||
with destination.open("wb") as file, gzip.GzipFile(filename="", fileobj=file, mode="wb", compresslevel=2, mtime=0) as compressed, tarfile.open(fileobj=compressed, mode="w|", format=tarfile.GNU_FORMAT) as archive:
|
||||
for path in sorted(tree.rglob("*")):
|
||||
name = path.relative_to(tree).as_posix()
|
||||
header = archive.gettarinfo(str(path), arcname=name)
|
||||
if not (header.isdir() or header.isfile()):
|
||||
raise ValueError(f"Unexpected entry {name}")
|
||||
header.uid = header.gid = header.mtime = 0
|
||||
header.uname = header.gname = ""
|
||||
if header.isfile():
|
||||
with path.open("rb") as source:
|
||||
archive.addfile(header, source)
|
||||
else:
|
||||
archive.addfile(header)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--work-dir", type=Path, default=Path.cwd(), help="Filesystem with 10 GiB available")
|
||||
args = parser.parse_args()
|
||||
base = Path(__file__).resolve().parent
|
||||
with tempfile.TemporaryDirectory(dir=args.work_dir.resolve()) as temp:
|
||||
work = Path(temp)
|
||||
raw = work / "volume.ext4"
|
||||
sparse = base / "userdata.img"
|
||||
manifest = json.loads((base / "package.json").read_text())
|
||||
with sparse.open("rb") as src:
|
||||
if hashlib.file_digest(src, "sha256").hexdigest() != manifest["partitions"]["userdata"]["sha256"]:
|
||||
raise ValueError("Invalid userdata.img digest")
|
||||
subprocess.run(["simg2img", sparse, raw], check=True)
|
||||
subprocess.run(["debugfs", "-R", 'rdump /tundra/engines/p26-161 .', raw], cwd=work, check=True)
|
||||
tree = work / "p26-161"
|
||||
if not (tree / "firefox/platform.ini").is_file():
|
||||
raise ValueError("Missing runtime in installation image")
|
||||
packed = work / "engine.tar.gz"
|
||||
pack(tree, packed)
|
||||
with gzip.open(packed, "rb") as data:
|
||||
digest = hashlib.file_digest(data, "sha256").hexdigest()
|
||||
if digest != (base / "engine-tar.sha256").read_text().strip():
|
||||
raise ValueError("Reconstructed engine checksum differs")
|
||||
import shutil
|
||||
shutil.copyfile(packed, base / "engine.tar.gz")
|
||||
print("engine.tar.gz ready for the recovery")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
31
tundra/devices/sargo/stage-engine.sh
Normal file
31
tundra/devices/sargo/stage-engine.sh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
test "$(id -u)" = 0
|
||||
dev=/dev/block/by-name/userdata
|
||||
test -b "$dev" || dev=/dev/mmcblk0p72
|
||||
uuid=4e2a0eec-cd82-4a0a-ac57-70e79b3faebb
|
||||
blkid "$dev" | grep -F "UUID=\"$uuid\"" >/dev/null
|
||||
cd /tmp
|
||||
actual=$(gzip -dc engine.tar.gz | sha256sum)
|
||||
test "${actual%% *}" = "ebe0c80498f2a520f83e52e04cecda82c948f427b725605a7cac6b1135313a68"
|
||||
vol=$(mktemp -d /tmp/vulpes-volume.XXXXXX)
|
||||
mount -t ext4 -o rw "$dev" "$vol"
|
||||
trap 'umount "$vol" && rmdir "$vol"' EXIT
|
||||
test "$(cat "$vol/tundra-volume-id")" = "$uuid"
|
||||
test -f "$vol/tundra/images/c3017c3decc0824ed4a64124b5f7c47a7ceac5d116419bfd4fecdc4bdffd70b0.ext4"
|
||||
mkdir -p "$vol/tundra/engines"
|
||||
dest="$vol/tundra/engines/p26-161"
|
||||
test ! -e "$dest" || { echo "Engine directory already exists; inspect before proceeding." >&2; exit 1; }
|
||||
stage=$(mktemp -d "$vol/tundra/engines/.p26-161.XXXXXX")
|
||||
trap 'rm -rf "$stage"; umount "$vol" && rmdir "$vol"' EXIT
|
||||
tar -xzpf engine.tar.gz -C "$stage"
|
||||
chown -R 32011:32011 "$stage/firefox/vulpes" "$stage/firefox/defaults/pref" "$stage/firefox/vulpes.cfg"
|
||||
chmod 755 "$stage"
|
||||
test -x "$stage/firefox/firefox"
|
||||
grep -qx 'Milestone=161.0' "$stage/firefox/platform.ini"
|
||||
mv "$stage" "$dest"
|
||||
sync
|
||||
umount "$vol"
|
||||
trap - EXIT
|
||||
rmdir "$vol"
|
||||
echo 'Vulpes engine ready'
|
||||
Loading…
Reference in a new issue