build: make ARCH=<arch>[,...] init installs what the tree needs

One ISA or several (ARCH=amd64,aarch64,riscv64, for the full
acceptance), on Debian/Ubuntu with apt-get, sudo when not root:

- common: the build, the disk-image tools (scripts/mkdiskimage.sh;
  sfdisk is in fdisk), git-lfs for the logs and DoE CSVs, and the
  documents -- docs/book/Makefile's own list, and pdflatex, doxygen and
  graphviz for docs/formal;
- per ISA: its QEMU, its UEFI firmware at kernel/Makefile's paths, and
  its compiler (aarch64's loader also needs clang and lld-link).

Then git lfs install --local, so a log or CSV committed from this
checkout goes into LFS (the 1003 plain files fixed in 027b144e came
from a checkout without it). Not installed: syft (make sbom), which is
not packaged.

Checked on Ubuntu 24.04: init for all three ISAs, then make docs and
make -C docs/formal vols build. make -C docs/formal doxygen fails in
LaTeX on "newunicodechar Error: ASCII character requested" with every
package present -- a separate fault, not a missing dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
This commit is contained in:
rajames
2026-11-06 01:18:07 +00:00
co-authored by Claude Opus 5.5
parent 25b17efd13
commit d8e3fa81eb
+37 -1
View File
@@ -36,6 +36,11 @@
# cleaned, built and booted in QEMU: the
# acceptance boot (.claude/CLAUDE.md)
# make boards list boards and whether they can be built
# make ARCH=<arch> init install everything needed to build <arch>,
# boot it in QEMU and build the documents
# (Debian/Ubuntu, apt-get; sudo if not root).
# ARCH=amd64,aarch64,riscv64 sets up all
# three, for the full acceptance
# make <other goal> goes to v3/Makefile (make help-hosted)
# ==============================================================================
@@ -63,7 +68,7 @@ SUBMAKE := $(MAKE) --no-print-directory
.DEFAULT_GOAL := all
.PHONY: all boot_image boot_images write_stick docs clean clean-docs kernel boards help help-hosted sbom sbom-board \
qemu qemu-esp qemu-gdb
qemu qemu-esp qemu-gdb init
# ARCH given on the command line and no TARGET: `clean` is the kernel's for that
# ISA, as `qemu` always is (make ARCH=<arch> clean qemu).
@@ -232,6 +237,37 @@ write_stick:
@[ -n "$(DEVICE)" ] || { echo "Usage: make write_stick DEVICE=/dev/sdX (lsblk lists the disks)"; exit 1; }
@bash scripts/write_stick.sh build/boards/pc/lithos-pc.img $(DEVICE)
# init -- the packages this tree needs, for one ISA or several (ARCH=amd64,aarch64,riscv64).
# Common: the build, the disk images (scripts/mkdiskimage.sh; sfdisk is in fdisk), git-lfs for
# the logs and DoE CSVs (.gitattributes), and the documents: the book (docs/book/Makefile's own
# list) and the formal volumes and API reference (docs/formal/Makefile: pdflatex, doxygen, dot).
# Per ISA: its QEMU, its UEFI firmware (kernel/Makefile's paths) and its compiler (kernel/Makefile
# TOOLCHAIN; aarch64's loader is clang + lld-link). Not installed: syft, which make sbom and
# boot_image need -- it is not packaged; see the message make sbom prints.
INIT_COMMON := build-essential make git git-lfs python3 xorriso mtools gdisk dosfstools fdisk \
pandoc latexmk texlive-xetex texlive-latex-base texlive-latex-recommended \
texlive-latex-extra texlive-pictures texlive-fonts-recommended lmodern \
fonts-dejavu fonts-dejavu-extra doxygen graphviz
INIT_amd64 := qemu-system-x86 ovmf
INIT_aarch64 := qemu-system-arm qemu-efi-aarch64 gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu clang lld
INIT_riscv64 := qemu-system-misc qemu-efi-riscv64 gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu
comma := ,
INIT_ARCHES := $(subst $(comma),$(space),$(ARCH))
INIT_BAD := $(filter-out amd64 aarch64 riscv64,$(INIT_ARCHES))
SUDO := $(if $(filter 0,$(shell id -u)),,sudo)
init:
@[ -n "$(INIT_ARCHES)" ] && [ -z "$(INIT_BAD)" ] || { \
echo "Usage: make ARCH=<amd64|aarch64|riscv64>[,...] init (e.g. ARCH=amd64,aarch64,riscv64)"; exit 1; }
@command -v apt-get >/dev/null 2>&1 || { \
echo "init: needs apt-get (Debian/Ubuntu). The packages are listed in the Makefile, at init."; exit 1; }
$(SUDO) env DEBIAN_FRONTEND=noninteractive apt-get update -qq
$(SUDO) env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
$(INIT_COMMON) $(foreach a,$(INIT_ARCHES),$(INIT_$(a)))
git lfs install --local
@echo ""
@echo "Ready for $(INIT_ARCHES): make ARCH=<arch> clean qemu, make -C v4 test, make docs"
help:
@sed -n '/^# TARGET is/,/^# =====/p' Makefile | sed '$$d; s/^# \{0,1\}//'