2
0
Fork 0

Use Genode.Boot.Rom type when building test images

This commit is contained in:
Ehmry - 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 Prelude = Genode.Prelude
let Args = 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 : 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) in λ(args : Args)
→ let addLink = → Prelude.List.fold
λ(e : Prelude.Map.Entry Text Text) RomEntry
→ λ(script : Text) args.rom
→ script ++ "ln -s ${Text/show e.mapValue} ${Text/show e.mapKey}\n" Text
addLine
let links = ''
Prelude.List.fold #!/bin/sh
(Prelude.Map.Entry Text Text) echo ${Text/show (Genode.Init.render args.config)} > config
args.rom ''
Text
addLink
""
in ''
#!/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 Prelude = Genode.Prelude
let RomMap = Prelude.Map.Type Text Genode.Boot.Rom
let RomEntry = Prelude.Map.Entry Text Genode.Boot.Rom
let Configuration = let Configuration =
{ arch : < x86_32 | x86_64 > { arch : < x86_32 | x86_64 >, config : Genode.Init.Type, rom : RomMap }
, config : Genode.Init.Type
, rom : Prelude.Map.Type Text Text
}
: Type : Type
in λ ( boot in λ ( boot
@ -19,23 +20,26 @@ in λ ( boot
let TextIndex = { index : Text, value : Text } let TextIndex = { index : Text, value : Text }
let moduleKeys = let rom =
let keys = Prelude.Map.keys Text Text boot.rom [ { mapKey = "config"
, mapValue =
in [ "config" ] # keys Genode.Boot.Rom.RomText (Genode.Init.render boot.config)
}
]
# boot.rom
let moduleKeys = Prelude.Map.keys Text Genode.Boot.Rom rom
let moduleValues = 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 = in Prelude.List.map RomEntry Text f rom
Prelude.List.map
Text
Text
(λ(path : Text) → ".incbin ${Text/show path}")
values
in [ ".ascii ${Text/show (Genode.Init.render boot.config)}" ]
# incbin
let map = let map =
λ(list : List Text) λ(list : List Text)
@ -47,7 +51,7 @@ in λ ( boot
NaturalIndex NaturalIndex
TextIndex TextIndex
( λ(x : NaturalIndex) ( λ(x : NaturalIndex)
→ { index = Prelude.Natural.show (x.index + 1) → { index = Prelude.Natural.show x.index
, value = x.value , value = x.value
} }
) )
@ -66,7 +70,9 @@ in λ ( boot
in '' in ''
.set MIN_PAGE_SIZE_LOG2, 12 .set MIN_PAGE_SIZE_LOG2, 12
.set DATA_ACCESS_ALIGNM_LOG2, 3 .set DATA_ACCESS_ALIGNM_LOG2, 3
.section .data .section .data
.p2align DATA_ACCESS_ALIGNM_LOG2 .p2align DATA_ACCESS_ALIGNM_LOG2
.global _boot_modules_headers_begin .global _boot_modules_headers_begin
_boot_modules_headers_begin: _boot_modules_headers_begin:
@ -94,6 +100,7 @@ in λ ( boot
_boot_module_${m.index}_name: _boot_module_${m.index}_name:
.string "${m.value}" .string "${m.value}"
.byte 0 .byte 0
'' ''
) )
++ '' ++ ''

View File

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

View File

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

View File

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

View File

@ -130,20 +130,21 @@ let
inherit driver iso test; inherit driver iso test;
config = hostPkgs.runCommand (name + ".dhall") env' '' config = hostPkgs.runCommand (name + ".dhall") env' ''
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
${apps.dhall.program} <<< "(${ ${apps.dhall.program} <<< "(${
./driver-nova-config.dhall ./driver-nova-config.dhall
} ${testConfig})" > $out } ${testConfig})" > $out
''; '';
xml = hostPkgs.runCommand (name + ".config") env' '' xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
${apps.render-init.program} "(${ ${apps.render-init.program} "(${
./driver-nova-config.dhall ./driver-nova-config.dhall
} ${testConfig}).config" > $out''; } ${testConfig}).config" > $out'';
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' '' sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''
export XDG_CACHE_HOME=${TMPDIR:-/tmp} export XDG_CACHE_HOME=${TMPDIR:-/tmp}
${apps.nova-image.program} image.elf \ ${apps.nova-image.program} image.elf "${./driver-nova-config.dhall} ${testConfig}"
${./driver-nova-config.dhall} ${testConfig}
cp "${testPkgs.bender}" bender cp "${testPkgs.bender}" bender
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
mkdir -p $out/nix-support 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,9 +76,10 @@ in { config =
, rom = , rom =
let os = env:OS_MANIFEST let os = env:OS_MANIFEST
in [ os.bin.acpi_drv in Genode.Boot.toRomPaths
, os.bin.platform_drv [ os.bin.acpi_drv
, os.bin.report_rom , os.bin.platform_drv
, os.bin.test-pci , 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 solo5 = env:SOLO5_MANIFEST
let Args = let RomMap = Genode.Prelude.Map.Type Text Genode.Boot.Rom
{ config : Genode.Init.Type, rom : Genode.Prelude.Map.Type Text Text }
: Type let Args = { config : Genode.Init.Type, rom : RomMap } : Type
in λ(boot : Args) 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 = '' testScript = ''
run_genode_until {child "ping" exited with exit value 0} 30 run_genode_until {child "ping" exited with exit value 0} 30
''; '';
qemuMem = 64;
} }
{ {

View File

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

View File

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

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