l4re-base-25.08.0

This commit is contained in:
2025-09-12 15:55:45 +02:00
commit d959eaab98
37938 changed files with 9382688 additions and 0 deletions

View File

@@ -0,0 +1,150 @@
# This file is an example for defining configurations for different boot
# methods:
# - QEMU (qemu)
# - Image mode (image)
# - ISO images (grub1iso, grub2iso)
# - VirtualBox
# - Fastboot
#
# This is a 'make' file.
#
# Copy this example file to Makeconf.boot in the same directory.
#
# Generic options:
#
# Search path for modules, such as binaries, libraries, kernel, configuration
# files or any other data file you might want to load. Note that the bin and
# lib directories of the build-tree are automatically added to the search
# path.
# MODULE_SEARCH_PATH = /path/to/cfgs:/path/to/foo:..
#
# For additional image building options see the header of
# pkg/bootstrap/server/src/Make.rules
# Add fiasco build directory to MODULE_SEARCH_PATH
MODULE_SEARCH_PATH += /path/to/fiasco-build
# For use with multiple platforms and architectures:
FIASCO_PATH-arm-integrator = /path/to/fiasco-build-arm-integrator
FIASCO_PATH-arm-rv_vexpress = /path/to/fiasco-build-arm-rv_vexpress
FIASCO_PATH-arm-rv_vexpress_a15 = /path/to/fiasco-build-arm-rv_vexpress_a15
FIASCO_PATH-arm-arm_virt = /path/to/fiasco-build-arm-arm_virt
FIASCO_PATH-arm64-arm_virt = /path/to/fiasco-build-arm64-arm_virt
FIASCO_PATH-mips-malta = /path/to/fiasco-build-mips-malta
FIASCO_PATH-x86 = /path/to/fiasco-build-x86
FIASCO_PATH-amd64 = /path/to/fiasco-build-amd64
MODULE_SEARCH_PATH += $(FIASCO_PATH-$(ARCH)-$(PLATFORM_TYPE))
MODULE_SEARCH_PATH += $(FIASCO_PATH-$(ARCH))
# QEMU: Specific configuration for 'qemu' target (make qemu E=xxx'):
# Optional options for QEMU, but setting '-serial stdio' is recommended
QEMU_OPTIONS += -serial stdio
#QEMU_OPTIONS += -nographic
#QEMU_OPTIONS += -monitor none
QEMU_OPTIONS-arm-rv += -M realview-eb -m 256
#QEMU_OPTIONS-arm-rv += -cpu arm926
QEMU_OPTIONS-arm-rv += -cpu arm1176
#QEMU_OPTIONS-arm-rv += -cpu cortex-a8
#QEMU_OPTIONS-arm-rv += -cpu cortex-a9
QEMU_OPTIONS-arm-integrator += -M integratorcp -m 256
#QEMU_OPTIONS-arm-integrator += -cpu arm1176
QEMU_OPTIONS-arm-rv_vexpress += -M vexpress-a9 -m 1024 -cpu cortex-a9 -smp 4
QEMU_OPTIONS-arm-rv_vexpress_a15 += -M vexpress-a15 -m 2047 -cpu cortex-a15 \
-smp 4
QEMU_OPTIONS-arm-rv_pbx += realview-pbx-a9 -m 512 -cpu cortex-a9 -smp 4
QEMU_OPTIONS-arm-arm_virt += -M virt,virtualization=true -cpu cortex-a15 -m 1024
QEMU_OPTIONS-arm-arm_mps3_an536 += -M mps3-an536 -smp 2
# Have to add additional serial devices to see output of UARTs other than UART0.
# UART0: Exclusively accessible to CPU0.
# UART1: Exclusively accessible to CPU1.
# UART2/3/4/5: Shared between CPU0 and CPU1.
# The following adds serial devices for UART0-3 and muxes them all into stdio.
# Must not be combined with the usual "-serial stdio".
# QEMU_OPTIONS-arm-arm_mps3_an536 += -chardev stdio,mux=on,id=stdio-mux -serial chardev:stdio-mux -serial chardev:stdio-mux -serial chardev:stdio-mux -serial chardev:stdio-mux
QEMU_OPTIONS-arm64-arm_virt += -M virt,virtualization=true,iommu=smmuv3 -cpu cortex-a57 -m 1024
QEMU_OPTIONS-mips-malta += -M malta -m 1024 -cpu P5600
QEMU_OPTIONS-riscv-riscv_virt += -bios default -M virt -m 1024 -smp 4
QEMU_OPTIONS-riscv-sifive_u += -bios default -M sifive_u -m 1024 -smp 4
QEMU_OPTIONS-arm += $(QEMU_OPTIONS-arm-$(PLATFORM_TYPE))
QEMU_OPTIONS-arm64 += $(QEMU_OPTIONS-arm64-$(PLATFORM_TYPE))
QEMU_OPTIONS-mips += $(QEMU_OPTIONS-mips-$(PLATFORM_TYPE))
QEMU_OPTIONS-riscv += $(QEMU_OPTIONS-riscv-$(PLATFORM_TYPE))
QEMU_OPTIONS-x86 += -m 512 -M q35
QEMU_OPTIONS-amd64 += -m 512 -M q35
#QEMU_OPTIONS-amd64 += -m 1024 -enable-kvm -M q35,kernel_irqchip=split -cpu host -device intel-iommu,intremap=on,eim=on
QEMU_OPTIONS += $(QEMU_OPTIONS-$(ARCH))
# The path to the QEMU binary - optional
#QEMU_PATH-x86 = /path/to/qemu
#QEMU_PATH-amd64 = /path/to/qemu-system-x86_64
#QEMU_PATH = $(QEMU_PATH-$(ARCH))
# Arm FVP: Specific configuration for 'fvp' target (make fvp E=xxx' PT=arm_fvp_base):
FVP_OPTIONS += -C cluster0.NUM_CORES=1 -C pctl.startup=0.0.*.*
# Basic settings for bare-metal boot without an ATF
FVP_OPTIONS += -C bp.refcounter.non_arch_start_at_default=1
FVP_OPTIONS += -C gic_distributor.has-two-security-states=0
# Speed up simulation
FVP_OPTIONS += -C cache_state_modelled=0
FVP_OPTIONS += -C bp.vis.disable_visualisation=1
# UART output. You probably want to disable telnet when running tests...
FVP_OPTIONS += -C bp.pl011_uart0.out_file=-
#FVP_OPTIONS += -C bp.terminal_0.start_telnet=0
# A-profile specific settings. Required because we boot witout ATF.
FVP_OPTIONS-arm_fvp_base += -C bp.secure_memory=false
FVP_OPTIONS-arm_fvp_base += -C cluster0.has_el3=0 -C cluster0.has_secure_el2=0
# R-profile specific settings.
FVP_OPTIONS-arm_fvp_base_r += -C gic_distributor.GICD_CTLR-DS-1-means-secure-only=1
FVP_OPTIONS-arm_fvp_base_r += -C gic_distributor.has-two-security-states=0
FVP_OPTIONS-arm_fvp_base_r += -C cci400.force_on_from_start=1
FVP_OPTIONS-arm_fvp_base_r += -C bp.exclusive_monitor.monitor_access_level=1
# Armv8-R VMSA is only supported on AArch64
FVP_OPTIONS-arm-arm_fvp_base_r += -C cluster0.VMSA_supported=0
FVP_OPTIONS-arm64-arm_fvp_base_r += -C cluster0.VMSA_supported=1
FVP_OPTIONS-arm += -C cluster0.has_aarch64=0
FVP_OPTIONS-arm64 += -C cluster0.has_aarch64=1
FVP_OPTIONS += $(FVP_OPTIONS-$(ARCH))
FVP_OPTIONS += $(FVP_OPTIONS-$(PLATFORM_TYPE))
FVP_OPTIONS += $(FVP_OPTIONS-$(ARCH)-$(PLATFORM_TYPE))
# Set path to FVP binary if model is not in $PATH - optional
#FVP_PATH = /path/to/FVP_Base_RevC-2xAEMvA
# VirtualBox
#
# To use VirtualBox create a VM in VirtualBox and set the name of the VM in
# 'VBOX_VM'. The 'vbox' target uses an ISO image generating target to generate
# an ISO and use that with VirtualBox.
#
# Required variables:
# VBOX_VM: Name of the VM to use.
#
# Additional (optional) variables:
# VBOX_ISOTARGET: grub1iso or grub2iso (grub2iso is the default)
# VBOX_OPTIONS: Additional options (see VBoxSDL --help)
VBOX_VM = L4
VBOX_ISOTARGET = grub1iso
#VBOX_OPTIONS += --memory 256
# Fastboot
# FASTBOOT_BOOT_CMD = path/to/fastboot boot

