2
0
Fork 0

Use Genode.Boot.Rom type when building test images

This commit is contained in:
Emery Hemingway 2020-01-23 18:15:32 +01:00
parent 2c1ace9a2a
commit 3aba7ac2c2
17 changed files with 131 additions and 89 deletions

View File

@ -5,25 +5,39 @@ let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let Args =
{ config : Genode.Init.Type, rom : Genode.Prelude.Map.Type Text Text }
{ config : Genode.Init.Type
, rom : Genode.Prelude.Map.Type Text Genode.Boot.Rom
}
: Type
in λ(args : Args)
→ let addLink =
λ(e : Prelude.Map.Entry Text Text)
→ λ(script : Text)
→ script ++ "ln -s ${Text/show e.mapValue} ${Text/show e.mapKey}\n"
let RomEntry = Prelude.Map.Entry Text Genode.Boot.Rom
let links =
Prelude.List.fold
(Prelude.Map.Entry Text Text)
let addLine =
λ(e : RomEntry)
→ λ(script : Text)
→ merge
{ RomText =
λ(rom : Text)
→ ''
${script}
echo ${Text/show rom} > ${Text/show e.mapKey}
''
, RomPath =
λ(rom : Text)
→ ''
${script}
ln -s ${Text/show rom} ${Text/show e.mapKey}
''
}
e.mapValue
in λ(args : Args)
→ Prelude.List.fold
RomEntry
args.rom
Text
addLink
""
in ''
addLine
''
#!/bin/sh
${links}
echo ${Text/show (Genode.Init.render args.config)} > config
''

View File

@ -4,11 +4,12 @@ let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let RomMap = Prelude.Map.Type Text Genode.Boot.Rom
let RomEntry = Prelude.Map.Entry Text Genode.Boot.Rom
let Configuration =
{ arch : < x86_32 | x86_64 >
, config : Genode.Init.Type
, rom : Prelude.Map.Type Text Text
}
{ arch : < x86_32 | x86_64 >, config : Genode.Init.Type, rom : RomMap }
: Type
in λ ( boot
@ -19,23 +20,26 @@ in λ ( boot
let TextIndex = { index : Text, value : Text }
let moduleKeys =
let keys = Prelude.Map.keys Text Text boot.rom
let rom =
[ { mapKey = "config"
, mapValue =
Genode.Boot.Rom.RomText (Genode.Init.render boot.config)
}
]
# boot.rom
in [ "config" ] # keys
let moduleKeys = Prelude.Map.keys Text Genode.Boot.Rom rom
let moduleValues =
let values = Prelude.Map.values Text Text boot.rom
let f =
λ(e : RomEntry)
→ merge
{ RomText = λ(text : Text) → ".ascii ${Text/show text}"
, RomPath = λ(path : Text) → ".incbin ${Text/show path}"
}
e.mapValue
let incbin =
Prelude.List.map
Text
Text
(λ(path : Text) → ".incbin ${Text/show path}")
values
in [ ".ascii ${Text/show (Genode.Init.render boot.config)}" ]
# incbin
in Prelude.List.map RomEntry Text f rom
let map =
λ(list : List Text)
@ -47,7 +51,7 @@ in λ ( boot
NaturalIndex
TextIndex
( λ(x : NaturalIndex)
→ { index = Prelude.Natural.show (x.index + 1)
→ { index = Prelude.Natural.show x.index
, value = x.value
}
)
@ -66,7 +70,9 @@ in λ ( boot
in ''
.set MIN_PAGE_SIZE_LOG2, 12
.set DATA_ACCESS_ALIGNM_LOG2, 3
.section .data
.p2align DATA_ACCESS_ALIGNM_LOG2
.global _boot_modules_headers_begin
_boot_modules_headers_begin:
@ -94,6 +100,7 @@ in λ ( boot
_boot_module_${m.index}_name:
.string "${m.value}"
.byte 0
''
)
++ ''

View File

@ -2,7 +2,9 @@
let Genode = env:DHALL_GENODE
let Args =
{ config : Genode.Init.Type, rom : Genode.Prelude.Map.Type Text Text }
{ config : Genode.Init.Type
, rom : Genode.Prelude.Map.Type Text Genode.Boot.Rom
}
: Type
in λ(args : Args)
@ -29,7 +31,8 @@ in λ(args : Args)
let os = env:OS_MANIFEST
in [ { mapKey = "ld.lib.so"
in Genode.Boot.toRomPaths
[ { mapKey = "ld.lib.so"
, mapValue = baseLinux.bin.ld-linux.mapValue
}
, baseLinux.bin.linux_timer_drv
@ -37,4 +40,5 @@ in λ(args : Args)
, baseLinux.bin.core-linux
]
# args.rom
: Genode.Prelude.Map.Type Text Genode.Boot.Rom
}

View File

@ -70,7 +70,6 @@ let
global env
set env(XDG_CACHE_HOME) /tmp
puts "${apps.linux-image.program} ${./driver-linux-config.dhall} ${testConfig}"
exec ${apps.linux-image.program} \
${./driver-linux-config.dhall} ${testConfig}

View File

@ -2,9 +2,11 @@
let Genode = env:DHALL_GENODE
let Args =
{ config : Genode.Init.Type, rom : Genode.Prelude.Map.Type Text Text }
: Type
let Prelude = Genode.Prelude
let RomMap = Prelude.Map.Type Text Genode.Boot.Rom
let Args = { config : Genode.Init.Type, rom : RomMap } : Type
in λ(args : Args)
→ { arch = let Arch = < x86_32 | x86_64 > in Arch.x86_64
@ -65,7 +67,8 @@ in λ(args : Args)
let sotest = env:SOTEST_PRODUCER_MANIFEST
in [ { mapKey = "ld.lib.so"
in Genode.Boot.toRomPaths
[ { mapKey = "ld.lib.so"
, mapValue = baseNova.lib.ld-nova.mapValue
}
, baseNova.bin.nova_timer_drv

View File

@ -130,20 +130,21 @@ let
inherit driver iso test;
config = hostPkgs.runCommand (name + ".dhall") env' ''
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
${apps.dhall.program} <<< "(${
./driver-nova-config.dhall
} ${testConfig})" > $out
'';
xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
${apps.render-init.program} "(${
./driver-nova-config.dhall
} ${testConfig}).config" > $out'';
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
${apps.nova-image.program} image.elf \
${./driver-nova-config.dhall} ${testConfig}
${apps.nova-image.program} image.elf "${./driver-nova-config.dhall} ${testConfig}"
cp "${testPkgs.bender}" bender
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
mkdir -p $out/nix-support

View File

@ -16,5 +16,8 @@ in { config =
}
}
}
, rom = let base = env:BASE_MANIFEST in [ base.bin.test-log ]
, rom =
let base = env:BASE_MANIFEST
in Genode.Boot.toRomPaths [ base.bin.test-log ]
}

View File

@ -76,7 +76,8 @@ in { config =
, rom =
let os = env:OS_MANIFEST
in [ os.bin.acpi_drv
in Genode.Boot.toRomPaths
[ os.bin.acpi_drv
, os.bin.platform_drv
, os.bin.report_rom
, os.bin.test-pci

View File

@ -25,5 +25,8 @@ in { config =
}
}
}
, rom = let os = env:OS_MANIFEST in [ os.bin.test-rtc, os.bin.rtc_drv ]
, rom =
let os = env:OS_MANIFEST
in Genode.Boot.toRomPaths [ os.bin.test-rtc, os.bin.rtc_drv ]
}

View File

@ -16,5 +16,8 @@ in { config =
}
}
}
, rom = let os = env:OS_MANIFEST in [ os.bin.test-signal ]
, rom =
let os = env:OS_MANIFEST
in Genode.Boot.toRomPaths [ os.bin.test-signal ]
}

