Merge pull request 'Automate boot unit inclusion with architecture-aware Moderne analysis' (#74) from feature/dangling-unit-resolution into develop
continuous-integration/drone/push Build is passing

Reviewed-on: #74
This commit was merged in pull request #74.
This commit is contained in:
Aaron committed 2026-11-07 22:32:22 +00:00
commit 9d4323ca53
20 files changed
+141 -113

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ steps:
- name: compile
image: t3hn3rd/asuro-build:latest
pull: always
depends_on:
- build-image
commands:
+4
View File
@@ -20,3 +20,7 @@ wasuro
src/core/core.version.pas
site/*
!site/.gitkeep
/src/boot/dangling_units.inc
/lib/dangling/
.moderne
CLAUDE.md
+3 -3
View File
@@ -1,4 +1,5 @@
FROM ubuntu:latest
ARG RECIPES_IMAGE=t3hn3rd/moderne-asuro-recipes:0.1.1@sha256:eaf54188053511dad9c620a8fb98b0f50c41770cd49a0b3d71a0538386522011
FROM ${RECIPES_IMAGE}
VOLUME ["/code"]
@@ -7,7 +8,7 @@ RUN dpkg --add-architecture i386
RUN apt-get update && apt-get install -y \
curl dos2unix wget git make nasm binutils xorriso grub-pc-bin gcc gcc-multilib \
python3 python3-pip python3-pil && \
apt-get clean my room
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir --break-system-packages "mkdocs>=1.6,<2" mkdocs-material
@@ -20,6 +21,5 @@ RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSIO
ADD https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver /usr/bin/semver
RUN chmod +x /usr/bin/semver
WORKDIR /code
RUN find . -type f -print0 | xargs -0 dos2unix
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["find toolchain -name '*.sh' -exec dos2unix {} + 2>/dev/null; find toolchain -name '*.sh' -exec chmod +x {} +; bash toolchain/compile.sh"]
+8
View File
@@ -0,0 +1,8 @@
**/.git
**/.gradle
**/build
**/.moderne
wasuro
site
lib
release
+45
View File
@@ -0,0 +1,45 @@
# Automatic boot-unit inclusion
Run the usual `docker compose build builder` and `docker compose run builder`
from Asuro. Only this repository is required. Compose and Drone use the same
Dockerfile and repository build context, producing `t3hn3rd/asuro-build:latest`.
The Dockerfile inherits the published `t3hn3rd/moderne-asuro-recipes:0.1.1` image,
pinned by digest. It already includes Java, Moderne CLI, the Pascal LST generator,
and the registered recipe. The Asuro layer installs FPC and the kernel build tools.
To upgrade tooling, publish the upstream images first and update `RECIPES_IMAGE`
in the Dockerfile to the new tag and digest. Local tooling image testing can use
`docker compose build --build-arg RECIPES_IMAGE=<local-tag> builder`.
`ASURO_ARCH` selects the source architecture, defaulting to `x86`. For example:
```sh
export ASURO_ARCH=x86
docker compose run --rm builder
```
Compose forwards this variable to the builder; Drone inherits it from its compile
environment. Only `src/arch/$ASURO_ARCH` is added to FPC's unit search paths.
Other architecture folders are excluded from LST generation and from the recipe's
dependency graph and results. Common units outside `src/arch` remain eligible.
The selected architecture folder must exist. This source selection does not
change the existing i386 compiler target, assembly stub, or linker settings;
an x86_64 port still needs those platform-specific changes.
`compile_dangling.sh` runs after Wasuro synchronization and before FPC. It copies
only `src/` and `compat/` into an isolated temporary analysis repository, generates
LSTs with rewrite-pascal, runs the standalone Moderne recipe, exports its
datatable, and writes `src/boot/dangling_units.inc`. Wasuro is not parsed.
Datatable conversion is provided by the standalone project's Java exporter.
Parse errors, recipe failures, and malformed datatables stop the build. The
generated include is ignored by Git and removed before each generation attempt.
Use `{$DEFINE NOT_DANGLING}` near a unit declaration to exclude an experimental
or legacy unit from automatic inclusion. It can still be referenced normally.
This is a file-level marker; conditional definitions are not evaluated. The
analysis follows both interface and implementation uses, without expanding
includes or evaluating conditional compilation.
Moderne runs through its CLI normally; any license or tenant configuration
required by your CLI installation must be provided to the container separately.
No host credentials are copied into the image.
+3
View File
@@ -1,5 +1,8 @@
services:
builder:
image: t3hn3rd/asuro-build:latest
build: .
environment:
ASURO_ARCH: ${ASURO_ARCH:-x86}
volumes:
- .:/code
+1
View File
@@ -283,6 +283,7 @@ nav:
- Version Generation: toolchain/compile_vergen.md
- LVGL Compilation: toolchain/compile_lvgl.md
- Wasuro Pull: toolchain/compile_wasuro.md
- Automatic Boot Units: toolchain/dangling_units.md
- Source List: toolchain/compile_sourcelist.md
- Source Compilation: toolchain/compile_sources.md
- Checksum: toolchain/compile_checksum.md
+2 -1
View File
@@ -28,7 +28,8 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f
4. Install Git for Windows.
5. Install VSCode & the listed plugins.
6. Install VirtualBox (v7+).
7. Clone this repository.
7. Clone this repository. The builder inherits the published Moderne/Pascal
tooling image; see [boot-unit generation](doc/toolchain/dangling_units.md).
8. Run the following command in the root of the repo to build the docker image:
```powershell
docker compose build builder
+2
View File
@@ -19,6 +19,8 @@
}
unit arch.x86.isr.tmr1;
{$DEFINE NOT_DANGLING} { Unused legacy timer ISR; not part of the kernel boot sequence. }
interface
uses
@@ -19,6 +19,8 @@
}
unit arch.x86.proc.loader;
{$DEFINE NOT_DANGLING} { Unimplemented process-loader stub. }
interface
implementation;
+3 -101
View File
@@ -71,107 +71,9 @@ procedure run;
implementation
uses
io.syslog, boot.splash,
// Silo units that must be included here to compile
driver.storage.boot,
test,
core,
app.wasm,
driver.storage.ctl.ahci,
core.enc.base64,
core.panic,
driver.video.bga,
arch.x86.bda,
arch.x86.panic,
core.ds.cfifo,
core.ds.cfifols,
core.ds.circ,
core.gfx.color,
arch.x86.proc.sched,
arch.x86.cpu,
driver.video.desktop,
driver.video.doublebuffer,
driver.mgr,
driver.net.dev.e1000,
driver.bus.usb.ehci,
driver.storage.fs.fat32,
arch.x86.fault,
core.ds.fifo,
driver.storage.fs.mgr,
driver.storage.fs.flatfs,
core.gfx.fonts,
arch.x86.gdt,
driver.video.gpu,
svc.gfxd,
core.ds.hashmap,
arch.x86.idt,
arch.x86.isr.ioapic,
arch.x86.irq,
driver.storage.fs.iso9660,
arch.x86.isr,
arch.x86.isr.mgr,
driver.hid.keyboard,
core.ds.lifo,
core.ds.lists,
memory.heap,
driver.video.lvgl,
core.ds.maxh,
core.enc.md5,
core.ds.minh,
driver.hid.mouse,
arch.x86.multiboot,
driver.net,
driver.bus.usb.ohci,
app.partcmd,
driver.bus.pci,
arch.x86.memory.physical,
core.ds.prio,
proc.mgr,
app.mgr,
driver.hid.ps2.keyboard,
driver.hid.ps2.mouse,
core.rand,
driver.timer.rtc,
driver.io.serial,
io.stdio,
driver.storage.mgr,
driver.storage.test,
core.strings,
driver.exp.testdriver,
proc.testprocs,
arch.x86.isr.tmr0,
debug.tracer,
driver.bus.usb.uhci,
app.uidebug,
driver.bus.usb,
driver.hid.usb.keyboard,
driver.hid.usb.mouse,
driver.storage.ctl.usb,
driver.bus.usb.core,
svc.usbd,
driver.bus.usb.hub,
driver.bus.usb.types,
core.util,
arch.x86.util,
arch.x86.v86,
driver.video.vesa,
driver.storage.vfs,
driver.video,
arch.x86.memory.virtual,
core.enc.fnv1a,
core.enc.djb2,
core.ds.bloom,
app.volcmd,
driver.storage.vol.mgr,
app.vterminal,
wasm,
wasm.vm.io,
wasm.test,
wasm.test.framework,
driver.video.windows,
driver.bus.usb.xhci,
core.fmt.json;
io.syslog, boot.splash
{$INCLUDE dangling_units.inc}
;
type
{ Resolved execution order — indices into Entries[] }
@@ -19,6 +19,8 @@
}
unit driver.storage.ctl.ide.ata;
{$DEFINE NOT_DANGLING} { Part of the unfinished legacy IDE stack. }
interface
uses
@@ -24,6 +24,8 @@
unit driver.storage.ctl.ide.atapi;
{$DEFINE NOT_DANGLING} { Nonfunctional legacy ATAPI driver. }
interface
uses
@@ -21,6 +21,8 @@
}
unit driver.storage.ctl.ide;
{$DEFINE NOT_DANGLING} { Unfinished legacy IDE stack; requires removed console/terminal units. }
interface
uses
@@ -19,6 +19,8 @@
}
unit driver.storage.fs.asfs;
{$DEFINE NOT_DANGLING} { Incomplete legacy filesystem; requires removed storagemanagement API. }
interface
uses
@@ -122,3 +124,5 @@ end;
procedure detect_volumes(disk : PStorage_Device) begin
end;
end.
@@ -19,6 +19,8 @@
unit driver.storage.vol.table;
{$DEFINE NOT_DANGLING} { Unimplemented legacy partition-table API; requires removed storagemanagement. }
interface
uses
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Shared source-architecture selection; callers run from the repository root.
# Folder names: x86 = i386, x86_64 = x86_64.
export ASURO_ARCH="${ASURO_ARCH:-x86}"
if [[ ! "$ASURO_ARCH" =~ ^[a-z][a-z0-9_]*$ ]]; then
echo "Invalid ASURO_ARCH: $ASURO_ARCH" >&2
return 1
fi
if [[ ! -d "src/arch/$ASURO_ARCH" ]]; then
echo "Architecture sources not found: src/arch/$ASURO_ARCH" >&2
return 1
fi
+3 -2
View File
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
TOOLCHAIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$TOOLCHAIN_DIR/architecture.sh" || exit 1
ERRCOUNT=0
echo " "
echo "======================="
@@ -20,14 +22,13 @@ runOrFail() {
fi
}
TOOLCHAIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
declare -a run_steps=(
"compile_stub.sh" "Failed to compile stub!"
"compile_vergen.sh" "Versions failed to compile"
"compile_lvgl.sh" "Failed to compile LVGL!"
"compile_icons.sh" "Failed to generate icons!"
"compile_wasuro.sh" "Failed to pull Wasuro!"
"compile_dangling.sh" "Failed to generate dangling unit list!"
"compile_sources.sh" "Failed to compile FPC Sources!"
"compile_initcalls.sh" "Failed to generate INITFINAL table!"
"compile_link.sh" "Failed linking!"
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
echo "Generating dangling Pascal units..."
TOOLCHAIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${TOOLCHAIN_DIR}/.."
source "$TOOLCHAIN_DIR/architecture.sh"
OUT="$(pwd)/src/boot/dangling_units.inc"
# Remove stale output before attempting analysis. Work in a separate temporary
# repository so developer Moderne runs and generated sources cannot contaminate it.
rm -f "$OUT"
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
mkdir -p "$WORK/src" "$WORK/compat"
cp -a src/. "$WORK/src/"
cp -a compat/. "$WORK/compat/"
# Do not parse inactive architectures: incomplete ports must not break this build.
for dir in "$WORK/src/arch/"*; do
[[ "$(basename "$dir")" == "$ASURO_ARCH" ]] || rm -rf "$dir"
done
git -C "$WORK" init -q
git -C "$WORK" remote add origin https://gitea.spexeah.com/Spexeah/Asuro.git
PASCAL_JAVA_OPTIONS='-Dpascal.sourceRoots=src,compat -Dpascal.failOnParseError=true' pascal-lst "$WORK"
mod run "$WORK" --recipe org.openrewrite.pascal.boot.FindDanglingUnits \
--recipe-option "architecture=$ASURO_ARCH"
dangling-include "$WORK" "$OUT"
+14 -6
View File
@@ -1,13 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/architecture.sh"
echo " "
echo "======================="
echo " "
echo "Compiling FPC Sources..."
echo " "
# Build -Fu flags for all directories under src/, wasuro/ and compat/
FU_PATHS="-Fusrc -Fuwasuro -Fucompat"
for dir in $(find src wasuro compat -type d 2>/dev/null); do
FU_PATHS="$FU_PATHS -Fu$dir"
done
# Keep other architectures out of FPC's unit resolution, including arch/ itself.
FU_PATHS=()
while IFS= read -r -d '' dir; do
FU_PATHS+=("-Fu$dir")
done < <(find src wasuro compat -path src/arch -prune -o -type d -print0
find "src/arch/$ASURO_ARCH" -type d -print0)
fpc -Aelf -gw -g -gl -n -v0e -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ $FU_PATHS src/asuro.pas
if [[ "$ASURO_ARCH" == "x86" ]]; then
fpc -Aelf -gw -g -gl -n -v0e -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ "${FU_PATHS[@]}" src/asuro.pas
else
echo "No compiler found for target: $ASURO_ARCH" >&2
exit 1
fi