2016-08-25 17:18:23 +00:00
|
|
|
if { ![have_spec foc] && ![have_spec nova] &&
|
|
|
|
![have_spec okl4] && ![have_spec sel4] } {
|
|
|
|
puts "Run script is not supported on this platform"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2018-04-11 12:14:20 +00:00
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
import_from_depot genodelabs/src/[base_src] \
|
|
|
|
genodelabs/pkg/[drivers_interactive_pkg] \
|
|
|
|
genodelabs/pkg/terminal \
|
|
|
|
genodelabs/src/init \
|
|
|
|
genodelabs/src/noux \
|
|
|
|
genodelabs/src/posix \
|
|
|
|
genodelabs/src/ram_fs \
|
|
|
|
genodelabs/src/log_terminal \
|
|
|
|
genodelabs/src/ncurses \
|
|
|
|
genodelabs/src/bash-minimal \
|
|
|
|
genodelabs/src/vim-minimal \
|
|
|
|
genodelabs/src/coreutils-minimal
|
2016-08-25 17:18:23 +00:00
|
|
|
|
2018-04-11 12:14:20 +00:00
|
|
|
|
|
|
|
set build_components { server/fs_log server/cpu_sampler test/cpu_sampler }
|
2017-07-04 12:17:38 +00:00
|
|
|
|
2017-02-27 18:54:03 +00:00
|
|
|
if {[have_spec foc] || [have_spec nova]} {
|
|
|
|
lappend build_components lib/cpu_sampler_platform-$::env(KERNEL)
|
2017-02-26 00:17:22 +00:00
|
|
|
} else {
|
|
|
|
lappend build_components lib/cpu_sampler_platform-generic
|
|
|
|
}
|
|
|
|
|
2016-08-25 17:18:23 +00:00
|
|
|
#
|
|
|
|
# Build Noux packages only once
|
|
|
|
#
|
2018-04-11 12:14:20 +00:00
|
|
|
foreach pkg {diffutils} {
|
2016-08-25 17:18:23 +00:00
|
|
|
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }
|
|
|
|
|
|
|
|
build $build_components
|
|
|
|
|
|
|
|
# write default vimrc file
|
2017-05-14 20:00:40 +00:00
|
|
|
set vimrc_fd [open "bin/vimrc" w]
|
2016-08-25 17:18:23 +00:00
|
|
|
puts $vimrc_fd {
|
|
|
|
set noloadplugins
|
|
|
|
set hls
|
|
|
|
set nocompatible
|
|
|
|
set laststatus=2
|
|
|
|
set noswapfile
|
|
|
|
set viminfo=}
|
|
|
|
close $vimrc_fd
|
|
|
|
|
|
|
|
append config {
|
|
|
|
<config verbose="yes">
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>
|
2017-05-07 20:36:11 +00:00
|
|
|
<default caps="100"/>
|
2016-08-25 17:18:23 +00:00
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if [get_cmd_switch --autopilot] config {
|
|
|
|
<start name="terminal">
|
|
|
|
<binary name="log_terminal"/>
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="Terminal"/></provides>
|
2018-04-11 12:14:20 +00:00
|
|
|
</start>}
|
2016-08-25 17:18:23 +00:00
|
|
|
|
|
|
|
append_if [expr ![get_cmd_switch --autopilot]] config {
|
2018-04-11 12:14:20 +00:00
|
|
|
<start name="drivers" caps="1000">
|
|
|
|
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
|
|
|
|
<binary name="init"/>
|
|
|
|
<route>
|
|
|
|
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
|
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</route>
|
|
|
|
<provides>
|
|
|
|
<service name="Input"/> <service name="Framebuffer"/>
|
|
|
|
</provides>
|
|
|
|
</start>
|
|
|
|
|
2016-08-25 17:18:23 +00:00
|
|
|
<start name="terminal">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides><service name="Terminal"/></provides>
|
2018-04-11 12:14:20 +00:00
|
|
|
<route>
|
|
|
|
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>}
|
2016-08-25 17:18:23 +00:00
|
|
|
|
|
|
|
append config {
|
|
|
|
<start name="ram_fs">
|
|
|
|
<resource name="RAM" quantum="10M"/>
|
|
|
|
<provides><service name="File_system"/></provides>
|
|
|
|
<config>
|
|
|
|
<content>
|
|
|
|
<dir name="home">
|
|
|
|
<inline name=".bashrc"> }
|
|
|
|
append_if [get_cmd_switch --autopilot] config {
|
2017-02-26 01:35:07 +00:00
|
|
|
FILE=/samples/cpu_sampler/samples/test-cpu_sampler/ep.*.log
|
2016-08-25 17:18:23 +00:00
|
|
|
while true; do if [ -e $FILE ]; then cat $FILE; fi; done }
|
|
|
|
append_if [expr ![get_cmd_switch --autopilot]] config {
|
|
|
|
echo "The sample data will appear in the /samples directory" }
|
|
|
|
append config {
|
|
|
|
</inline>
|
|
|
|
</dir>
|
|
|
|
<dir name="samples"/>
|
|
|
|
<dir name="tmp"/>
|
|
|
|
</content>
|
|
|
|
<!-- constrain sessions according to their labels -->
|
2016-11-24 14:28:32 +00:00
|
|
|
<policy label_prefix="fs_log" root="/samples" writeable="yes" />
|
2016-08-25 17:18:23 +00:00
|
|
|
<policy label="noux -> home" root="/home" writeable="yes" />
|
|
|
|
<policy label="noux -> samples" root="/samples" />
|
|
|
|
<policy label="noux -> tmp" root="/tmp" writeable="yes" />
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="fs_log">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides><service name="LOG"/></provides>
|
|
|
|
<config>
|
|
|
|
<policy label="cpu_sampler" merge="true"/>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="cpu_sampler">
|
2017-01-18 16:10:07 +00:00
|
|
|
<resource name="RAM" quantum="4M"/>
|
2016-08-25 17:18:23 +00:00
|
|
|
<provides>
|
|
|
|
<service name="CPU"/>
|
|
|
|
</provides>
|
|
|
|
<config sample_interval_ms="1000" sample_duration_s="10">
|
2017-02-26 01:35:07 +00:00
|
|
|
<policy label_prefix="test-cpu_sampler ->" />
|
2016-08-25 17:18:23 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="LOG" label_prefix="samples"> <child name="fs_log"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
2017-02-26 01:35:07 +00:00
|
|
|
<start name="test-cpu_sampler">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<config ld_verbose="yes"/>
|
2016-08-25 17:18:23 +00:00
|
|
|
<route>
|
|
|
|
<service name="CPU"> <child name="cpu_sampler"/> </service>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
2017-05-07 20:36:11 +00:00
|
|
|
<start name="noux" caps="500">
|
2017-01-18 16:10:07 +00:00
|
|
|
<resource name="RAM" quantum="16M" />
|
2016-08-25 17:18:23 +00:00
|
|
|
<config>
|
|
|
|
<fstab>
|
2018-04-11 12:14:20 +00:00
|
|
|
<tar name="coreutils-minimal.tar" />
|
|
|
|
<tar name="vim-minimal.tar" />
|
2016-08-25 17:18:23 +00:00
|
|
|
<tar name="diffutils.tar" />
|
2018-04-11 12:14:20 +00:00
|
|
|
<tar name="bash-minimal.tar" />
|
2016-08-25 17:18:23 +00:00
|
|
|
|
|
|
|
<dir name="dev"> <zero/> <null/> </dir>
|
|
|
|
|
|
|
|
<dir name="home"> <fs label="home" /> </dir>
|
|
|
|
<dir name="samples"> <fs label="samples" /> </dir>
|
|
|
|
<dir name="tmp"> <fs label="tmp" /> </dir>
|
2017-05-14 20:00:40 +00:00
|
|
|
<dir name="share"> <dir name="vim"> <rom name="vimrc"/> </dir> </dir>
|
2016-08-25 17:18:23 +00:00
|
|
|
</fstab>
|
|
|
|
<start name="/bin/bash">
|
2018-04-03 14:46:04 +00:00
|
|
|
<env name="TERM" value="screen" />
|
2016-08-25 17:18:23 +00:00
|
|
|
<env name="HOME" value="/home" />
|
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="Terminal"> <child name="terminal"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
2018-04-11 12:14:20 +00:00
|
|
|
</config> }
|
2016-08-25 17:18:23 +00:00
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot modules
|
|
|
|
#
|
|
|
|
|
2017-02-26 00:17:22 +00:00
|
|
|
# evaluated by the run tool
|
|
|
|
proc binary_name_cpu_sampler_platform_lib_so { } {
|
2017-02-27 18:54:03 +00:00
|
|
|
if {[have_spec foc] || [have_spec nova]} {
|
|
|
|
return "cpu_sampler_platform-$::env(KERNEL).lib.so"
|
2017-02-26 00:17:22 +00:00
|
|
|
} else {
|
|
|
|
return "cpu_sampler_platform-generic.lib.so"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-11 12:14:20 +00:00
|
|
|
build_boot_image {
|
|
|
|
diffutils.tar vimrc
|
2017-02-26 00:17:22 +00:00
|
|
|
fs_log cpu_sampler cpu_sampler_platform.lib.so test-cpu_sampler
|
2016-08-25 17:18:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if { ![get_cmd_switch --autopilot] } { run_genode_until forever }
|
|
|
|
|
|
|
|
# autopilot test
|
|
|
|
|
|
|
|
append qemu_args " -nographic "
|
|
|
|
|
|
|
|
set match_string "Test started. func: 0x(\[0-9a-f\]+).*\n"
|
|
|
|
|
|
|
|
run_genode_until "$match_string" 120
|
|
|
|
|
|
|
|
regexp $match_string $output all func
|
|
|
|
|
2016-11-24 13:22:21 +00:00
|
|
|
run_genode_until "\\\[init -> terminal] \[0\]*$func" 90 [output_spawn_id]
|
2016-08-25 17:18:23 +00:00
|
|
|
|