config + base-initfs: comprehensive redbear-bare target gaps

Address 4 gaps in the new redbear-bare target per review:

Gap 1: add REDBEAR_BARE_INITFS env var to base-initfs recipe. When
  set, BINS=init logd ramfs randd zerod ptyd getty instead of 22+
  daemons/drivers. The bare target can now opt into the truly-minimal
  initfs via the env var.

Gap 2: add ptyd and getty to the cp case-list so they go to /initfs/bin
  not /initfs/lib/drivers. Without this, the getty 2 service cannot
  start because ptyd (which it requires) isn't in the initfs.

Gap 3: add /etc/issue (pre-login banner) and /etc/motd (post-login
  message) to the bare config. Standard Unix login surface polish.

Gap 4: trim packages in the bare config. Override ca-certificates,
  pkgutils, kibi (from minimal.toml) to empty. Bare only needs:
  zsh, coreutils, base, base-initfs, kernel, relibc, userutils,
  libgcc, libstdcxx.

Build invocation:
  REDBEAR_BARE_INITFS=1 make live CONFIG_NAME=redbear-bare

(NO AI attribution)
This commit is contained in:
2026-07-14 23:32:53 +09:00
parent 1256a43a5b
commit 48a6f4c20b
2 changed files with 62 additions and 6 deletions
+43 -4
View File
@@ -1,20 +1,33 @@
# Red Bear OS Bare Configuration
#
#
# Target contract:
# - Boots kernel
# - Starts init daemons via base-initfs 90_initfs.target
# (logd, randd, zerod, ptyd, inputd — provided by base recipe)
# - Starts init daemons via a minimal base-initfs
# (logd, randd, zerod, ptyd, getty — see recipes/core/base-initfs)
# - Console getty → zsh login prompt (from minimal.toml's 30_console.service)
# - No networking, no driver-manager, no display, no audio, no extra daemons
# - Stripped to bare minimum
#
# Build: make live CONFIG_NAME=redbear-bare
# To trigger the bare initfs (BINS=init logd ramfs randd zerod ptyd getty):
# REDBEAR_BARE_INITFS=1 make live CONFIG_NAME=redbear-bare
#
# Or via the build script with the env var set:
# REDBEAR_BARE_INITFS=1 ./local/scripts/build-redbear.sh redbear-bare
include = ["minimal.toml"]
[general]
filesystem_size = 96
# Trim down packages beyond what minimal.toml includes.
# minimal.toml includes ca-certificates, coreutils, extrautils, zsh, pkgutils, kibi.
# For "bare" we only need: zsh, coreutils, base, base-initfs, kernel, relibc,
# userutils, libgcc, libstdcxx. Drop ca-certificates, pkgutils, kibi.
[packages]
ca-certificates = {} # explicitly empty (overrides minimal)
pkgutils = {} # explicitly empty (overrides minimal)
kibi = {} # explicitly empty (overrides minimal)
# Override base.toml's network config — no DNS, no IP, no router
[[files]]
path = "/etc/net/dns"
@@ -87,6 +100,27 @@ schemes = [
]
"""
# Pre-login banner (printed by getty before the login prompt)
[[files]]
path = "/etc/issue"
data = """
Red Bear OS 0.3.1 - bare target
Kernel \\r on an \\m (\\s)
Login as 'root' (password: password) or 'user' (no password).
"""
# Post-login message (printed by zsh at shell startup)
[[files]]
path = "/etc/motd"
data = """
Welcome to Red Bear OS bare target.
This is a stripped-down initfs+rootfs build with only:
init, logd, ramfs, randd, zerod, ptyd, getty
No networking, no display, no audio, no driver-manager.
"""
[users.root]
password = "password"
uid = 0
@@ -100,3 +134,8 @@ shell = "/usr/bin/zsh"
[groups.sudo]
gid = 1
members = ["user"]
# Build override: trigger the bare-initfs branch in base-initfs/recipe.toml.
# The cookbook honors REDBEAR_BARE_INITFS in the env when invoking make.
[build.env]
REDBEAR_BARE_INITFS = "1"
+19 -2
View File
@@ -58,12 +58,29 @@ aarch64_bins()
esac
}
bare_initfs()
{
BINS=(
init
logd
ramfs
randd
zerod
ptyd
getty
)
}
case "${TARGET}" in
i586-unknown-redox | i686-unknown-redox)
x86_common_bins
;;
x86_64-unknown-redox)
x86_common_bins
if [ "${REDBEAR_BARE_INITFS:-0}" = "1" ]; then
bare_initfs
else
x86_common_bins
fi
;;
aarch64-unknown-redox)
aarch64_bins
@@ -93,7 +110,7 @@ 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)
init | logd | ramfs | randd | zerod | pcid | pcid-spawner | fbbootlogd | fbcond | inputd | vesad | lived | ps2d | acpid | bcm2835-sdhcid | rtcd | hwd | ptyd | getty)
cp -v "target/${TARGET}/${build_type}/${bin}" "${COOKBOOK_BUILD}/initfs/bin"
;;
*)