View File

@@ -0,0 +1,69 @@
-- vim:set ft=lua:
-- This script shall start mag. For that we need a frame-buffer and io to
-- get access to the required hardware resources. Target platform is ARM
-- Real-View as used with QEmu.
local L4 = require("L4");
local l = L4.default_loader;
local io_buses =
{
gui = l:new_channel();
fbdrv = l:new_channel();
};
l:start({
caps = {
gui = io_buses.gui:svr(),
fbdrv = io_buses.fbdrv:svr(),
icu = L4.Env.icu,
sigma0 = L4.Env.sigma0,
},
log = { "IO", "y" },
l4re_dbg = L4.Dbg.Warn,
},
"rom/io rom/hw_devices.io rom/arm-rv-lcd.io");
local fbdrv_fb = l:new_channel();
l:startv({
caps = {
vbus = io_buses.fbdrv,
fb = fbdrv_fb:svr(),
},
log = { "fbdrv", "r" },
l4re_dbg = L4.Dbg.Warn,
},
"rom/fb-drv", "-c", "1024 565 bgr");
local mag_caps = {
mag = l:new_channel(),
svc = l:new_channel(),
};
l:start({
caps = {
vbus = io_buses.gui,
fb = fbdrv_fb,
mag = mag_caps.mag:svr(),
svc = mag_caps.svc:svr(),
},
log = { "mag", "g" },
l4re_dbg = L4.Dbg.Warn,
-- scheduler = L4.Env.user_factory:create(L4.Proto.Scheduler, 0xa0, 0x80),
},
"rom/mag");
e = l:start({ caps = {
fb = mag_caps.svc:create(L4.Proto.Goos, "g=640x480"),
},
log = { "spectrum", "b" },
l4re_dbg = L4.Dbg.Warn,
-- scheduler = L4.Env.user_factory:create(L4.Proto.Scheduler, 0x18, 0x8),
},
"rom/ex_fb_spectrum_cc");
print("ex_fb_spectrum exited with: " .. e:wait());