View File

@ -34,5 +34,6 @@ in { config =
}
}
}
, rom = [ tests.bin.solo5-test_blk, os.bin.ram_block ]
, rom =
Genode.Boot.toRomPaths [ tests.bin.solo5-test_blk, os.bin.ram_block ]
}

View File

@ -4,9 +4,11 @@ let Genode = env:DHALL_GENODE
let solo5 = env:SOLO5_MANIFEST
let Args =
{ config : Genode.Init.Type, rom : Genode.Prelude.Map.Type Text Text }
: Type
let RomMap = Genode.Prelude.Map.Type Text Genode.Boot.Rom
let Args = { config : Genode.Init.Type, rom : RomMap } : Type
in λ(boot : Args)
→ { config = boot.config, rom = boot.rom # [ solo5.lib.solo5 ] }
→ { config = boot.config
, rom = Genode.Boot.toRomPaths [ solo5.lib.solo5 ] # boot.rom
}

View File

@ -56,6 +56,7 @@ let
testScript = ''
run_genode_until {child "ping" exited with exit value 0} 30
'';
qemuMem = 64;
}
{

View File

@ -43,9 +43,7 @@ in { config =
, config =
Some
( Genode.Prelude.XML.text
''
<config><cmdline>limit</cmdline></config>
''
"<config><cmdline>limit</cmdline></config>"
)
}
, ping =
@ -73,6 +71,7 @@ in { config =
}
}
, rom =
Genode.Boot.toRomPaths
[ os.bin.nic_loopback
, os.bin.nic_bridge
, os.bin.ping

View File

@ -77,6 +77,7 @@ in { config =
}
}
, rom =
Genode.Boot.toRomPaths
[ tests.bin.solo5-test_net_2if
, os.bin.sequence
, os.bin.nic_bridge

View File

@ -35,5 +35,5 @@ in λ(testBinary : Genode.Prelude.Map.Entry Text Text)
}
}
}
, rom = [ testBinary ]
, rom = Genode.Boot.toRomPaths [ testBinary ]
}

View File

@ -29,5 +29,5 @@ in { config =
}
}
}
, rom = [ test, os.bin.rtc_drv ]
, rom = Genode.Boot.toRomPaths [ test, os.bin.rtc_drv ]
}