Write boot image configuration to file during compilation
Sometimes ld chokes on complex XML renderings.
This commit is contained in:
parent
19dccc4862
commit
2aab55dc38
|
@ -39,8 +39,20 @@ in nixpkgs.writeScriptBin "hw-image" (with nixpkgs.buildPackages;
|
||||||
"$lib" "$TMPDIR/boot_modules.o"
|
"$lib" "$TMPDIR/boot_modules.o"
|
||||||
cat a.out
|
cat a.out
|
||||||
}
|
}
|
||||||
set -v
|
|
||||||
${dhallApps.dhall.program} <<< "${../render-rom.dhall} ($@)" > "$TMPDIR/modules.dhall"
|
${dhallApps.dhall.program} text \
|
||||||
|
<<< "(env:DHALL_GENODE).Init.render ($@).config" \
|
||||||
|
| ${nixpkgs.buildPackages.libxml2}/bin/xmllint \
|
||||||
|
-schema ${packages.genode-sources}/repos/os/src/init/config.xsd - \
|
||||||
|
| sed 's/>/>/g' \
|
||||||
|
> $TMPDIR/config
|
||||||
|
|
||||||
|
${dhallApps.dhall.program} \
|
||||||
|
<<< "${../insert-config-rom.dhall} \"$TMPDIR/config\" ($@).rom" \
|
||||||
|
> "$TMPDIR/modules.dhall"
|
||||||
|
|
||||||
build_core "''${CORE_OBJ:-${base-hw-pc}/lib/core-hw-pc.o}" "$TMPDIR/modules.dhall" 0xffffffc000000000 > core.elf
|
build_core "''${CORE_OBJ:-${base-hw-pc}/lib/core-hw-pc.o}" "$TMPDIR/modules.dhall" 0xffffffc000000000 > core.elf
|
||||||
build_core "''${BOOTSTRAP_OBJ:-${base-hw-pc}/lib/bootstrap-hw-pc.o}" "${../to-rom.dhall} \"core.elf\" \"./core.elf\"" 0x00200000
|
build_core "''${BOOTSTRAP_OBJ:-${base-hw-pc}/lib/bootstrap-hw-pc.o}" "${
|
||||||
|
../to-rom.dhall
|
||||||
|
} \"core.elf\" \"./core.elf\"" 0x00200000
|
||||||
'')
|
'')
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
|
let BootModules = Genode.BootModules
|
||||||
|
|
||||||
|
in λ(configPath : Text)
|
||||||
|
→ λ(rom : Genode.BootModules.Type)
|
||||||
|
→ BootModules.toRomPaths (toMap { config = configPath }) # rom
|
|
@ -18,8 +18,18 @@ in nixpkgs.writeScriptBin "nova-image" (with nixpkgs.buildPackages;
|
||||||
|
|
||||||
export DHALL_PRELUDE=${packages.dhallPrelude}/package.dhall
|
export DHALL_PRELUDE=${packages.dhallPrelude}/package.dhall
|
||||||
export DHALL_GENODE=${packages.dhallGenode}/package.dhall
|
export DHALL_GENODE=${packages.dhallGenode}/package.dhall
|
||||||
${dhallApps.dhall.program} text <<< \
|
|
||||||
"(${../modules.as.dhall}).to64bitImage (${../render-rom.dhall} ($@))" \
|
${dhallApps.dhall.program} text \
|
||||||
|
<<< "(env:DHALL_GENODE).Init.render ($@).config" \
|
||||||
|
| ${nixpkgs.buildPackages.libxml2}/bin/xmllint \
|
||||||
|
-schema ${packages.genode-sources}/repos/os/src/init/config.xsd - \
|
||||||
|
| sed 's/>/>/g' \
|
||||||
|
> $TMPDIR/config
|
||||||
|
|
||||||
|
${dhallApps.dhall.program} text \
|
||||||
|
<<< "(${../modules.as.dhall}).to64bitImage (${
|
||||||
|
../insert-config-rom.dhall
|
||||||
|
} \"$TMPDIR/config\" ($@).rom)" \
|
||||||
> "$TMPDIR/modules.as"
|
> "$TMPDIR/modules.as"
|
||||||
|
|
||||||
# compile the boot modules into one object file
|
# compile the boot modules into one object file
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
nixpkgs.writeScriptBin "render-init" (with nixpkgs.buildPackages; ''
|
nixpkgs.writeScriptBin "render-init" (with nixpkgs.buildPackages; ''
|
||||||
#!${runtimeShell}
|
#!${runtimeShell}
|
||||||
set -eu
|
set -eu
|
||||||
if [ -z "$@" ]; then
|
|
||||||
echo "Error: a Dhall init configuration file must be passed as an argument - $0" > /dev/stderr
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export DHALL_PRELUDE=''${DHALL_PRELUDE:-${packages.dhallPrelude}/package.dhall}
|
export DHALL_PRELUDE=''${DHALL_PRELUDE:-${packages.dhallPrelude}/package.dhall}
|
||||||
export DHALL_GENODE=''${DHALL_GENODE:-${packages.dhallGenode}/package.dhall}
|
export DHALL_GENODE=''${DHALL_GENODE:-${packages.dhallGenode}/package.dhall}
|
||||||
${dhallApps.dhall.program} text \
|
${dhallApps.dhall.program} text \
|
||||||
<<< "(env:DHALL_GENODE).Init.render ($@)" \
|
<<< "(env:DHALL_GENODE).Init.render ($(cat))" \
|
||||||
| ${nixpkgs.buildPackages.libxml2}/bin/xmllint -format -
|
| ${nixpkgs.buildPackages.libxml2}/bin/xmllint \
|
||||||
|
-format \
|
||||||
|
-schema ${packages.genode-sources}/repos/os/src/init/config.xsd \
|
||||||
|
- \
|
||||||
|
| sed 's/>/>/g'
|
||||||
'')
|
'')
|
||||||
|
|
|
@ -29,22 +29,6 @@ in {
|
||||||
dhall text < $source > $out
|
dhall text < $source > $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
renderDhallInit = path: args:
|
|
||||||
hostPkgs.runCommand "init.xml" {
|
|
||||||
preferLocalBuild = true;
|
|
||||||
buildInputs = with hostPkgs; [ dhall libxml2 ];
|
|
||||||
initConfig = path;
|
|
||||||
initArgs = args;
|
|
||||||
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
|
|
||||||
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
|
|
||||||
} ''
|
|
||||||
export XDG_CACHE_HOME=$NIX_BUILD_TOP
|
|
||||||
dhall text \
|
|
||||||
<<< 'let Prelude = env:DHALL_GENODE in Prelude.Init.render (env:initConfig env:initArgs)' \
|
|
||||||
> $out
|
|
||||||
xmllint --noout $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
mergeManifests = inputs:
|
mergeManifests = inputs:
|
||||||
nixpkgs.legacyPackages.${localSystem}.writeTextFile {
|
nixpkgs.legacyPackages.${localSystem}.writeTextFile {
|
||||||
name = "manifest.dhall";
|
name = "manifest.dhall";
|
||||||
|
|
|
@ -17,16 +17,15 @@ let
|
||||||
callPackage' = path: attrs:
|
callPackage' = path: attrs:
|
||||||
addManifest (legacyPackages.callPackages path attrs);
|
addManifest (legacyPackages.callPackages path attrs);
|
||||||
|
|
||||||
buildUpstream = let
|
buildUpstream = let f = import ./genodelabs { nixpkgs = legacyPackages; };
|
||||||
f = import ./genodelabs {
|
|
||||||
nixpkgs = legacyPackages;
|
|
||||||
};
|
|
||||||
in args: addManifest (f args);
|
in args: addManifest (f args);
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
|
|
||||||
inherit (legacyPackages) stdenv;
|
inherit (legacyPackages) stdenv;
|
||||||
|
|
||||||
|
genode-sources = legacyPackages.callPackage ./genodelabs/sources.nix { };
|
||||||
|
|
||||||
base-hw-pc = buildUpstream {
|
base-hw-pc = buildUpstream {
|
||||||
name = "base-hw-pc";
|
name = "base-hw-pc";
|
||||||
KERNEL = "hw";
|
KERNEL = "hw";
|
||||||
|
@ -61,10 +60,7 @@ in rec {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
driversPc = let
|
driversPc = let directoryBlacklist = [ "repos/dde_zircon" ];
|
||||||
directoryBlacklist = [
|
|
||||||
"repos/dde_zircon"
|
|
||||||
];
|
|
||||||
in buildUpstream {
|
in buildUpstream {
|
||||||
name = "drivers";
|
name = "drivers";
|
||||||
BOARD = "pc";
|
BOARD = "pc";
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
commit c0a6db17001fb088d3289613a02660d8725bbde8
|
||||||
|
Author: Emery Hemingway <ehmry@posteo.net>
|
||||||
|
Date: Sat Feb 22 15:40:56 2020 +0100
|
||||||
|
|
||||||
|
Update Init config schema
|
||||||
|
|
||||||
|
- Add <exit propagate="…"/> to the Init schema
|
||||||
|
- Use a relative path for base_types.xsd
|
||||||
|
- Allow empty <provides/> nodes
|
||||||
|
- Allow "label" attributes within <parent-provides/>
|
||||||
|
|
||||||
|
diff --git a/repos/os/src/init/config.xsd b/repos/os/src/init/config.xsd
|
||||||
|
index 938dcdb8fb..e7bfb5dfc5 100644
|
||||||
|
--- a/repos/os/src/init/config.xsd
|
||||||
|
+++ b/repos/os/src/init/config.xsd
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
|
||||||
|
- <xs:include schemaLocation="base_types.xsd"/>
|
||||||
|
+ <xs:include schemaLocation="../../../base/xsd/base_types.xsd"/>
|
||||||
|
|
||||||
|
<xs:complexType name="template_service">
|
||||||
|
<xs:choice minOccurs="1" maxOccurs="3">
|
||||||
|
@@ -90,6 +90,7 @@
|
||||||
|
<xs:element name="service" minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="name" type="xs:string" />
|
||||||
|
+ <xs:attribute name="label" type="xs:string" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
@@ -160,6 +161,12 @@
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element> <!-- "resource" -->
|
||||||
|
|
||||||
|
+ <xs:element name="exit">
|
||||||
|
+ <xs:complexType>
|
||||||
|
+ <xs:attribute name="propagate" type="Boolean" />
|
||||||
|
+ </xs:complexType>
|
||||||
|
+ </xs:element> <!-- "exit" -->
|
||||||
|
+
|
||||||
|
<xs:element name="configfile">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="name" type="xs:string" />
|
||||||
|
@@ -168,7 +175,7 @@
|
||||||
|
|
||||||
|
<xs:element name="provides">
|
||||||
|
<xs:complexType>
|
||||||
|
- <xs:choice maxOccurs="unbounded">
|
||||||
|
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:element name="service">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="name" type="xs:string" />
|
|
@ -0,0 +1,10 @@
|
||||||
|
{ stdenv, genodeHeaders }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "genode-sources";
|
||||||
|
inherit (genodeHeaders) version src;
|
||||||
|
patches = [ ./init.xsd.patch ./svn-trust-server-cert.patch ];
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
installPhase = "cp -a . $out";
|
||||||
|
}
|
|
@ -143,7 +143,7 @@ let
|
||||||
iso = apps.hw-iso.function testEnv' testConfig';
|
iso = apps.hw-iso.function testEnv' testConfig';
|
||||||
|
|
||||||
xml = hostPkgs.runCommand (name + ".config") testEnv' ''
|
xml = hostPkgs.runCommand (name + ".config") testEnv' ''
|
||||||
${apps.render-init.program} "(${testConfig'}).config" > $out'';
|
${apps.render-init.program} <<< "(${testConfig'}).config" > $out'';
|
||||||
|
|
||||||
sotest = hostPkgs.runCommand "hw-${name}-sotest" testEnv' ''
|
sotest = hostPkgs.runCommand "hw-${name}-sotest" testEnv' ''
|
||||||
cp "${testPkgs.bender}" bender
|
cp "${testPkgs.bender}" bender
|
||||||
|
|
|
@ -104,7 +104,7 @@ let
|
||||||
${apps.dhall.program} <<< "(${testConfig'}).config" > $out
|
${apps.dhall.program} <<< "(${testConfig'}).config" > $out
|
||||||
'';
|
'';
|
||||||
xml = hostPkgs.runCommand (name + ".config") env' ''
|
xml = hostPkgs.runCommand (name + ".config") env' ''
|
||||||
${apps.render-init.program} "(${testConfig'}).config" > $out
|
${apps.render-init.program} <<< "(${testConfig'}).config" > $out
|
||||||
'';
|
'';
|
||||||
image = hostPkgs.runCommand (name + ".image.elf") env' ''
|
image = hostPkgs.runCommand (name + ".image.elf") env' ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
|
@ -144,7 +144,7 @@ let
|
||||||
iso = apps.nova-iso.function testEnv' "${testConfig'}";
|
iso = apps.nova-iso.function testEnv' "${testConfig'}";
|
||||||
|
|
||||||
xml = hostPkgs.runCommand (name + ".config") testEnv' ''
|
xml = hostPkgs.runCommand (name + ".config") testEnv' ''
|
||||||
${apps.render-init.program} "(${testConfig'}).config" > $out'';
|
${apps.render-init.program} <<< "(${testConfig'}).config" > $out'';
|
||||||
|
|
||||||
sotest = hostPkgs.runCommand "nova-${name}-sotest" testEnv' ''
|
sotest = hostPkgs.runCommand "nova-${name}-sotest" testEnv' ''
|
||||||
cp "${testPkgs.bender}" bender
|
cp "${testPkgs.bender}" bender
|
||||||
|
|
|
@ -38,7 +38,7 @@ in { config =
|
||||||
, constrainPhys = True
|
, constrainPhys = True
|
||||||
}
|
}
|
||||||
, provides = [ "Platform", "Acpi" ]
|
, provides = [ "Platform", "Acpi" ]
|
||||||
, romReports = [ label "acpi" ]
|
, romReports = [ label "acpi", label "smbios_table" ]
|
||||||
, routes =
|
, routes =
|
||||||
[ ServiceRoute.parent "IRQ"
|
[ ServiceRoute.parent "IRQ"
|
||||||
, ServiceRoute.parent "IO_MEM"
|
, ServiceRoute.parent "IO_MEM"
|
||||||
|
@ -77,7 +77,7 @@ in { config =
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let manifest = env:MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
in Genode.Boot.toRomPaths
|
in Genode.Boot.toRomPaths
|
||||||
[ manifest.drivers.bin.acpi_drv
|
[ manifest.drivers.bin.acpi_drv
|
||||||
, manifest.drivers.bin.platform_drv
|
, manifest.drivers.bin.platform_drv
|
||||||
|
|
Loading…
Reference in New Issue