-
Notifications
You must be signed in to change notification settings - Fork 0
Build System
JNode uses Apache Ant for builds, with a custom
BootImageBuilderthat compiles Java classes and assembles them into a bootable ISO image.
The build system compiles ~3,300 Java files, assembles x86 native code with JNasm (a custom Java assembler), links everything into a boot image, and wraps it in a bootable ISO. The entire process runs on a host JVM (Java 1.6–1.8).
| Action | Command |
|---|---|
| Build x86 lite ISO | sh build.sh cd-x86-lite |
| Build x86_64 lite ISO | sh build.sh cd-x86_64-lite |
| Assemble only | sh build.sh assemble |
| Run all tests | sh build.sh tests |
| Per-subproject tests | cd <subproject> && ant test |
Output: all/build/cdroms/jnode-x86-lite.iso (or x86_64)
Source Code Compile Assemble Package
┌─────────┐ ┌──────────────┐ ┌───────────────┐ ┌──────────┐
│ Java │────▶│ javac (1.6) │───▶│BootImageBuilder│──▶│ ISO │
│ files │ │ per subprj │ │ + JNasm │ │ (GRUB + │
│ │ └──────────────┘ │ + initjar │ │ image) │
├─────────┤ └───────────────┘ └──────────┘
│ .asm │─────────────────────────────────▲
│ files │ JNasm assembler │
├─────────┤ │
│ plugin │ Descriptor processing │
│ XMLs │─────────────────────────────────┘
└─────────┘
-
build.shis a thin wrapper that invokesantwith the specified target inall/build.xml -
all/build.xmlis the master build file that orchestrates all sub-project builds - Each sub-project has its own
build.xmlandbuild-tests.xml
| File | builder/src/builder/org/jnode/build/x86/BootImageBuilder.java |
|---|
The BootImageBuilder is the heart of the build:
- Loads all compiled classes
- Pre-compiles selected methods using the L1 JIT compiler (running on the host JVM)
- Lays out objects in memory (class metadata, vtables, static fields)
- Assembles native code via JNasm
- Writes the boot image binary
- Packages it with GRUB into a bootable ISO
| Directory | builder/src/builder/org/jnode/jnasm/ |
|---|
A custom x86 assembler written in Java. Assembles the .asm files in core/src/native/x86/ into native code that gets linked into the boot image.
- Downloaded during build to
all/lib/classlib.jar - Provides the GNU Classpath / OpenJDK standard library classes
- Source also available as
classlib-src.jar
Each plugin has an XML descriptor in <subproject>/descriptors/:
<plugin id="org.jnode.driver.video.vga"
name="JNode Video Standard VGA driver"
version="@VERSION@"
provider-name="JNode.org">
<requires>
<import plugin="org.jnode.driver.bus.pci"/>
<import plugin="org.jnode.driver.video.vgahw"/>
</requires>
<runtime>
<library name="jnode-gui.jar">
<export name="org.jnode.driver.video.vga.*"/>
</library>
</runtime>
<extension point="org.jnode.driver.bus.pci.device-factories">
<device-factory class="..." />
</extension>
</plugin>The build system processes these descriptors to:
- Resolve plugin dependencies
- Build the init-jar with all required plugins
- Set up the classloader hierarchy
| File | Purpose |
|---|---|
all/conf/default-plugin-list.xml |
Default plugins for a standard build |
all/conf/full-plugin-list.xml |
All available plugins |
The plugin list also specifies the main class to launch after boot:
<manifest>
<attribute key="Main-Class" value="org.jnode.shell.CommandShell"/>
<attribute key="Main-Class-Arg" value="boot"/>
</manifest>Build-time configuration file. Key settings include:
- Java compiler source/target level
- Platform selection (x86 / x86_64)
- Memory layout parameters
- Plugin list selection
Note: jnode.properties is gitignored. Copy from jnode.properties.dist and customize.
- Framework: JUnit 4.5, JMock, Mockito
-
Test source:
<subproject>/src/test/ -
Run all:
sh build.sh tests -
Run per-subproject:
cd <subproject> && ant test - 390 test files across all sub-projects
-
Java 1.6 target — All source must compile with
-source 1.6 -target 1.6. No lambdas, no try-with-resources, no diamond operator. - US-ASCII encoding — Source files must be US-ASCII. No Unicode in source code.
- Host JVM vs. target — The build runs on a standard JVM, but the output runs on JNode's own VM. Some code has different behavior in these two contexts.
-
@LoadStatics — Build-time static initializers run on the host JVM. Fields marked
@LoadStaticsare re-initialized on the target at boot. - classlib.jar — Downloaded automatically during the first build. If the download fails, the build fails. Check network connectivity.
-
Build time — A full build takes several minutes. Use
assemblefor code-only changes without ISO generation.
- Architecture — System overview
- Boot-Sequence — What happens after the ISO boots
- Boot-CD-ROM-Builder — CD-ROM ISO assembly
- Plugin-System — How plugin descriptors work at runtime
- Testing — Detailed testing guide