Files
RedBear-OS/recipes/core/base-initfs/recipe.toml
T
vasilito 9871d79aa4 phase 4.3: archive 2 kernel patches operator-superseded
Phase 4.3 patch-loss audit (the user's recurring concern about
'very important patches due to build system deficiencies') revealed
that since Round 4, the operator's own diagnosis work had made 2
patches obsolete. Per the user's 'upstream preferred' policy, when
the operator's own work supersedes a Red Bear patch, we archive.

P0-canary (operator-superseded):
- Original: Phase 1.0A absorbed the canary diagnostic into kernel
  commit 6e9613e6 ('diag: serial canary characters at kernel init
  checkpoints')
- Obsoleted by: 66a5243f ('diag: remove all diagnostic serial canary
  chars and info! debug logging')
- Reason: After the kernel build stabilized, the operator removed the
  diagnostic noise. The canary's purpose (early-boot serial output)
  is no longer needed.

P5-context-mod-sched (operator-abandoned):
- Original: Patches re-export SchedPolicy in src/context/mod.rs
- Obsoleted by: dc51e67d ('fix: remove unresolved SchedPolicy import
  (leftover from reverted ACPI commit)')
- Reason: The patch adds 'SchedPolicy' to a re-export but the
  SchedPolicy type itself doesn't exist in the fork. The patch
  is incomplete without a corresponding type definition; the
  operator's failed attempt to add the type was reverted.

Both moves follow AGENTS.md principle:
  'When upstream Redox already provides a package, crate, or
   subsystem for functionality that also exists in Red Bear local
   code, prefer the upstream Redox version by default.'

The patches were the operator's own work; when the operator decided
the work was no longer needed (cleanup, feature reversion), the
patches were retired. 'Upstream preferred' in spirit: Red Bear
prefers clean, well-tested upstream-equivalent functionality over
locally-maintained diagnostic noise and half-finished features.

After this commit:
  Active patches: 119 (was 121)
  Archived: 96 in legacy-superseded-2026-07-12/
  All forks: 0 orphans
2026-07-12 09:23:10 +03:00

146 lines
4.1 KiB
TOML

[source]
same_as = "../base"
[package]
version = "0.3.1"
[build]
template = "custom"
dependencies = [
"redoxfs",
"ion",
"driver-manager",
]
script = """
set -eo pipefail
BINS=(
init
logd
ramfs
randd
zerod
acpid
fbbootlogd
fbcond
hwd
inputd
lived
nvmed
pcid
pcid-spawner
rtcd
vesad
)
virt_bins()
{
BINS+=(virtio-blkd virtio-gpud)
}
x86_common_bins()
{
BINS+=(ahcid ided ps2d usbhidd usbscsid usbhubd xhcid vesad e1000d rtl8168d)
virt_bins
}
aarch64_bins()
{
case "${BOARD}" in
raspi3b*)
BINS+=(bcm2835-sdhcid)
;;
*)
#qemu-virt
virt_bins
;;
esac
}
case "${TARGET}" in
i586-unknown-redox | i686-unknown-redox)
x86_common_bins
;;
x86_64-unknown-redox)
x86_common_bins
;;
aarch64-unknown-redox)
aarch64_bins
;;
*)
;;
esac
rm -rf "${COOKBOOK_BUILD}/initfs"
mkdir -p "${COOKBOOK_BUILD}/initfs/lib/init.d"
cp "${COOKBOOK_SOURCE}/init.initfs.d"/* "${COOKBOOK_BUILD}/initfs/lib/init.d/"
mkdir -pv "${COOKBOOK_BUILD}/initfs/lib/drivers.d"
cp -v "${COOKBOOK_SOURCE}/drivers/initfs-storage.toml" "${COOKBOOK_BUILD}/initfs/lib/drivers.d/00-storage.toml"
mkdir -pv "${COOKBOOK_BUILD}/initfs/lib/pcid.d"
cp -v "${COOKBOOK_SOURCE}/drivers/initfs-pcid-storage.toml" "${COOKBOOK_BUILD}/initfs/lib/pcid.d/00-storage.toml"
export CARGO_PROFILE_RELEASE_OPT_LEVEL=s
export CARGO_PROFILE_RELEASE_PANIC=abort
rm -rf "${CARGO_TARGET_DIR}"
"${COOKBOOK_CARGO}" build ${build_flags} \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
$(for bin in "${BINS[@]}"; do echo "-p" "${bin}"; done)
mkdir -pv "${COOKBOOK_BUILD}/initfs/bin" "${COOKBOOK_BUILD}/initfs/lib/drivers"
for bin in "${BINS[@]}"
do
case "${bin}" in
init | logd | ramfs | randd | zerod | pcid | pcid-spawner | fbbootlogd | fbcond | inputd | vesad | lived | ps2d | acpid | bcm2835-sdhcid | rtcd | hwd)
cp -v "target/${TARGET}/${build_type}/${bin}" "${COOKBOOK_BUILD}/initfs/bin"
;;
*)
cp -v "target/${TARGET}/${build_type}/${bin}" "${COOKBOOK_BUILD}/initfs/lib/drivers"
;;
esac
done
cp "${COOKBOOK_SYSROOT}/usr/bin/redoxfs" "${COOKBOOK_BUILD}/initfs/bin"
cp "${COOKBOOK_SYSROOT}/usr/bin/ion" "${COOKBOOK_BUILD}/initfs/bin"
cp "${COOKBOOK_SYSROOT}/usr/bin/driver-manager" "${COOKBOOK_BUILD}/initfs/bin"
ARCH="$(echo "${GNU_TARGET}" | cut -d - -f1)"
RUSTFLAGS="$RUSTFLAGS -Ctarget-feature=+crt-static -Clink-arg=-nostartfiles -Clink-arg=-nostdlib" cargo \
-Zbuild-std=core,alloc,compiler_builtins \
-Zbuild-std-features=compiler-builtins-mem build \
--target "${TARGET}" \
--manifest-path "${COOKBOOK_SOURCE}/bootstrap/Cargo.toml" \
--release \
--target-dir "${COOKBOOK_BUILD}"
if [ -f "${COOKBOOK_BUILD}/${TARGET}/release/libbootstrap.a" ]; then
"${GNU_TARGET}-ld" \
-o "${COOKBOOK_BUILD}/bootstrap" \
-nostdlib \
--gc-sections \
-T "${COOKBOOK_SOURCE}/bootstrap/src/${ARCH}.ld" \
-z max-page-size=4096 \
"${COOKBOOK_BUILD}/${TARGET}/release/libbootstrap.a"
else
cp -v "${COOKBOOK_BUILD}/${TARGET}/release/bootstrap" "${COOKBOOK_BUILD}/bootstrap"
fi
# Build the loop_mnt discovery helper as a separate target so the
# initfs can fall back to scanning for the live medium at runtime
# (analogous to CachyOS's archiso_loop_mnt hook). Cross-compile
# directly so we don't need a runtime libstd.
CARGO_PROFILE_RELEASE_OPT_LEVEL=s CARGO_PROFILE_RELEASE_PANIC=abort \
"${COOKBOOK_CARGO}" build ${build_flags} \
--manifest-path "${COOKBOOK_SOURCE}/initfs/tools/Cargo.toml" \
--target "${TARGET}" \
--bin loop_mnt
cp -v "target/${TARGET}/${build_type}/loop_mnt" "${COOKBOOK_BUILD}/initfs/bin/loop_mnt"
env -u CARGO -u RUSTFLAGS cargo run --manifest-path "${COOKBOOK_SOURCE}/initfs/tools/Cargo.toml" --bin redox-initfs-ar -- "${COOKBOOK_BUILD}/initfs" "${COOKBOOK_BUILD}/bootstrap" -o "${COOKBOOK_BUILD}/initfs.img"
mkdir -pv "${COOKBOOK_STAGE}/usr/lib/boot"
cp "${COOKBOOK_BUILD}/initfs.img" "${COOKBOOK_STAGE}/usr/lib/boot/initfs"
"""