libbsd.txt "test runner" realview_pbx_a9_qemu

Gene Smith gds at chartertn.net
Fri Jun 19 05:46:50 UTC 2015


On 06/18/2015 02:02 AM, Chris Johns wrote:
>
> I added to the ping01 code the following ...
>
> #include <rtems/netcmds-config.h>
>
> #define CONFIGURE_SHELL_COMMANDS_INIT
> #define CONFIGURE_SHELL_COMMANDS_ALL
>
> #define CONFIGURE_SHELL_USER_COMMANDS \
>    &rtems_shell_HOSTNAME_Command,      \
>      &rtems_shell_PING_Command,        \
>      &rtems_shell_ROUTE_Command,       \
>      &rtems_shell_NETSTAT_Command,     \
>      &rtems_shell_IFCONFIG_Command,    \
>      &rtems_shell_TCPDUMP_Command
>
> #include <rtems/shellconfig.h>
>
> static void shell(void)
> {
>    rtems_shell_env_t env;
>
>    memset(&env, 0, sizeof(env));
>    rtems_shell_main_loop( &env );
>
>    exit( 0 );
> }
>
> and just call 'shell' after the ping.
>
> Note, currently tcpdump will not exit. I am not sure how to fix that.

I may revisit the vde method but for now I just tried the latest libbsd 
with the tcpdump added. I have been using the Makefile build system but 
it now fails with the git pull. So I tried the waf build and it builds 
with no apparent errors. However, it didn't seem to include the 
NET_CFG_... constants (at least README.waf doesn't mention them). So I 
debugged the Makefile.

It appears there are three things wrong with the Makefile.

1) Everywhere the string "-D_U_=__attribute__((unused))" appears in the 
rules it needs to be quoted. It appears in almost every rule so there 
are maybe 100s of them. (I used single quotes, FWIW.)
2) Everywhere sting "freebsd/usr.sbin/tcpdump/tcpdump-D__FreeBSD__=1" 
appears it needs have a space inserted:
"freebsd/usr.sbin/tcpdump/tcpdump -D__FreeBSD__=1"
Quotes aren't required. Again, there a many of these.
3) Several include paths need to be added:
COMMON_FLAGS += -Ifreebsd/contrib/libpcap
COMMON_FLAGS += -Irtemsbsd/sys
COMMON_FLAGS += -Ifreebsd/usr.sbin/tcpdump/tcpdump
COMMON_FLAGS += -Ifreebsd/contrib/tcpdump
COMMON_FLAGS += -Ibuild/arm-rtems4.11-realview_pbx_a9_qemu/testsuite/include
(The last one contains the bsp name so probably needs to be more 
general, but seems to work ok as an ad hoc fix.)

With these Makefile fixes, the libbsd builds again & everything works 
like before. But when I added the shell() code as you suggested above, 
initial ping and the shell work but when I run tcpdump from the rtems 
shell, the "guest" becomes unresponsive: ping to the rtems guest no 
longer responds and tcpdump in rtems shell prints nothing (except for 
the standard tcpdump introductory message). Is tcpdump actually working 
for you and printing packet info?

Since the Makefile is deprecated, you may not want to fix it. I 
understand that. However, can you provide information on how the 
information in config.inc can be applied in waf, primarily the 
NET_CFG_... network parameters. (The file and NET_CFG_... items appear 
in wscript but don't understand if they have an effect.)

Thanks!
-gene



More information about the users mailing list