universalisos/kernel/pkg
2026-07-12 16:40:24 +01:00
..
build.mk fix(kernel): resolve armv7 linker errors, fix exceptions vector base address, and remove untracked conflicting files 2026-07-12 16:40:24 +01:00
manifest.mk fix(kernel): resolve armv7 linker errors, fix exceptions vector base address, and remove untracked conflicting files 2026-07-12 16:40:24 +01:00
README.md fix(kernel): resolve armv7 linker errors, fix exceptions vector base address, and remove untracked conflicting files 2026-07-12 16:40:24 +01:00

UOS Package Build System

PikeOS package.mk grammar (family prefix aos_adt) integrated into the Universalisos kernel build.

Architecture

kernel/
├── pkg/
│   ├── manifest.mk    # Package list + dependency enforcement
│   ├── build.mk       # Includes package.mk files, computes ADT_OBJS
│   └── README.md      # This file
└── src/core/adt/
    ├── base/package.mk
    ├── stand/package.mk
    ├── avl/package.mk
    ├── crc32/package.mk
    ├── kdev/package.mk
    ├── lheap/package.mk
    └── list/package.mk

Package.mk Grammar

Each package.mk is a GNU Make include fragment. For package <p>, it defines:

Variable Required Meaning
aos_adt_packages += <p> yes Self-registration into the family package list
aos_adt_<p>_srcdir yes Source directory
aos_adt_<p>_incdir yes Include directory ($(srcdir)/include)
aos_adt_<p>_incdir_subdirs yes Header namespace subdirs
aos_adt_<p>_headers yes Public header list (relative to incdir)
aos_adt_<p>_options yes Build options; base is mandatory
aos_adt_<p>_base_files yes C sources for the base option
aos_adt_<p>_base_objects yes Objects for the base option
aos_adt_<p>_<opt>_files per extra option Sources for each non-base option
aos_adt_<p>_<opt>_objects per extra option Objects for each non-base option
aos_adt_<p>_other optional Miscellaneous files
aos_adt_<p>_userlib yes 1 = usable from user-level libs

Dependency Enforcement

Dependencies are asserted at include time via Make conditionals:

ifeq ($(filter base,$(aos_adt_packages)),)
$(error adt/avl requires adt/base)
endif

The manifest (manifest.mk) additionally validates the full dependency graph before any package.mk is included.

Option Selection

UOS_PKG_OPTIONS controls which package options are enabled:

# Default: all options
make ARCH=armv7 PLATFORM=qemu-arm-virt

# Minimal: only base objects
make ARCH=armv7 PLATFORM=qemu-arm-virt UOS_PKG_OPTIONS=base

# Custom: base + sprintf + snprintf (no remove)
make ARCH=armv7 PLATFORM=qemu-arm-virt UOS_PKG_OPTIONS="base sprintf snprintf"

Adding a New Package

  1. Create src/core/adt/<name>/package.mk following the grammar above.
  2. Add <name> to uos_packages in pkg/manifest.mk.
  3. Add dependency assertions in pkg/manifest.mk.
  4. Add the package to the include list in pkg/build.mk.

Build Integration

The kernel Makefile includes:

  1. pkg/manifest.mk — validates dependencies, registers packages.
  2. pkg/build.mk — includes all package.mk files, computes ADT_PKG_OBJS.

The computed ADT_PKG_OBJS replaces the wildcard ADT_OBJS. If the package.mk path yields no objects (e.g. during migration), the wildcard fallback is used automatically.

Verified Packages

Package Options Dependencies Userlib
base base 1
stand base, sprintf, snprintf base 1
avl base, remove base 1
crc32 base base 1
kdev base crc32 1
lheap base base 1
list base base 0