View File

@@ -0,0 +1,15 @@
-- vi:ft=lua
-- configuration file for io
local hw = Io.system_bus()
Io.add_vbus("gui", Io.Vi.System_bus
{
INPUT = wrap(hw:match("arm,pl050"));
})
Io.add_vbus("fbdrv", Io.Vi.System_bus
{
CTRL = wrap(hw:match("arm,sysctl"));
LCD = wrap(hw:match("arm,pl111"));
})

View File

@@ -0,0 +1,16 @@
modaddr 0x1100000
entry arm-lcd-example
bootstrap bootstrap -serial
kernel fiasco -serial_esc
roottask moe rom/arm-rv-lcd.cfg
module arm-rv-lcd.cfg
module arm-rv-lcd.io
module plat-rv/hw_devices.io
module l4re
module io
module ned
module fb-drv
module mag
module ex_fb_spectrum_cc

View File

@@ -0,0 +1,11 @@
-- vi:ft=lua
local hw = Io.system_bus()
-- create a virtual bus 'l4lx'
Io.add_vbus("l4lx", Io.Vi.System_bus
{
-- add device which matches the compatibility ID (CID)
-- 'smsc,lan9118'
NIC = wrap(hw:match("smsc,lan9118"));
})

View File

@@ -0,0 +1,32 @@
-- vi:ft=lua
Io.Dt.add_children(Io.system_bus(), function()
pciec0 = Io.Hw.Ecam_pcie_bridge(function()
Property.regs_base = 0x10000000
Property.regs_size = 0x2eff0000
Property.cfg_base = 0x4010000000
Property.cfg_size = 0x0010000000 -- 256 buses x 256 devs x 4KB
Property.ioport_base = 0x3eff0000
Property.ioport_size = 0x10000 -- 64KB (for port I/O access)
Property.mmio_base = 0x10000000
Property.mmio_size = 0x2eff0000 -- ~750MB (for memory I/O access)
Property.mmio_base_64 = 0x8000000000
Property.mmio_size_64 = 0x8000000000 -- 512GB (for memory I/O access)
Property.int_a = 32 + 3
Property.int_b = 32 + 4
Property.int_c = 32 + 5
Property.int_d = 32 + 6
Property.flags = Io.Hw_device_DF_dma_supported
end);
end);
local hw = Io.system_bus()
Io.add_vbusses
{
vbus = Io.Vi.System_bus(function ()
Property.num_msis = 26
PCI = Io.Vi.PCI_bus(function ()
pci_bus = wrap(hw:match("PCI/network", "PCI/storage", "PCI/media"));
end)
end);
}

View File

@@ -0,0 +1,9 @@
-- vim:ft=lua
-- This is a configuration to start two 'hello's,
-- showing the colored prefix made by the system to securely differentiate
-- the two applications.
local L4 = require("L4");
L4.default_loader:start({ log = { "hello-1", "red" } }, "rom/hello");
L4.default_loader:start({ log = { "hello-2", "cyan" } }, "rom/hello");

View File

@@ -0,0 +1,6 @@
-- vim:ft=lua
-- this is a configuration to start 'hello'
local L4 = require("L4");
L4.default_loader:start({}, "rom/hello");

View File

@@ -0,0 +1,66 @@
-- vim:set ft=lua:
local L4 = require("L4");
loader = L4.default_loader;
local lxname = "vmlinuz";
-- Start io
vbus_l4linux = loader:new_channel();
vbus_input = loader:new_channel();
vbus_fbdrv = loader:new_channel();
loader:start(
{
caps = {
sigma0 = L4.Env.sigma0,
icu = L4.Env.icu,
input = vbus_input:svr(),
l4linux = vbus_l4linux:svr(),
fbdrv = vbus_fbdrv:svr(),
},
}, "rom/io rom/x86-legacy.devs rom/l4lx-x86.io");
-- Start fb-drv (but only if we need to)
local fb = L4.Env.vesa;
if (not fb) then
fb = loader:new_channel();
loader:start(
{
caps = {
fb = fb:svr(),
vbus = vbus_fbdrv
}
}, "rom/fb-drv -m 0x117");
end
local mag_mag = loader:new_channel();
local mag_svc = loader:new_channel();
-- Start mag
loader:start(
{
caps = {
vbus = vbus_input;
mag = mag_mag:svr();
svc = mag_svc:svr();
fb = fb;
},
}, "rom/mag");
-- Start Linux
loader:start(
{
caps = {
fb = mag_svc:create(L4.Proto.Goos, "g=640x480");
vbus = vbus_l4linux;
},
l4re_dbg = L4.Dbg.Warn,
log = L4.Env.log,
},
"rom/vmlinuz mem=64M console=tty0 "
.. "l4x_rd=rom/ramdisk-" .. L4.Info.arch() .. ".rd "
.. "root=1:0 ramdisk_size=5000");

