Files
makronix/mobile/tools/mkrootfs-debian.sh
T
lotherkandClaude Sonnet 5.5 73c9de51a6 licence: the CNCL line in every file Makronix wrote (tools, docs, www, mobile, top level)
consmirror.c: the BSD notice is replaced (Makronix's own file).  Files with
changes of other sessions pending are left for their commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 11:50:26 +00:00

38 lines
1.2 KiB
Bash

#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
#
# Build the root file system of the glibc base for one device: Debian for the
# device's ARCH, minimal, plus the packages in base/debian/packages, as a tar.
# No root needed (mmdebstrap --mode=unshare); a foreign architecture needs
# qemu-user-binfmt on the host.
#
# Usage: mkrootfs-debian.sh DEVICEDIR OUT.tar
#
# The userland (X11, CDE, the makronix set) is not part of this: pkgsrc adds
# it under /usr/pkg. Device-specific files (firmware, fstab, the kernel
# modules) are laid over the result by the device's own step.
set -eu
. "$(dirname "$0")/lib.sh"
[ $# -eq 2 ] || { echo "usage: $0 DEVICEDIR OUT.tar" >&2; exit 2; }
load_device "$1"
out=$2
. "$ROOT/base/debian/base.conf"
# Debian's name for the architecture
case $ARCH in
arm64) debarch=arm64 ;;
amd64|x86_64) debarch=amd64 ;;
*) die "no Debian architecture for $ARCH" ;;
esac
pkgs=$(sed 's/#.*//' "$ROOT/base/debian/packages" | tr -s ' \n' ',' | sed 's/^,//; s/,$//')
mmdebstrap --mode=unshare --variant="$BASE_VARIANT" --arch="$debarch" \
--include="$pkgs" \
--customize-hook='echo "'"$BASE_HOSTNAME"'" > "$1/etc/hostname"' \
"$BASE_SUITE" "$out" "$BASE_MIRROR"
echo "$out: $(wc -c < "$out" | tr -d ' ') bytes"