[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3 of 4] minios/build: Introduce application directories



On Mon, 2012-11-26 at 16:24 +0000, Andrew Cooper wrote:
> Allow for separate application subdirectories when developing with
> minios.
> 
> The new system allows a developer to run:
> 
> make XEN_TARGET_ARCH=<arch> APP=<foo>
> 
> While maintaining separate apps in apps/<foo>/
> 
> There is now a requirement to have apps/<foo>/app.mk which lists the
> source files, and can provide application specific configuration of
> settings.

How does this affect building stub domains?

> The default application, daytime, has been moved to use this system, and
> remains the default if no APP is provided to the invocation of make.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> diff -r 29138c27eb72 -r 121ae49aabcb extras/mini-os/Config.mk
> --- a/extras/mini-os/Config.mk
> +++ b/extras/mini-os/Config.mk
> @@ -2,6 +2,10 @@
>  MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os
>  export MINI-OS_ROOT
>  
> +# Default to the daytime app
> +MINIOS_APP_DIR := apps
> +APP ?= daytime
> +
>  libc = $(stubdom)
>  
>  XEN_INTERFACE_VERSION := 0x00030205
> diff -r 29138c27eb72 -r 121ae49aabcb extras/mini-os/Makefile
> --- a/extras/mini-os/Makefile
> +++ b/extras/mini-os/Makefile
> @@ -15,6 +15,9 @@ EXTRA_DEPS += $(MINIOS_CONFIG)
>  include $(MINIOS_CONFIG)
>  endif
>  
> +EXTRA_DEPS += $(MINIOS_APP_DIR)/$(APP)/app.mk
> +include $(MINIOS_APP_DIR)/$(APP)/app.mk
> +
>  # Configuration defaults
>  CONFIG_START_NETWORK ?= y
>  CONFIG_SPARSE_BSS ?= y
> @@ -77,7 +80,6 @@ src-$(CONFIG_TPMFRONT) += tpmfront.c
>  src-$(CONFIG_TPM_TIS) += tpm_tis.c
>  src-$(CONFIG_TPMBACK) += tpmback.c
>  src-y += cmdline.c
> -src-y += daytime.c
>  src-y += events.c
>  src-$(CONFIG_FBFRONT) += fbfront.c
>  src-y += gntmap.c
> @@ -108,7 +110,6 @@ src-y += console/xencons_ring.c
>  src-$(CONFIG_CONSFRONT) += console/xenbus.c
>  
>  # The common mini-os objects to build.
> -APP_OBJS :=
>  OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(src-y))
>  
>  .PHONY: default
> @@ -181,12 +182,15 @@ endif
>       $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
>       gzip -f -9 -c $@ >$@.gz
>  
> -.PHONY: clean arch_clean
> +.PHONY: clean arch_clean apps_clean
>  
>  arch_clean:
>       $(MAKE) --directory=$(TARGET_ARCH_DIR) 
> OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) clean || exit 1;
>  
> -clean:       arch_clean
> +apps_clean:
> +     find $(OBJ_DIR)/$(MINIOS_APP_DIR) -name '*.o' | xargs rm -f
> +
> +clean:       arch_clean apps_clean
>       for dir in $(addprefix $(OBJ_DIR)/,$(SUBDIRS)); do \
>               rm -f $$dir/*.o; \
>       done
> diff -r 29138c27eb72 -r 121ae49aabcb extras/mini-os/apps/daytime/app.mk
> --- /dev/null
> +++ b/extras/mini-os/apps/daytime/app.mk
> @@ -0,0 +1,1 @@
> +src-y += $(MINIOS_APP_DIR)/$(APP)/daytime.c
> diff -r 29138c27eb72 -r 121ae49aabcb extras/mini-os/apps/daytime/daytime.c
> --- /dev/null
> +++ b/extras/mini-os/apps/daytime/daytime.c
> @@ -0,0 +1,67 @@
> +/* 
> + * daytime.c: a simple network service based on lwIP and mini-os
> + * 
> + * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
> + */
> +
> +#include <os.h>
> +#include <xmalloc.h>
> +#include <console.h>
> +#include <netfront.h>
> +#include <lwip/api.h>
> +
> +static char message[29];
> +
> +void run_server(void *p)
> +{
> +    struct ip_addr listenaddr = { 0 };
> +    struct netconn *listener;
> +    struct netconn *session;
> +    struct timeval tv;
> +    err_t rc;
> +
> +    start_networking();
> +
> +    if (0) {
> +        struct ip_addr ipaddr = { htonl(0x0a000001) };
> +        struct ip_addr netmask = { htonl(0xff000000) };
> +        struct ip_addr gw = { 0 };
> +        networking_set_addr(&ipaddr, &netmask, &gw);
> +    }
> +
> +    tprintk("Opening connection\n");
> +
> +    listener = netconn_new(NETCONN_TCP);
> +    tprintk("Connection at %p\n", listener);
> +
> +    rc = netconn_bind(listener, &listenaddr, 13);
> +    if (rc != ERR_OK) {
> +        tprintk("Failed to bind connection: %i\n", rc);
> +        return;
> +    }
> +
> +    rc = netconn_listen(listener);
> +    if (rc != ERR_OK) {
> +        tprintk("Failed to listen on connection: %i\n", rc);
> +        return;
> +    }
> +
> +    while (1) {
> +        session = netconn_accept(listener);
> +        if (session == NULL) 
> +            continue;
> +
> +        gettimeofday(&tv, NULL);
> +        sprintf(message, "%20lu.%6.6lu\n", tv.tv_sec, tv.tv_usec);
> +        (void) netconn_write(session, message, strlen(message), 
> NETCONN_COPY);
> +        (void) netconn_disconnect(session);
> +        (void) netconn_delete(session);
> +    }
> +}
> +
> +
> +int app_main(start_info_t *si)
> +{
> +    create_thread("server", run_server, NULL);
> +    return 0;
> +}
> diff -r 29138c27eb72 -r 121ae49aabcb extras/mini-os/daytime.c
> --- a/extras/mini-os/daytime.c
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/* 
> - * daytime.c: a simple network service based on lwIP and mini-os
> - * 
> - * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
> - */
> -
> -#include <os.h>
> -#include <xmalloc.h>
> -#include <console.h>
> -#include <netfront.h>
> -#include <lwip/api.h>
> -
> -static char message[29];
> -
> -void run_server(void *p)
> -{
> -    struct ip_addr listenaddr = { 0 };
> -    struct netconn *listener;
> -    struct netconn *session;
> -    struct timeval tv;
> -    err_t rc;
> -
> -    start_networking();
> -
> -    if (0) {
> -        struct ip_addr ipaddr = { htonl(0x0a000001) };
> -        struct ip_addr netmask = { htonl(0xff000000) };
> -        struct ip_addr gw = { 0 };
> -        networking_set_addr(&ipaddr, &netmask, &gw);
> -    }
> -
> -    tprintk("Opening connection\n");
> -
> -    listener = netconn_new(NETCONN_TCP);
> -    tprintk("Connection at %p\n", listener);
> -
> -    rc = netconn_bind(listener, &listenaddr, 13);
> -    if (rc != ERR_OK) {
> -        tprintk("Failed to bind connection: %i\n", rc);
> -        return;
> -    }
> -
> -    rc = netconn_listen(listener);
> -    if (rc != ERR_OK) {
> -        tprintk("Failed to listen on connection: %i\n", rc);
> -        return;
> -    }
> -
> -    while (1) {
> -        session = netconn_accept(listener);
> -        if (session == NULL) 
> -            continue;
> -
> -        gettimeofday(&tv, NULL);
> -        sprintf(message, "%20lu.%6.6lu\n", tv.tv_sec, tv.tv_usec);
> -        (void) netconn_write(session, message, strlen(message), 
> NETCONN_COPY);
> -        (void) netconn_disconnect(session);
> -        (void) netconn_delete(session);
> -    }
> -}
> -
> -
> -int app_main(start_info_t *si)
> -{
> -    create_thread("server", run_server, NULL);
> -    return 0;
> -}
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.