View File

@@ -0,0 +1,33 @@
-- vi:ft=lua
local hw = Io.system_bus()
Io.add_vbusses
{
input = Io.Vi.System_bus
{
ps2dev = wrap(hw:match("PNP0[3F]??"));
};
fbdrv = Io.Vi.System_bus
{
PCI0 = Io.Vi.PCI_bus_ident
{
dummy = Io.Vi.PCI_dummy_device();
pci_gfx = wrap(hw:match("PCI/display"));
};
x1 = wrap(hw:match("BIOS"));
x2 = wrap(hw:match("PNP0900"));
x3 = wrap(hw:match("PNP0100"));
};
l4linux = Io.Vi.System_bus
{
-- Add a new virtual PCI root bridge
PCI0 = Io.Vi.PCI_bus
{
pci_l4x = wrap(hw:match("PCI/network", "PCI/storage", "PCI/media"));
};
};
}

View File

@@ -0,0 +1,11 @@
-- vim:set ft=lua:
local L4 = require("L4");
L4.default_loader:start(
{
log = L4.Env.log,
}, "rom/vmlinuz mem=64M console=ttyLv0 "
.. "l4x_rd=rom/ramdisk-" .. L4.Info.arch() .. ".rd "
.. (L4.Info.arch() == "arm64" and "l4x_dtb=rom/simple.dtb " or "")
.. "root=1:0 ramdisk_size=5000");

View File

@@ -0,0 +1,13 @@
-- vi:ft=lua
local hw = Io.system_bus()
Io.add_vbusses
{
vbus = Io.Vi.System_bus(function ()
Property.num_msis = 26
PCI = Io.Vi.PCI_bus(function ()
pci_bus = wrap(hw:match("PCI/network", "PCI/storage", "PCI/media"));
end)
end)
}

View File

@@ -0,0 +1,61 @@
-- vim:set ft=lua:
local L4 = require("L4");
local l = L4.default_loader;
-- start console server
local cons = l:new_channel();
l:start({ caps = { cons = cons:svr(); },
log = L4.Env.log
},
"rom/cons -a");
l.log_fab = cons;
-- start io server
local vbus = l:new_channel();
l:start({
caps = {
vbus = vbus:svr(),
icu = L4.Env.icu,
iommu = L4.Env.iommu,
sigma0 = L4.Env.sigma0,
},
log = { "IO", "y" },
l4re_dbg = L4.Dbg.Warn,
},
"rom/io rom/pci.io");
local flags = L4.Mem_alloc_flags.Continuous
| L4.Mem_alloc_flags.Pinned
| L4.Mem_alloc_flags.Super_pages;
local align = 28;
local dt;
local overlay
if (L4.Info.arch() == "arm64") then
dt = "-drom/.fdt"
overlay = "-drom/virt-pci.dtb"
else
dt = "-drom/virt-pci.dtb"
end
local serialdev = { arm = "ttyAMA0", arm64 = "ttyAMA0", amd64 = "ttyS0" };
l:startv({
caps = {
ram = L4.Env.user_factory:create(L4.Proto.Dataspace,
256 * 1024 * 1024,
flags, align):m("rw"),
vbus = vbus
},
log = { "vm", "Blue" },
},
"rom/uvmm", "-v",
"-krom/linux",
"-rrom/ramdisk.cpio.gz",
dt, overlay,
"-cconsole=" .. serialdev[L4.Info.arch()] .. " rw");

View File

@@ -0,0 +1,26 @@
-- vim:set ft=lua:
local L4 = require("L4");
local l = L4.default_loader;
local flags = L4.Mem_alloc_flags.Continuous
| L4.Mem_alloc_flags.Pinned
| L4.Mem_alloc_flags.Super_pages;
local align = 21;
local serialdev = { arm = "ttyAMA0", arm64 = "ttyAMA0", amd64 = "ttyS0", riscv = "ttyS0" };
l:startv({
caps = {
ram = L4.Env.user_factory:create(L4.Proto.Dataspace,
128 * 1024 * 1024,
flags, align):m("rw"),
},
log = L4.Env.log,
},
"rom/uvmm", "-v",
"-krom/linux",
"-rrom/ramdisk.cpio.gz",
"-drom/virt.dtb",
"-cconsole=" .. serialdev[L4.Info.arch()] .. " rw");

View File

