2015-09-03 12:55:05 +00:00
|
|
|
set use_usb_driver [expr [have_spec omap4] || [have_spec arndale] || [have_spec rpi]]
|
2017-01-03 12:17:41 +00:00
|
|
|
set use_nic_driver [expr !$use_usb_driver && ![have_spec imx53] && ![have_spec linux] && ![have_spec odroid_xu] && ![have_spec wand_quad]]
|
2013-07-11 09:14:57 +00:00
|
|
|
|
2016-07-01 06:54:37 +00:00
|
|
|
if {[expr !$use_usb_driver && !$use_nic_driver || [expr [have_include "power_on/qemu"] && [have_spec zynq]]]} {
|
2013-07-11 09:14:57 +00:00
|
|
|
puts "\n Run script is not supported on this platform. \n"; exit 0 }
|
2012-05-24 13:41:11 +00:00
|
|
|
|
2013-03-08 09:45:44 +00:00
|
|
|
set build_components {
|
2012-05-24 13:41:11 +00:00
|
|
|
core init
|
2015-05-28 11:43:13 +00:00
|
|
|
drivers/timer
|
2013-05-16 07:28:52 +00:00
|
|
|
server/tcp_terminal
|
|
|
|
server/nic_bridge
|
2012-05-24 13:41:11 +00:00
|
|
|
noux/net lib/libc_noux
|
2012-06-15 10:20:19 +00:00
|
|
|
noux-pkg/netcat
|
2012-05-24 13:41:11 +00:00
|
|
|
}
|
|
|
|
|
2017-02-08 12:28:11 +00:00
|
|
|
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
|
|
|
|
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
|
|
|
|
return gpio_drv }
|
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
lappend_if $use_usb_driver build_components drivers/usb
|
|
|
|
lappend_if $use_nic_driver build_components drivers/nic
|
|
|
|
lappend_if [have_spec gpio] build_components drivers/gpio
|
|
|
|
lappend_if [have_include "power_on/qemu"] build_components drivers/uart
|
2015-05-28 11:43:13 +00:00
|
|
|
|
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
|
|
|
append_platform_drv_build_components
|
2013-03-08 09:45:44 +00:00
|
|
|
|
|
|
|
build $build_components
|
|
|
|
|
2012-05-24 13:41:11 +00:00
|
|
|
exec tar cfv bin/noux_netcat.tar -h -C bin/netcat .
|
|
|
|
|
|
|
|
#
|
|
|
|
# The '<build-dir>/bin/etc/' directory is expected to contain the
|
|
|
|
# files 'services', 'protocols', 'hosts', and 'resolv.conf'.
|
|
|
|
# Download these files from the FreeBSD source tree is possible.
|
|
|
|
#
|
|
|
|
exec mkdir -p bin/etc
|
|
|
|
set freebsd_url "http://svn.freebsd.org/base/release/8.2.0/etc"
|
|
|
|
foreach etc_file { services protocols hosts } {
|
|
|
|
if {![file exists bin/etc/$etc_file]} {
|
|
|
|
catch { exec wget -c -P bin/etc $freebsd_url/$etc_file } } }
|
|
|
|
exec touch bin/etc/resolv.conf
|
|
|
|
|
|
|
|
exec tar rfv bin/noux_netcat.tar -h -C bin/ etc
|
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
2012-06-08 12:59:40 +00:00
|
|
|
append config {
|
2012-05-24 13:41:11 +00:00
|
|
|
<config verbose="yes">
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
<service name="RAM"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
2015-05-26 18:12:17 +00:00
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
2012-05-24 13:41:11 +00:00
|
|
|
</default-route>
|
|
|
|
<start name="timer">
|
2012-06-08 12:59:40 +00:00
|
|
|
<resource name="RAM" quantum="1M"/>
|
2012-05-24 13:41:11 +00:00
|
|
|
<provides><service name="Timer"/></provides>
|
2013-05-16 07:28:52 +00:00
|
|
|
</start>}
|
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
append_if [have_include "power_on/qemu"] config {
|
2012-05-24 13:41:11 +00:00
|
|
|
<start name="uart_drv">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
2015-05-26 18:12:17 +00:00
|
|
|
<provides>
|
|
|
|
<service name="Terminal"/>
|
|
|
|
<service name="Uart"/>
|
|
|
|
</provides>
|
2012-05-24 13:41:11 +00:00
|
|
|
<config>
|
2016-11-24 14:28:32 +00:00
|
|
|
<policy label_prefix="noux_net" uart="1"/>
|
2013-05-16 07:28:52 +00:00
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
if {![have_include "power_on/qemu"]} {
|
2013-06-25 07:43:59 +00:00
|
|
|
append config {
|
2013-05-16 07:28:52 +00:00
|
|
|
<start name="tcp_terminal">
|
2013-09-16 10:02:54 +00:00
|
|
|
<resource name="RAM" quantum="5M"/>
|
2013-05-16 07:28:52 +00:00
|
|
|
<provides> <service name="Terminal"/> </provides>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config>
|
2016-11-24 14:28:32 +00:00
|
|
|
<policy label_prefix="noux_net" port="8888"/>
|
2012-05-24 13:41:11 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
2013-05-16 07:28:52 +00:00
|
|
|
<start name="nic_bridge">
|
2017-03-20 10:17:49 +00:00
|
|
|
<resource name="RAM" quantum="6M"/>
|
2013-05-16 07:28:52 +00:00
|
|
|
<provides><service name="Nic"/></provides>
|
2016-06-03 14:21:45 +00:00
|
|
|
<config/>
|
2013-06-25 07:43:59 +00:00
|
|
|
<route>}
|
|
|
|
append_if $use_nic_driver config {
|
|
|
|
<service name="Nic"> <child name="nic_drv"/></service>}
|
|
|
|
append_if $use_usb_driver config {
|
|
|
|
<service name="Nic"> <child name="usb_drv"/></service>}
|
|
|
|
append config {
|
|
|
|
<any-service> <parent/> </any-service>
|
2013-05-16 07:28:52 +00:00
|
|
|
</route>
|
|
|
|
</start>}
|
2013-06-25 07:43:59 +00:00
|
|
|
}
|
2013-05-16 07:28:52 +00:00
|
|
|
|
|
|
|
append_if $use_nic_driver config {
|
2012-05-24 13:41:11 +00:00
|
|
|
<start name="nic_drv">
|
2016-11-23 16:07:49 +00:00
|
|
|
<resource name="RAM" quantum="8M"/>
|
2012-05-24 13:41:11 +00:00
|
|
|
<provides> <service name="Nic"/> </provides>
|
2012-06-08 12:59:40 +00:00
|
|
|
</start>}
|
|
|
|
|
2017-02-08 12:28:11 +00:00
|
|
|
append_if [have_spec gpio] config "
|
|
|
|
<start name=\"[gpio_drv]\">
|
|
|
|
<resource name=\"RAM\" quantum=\"4M\"/>
|
|
|
|
<provides><service name=\"Gpio\"/></provides>
|
2013-11-13 13:10:49 +00:00
|
|
|
<config/>
|
2017-02-08 12:28:11 +00:00
|
|
|
</start>"
|
2013-11-13 13:10:49 +00:00
|
|
|
|
2013-05-16 07:28:52 +00:00
|
|
|
append_if $use_usb_driver config {
|
|
|
|
<start name="usb_drv">
|
2016-07-05 10:29:31 +00:00
|
|
|
<resource name="RAM" quantum="14M"/>
|
2013-05-16 07:28:52 +00:00
|
|
|
<provides>
|
|
|
|
<service name="Nic"/>
|
|
|
|
<service name="Input"/>
|
|
|
|
</provides>
|
2013-06-25 07:43:59 +00:00
|
|
|
<config uhci="no" ehci="yes" xhci="no">
|
2014-04-22 09:50:56 +00:00
|
|
|
<nic mac="02:00:00:00:01:01"/>
|
2013-05-16 07:28:52 +00:00
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
2015-05-28 11:43:13 +00:00
|
|
|
append_platform_drv_config
|
2013-03-08 09:45:44 +00:00
|
|
|
|
2012-06-08 12:59:40 +00:00
|
|
|
append config {
|
2012-05-24 13:41:11 +00:00
|
|
|
<start name="noux_net">
|
|
|
|
<resource name="RAM" quantum="1G"/>
|
|
|
|
<config>
|
|
|
|
<fstab> <tar name="noux_netcat.tar" at="/"/> </fstab>
|
|
|
|
<start name="/bin/netcat">
|
|
|
|
<arg value="-l"/>
|
|
|
|
<arg value="-p 5555"/>
|
|
|
|
</start>
|
2013-05-16 07:28:52 +00:00
|
|
|
</config>}
|
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
append_if [expr ![have_include "power_on/qemu"]] config {
|
2013-05-16 07:28:52 +00:00
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>}
|
|
|
|
|
|
|
|
append config {
|
2012-05-24 13:41:11 +00:00
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
2012-06-08 12:59:40 +00:00
|
|
|
install_config $config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot modules
|
|
|
|
#
|
|
|
|
|
|
|
|
# generic modules
|
|
|
|
set boot_modules {
|
2013-05-16 07:28:52 +00:00
|
|
|
core init timer tcp_terminal nic_bridge
|
2017-02-23 17:59:53 +00:00
|
|
|
ld.lib.so noux_net libc.lib.so libm.lib.so libc_pipe.lib.so pthread.lib.so
|
2017-05-14 19:55:57 +00:00
|
|
|
libc_resolv.lib.so libc_noux.lib.so lwip.lib.so noux_netcat.tar posix.lib.so
|
2012-05-24 13:41:11 +00:00
|
|
|
}
|
|
|
|
|
2012-06-08 12:59:40 +00:00
|
|
|
# platform-specific modules
|
2015-01-08 21:09:08 +00:00
|
|
|
lappend_if $use_nic_driver boot_modules nic_drv
|
|
|
|
lappend_if $use_usb_driver boot_modules usb_drv
|
|
|
|
lappend_if [have_include "power_on/qemu"] boot_modules uart_drv
|
2017-02-08 12:28:11 +00:00
|
|
|
lappend_if [have_spec gpio] boot_modules [gpio_drv]
|
2012-06-08 12:59:40 +00:00
|
|
|
|
2015-05-28 11:43:13 +00:00
|
|
|
append_platform_drv_boot_modules
|
|
|
|
|
2012-06-08 12:59:40 +00:00
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
2013-05-16 07:28:52 +00:00
|
|
|
set noux_output_file "noux_output.log"
|
|
|
|
set serial_ip_addr "localhost"
|
|
|
|
set noux_ip_addr "localhost"
|
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
if {[have_include "power_on/qemu"]} {
|
2013-03-08 09:45:44 +00:00
|
|
|
#
|
|
|
|
# Redirect the output of Noux via the virtual serial port 1 into a file to be
|
|
|
|
# dumped after the successful completion of the test.
|
|
|
|
append qemu_args " -nographic"
|
|
|
|
append qemu_args " -serial mon:stdio"
|
|
|
|
append qemu_args " -serial file:$noux_output_file"
|
2012-05-24 13:41:11 +00:00
|
|
|
|
2013-03-08 09:45:44 +00:00
|
|
|
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
|
|
|
|
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
2012-05-24 13:41:11 +00:00
|
|
|
|
2013-03-08 09:45:44 +00:00
|
|
|
append qemu_args " -net user -redir tcp:5555::5555 "
|
2012-05-24 13:41:11 +00:00
|
|
|
|
2013-05-16 07:28:52 +00:00
|
|
|
run_genode_until {.*got IP address.*\n} 60
|
2015-01-08 21:09:08 +00:00
|
|
|
set serial_id [output_spawn_id]
|
2013-05-16 07:28:52 +00:00
|
|
|
} else {
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
# wait until we got both IP addresses in the output afterwards
|
|
|
|
run_genode_until {.*got IP address.*\n.*got IP address.*\n} 60
|
2015-01-08 21:09:08 +00:00
|
|
|
set serial_id [output_spawn_id]
|
2012-05-24 13:41:11 +00:00
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
regexp {\[init -> noux_net\] got IP address [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $output noux_ip_addr
|
2015-03-24 10:08:14 +00:00
|
|
|
regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $noux_ip_addr noux_ip_addr
|
2012-05-24 13:41:11 +00:00
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
regexp {\[init -> tcp_terminal\] got IP address [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $output serial_ip_addr
|
2015-03-24 10:08:14 +00:00
|
|
|
regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $serial_ip_addr serial_ip_addr
|
2013-05-16 07:28:52 +00:00
|
|
|
|
|
|
|
# connect to Genode target and reading log output via network connection
|
2013-07-16 15:13:25 +00:00
|
|
|
|
|
|
|
spawn socat -u tcp:$serial_ip_addr:8888 OPEN:$noux_output_file,creat,append
|
2013-03-08 09:45:44 +00:00
|
|
|
}
|
|
|
|
|
2013-06-25 07:43:59 +00:00
|
|
|
sleep 4
|
2012-05-24 13:41:11 +00:00
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
|
2013-05-16 07:28:52 +00:00
|
|
|
puts "--- serial '$serial_ip_addr' noux '$noux_ip_addr'"
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
#
|
|
|
|
# This usage of netcat needs the OpenBSD nc command and will not
|
|
|
|
# work with GNU netcat because it will not close the connection
|
|
|
|
# automatically after sending the string.
|
|
|
|
#
|
2013-07-16 15:13:25 +00:00
|
|
|
exec echo -e "Hello Genode" | netcat $noux_ip_addr 5555 &
|
|
|
|
|
|
|
|
run_genode_until {exited with exit value 1} 20 $serial_id
|
2012-05-24 13:41:11 +00:00
|
|
|
|
2013-06-25 07:43:59 +00:00
|
|
|
sleep 4
|
2013-05-16 07:28:52 +00:00
|
|
|
|
|
|
|
set output [exec cat $noux_output_file]
|
2013-07-16 15:13:25 +00:00
|
|
|
puts "\noutput:\n$output\n"
|
2013-05-16 07:28:52 +00:00
|
|
|
exec rm $noux_output_file
|
2012-05-24 13:41:11 +00:00
|
|
|
|
|
|
|
exec rm bin/noux_netcat.tar
|
|
|
|
exec rm -r bin/etc
|
|
|
|
|
|
|
|
if {![regexp {Hello Genode} $output dummy]} {
|
|
|
|
puts stderr "Error: output not as expected"
|
|
|
|
exit 1
|
|
|
|
}
|