genode/repos/os/run/sd_card_bench.run
2024-06-20 12:54:30 +02:00

110 lines
3.0 KiB
Plaintext

#
# Check for platform support
#
if {[get_cmd_switch --autopilot] &&
[expr [have_board virt_qemu_riscv] || [have_board rpi]]} {
puts "Autopilot mode is not supported on this platform."
exit 0
}
proc buffer_size_kib {} {
if {[have_board pbxa9]} { return [expr 12 * 1024] }
if {[have_board imx6q_sabrelite]} { return [expr 1024] }
if {[have_board imx53_qsb]} { return [expr 1024] }
if {[have_board imx53_qsb_tz]} { return [expr 1024] }
if {[have_board rpi]} { return [expr 4 * 1024] }
puts "\n Run script is not supported on this platform. \n";
exit 0;
}
proc sd_card {} {
if {[have_board pbxa9]} { return pl180_sd_card }
if {[have_board imx6q_sabrelite]} { return imx6_sd_card }
if {[have_board imx53_qsb]} { return imx53_sd_card }
if {[have_board imx53_qsb_tz]} { return imx53_sd_card }
if {[have_board rpi]} { return rpi_sd_card }
puts "\n Run script is not supported on this platform. \n";
exit 0;
}
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/src/init \
[depot_user]/src/platform
install_config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default caps="100"/>
<start name="platform" managing_system="yes">
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<policy label="sd_card -> "> <device name="mmc0"/> </policy>
</config>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="sd_card">
<binary name="} [sd_card] {"/>
<resource name="RAM" quantum="16M"/>
<provides><service name="Block"/></provides>
<config benchmark="yes" buffer_size_kib="} [buffer_size_kib] {"/>
<route>
<service name="ROM"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="RM"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<any-service> <any-child/> </any-service>
</route>
</start>
</config> }
file copy [select_from_repositories board/[board]/devices] [run_dir]/genode/devices
build { driver/sd_card }
build_boot_image [build_artifacts]
#
# Run and evaluate the test
#
# If we run on qemu, provide a virtual disk
#
set disk_image "bin/sd_card.img"
if {[have_include power_on/qemu]} {
if { [file exists $disk_image] == 0 } then {
catch { exec dd if=/dev/zero of=$disk_image bs=1M count=512 } }
append qemu_args "-drive file=$disk_image,format=raw,if=sd,cache=writeback "
append qemu_args "-nographic "
}
run_genode_until "--- SD card benchmark finished ---" 120
if {[have_include power_on/qemu]} {
if { [file exists $disk_image] != 0 } then {
exec rm -f $disk_image
}
}