Browse Source

Use Genode.Boot.Rom type when building test images

20.02
Emery Hemingway 2 years ago
parent
commit
3aba7ac2c2
  1. 52
      apps/linux-image/script.dhall
  2. 45
      apps/nova-image/nova-modules.as.dhall
  3. 22
      tests/driver-linux-config.dhall
  4. 1
      tests/driver-linux.nix
  5. 23
      tests/driver-nova-config.dhall
  6. 5
      tests/driver-nova.nix
  7. 5
      tests/log.dhall
  8. 11
      tests/pci.dhall
  9. 5
      tests/rtc.dhall
  10. 5
      tests/signal.dhall
  11. 3
      tests/solo5/blk.dhall
  12. 10
      tests/solo5/boot-wrapper.dhall
  13. 1
      tests/solo5/default.nix
  14. 15
      tests/solo5/net.dhall
  15. 13
      tests/solo5/net_2if.dhall
  16. 2
      tests/solo5/simple.dhall
  17. 2
      tests/solo5/time.dhall

52
apps/linux-image/script.dhall

@ -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
let RomEntry = Prelude.Map.Entry Text Genode.Boot.Rom
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)
→ let addLink =
λ(e : Prelude.Map.Entry Text Text)
→ λ(script : Text)
→ script ++ "ln -s ${Text/show e.mapValue} ${Text/show e.mapKey}\n"
let links =
Prelude.List.fold
(Prelude.Map.Entry Text Text)
args.rom
Text
addLink
""
in ''
#!/bin/sh
${links}
echo ${Text/show (Genode.Init.render args.config)} > config
''
→ Prelude.List.fold
RomEntry
args.rom
Text
addLine
''
#!/bin/sh
echo ${Text/show (Genode.Init.render args.config)} > config
''

45
apps/nova-image/nova-modules.as.dhall

@ -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
in [ "config" ] # keys
let rom =
[ { mapKey = "config"
, mapValue =
Genode.Boot.Rom.RomText (Genode.Init.render boot.config)
}
]
# boot.rom
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
''
)
++ ''

22
tests/driver-linux-config.dhall

@ -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,12 +31,14 @@ in λ(args : Args)
let os = env:OS_MANIFEST
in [ { mapKey = "ld.lib.so"
, mapValue = baseLinux.bin.ld-linux.mapValue
}
, baseLinux.bin.linux_timer_drv
, os.bin.init
, baseLinux.bin.core-linux
]
# args.rom
in Genode.Boot.toRomPaths
[ { mapKey = "ld.lib.so"
, mapValue = baseLinux.bin.ld-linux.mapValue
}
, baseLinux.bin.linux_timer_drv
, os.bin.init
, baseLinux.bin.core-linux
]
# args.rom
: Genode.Prelude.Map.Type Text Genode.Boot.Rom
}

1
tests/driver-linux.nix

@ -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}

23
tests/driver-nova-config.dhall

@ -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,12 +67,13 @@ in λ(args : Args)
let sotest = env:SOTEST_PRODUCER_MANIFEST
in [ { mapKey = "ld.lib.so"
, mapValue = baseNova.lib.ld-nova.mapValue
}
, baseNova.bin.nova_timer_drv
, os.bin.init
, sotest.bin.sotest-harness
]
in Genode.Boot.toRomPaths
[ { mapKey = "ld.lib.so"
, mapValue = baseNova.lib.ld-nova.mapValue
}
, baseNova.bin.nova_timer_drv
, os.bin.init
, sotest.bin.sotest-harness
]
# args.rom
}

5
tests/driver-nova.nix

@ -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

5
tests/log.dhall

@ -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 ]
}

11
tests/pci.dhall

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

5
tests/rtc.dhall

@ -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 ]
}

5
tests/signal.dhall

@ -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 ]
}

3
tests/solo5/blk.dhall

@ -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 ]
}

10
tests/solo5/boot-wrapper.dhall

@ -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
}

1
tests/solo5/default.nix

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

15
tests/solo5/net.dhall

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

13
tests/solo5/net_2if.dhall

@ -77,10 +77,11 @@ in { config =
}
}
, rom =
[ tests.bin.solo5-test_net_2if
, os.bin.sequence
, os.bin.nic_bridge
, os.bin.nic_loopback
, os.bin.ping
]
Genode.Boot.toRomPaths
[ tests.bin.solo5-test_net_2if
, os.bin.sequence
, os.bin.nic_bridge
, os.bin.nic_loopback
, os.bin.ping
]
}

2
tests/solo5/simple.dhall

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

2
tests/solo5/time.dhall

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

Loading…
Cancel
Save