diff --git a/run/eth.run b/run/eth.run new file mode 100644 index 0000000..c5c29d2 --- /dev/null +++ b/run/eth.run @@ -0,0 +1,111 @@ +# +# Build +# + +set use_usb_driver [expr [have_spec omap4] || [have_spec arndale] || [have_spec rpi]] +set use_nic_driver [expr !$use_usb_driver && ![have_spec odroid_xu] && ![have_spec linux]] + +if {[expr !$use_usb_driver && !$use_nic_driver] || + [expr [have_spec imx53] && [have_spec trustzone]]} { + puts "\n Run script is not supported on this platform. \n"; exit 0 } + +set build_components { + core init + drivers/timer drivers/nic + lib/vfs/lwip + app/eth +} + +lappend_if $use_usb_driver build_components drivers/usb +lappend_if [have_spec gpio] build_components drivers/gpio + +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 } + +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + +build $build_components + +create_boot_directory + +# +# Generate config +# + +set config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + +append_if [have_spec gpio] config " + + + + + " + +append_if $use_usb_driver config { + + + + + + + + + } + +append_platform_drv_config + +append_if $use_nic_driver config { + + + + } [nic_drv_config] { + } + +append config { + +} + +install_config $config + +# +# Boot image +# + +build_boot_image { core ld.lib.so init eth nic_drv vfs_lwip.lib.so timer libc.lib.so vfs.lib.so } + +append qemu_args " -nographic " + +append_if [have_spec lan9118] qemu_args " -net nic,macaddr=02:00:00:00:01:03 -net nic,model=lan9118 -net tap,ifname=tap0,script=no " + +run_genode_until forever diff --git a/src/app/eth/main.cc b/src/app/eth/main.cc new file mode 100644 index 0000000..69ee2ab --- /dev/null +++ b/src/app/eth/main.cc @@ -0,0 +1,48 @@ +/* + * \brief Test client for the Hello RPC interface + * \author Björn Döbel + * \author Norman Feske + * \date 2008-03-20 + */ + +/* + * Copyright (C) 2008-2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +void Libc::Component::construct(Libc::Env &env) +{ + Libc::with_libc([&] () { + Genode::log("hello test completed"); + + struct sockaddr_in srv_addr; + srv_addr.sin_port = htons(8080); + srv_addr.sin_family = AF_INET; + srv_addr.sin_addr.s_addr = inet_addr("131.159.12.17"); + + int sd = ::socket(AF_INET, SOCK_STREAM, 0); + ::connect(sd, (struct sockaddr *)&srv_addr, sizeof(srv_addr)); + + char buffer[16384]; + ::recv(sd, buffer, 16383, 0); + Genode::String<16383> s(buffer); + Genode::log(s); + + // ---------------------------------- + + }); +} diff --git a/src/app/eth/target.mk b/src/app/eth/target.mk new file mode 100644 index 0000000..9b4e237 --- /dev/null +++ b/src/app/eth/target.mk @@ -0,0 +1,3 @@ +TARGET = eth +SRC_CC = main.cc +LIBS = base libc