Integrate Red Bear boot and packaging updates
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
# ./local/scripts/build-redbear.sh # Default: redbear-full
|
||||
# ./local/scripts/build-redbear.sh redbear-mini # Minimal validation baseline
|
||||
# ./local/scripts/build-redbear.sh redbear-full # Full Red Bear desktop/session target
|
||||
# ./local/scripts/build-redbear.sh redbear-live-mini # Live ISO for minimal target
|
||||
# ./local/scripts/build-redbear.sh redbear-live-full # Live ISO for full target
|
||||
# ./local/scripts/build-redbear.sh redbear-live # Canonical full live profile config
|
||||
# ./local/scripts/build-redbear.sh redbear-live-mini # Text-only mini live profile config
|
||||
# ./local/scripts/build-redbear.sh redbear-grub-live-mini # Text-only GRUB mini live profile config
|
||||
# ./local/scripts/build-redbear.sh --upstream redbear-full # Allow Redox/upstream recipe refresh
|
||||
# APPLY_PATCHES=0 ./local/scripts/build-redbear.sh # Skip patch application
|
||||
#
|
||||
@@ -24,6 +25,23 @@ JOBS="${JOBS:-$(nproc)}"
|
||||
APPLY_PATCHES="${APPLY_PATCHES:-1}"
|
||||
ALLOW_UPSTREAM=0
|
||||
|
||||
canonicalize_config() {
|
||||
case "$1" in
|
||||
redbear-mini)
|
||||
printf '%s\n' "redbear-minimal"
|
||||
;;
|
||||
redbear-live-full)
|
||||
printf '%s\n' "redbear-live"
|
||||
;;
|
||||
redbear-live-mini-grub)
|
||||
printf '%s\n' "redbear-grub-live-mini"
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [OPTIONS] [CONFIG]
|
||||
@@ -35,7 +53,7 @@ Options:
|
||||
-h, --help Show this help
|
||||
|
||||
Configs:
|
||||
redbear-mini, redbear-live-mini, redbear-full, redbear-live-full
|
||||
redbear-mini, redbear-full, redbear-live, redbear-live-mini, redbear-grub-live-mini
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -69,18 +87,22 @@ fi
|
||||
|
||||
[ ${#POSITIONAL[@]} -eq 1 ] && CONFIG="${POSITIONAL[0]}"
|
||||
|
||||
CONFIG="$(canonicalize_config "$CONFIG")"
|
||||
|
||||
case "$CONFIG" in
|
||||
redbear-mini)
|
||||
CONFIG="redbear-minimal"
|
||||
redbear-minimal)
|
||||
;;
|
||||
redbear-live)
|
||||
;;
|
||||
redbear-live-mini)
|
||||
CONFIG="redbear-live-minimal"
|
||||
;;
|
||||
redbear-minimal|redbear-full|redbear-live-minimal|redbear-live-full)
|
||||
redbear-grub-live-mini)
|
||||
;;
|
||||
redbear-full)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown config '$CONFIG'"
|
||||
echo "Supported: redbear-mini, redbear-live-mini, redbear-full, redbear-live-full"
|
||||
echo "Supported: redbear-mini, redbear-full, redbear-live, redbear-live-mini, redbear-grub-live-mini"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -98,6 +120,12 @@ echo ""
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
if [ -x "$PROJECT_ROOT/local/scripts/verify-overlay-integrity.sh" ]; then
|
||||
echo ">>> Verifying overlay integrity (auto-repair)..."
|
||||
"$PROJECT_ROOT/local/scripts/verify-overlay-integrity.sh" --repair
|
||||
echo ""
|
||||
fi
|
||||
|
||||
stash_nested_repo_if_dirty() {
|
||||
local target_dir="$1"
|
||||
local label="$2"
|
||||
@@ -193,17 +221,23 @@ if [ "$APPLY_PATCHES" = "1" ]; then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ -x "$PROJECT_ROOT/local/scripts/verify-overlay-integrity.sh" ]; then
|
||||
echo ">>> Verifying overlay integrity (strict)..."
|
||||
"$PROJECT_ROOT/local/scripts/verify-overlay-integrity.sh"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ ! -f "target/release/repo" ]; then
|
||||
echo ">>> Building cookbook binary..."
|
||||
cargo build --release
|
||||
fi
|
||||
|
||||
if [ "$CONFIG" = "redbear-full" ] || [ "$CONFIG" = "redbear-live-full" ]; then
|
||||
if [ "$CONFIG" = "redbear-full" ] || [ "$CONFIG" = "redbear-live" ]; then
|
||||
ensure_relibc_desktop_surface
|
||||
fi
|
||||
|
||||
FW_AMD_DIR="$PROJECT_ROOT/local/firmware/amdgpu"
|
||||
if [ "$CONFIG" != "redbear-minimal" ]; then
|
||||
if [ "$CONFIG" != "redbear-minimal" ] && [ "$CONFIG" != "redbear-live-mini" ] && [ "$CONFIG" != "redbear-grub-live-mini" ]; then
|
||||
if [ -d "$FW_AMD_DIR" ] && [ -n "$(ls -A "$FW_AMD_DIR" 2>/dev/null)" ]; then
|
||||
FW_COUNT=$(ls "$FW_AMD_DIR"/*.bin 2>/dev/null | wc -l)
|
||||
echo ">>> Found $FW_COUNT AMD firmware blobs"
|
||||
|
||||
@@ -160,6 +160,11 @@ else
|
||||
ls -la recipes/core/kernel/redox.patch recipes/core/base/redox.patch
|
||||
fi
|
||||
|
||||
if [ -x local/scripts/verify-overlay-integrity.sh ]; then
|
||||
echo "==> Verifying overlay integrity..."
|
||||
local/scripts/verify-overlay-integrity.sh --repair
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "==> Sync complete."
|
||||
echo " Previous HEAD: $PREV_HEAD"
|
||||
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
# test-live-iso-qemu.sh — bounded QEMU smoke test for Red Bear live ISOs.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
canonicalize_live_config() {
|
||||
case "$1" in
|
||||
redbear-live-full)
|
||||
printf '%s\n' "redbear-live"
|
||||
;;
|
||||
redbear-live-mini-grub)
|
||||
printf '%s\n' "redbear-grub-live-mini"
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: test-live-iso-qemu.sh [CONFIG_NAME ...]
|
||||
|
||||
Boot one or more Red Bear live ISO targets in QEMU/UEFI and verify that each reaches a text
|
||||
`login:` prompt on the serial console.
|
||||
|
||||
Defaults:
|
||||
redbear-live redbear-live-mini redbear-grub-live-mini
|
||||
USAGE
|
||||
}
|
||||
|
||||
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" || "${1:-}" == "help" ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
configs=("$@")
|
||||
if [[ ${#configs[@]} -eq 0 ]]; then
|
||||
configs=(redbear-live redbear-live-mini redbear-grub-live-mini)
|
||||
fi
|
||||
|
||||
for i in "${!configs[@]}"; do
|
||||
configs[$i]="$(canonicalize_live_config "${configs[$i]}")"
|
||||
done
|
||||
|
||||
for config in "${configs[@]}"; do
|
||||
case "$config" in
|
||||
redbear-live|redbear-live-mini|redbear-grub-live-mini)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unsupported live ISO target $config" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
arch="${ARCH:-$(uname -m)}"
|
||||
|
||||
for config in "${configs[@]}"; do
|
||||
image="build/$arch/$config.iso"
|
||||
if [[ ! -f "$image" ]]; then
|
||||
echo "ERROR: missing ISO $image" >&2
|
||||
echo "Build it first with: ./scripts/build-iso.sh $config" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for config in "${configs[@]}"; do
|
||||
echo "=== Boot-testing $config ==="
|
||||
expect <<EOF
|
||||
log_user 1
|
||||
set timeout 420
|
||||
spawn make qemu CONFIG_NAME=$config live=yes serial=yes gpu=no net=no
|
||||
expect "login:"
|
||||
send "root\r"
|
||||
expect "assword:"
|
||||
send "password\r"
|
||||
expect "Type 'help' for available commands."
|
||||
send "shutdown\r"
|
||||
expect eof
|
||||
EOF
|
||||
done
|
||||
Executable
+143
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
# verify-overlay-integrity.sh — ensure Red Bear overlay is present and repairable.
|
||||
#
|
||||
# Usage:
|
||||
# ./local/scripts/verify-overlay-integrity.sh
|
||||
# ./local/scripts/verify-overlay-integrity.sh --repair
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
REPAIR=0
|
||||
|
||||
if [ "${1:-}" = "--repair" ]; then
|
||||
REPAIR=1
|
||||
fi
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
fail() {
|
||||
echo "overlay-integrity: ERROR: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
need_file() {
|
||||
local path="$1"
|
||||
[ -f "$path" ] || fail "missing file: $path"
|
||||
}
|
||||
|
||||
need_symlink_target() {
|
||||
local link="$1"
|
||||
local expected="$2"
|
||||
local current
|
||||
|
||||
if [ ! -L "$link" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
current="$(readlink "$link")"
|
||||
[ "$current" = "$expected" ]
|
||||
}
|
||||
|
||||
ensure_link() {
|
||||
local link="$1"
|
||||
local target="$2"
|
||||
if ! need_symlink_target "$link" "$target"; then
|
||||
if [ "$REPAIR" -eq 1 ] && [ -x "$REPO_ROOT/local/scripts/apply-patches.sh" ]; then
|
||||
"$REPO_ROOT/local/scripts/apply-patches.sh" >/dev/null
|
||||
fi
|
||||
need_symlink_target "$link" "$target" || fail "bad symlink: $link -> expected $target"
|
||||
fi
|
||||
}
|
||||
|
||||
has_marker() {
|
||||
local file="$1"
|
||||
local pattern="$2"
|
||||
[ -f "$file" ] && grep -q "$pattern" "$file"
|
||||
}
|
||||
|
||||
ensure_marker() {
|
||||
local file="$1"
|
||||
local pattern="$2"
|
||||
if ! has_marker "$file" "$pattern"; then
|
||||
if [ "$REPAIR" -eq 1 ]; then
|
||||
if [ -x "$REPO_ROOT/local/scripts/apply-patches.sh" ]; then
|
||||
"$REPO_ROOT/local/scripts/apply-patches.sh" >/dev/null || true
|
||||
fi
|
||||
apply_patch_dir "$REPO_ROOT/local/patches/base" "$REPO_ROOT/recipes/core/base/source"
|
||||
apply_patch_dir "$REPO_ROOT/local/patches/kernel" "$REPO_ROOT/recipes/core/kernel/source"
|
||||
apply_patch_dir "$REPO_ROOT/local/patches/relibc" "$REPO_ROOT/recipes/core/relibc/source"
|
||||
fi
|
||||
fi
|
||||
has_marker "$file" "$pattern" || fail "missing marker in $file: $pattern"
|
||||
}
|
||||
|
||||
check_local_over_wip_priority() {
|
||||
local local_dir
|
||||
local rel
|
||||
local name
|
||||
local wip_match
|
||||
local active_path
|
||||
|
||||
for local_dir in "$REPO_ROOT"/local/recipes/*/*; do
|
||||
[ -d "$local_dir" ] || continue
|
||||
rel="${local_dir#"$REPO_ROOT/local/recipes/"}"
|
||||
name="${local_dir##*/}"
|
||||
wip_match="$(find "$REPO_ROOT/recipes/wip" -mindepth 2 -maxdepth 2 -type d -name "$name" 2>/dev/null | head -n1 || true)"
|
||||
|
||||
# Policy: if local package conflicts with an upstream WIP package of the same name,
|
||||
# the active recipe must be our local overlay (symlink in recipes/*/<name>).
|
||||
[ -n "$wip_match" ] || continue
|
||||
|
||||
active_path="$(find "$REPO_ROOT/recipes" -mindepth 2 -maxdepth 2 -type l -name "$name" ! -path "$REPO_ROOT/recipes/wip/*" 2>/dev/null | head -n1 || true)"
|
||||
# Only enforce for actively mounted local overlays.
|
||||
[ -n "$active_path" ] || continue
|
||||
|
||||
if [ "$(readlink "$active_path")" != "../../local/recipes/${rel}" ]; then
|
||||
fail "local-over-wip policy violated: '$active_path' does not point to ../../local/recipes/${rel}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
apply_patch_dir() {
|
||||
local patch_dir="$1"
|
||||
local target_dir="$2"
|
||||
local patch_file
|
||||
|
||||
[ -d "$patch_dir" ] || return 0
|
||||
[ -d "$target_dir" ] || return 0
|
||||
|
||||
for patch_file in "$patch_dir"/*.patch; do
|
||||
[ -f "$patch_file" ] || continue
|
||||
if patch --dry-run -p1 -d "$target_dir" < "$patch_file" >/dev/null 2>&1; then
|
||||
patch -p1 -d "$target_dir" < "$patch_file" >/dev/null 2>&1 || true
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
need_file "local/patches/kernel/redox.patch"
|
||||
need_file "local/patches/base/redox.patch"
|
||||
need_file "local/patches/relibc/redox.patch"
|
||||
|
||||
ensure_link "recipes/core/kernel/redox.patch" "../../../local/patches/kernel/redox.patch"
|
||||
ensure_link "recipes/core/base/redox.patch" "../../../local/patches/base/redox.patch"
|
||||
ensure_link "recipes/core/bootloader/P2-live-preload-guard.patch" "../../../local/patches/bootloader/P2-live-preload-guard.patch"
|
||||
ensure_link "recipes/core/bootloader/P3-uefi-live-image-safe-read.patch" "../../../local/patches/bootloader/P3-uefi-live-image-safe-read.patch"
|
||||
ensure_link "recipes/core/grub" "../../local/recipes/core/grub"
|
||||
check_local_over_wip_priority
|
||||
|
||||
# Critical runtime markers in source trees (if sources are present locally).
|
||||
if [ -d "recipes/core/base/source" ]; then
|
||||
ensure_marker \
|
||||
"recipes/core/base/source/drivers/acpid/src/acpi.rs" \
|
||||
"AML interpreter requires PCI registration before initialization"
|
||||
ensure_marker \
|
||||
"recipes/core/base/source/drivers/acpid/src/scheme.rs" \
|
||||
"wait_for_pci_ready"
|
||||
ensure_marker \
|
||||
"recipes/core/base/source/drivers/input/ps2d/src/controller.rs" \
|
||||
"continuing without second port"
|
||||
fi
|
||||
|
||||
echo "overlay-integrity: OK"
|
||||
Reference in New Issue
Block a user