@@ -0,0 +1,51 @@
-- vim:set ft=lua:
local L4 = require("L4");
local l = L4.default_loader;
local cons = l:new_channel();
l:start({ caps = { cons = cons:svr(); },
log = L4.Env.log
},
"rom/cons -a");
l.log_fab = cons;
local p2p = l:new_channel();
l:start({
caps = { svr = p2p:svr() },
log = { "p2p", "Blue" }
},
"rom/l4vio_net_p2p" );
local ports = {}
ports[1] = p2p:create(0, "ds-max=4")
ports[2] = p2p:create(0, "ds-max=4")
local serialdev = { arm = "ttyAMA0", arm64 = "ttyAMA0", amd64 = "ttyS0", riscv = "ttyS0" };
function start_vm(num, port)
local flags = L4.Mem_alloc_flags.Continuous
| L4.Mem_alloc_flags.Pinned
| L4.Mem_alloc_flags.Super_pages;
local align = 21;
l:startv({
caps = {
ram = L4.Env.user_factory:create(L4.Proto.Dataspace,
128 * 1024 * 1024,
flags, align):m("rw"),
net = port
},
log = { "vm-" .. num, "", "key=" .. num },
},
"rom/uvmm", "-v",
"-krom/linux",
"-rrom/ramdisk.cpio.gz",
"-drom/virt.dtb",
"-cconsole=" .. serialdev[L4.Info.arch()] .. " rw");
end
start_vm(1, ports[1])
start_vm(2, ports[2])

View File

@@ -0,0 +1,40 @@
-- vim:set ft=lua:
local L4 = require("L4");
local l = L4.default_loader;
local cons = l:new_channel();
l:start({ caps = { cons = cons:svr(); },
log = L4.Env.log
},
"rom/cons -a");
l.log_fab = cons;
local serialdev = { arm = "ttyAMA0", arm64 = "ttyAMA0", amd64 = "ttyS0", riscv = "ttyS0" };
function start_vm(num)
local flags = L4.Mem_alloc_flags.Continuous
| L4.Mem_alloc_flags.Pinned
| L4.Mem_alloc_flags.Super_pages;
local align = 21;
l:startv({
caps = {
ram = L4.Env.user_factory:create(L4.Proto.Dataspace,
128 * 1024 * 1024,
flags, align):m("rw"),
},
log = { "vm-" .. num, "", "key=" .. num },
},
"rom/uvmm", "-v",
"-krom/linux",
"-rrom/ramdisk.cpio.gz",
"-drom/virt.dtb",
"-cconsole=" .. serialdev[L4.Info.arch()] .. " rw");
end
start_vm(1)
start_vm(2)
start_vm(3)

View File

@@ -0,0 +1,69 @@
-- vim:set ft=lua:
-- This script shall start mag. For that we need a frame-buffer and io to
-- get access to the required hardware resources. Target platform is x86.
local L4 = require("L4");
local l = L4.default_loader;
local io_buses =
{
gui = l:new_channel();
fbdrv = l:new_channel();
};
l:start({
caps = {
icu = L4.Env.icu,
sigma0 = L4.Env.sigma0,
gui = io_buses.gui:svr(),
fbdrv = io_buses.fbdrv:svr(),
},
log = { "IO", "y" },
l4re_dbg = L4.Dbg.Warn,
},
"rom/io rom/x86-legacy.devs rom/x86-fb.io");
-- Start fb-drv (but only if we need to)
local fbdrv_fb = L4.Env.vesa;
if (not fbdrv_fb) then
fbdrv_fb = l:new_channel();
l:start({
caps = {
vbus = io_buses.fbdrv,
fb = fbdrv_fb:svr(),
},
log = { "fbdrv", "r" },
},
"rom/fb-drv");
end
local mag_caps = {
mag = l:new_channel(),
svc = l:new_channel(),
};
l:start({
caps = {
vbus = io_buses.gui,
fb = fbdrv_fb,
mag = mag_caps.mag:svr(),
svc = mag_caps.svc:svr(),
},
log = { "mag", "g" },
l4re_dbg = L4.Dbg.Warn,
-- scheduler = L4.Env.user_factory:create(L4.Proto.Scheduler, 0xa0, 0x80),
},
"rom/mag");
e = l:start({ caps = {
fb = mag_caps.svc:create(L4.Proto.Goos, "g=640x480"),
},
log = { "spectrum", "b" },
l4re_dbg = L4.Dbg.Warn,
-- scheduler = L4.Env.user_factory:create(L4.Proto.Scheduler, 0x18, 0x8),
},
"rom/ex_fb_spectrum_cc");
print("ex_fb_spectrum exited with: " .. e:wait());

View File

@@ -0,0 +1,23 @@
-- vim:set ft=lua:
-- configuration file for io
local hw = Io.system_bus()
Io.add_vbus("gui", Io.Vi.System_bus
{
ps2 = wrap(hw:match("PNP0[3F]??"));
})
Io.add_vbus("fbdrv", Io.Vi.System_bus
{
PCI0 = Io.Vi.PCI_bus_ident
{
dummy = Io.Vi.PCI_dummy_device();
pci = wrap(hw:match("PCI/display"));
};
bios = wrap(hw:match("BIOS"));
dev1 = wrap(hw:match("PNP0900"));
dev2 = wrap(hw:match("PNP0100"));
})

209
src/l4/conf/modules.list Normal file
View File

