mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-30 06:04:25 +00:00
run: add support to run noux_net_netcat natively
This commit is contained in:
parent
8ac6d8c96c
commit
37cde31eb3
@ -5,13 +5,21 @@ if {[have_spec linux]} {
|
|||||||
|
|
||||||
set build_components {
|
set build_components {
|
||||||
core init
|
core init
|
||||||
drivers/timer drivers/uart drivers/nic drivers/pci
|
drivers/timer drivers/pci
|
||||||
|
server/tcp_terminal
|
||||||
|
server/nic_bridge
|
||||||
noux/net lib/libc_noux
|
noux/net lib/libc_noux
|
||||||
noux-pkg/netcat
|
noux-pkg/netcat
|
||||||
}
|
}
|
||||||
|
|
||||||
lappend_if [have_spec acpi] build_components drivers/acpi
|
set use_usb_driver [expr [have_spec omap4] || [have_spec exynos5]]
|
||||||
lappend_if [have_spec pci] build_components drivers/pci/device_pd
|
set use_nic_driver [expr !$use_usb_driver]
|
||||||
|
|
||||||
|
lappend_if $use_usb_driver build_components drivers/usb
|
||||||
|
lappend_if $use_nic_driver build_components drivers/nic
|
||||||
|
lappend_if [have_spec acpi] build_components drivers/acpi
|
||||||
|
lappend_if [have_spec pci] build_components drivers/pci/device_pd
|
||||||
|
lappend_if [is_qemu_available] build_components drivers/uart
|
||||||
|
|
||||||
build $build_components
|
build $build_components
|
||||||
|
|
||||||
@ -54,19 +62,58 @@ append config {
|
|||||||
<start name="timer">
|
<start name="timer">
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="1M"/>
|
||||||
<provides><service name="Timer"/></provides>
|
<provides><service name="Timer"/></provides>
|
||||||
</start>
|
</start>}
|
||||||
|
|
||||||
|
append_if [is_qemu_available] config {
|
||||||
<start name="uart_drv">
|
<start name="uart_drv">
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="1M"/>
|
||||||
<provides><service name="Terminal"/></provides>
|
<provides><service name="Terminal"/></provides>
|
||||||
<config>
|
<config>
|
||||||
<policy label="noux" uart="1"/>
|
<policy label="noux" uart="1"/>
|
||||||
|
</config>
|
||||||
|
</start>}
|
||||||
|
|
||||||
|
append_if [expr ![is_qemu_available]] config {
|
||||||
|
<start name="tcp_terminal">
|
||||||
|
<resource name="RAM" quantum="2560K"/>
|
||||||
|
<provides> <service name="Terminal"/> </provides>
|
||||||
|
<route>
|
||||||
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||||
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
|
</route>
|
||||||
|
<config>
|
||||||
|
<policy label="noux_net" port="8888"/>
|
||||||
</config>
|
</config>
|
||||||
</start>
|
</start>
|
||||||
|
<start name="nic_bridge">
|
||||||
|
<resource name="RAM" quantum="2M"/>
|
||||||
|
<provides><service name="Nic"/></provides>
|
||||||
|
<route>
|
||||||
|
<service name="Nic">
|
||||||
|
<child name="usb_drv"/>
|
||||||
|
</service>
|
||||||
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
|
</route>
|
||||||
|
</start>}
|
||||||
|
|
||||||
|
append_if $use_nic_driver config {
|
||||||
<start name="nic_drv">
|
<start name="nic_drv">
|
||||||
<resource name="RAM" quantum="4M"/>
|
<resource name="RAM" quantum="4M"/>
|
||||||
<provides> <service name="Nic"/> </provides>
|
<provides> <service name="Nic"/> </provides>
|
||||||
</start>}
|
</start>}
|
||||||
|
|
||||||
|
append_if $use_usb_driver config {
|
||||||
|
<start name="usb_drv">
|
||||||
|
<resource name="RAM" quantum="12M"/>
|
||||||
|
<provides>
|
||||||
|
<service name="Nic"/>
|
||||||
|
<service name="Input"/>
|
||||||
|
</provides>
|
||||||
|
<config>
|
||||||
|
<nic />
|
||||||
|
</config>
|
||||||
|
</start>}
|
||||||
|
|
||||||
append_if [have_spec acpi] config {
|
append_if [have_spec acpi] config {
|
||||||
<start name="acpi">
|
<start name="acpi">
|
||||||
<resource name="RAM" quantum="6M"/>
|
<resource name="RAM" quantum="6M"/>
|
||||||
@ -96,7 +143,15 @@ append config {
|
|||||||
<arg value="-l"/>
|
<arg value="-l"/>
|
||||||
<arg value="-p 5555"/>
|
<arg value="-p 5555"/>
|
||||||
</start>
|
</start>
|
||||||
</config>
|
</config>}
|
||||||
|
|
||||||
|
append_if [expr ![is_qemu_available]] config {
|
||||||
|
<route>
|
||||||
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||||
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
|
</route>}
|
||||||
|
|
||||||
|
append config {
|
||||||
</start>
|
</start>
|
||||||
</config>
|
</config>
|
||||||
}
|
}
|
||||||
@ -109,25 +164,30 @@ install_config $config
|
|||||||
|
|
||||||
# generic modules
|
# generic modules
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core init timer uart_drv nic_drv
|
core init timer tcp_terminal nic_bridge
|
||||||
ld.lib.so noux_net libc.lib.so libm.lib.so
|
ld.lib.so noux_net libc.lib.so libm.lib.so
|
||||||
|
libc_lock_pipe.lib.so libc_log.lib.so
|
||||||
libc_resolv.lib.so libc_noux.lib.so lwip.lib.so noux_netcat.tar
|
libc_resolv.lib.so libc_noux.lib.so lwip.lib.so noux_netcat.tar
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform-specific modules
|
# platform-specific modules
|
||||||
lappend_if [have_spec pci] boot_modules pci_drv
|
lappend_if $use_nic_driver boot_modules nic_drv
|
||||||
lappend_if [have_spec acpi] boot_modules acpi_drv
|
lappend_if $use_usb_driver boot_modules usb_drv
|
||||||
lappend_if [have_spec nova] boot_modules pci_device_pd
|
lappend_if [have_spec pci] boot_modules pci_drv
|
||||||
|
lappend_if [have_spec acpi] boot_modules acpi_drv
|
||||||
|
lappend_if [have_spec nova] boot_modules pci_device_pd
|
||||||
|
lappend_if [is_qemu_available] boot_modules uart_drv
|
||||||
|
|
||||||
build_boot_image $boot_modules
|
build_boot_image $boot_modules
|
||||||
|
|
||||||
if {![is_amt_available]} {
|
set noux_output_file "noux_output.log"
|
||||||
|
set serial_ip_addr "localhost"
|
||||||
|
set noux_ip_addr "localhost"
|
||||||
|
|
||||||
|
if {[is_qemu_available]} {
|
||||||
#
|
#
|
||||||
# Redirect the output of Noux via the virtual serial port 1 into a file to be
|
# Redirect the output of Noux via the virtual serial port 1 into a file to be
|
||||||
# dumped after the successful completion of the test.
|
# dumped after the successful completion of the test.
|
||||||
#
|
|
||||||
set noux_output_file "noux_output.log"
|
|
||||||
|
|
||||||
append qemu_args " -nographic"
|
append qemu_args " -nographic"
|
||||||
append qemu_args " -serial mon:stdio"
|
append qemu_args " -serial mon:stdio"
|
||||||
append qemu_args " -serial file:$noux_output_file"
|
append qemu_args " -serial file:$noux_output_file"
|
||||||
@ -136,32 +196,31 @@ if {![is_amt_available]} {
|
|||||||
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
||||||
|
|
||||||
append qemu_args " -net user -redir tcp:5555::5555 "
|
append qemu_args " -net user -redir tcp:5555::5555 "
|
||||||
}
|
|
||||||
|
|
||||||
run_genode_until {.*got IP address.*\n} 60
|
run_genode_until {.*got IP address.*\n} 60
|
||||||
|
} else {
|
||||||
|
run_genode_until {\[init -> tcp_terminal\] listening on port 8888\.\.\.} 60
|
||||||
|
|
||||||
|
regexp {\[init -> noux_net\] .{1,5}got IP address [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $output noux_ip_addr
|
||||||
|
regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $noux_ip_addr noux_ip_addr
|
||||||
|
|
||||||
|
regexp {\[init -> tcp_terminal\] .{1,5}got IP address [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $output serial_ip_addr
|
||||||
|
regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $serial_ip_addr serial_ip_addr
|
||||||
|
|
||||||
|
# connect to Genode target and reading log output via network connection
|
||||||
|
exec telnet $serial_ip_addr 8888 > $noux_output_file &
|
||||||
|
}
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
if [is_amt_available] {
|
puts "--- serial '$serial_ip_addr' noux '$noux_ip_addr'"
|
||||||
set match_string "got IP address"
|
exec echo -e "Hello Genode" | netcat $noux_ip_addr 5555
|
||||||
grep_output $match_string
|
|
||||||
unify_output {[\r\n\t]+} ""
|
|
||||||
unify_output {[\033]\[0m} ""
|
|
||||||
set pos [string first $match_string $output]
|
|
||||||
set ip_addr [string replace $output 0 [expr $pos+14]]
|
|
||||||
} else {
|
|
||||||
set ip_addr "localhost"
|
|
||||||
}
|
|
||||||
|
|
||||||
exec echo -e "Hello Genode" | netcat $ip_addr 5555
|
sleep 2
|
||||||
|
|
||||||
sleep 1
|
set output [exec cat $noux_output_file]
|
||||||
|
puts "output:\n$output\n"
|
||||||
if {![is_amt_available]} {
|
exec rm $noux_output_file
|
||||||
set output [exec cat $noux_output_file]
|
|
||||||
puts "output:\n$output\n"
|
|
||||||
exec rm $noux_output_file
|
|
||||||
}
|
|
||||||
|
|
||||||
exec rm bin/noux_netcat.tar
|
exec rm bin/noux_netcat.tar
|
||||||
exec rm -r bin/etc
|
exec rm -r bin/etc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user