genode/repos/gems/run/driver_manager.run
2021-05-28 14:15:26 +02:00

173 lines
5.4 KiB
Plaintext

if {![have_spec x86] || [have_spec linux]} {
puts "Platform is unsupported."
exit 0
}
build { app/driver_manager test/driver_manager lib/ld }
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/drivers_managed-pc \
[depot_user]/src/report_rom \
[depot_user]/src/dynamic_rom \
[depot_user]/src/nitpicker \
[depot_user]/src/init
install_config {
<config prio_levels="2">
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="report_rom">
<binary name="report_rom"/>
<resource name="RAM" quantum="1M"/>
<provides> <service name="Report"/> <service name="ROM"/> </provides>
<config verbose="yes">
<policy label="test-driver_manager -> block_devices" report="drivers -> block_devices"/>
<policy label="test-driver_manager -> displays" report="nitpicker -> displays"/>
</config>
</start>
<start name="drivers" caps="2500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label_last="managed/event_filter">
<parent label="event_filter.config"/> </service>
<service name="ROM" label_last="numlock_remap">
<parent label="numlock_remap.config"/> </service>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
<service name="ROM" label="capslock"> <child name="dynamic_rom"/> </service>
<service name="ROM" label="numlock"> <child name="dynamic_rom"/> </service>
<service name="ROM" label="system"> <child name="dynamic_rom"/> </service>
<service name="ROM" label="usb_policy"><child name="dynamic_rom"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="Capture"> <child name="nitpicker"/> </service>
<service name="Event"> <child name="nitpicker"/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<any-service> <parent/> </any-service>
</route>
<provides> <service name="Block"/> </provides>
</start>
<start name="dynamic_rom">
<resource name="RAM" quantum="4M"/>
<provides> <service name="ROM"/> </provides>
<config verbose="yes">
<rom name="capslock">
<inline> <capslock enabled="no"/> </inline>
<sleep milliseconds="500" />
<inline> <capslock enabled="yes"/> </inline>
<sleep milliseconds="500" />
</rom>
<rom name="numlock">
<inline> <numlock enabled="no"/> </inline>
<sleep milliseconds="1000" />
<inline> <numlock enabled="yes"/> </inline>
<sleep milliseconds="1000" />
</rom>
<rom name="system">
<inline> <system state=""/> </inline>
<sleep milliseconds="10000" />
</rom>
<rom name="numlock_remap">
<inline> <system state=""/> </inline>
<sleep milliseconds="10000" />
</rom>
</config>
</start>
<start name="nitpicker">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Gui"/> <service name="Capture"/> <service name="Event"/>
</provides>
<config>
<capture/> <event/>
<report displays="yes"/>
</config>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="test-driver_manager">
<resource name="RAM" quantum="1M"/>
<config>
<check_ahci_block_device label="ahci-1" block_count="65536" block_size="512"
model="QEMU HARDDISK"/>
<check_displays/>
</config>
<route>
<service name="ROM" label="block_devices"> <child name="report_rom"/> </service>
<service name="ROM" label="displays"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>}
set fd [open [run_dir]/genode/fb_drv.config "w"]
puts $fd {
<config width="1024" height="768" buffered="yes"> <!-- used by VESA driver -->
<report connectors="yes"/>
<connector name="eDP-36" width="1920" height="1080" enabled="true"/>
</config>}
close $fd
set fd [open [run_dir]/genode/usb_policy "w"]
puts $fd {<usb/>}
close $fd
#
# Override 'drivers.config' as supplied with the 'drivers_managed-pc' pkg
# with the (possibly modified) version found in the source tree. This avoids
# the need to re-create the pkg while testing modifications of this file.
#
copy_file [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \
[run_dir]/genode/drivers.config
build_boot_image { driver_manager test-driver_manager ld.lib.so }
#
# Build ext2 file-system images to be supplied to Qemu
#
if {[have_include "power_on/qemu"]} {
set mke2fs [installed_command mke2fs]
set dd [installed_command dd]
catch { exec $dd if=/dev/zero of=bin/hdd_disk.raw bs=1M count=32 }
catch { exec $mke2fs -F bin/hdd_disk.raw }
}
#
# Qemu opts for supplying hdd_disk.raw as AHCI disk
#
append qemu_args " -nographic "
append qemu_args " -device ahci,id=ahci "
append qemu_args " -drive id=hdd,file=bin/hdd_disk.raw,format=raw,if=none -device ide-hd,drive=hdd,bus=ahci.1 "
run_genode_until {.*all expected devices present and accessible.*\n} 120