From 8f4b3dd4f14c26878efc37356a2a8e91a2a5a0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 24 May 2012 15:41:11 +0200 Subject: [PATCH] Add gnu-netcat as Noux package Please find run script at 'ports/run/noux_net_netcat.run'. --- ports/ports/gnu-netcat.mk | 21 ++++ ports/run/noux_net_netcat.run | 128 ++++++++++++++++++++++++ ports/src/noux-pkg/gnu-netcat/target.mk | 3 + tool/autopilot.list | 1 + 4 files changed, 153 insertions(+) create mode 100644 ports/ports/gnu-netcat.mk create mode 100644 ports/run/noux_net_netcat.run create mode 100644 ports/src/noux-pkg/gnu-netcat/target.mk diff --git a/ports/ports/gnu-netcat.mk b/ports/ports/gnu-netcat.mk new file mode 100644 index 000000000..16aeb24ec --- /dev/null +++ b/ports/ports/gnu-netcat.mk @@ -0,0 +1,21 @@ +GNUNETCAT = gnu-netcat-0.7.1 +GNUNETCAT_VERSION = 0.7.1 +GNUNETCAT_TBZ = netcat-$(GNUNETCAT_VERSION).tar.bz2 +GNUNETCAT_URL = http://downloads.sourceforge.net/sourceforge/netcat/netcat-$(GNUNETCAT_VERSION).tar.bz2 + +# +# Interface to top-level prepare Makefile +# +PORTS += $(GNUNETCAT) + +prepare:: $(CONTRIB_DIR)/$(GNUNETCAT) + +# +# Port-specific local rules +# +$(DOWNLOAD_DIR)/$(GNUNETCAT_TBZ): + $(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GNUNETCAT_URL) && touch $@ + +$(CONTRIB_DIR)/$(GNUNETCAT): $(DOWNLOAD_DIR)/$(GNUNETCAT_TBZ) + $(VERBOSE)tar xfj $< -C $(CONTRIB_DIR) && touch $@ + diff --git a/ports/run/noux_net_netcat.run b/ports/run/noux_net_netcat.run new file mode 100644 index 000000000..e7c75de9c --- /dev/null +++ b/ports/run/noux_net_netcat.run @@ -0,0 +1,128 @@ +if {![have_spec x86_32]} { + puts "\nNoux is supported on the x86_32 architecture only\n" + exit 0 +} +if {[have_spec linux]} { + puts "\nLinux not supported because of missing UART driver\n" + exit 0 +} + +build { + core init + drivers/timer drivers/uart drivers/nic drivers/pci + noux/net lib/libc_noux + noux-pkg/gnu-netcat +} + +exec tar cfv bin/noux_netcat.tar -h -C bin/netcat . + +# +# The '/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 + +install_config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +build_boot_image { + core init timer uart_drv pci_drv nic_drv + ld.lib.so noux_net libc.lib.so libm.lib.so + libc_noux.lib.so lwip.lib.so noux_netcat.tar +} + +# +# Redirect the output of Noux via the virtual serial port 1 into a file to be +# dumped after the successful completion of the test. +# +set noux_output_file "noux_output.log" + +append qemu_args " -nographic" +append qemu_args " -serial mon:stdio" +append qemu_args " -serial file:$noux_output_file" + +append_if [have_spec x86] qemu_args " -net nic,model=e1000 " +append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 " + +append qemu_args " -net user -redir tcp:5555::5555 " + +run_genode_until {.*got IP address.*\n} 60 + +sleep 2 + +exec echo -e "Hello Genode" | netcat localhost 5555 + +sleep 1 + +set output [exec cat $noux_output_file] + +puts "output:\n$output\n" + +exec rm bin/noux_netcat.tar +exec rm -r bin/etc +exec rm $noux_output_file + +if {![regexp {Hello Genode} $output dummy]} { + puts stderr "Error: output not as expected" + exit 1 +} + +puts "Test succeeded" +exit 0 diff --git a/ports/src/noux-pkg/gnu-netcat/target.mk b/ports/src/noux-pkg/gnu-netcat/target.mk new file mode 100644 index 000000000..6718200b8 --- /dev/null +++ b/ports/src/noux-pkg/gnu-netcat/target.mk @@ -0,0 +1,3 @@ +TARGET = netcat + +include $(REP_DIR)/mk/noux.mk diff --git a/tool/autopilot.list b/tool/autopilot.list index f3653a93a..9c36768b9 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -4,6 +4,7 @@ rm_fault rom_blk tar_rom noux +noux_net_netcat libc_ffat timed_semaphore signal