@@ -0,0 +1,209 @@
# vim:set ft=l4mods:
# Module configuration file for single image mode
#
# kernel, sigma0 and moe are always loaded automatically
#
# add kernel command line arguments with
# kernel fiasco arguments...
# the second argument (here 'fiasco') is the binary name
#
# add sigma command line arguments with
# sigma0 sigma0 arguments...
# the second argument (here 'sigma0') is the binary name
#
# add roottask command line arguments with
# roottask moe arguments...
# the second argument (here 'moe') is the binary name
#
# modaddr: address where modules start, relative to begin of RAM
# this statement is either global (before first entry statement)
# or per entry
#
# 'module' variants
# - module file: add file
# - module[uncompress] module name: uncompress module (gzip) before adding it
# - module[glob] /some/path/*.foo: add all file matching
# - module[perl] perl-code: Perl code returns array of files to include
# - module[shell] shell-code: Return list of files to include
# - module[fname=FOO] /some/path/bar: The file 'bar' will be added as the
# module named 'FOO'.
# - moe file.cfg: expands to
# roottask moe rom/file.cfg
# module file.cfg
#
# Modules can have an arbitrary number of attributes (key-value-pairs). The
# attribute key must be prefixed by 'attr:':
# - module[attr:nodes=0-3]: The attribute 'nodes' with the value '0-3'
#
# Define a module group:
# group oftenneedthose
# module one
# module two
# module ...
#
# Use a module group:
# entry someentry
# module-group oftenneedthose
#
# Include other module list files:
# include /path/to/other.list
#
# Set defaults:
# - default-kernel: set default kernel including arguments
# - default-sigma0: set default sigma0 including arguments
# - default-roottask: set default roottask including arguments
modaddr 0x01100000
default-kernel fiasco -serial_esc
default-bootstrap bootstrap
entry hello
roottask moe --init=rom/hello
module l4re
module hello
entry hello-cfg
kernel fiasco -serial_esc
roottask moe rom/hello.cfg
module l4re
module ned
module hello.cfg
module hello
entry hello-2
kernel fiasco -serial_esc
roottask moe rom/hello-2.cfg
module l4re
module ned
module hello-2.cfg
module hello
entry hello-shared
roottask moe --init=rom/ex_hello_shared
module l4re
module ex_hello_shared
entry[arch=x86|amd64] framebuffer-example
roottask moe rom/x86-fb.cfg
module x86-fb.cfg
module l4re
module ned
module io
module io/x86-legacy.devs
module x86-fb.io
module fb-drv
module mag
module ex_fb_spectrum_cc
entry[arch=x86|amd64|arm|arm64] L4Linux-basic
roottask moe rom/l4lx.cfg
module l4lx.cfg
module l4re
module ned
module[arch=arm64] arch/l4/boot/dts/simple.dtb
module[uncompress] vmlinuz
module[perl] "ramdisk-$ENV{ARCH}.rd"
entry[arch=x86|amd64] L4Linux-mag
moe l4lx-gfx.cfg
module l4re
module ned
module io
module fb-drv
module mag
module io/x86-legacy.devs
module l4lx-x86.io
module[uncompress] vmlinuz
module[perl] "ramdisk-$ENV{ARCH}.rd"
entry[arch=arm|arm64|amd64|riscv] VM-basic
moe vm-basic.cfg
module l4re
module ned
module uvmm
module[arch=arm,fname=virt.dtb] dtb/virt-arm_virt-32.dtb
module[arch=arm64,fname=virt.dtb] dtb/virt-arm_virt-64.dtb
module[arch=amd64,fname=virt.dtb] dtb/virt-pc.dtb
module[arch=riscv,bits=32,fname=virt.dtb] dtb/virt-riscv32.dtb
module[arch=riscv,bits=64,fname=virt.dtb] dtb/virt-riscv64.dtb
module[arch=arm,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm32/zImage-6.6.8
module[arch=arm64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm64/Image-6.6.8
module[arch=amd64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/x86-64/bzImage-6.6.8
module[arch=riscv,bits=64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/riscv64/Image-6.11.4.gz
module[arch=arm,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv7.cpio.gz
module[arch=arm64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv8-64.cpio.gz
module[arch=amd64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-amd64.cpio.gz
module[arch=riscv,bits=64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-riscv64.cpio.gz
entry[arch=arm|arm64|amd64|riscv] VM-multi
moe vm-multi.cfg
module l4re
module ned
module cons
module uvmm
module[arch=arm,fname=virt.dtb] dtb/virt-arm_virt-32.dtb
module[arch=arm64,fname=virt.dtb] dtb/virt-arm_virt-64.dtb
module[arch=amd64,fname=virt.dtb] dtb/virt-pc.dtb
module[arch=riscv,bits=32,fname=virt.dtb] dtb/virt-riscv32.dtb
module[arch=riscv,bits=64,fname=virt.dtb] dtb/virt-riscv64.dtb
module[arch=arm,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm32/zImage-6.6.8
module[arch=arm64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm64/Image-6.6.8
module[arch=amd64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/x86-64/bzImage-6.6.8
module[arch=riscv,bits=64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/riscv64/Image-6.11.4.gz
module[arch=arm,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv7.cpio.gz
module[arch=arm64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv8-64.cpio.gz
module[arch=amd64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-amd64.cpio.gz
module[arch=riscv,bits=64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-riscv64.cpio.gz
entry[arch=arm|arm64|amd64|riscv] VM-multi-p2p
moe vm-multi-p2p.cfg
module l4re
module ned
module cons
module l4vio_net_p2p
module uvmm
module[arch=arm,fname=virt.dtb] dtb/virt-arm_virt-32.dtb
module[arch=arm64,fname=virt.dtb] dtb/virt-arm_virt-64.dtb
module[arch=amd64,fname=virt.dtb] dtb/virt-pc.dtb
module[arch=riscv,bits=32,fname=virt.dtb] dtb/virt-riscv32.dtb
module[arch=riscv,bits=64,fname=virt.dtb] dtb/virt-riscv64.dtb
module[arch=arm,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm32/zImage-6.6.8
module[arch=arm64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm64/Image-6.6.8
module[arch=amd64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/x86-64/bzImage-6.6.8
module[arch=riscv,bits=64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/riscv64/Image-6.11.4.gz
module[arch=arm,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv7.cpio.gz
module[arch=arm64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv8-64.cpio.gz
module[arch=amd64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-amd64.cpio.gz
module[arch=riscv,bits=64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-riscv64.cpio.gz
entry[arch=arm|arm64|amd64] VM-basic-pci
moe vm-basic-pci.cfg
module l4re
module ned
module cons
module io
module[arch=arm|arm64,fname=pci.io] arm-virt64.io
module[arch=amd64] pci.io
module uvmm
module[arch=arm, fname=virt-pci.dtb] dtb/virt-arm_virt-64_pci.dtb
module[arch=arm64,fname=virt-pci.dtb] dtb/virt-arm_virt-64_pci.dtb
module[arch=amd64,fname=virt-pci.dtb] dtb/virt-pc.dtb
module[arch=arm,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm32/zImage-6.6.8
module[arch=arm64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/arm64/Image-6.6.8
module[arch=amd64,fname=linux,nostrip] https://l4re.org/download/Linux-kernel/x86-64/bzImage-6.6.8
module[arch=arm,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv7.cpio.gz
module[arch=arm64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-armv8-64.cpio.gz
module[arch=amd64,fname=ramdisk.cpio.gz] https://l4re.org/download/ramdisks/ramdisk-amd64.cpio.gz
entry ipcbench
roottask moe rom/ipcbench.cfg
module l4re
module ned
module ipcbench
module ipcbench_client
module ipcbench_server
module ipcbench_parallel
module syscallbench
module syscallbench_parallel
module ned/ipcbench/ipcbench.cfg

View File

@@ -0,0 +1 @@
Put your own local platform configuration files in this directory.

10
src/l4/conf/test/README Normal file
View File

@@ -0,0 +1,10 @@
Standard configuration files for test setups.
Test configurations expect a number of environment variables to be set up.
Within the test framework this is done by the test execution script,
which creates a second lua config with the variables.
The following variables are defined:
TEST_PROG - name of executable containing test
REQUIRED_MODULES - list of additional modules loaded (filename only)

View File

@@ -0,0 +1,209 @@
-- SPDX-License-Identifier: GPL-2.0-only or License-Ref-kk-custom
-- Copyright (C) 2020 Kernkonzept GmbH.
-- Author: Philipp Eppelt <philipp.eppelt@kernkonzept.com>
--
--
-- Usage note:
-- If you use this library you must abort further program startup if any of the
-- used functions return false.
-- In this case the library already printed a TAP TEST START - TAP TEST FINISH
-- block, which a) can lead to program termination from the outside, b)
-- further TAP blocks will be ignored by the infrastructure, c) additional
-- messages are likely not picked up by the infrastructure.
--
-- Errors during usage of this library will print a TAP block containing a
-- 'not ok' line with the error message.
-- A failure of a HWconfig check will print a TAP block containing an 'ok-skip'
-- line with the failed check.
local t = require("rom/test_env")
local conf = t.FULLCONFIG
local function print_tap_start()
print "TAP TEST START"
end
local function print_tap_finish()
print "TAP TEST FINISH"
end
local function print_tap_skip_line(reason)
skip_msg = "1..0 # SKIP"
if type(reason) == "string" then
skip_msg = skip_msg .. " - " .. reason
end
print(skip_msg)
end
-- Print a failure message in TAP format. Use this instead of error().
--
-- error() terminates the program and leaves the TAP infrastructure waiting
-- until the timeout hits. Instead of waiting, we print a failure message in
-- TAP format, such that other tests can progress and the failure is recorded.
local function print_tap_failure(reason)
local failure_msg = "1..1\nnot ok lib-test-setup - "
if type(reason) == "string" then
failure_msg = failure_msg .. reason
end
print_tap_start()
print(failure_msg)
print_tap_finish()
end
-- print the reason to skip the test in TAP format
local function print_tap_skip(msg)
print_tap_start()
print_tap_skip_line(msg)
print_tap_finish()
end
-- Check for HWconfig and print default TAP messages if not.
local function conf_present()
if conf == nil then
print_tap_skip("Hardware configuration unknown (see TEST_HWCONFIG)")
return false
end
return true
end
local function conf_prop(prop, val)
if type(prop) ~= "string" or type(val) ~= "boolean" then
print_tap_failure("conf_prop: Property must be of type string.")
return false
end
-- convention with HWconfig: every property is upper case
prop = string.upper(prop)
if val and conf[prop] ~= "y" then
print_tap_skip("Hardware does not support property " .. prop .. " (see TEST_HWCONFIG)")
return false
elseif not val and conf[prop] == "y" then
print_tap_skip("Hardware supports property " .. prop .. " (see TEST_HWCONFIG)")
return false;
end
return true
end
-- A property `prop` is set to "y".
-- pre: present() == true
-- param: prop = string
local function conf_prop_set(prop)
return conf_prop(prop, true)
end
-- A property `prop` is set to "n".
-- pre: present() == true
-- param: prop = string
local function conf_prop_unset(prop)
return conf_prop(prop, false)
end
-- All of the passed properties are set to "y".
-- pre: present() == true
-- param: ... = string
local function conf_props_set(...)
for _, prop in pairs({...}) do
if not conf_prop_set(prop) then
return false
end
end
return true
end
-- All of the passed properties are set to "n".
-- pre: present() == true
-- param: ... = string
local function conf_props_unset(...)
for _, prop in pairs({...}) do
if not conf_prop_unset(prop) then
return false
end
end
return true
end
-- A property `prop` compares to value used in `prop_test_fn`.
-- pre: present() == true
-- param: prop = string
-- param: prop_test_fn = function testing the property
--
-- returns: comparison result and error_msg.
local function prop_val_cmp(prop, prop_test_fn)
if type(prop) ~= "string" then
print_tap_failure("prop_val_cmp: Property must be of type string.")
return false
end
if type(prop_test_fn) ~= "function" then
print_tap_failure("prop_val_cmp: Compare function must be of type function.")
return false
end
-- convention with HWconfig: every property is upper case
prop = string.upper(prop)
if (conf[prop] == nil) then
print_tap_skip("Hardware does not feature property " .. prop .. " (see TEST_HWCONFIG)")
return false
end
if not prop_test_fn(conf[prop]) then
print_tap_skip("Hardware provides " .. prop .. " = " .. conf[prop] .. ". "
.. "This does not satisfy the requested property value (see TEST_HWCONFIG)")
return false
end
return true
end
-- A property `prop` compares to value used in `prop_test_fn`.
-- pre: present() == true
-- param: prop = string
-- param: prop_test_fn = function testing the property
--
-- usage:
-- ret = conf_prop_val_cmp(num_cpus, function (v1) return v1 > 1 end)
local function conf_prop_val_cmp(prop, prop_test_fn)
return prop_val_cmp(prop, prop_test_fn)
end
-- All of the passed property-comparator-pairs are satisfied.
--
-- usage:
-- conf_props_values_cmp({ ["num_cpus"] = function (v) return v == 1 end,
-- ["FOO"] = prop_test_fnB })
local function conf_props_values_cmp(...)
local _, tbl = pairs({...})
if type(tbl) ~= "table" then
print_tap_failure("conf_props_values_cmp: Parameter must be of type table.")
return false
end
for prop, fn in pairs(tbl) do
if not prop_val_cmp(prop, fn) then
return false
end
end
return true
end
return {
print_tap_start = print_tap_start,
print_tap_finish = print_tap_start,
print_tap_skip_line = print_tap_skip_line,
print_tap_skip = print_tap_skip,
conf_prop_set = conf_prop_set,
conf_prop_unset = conf_prop_unset,
conf_props_set = conf_props_set,
conf_props_unset = conf_props_unset,
conf_present = conf_present,
conf_prop_val = conf_prop_val_cmp,
conf_props_vals = conf_props_values_cmp
}

View File

@@ -0,0 +1,17 @@
-- vim:set ft=lua:
-- Starts the test program and all applications from the required modules list
-- independently without creating any communication channels.
local t = require("rom/test_env")
local L4 = require("L4");
for k,v in ipairs(t.REQUIRED_MODULES) do
L4.default_loader:start({}, "rom/" .. v);
end
-- The pfc cap is passed in to allow the test to reboot the machine once it
-- finishes. Rebooting only happens if the test arguments contain the -b switch.
L4.default_loader:start({ caps = {pfc = L4.Env.icu} }, "rom/" .. t.TEST_PROG);

View File

@@ -0,0 +1,13 @@
-- vim:set ft=lua:
-- Simple configuration that starts exactly one server.
-- load the test_env module which provides additional test environment variables
local t = require("rom/test_env")
local L4 = require("L4");
-- The pfc cap is passed in to allow the test to reboot the machine once it
-- finishes. Rebooting only happens if the test arguments contain the -b switch.
L4.default_loader:start({ caps = {pfc = L4.Env.icu, jdb = L4.Env.jdb} },
"rom/" .. t.TEST_PROG);

View File

@@ -0,0 +1 @@
.*TAP TEST FINISHED