[SLOF] [PATCH 2/3] net: Move files from clients/net-snk/app/netlib/ to lib/libnet/
Thomas Huth
thuth at redhat.com
Thu Jun 9 17:06:49 AEST 2016
When we want to link the network stack to other parts of the
firmware later (paflof), we've got to turn it into a proper
library first.
Signed-off-by: Thomas Huth <thuth at redhat.com>
---
board-js2x/Makefile | 3 +-
board-qemu/Makefile | 4 +-
clients/net-snk/Makefile | 2 +-
clients/net-snk/app/Makefile | 4 +-
clients/net-snk/app/netapps/Makefile | 2 +-
lib/Makefile | 2 +-
.../net-snk/app/netlib => lib/libnet}/Makefile | 43 +++++++++++++---------
{clients/net-snk/app/netlib => lib/libnet}/bootp.c | 0
{clients/net-snk/app/netlib => lib/libnet}/dhcp.c | 0
{clients/net-snk/app/netlib => lib/libnet}/dhcp.h | 0
.../net-snk/app/netlib => lib/libnet}/dhcpv6.c | 0
.../net-snk/app/netlib => lib/libnet}/dhcpv6.h | 0
{clients/net-snk/app/netlib => lib/libnet}/dns.c | 0
{clients/net-snk/app/netlib => lib/libnet}/dns.h | 0
.../net-snk/app/netlib => lib/libnet}/ethernet.c | 0
.../net-snk/app/netlib => lib/libnet}/ethernet.h | 0
.../net-snk/app/netlib => lib/libnet}/icmpv6.c | 0
.../net-snk/app/netlib => lib/libnet}/icmpv6.h | 0
{clients/net-snk/app/netlib => lib/libnet}/ipv4.c | 0
{clients/net-snk/app/netlib => lib/libnet}/ipv4.h | 0
{clients/net-snk/app/netlib => lib/libnet}/ipv6.c | 0
{clients/net-snk/app/netlib => lib/libnet}/ipv6.h | 0
{clients/net-snk/app/netlib => lib/libnet}/ndp.c | 0
{clients/net-snk/app/netlib => lib/libnet}/ndp.h | 0
{clients/net-snk/app/netlib => lib/libnet}/tcp.c | 0
{clients/net-snk/app/netlib => lib/libnet}/tcp.h | 0
{clients/net-snk/app/netlib => lib/libnet}/tftp.c | 0
{clients/net-snk/app/netlib => lib/libnet}/tftp.h | 0
{clients/net-snk/app/netlib => lib/libnet}/udp.c | 0
{clients/net-snk/app/netlib => lib/libnet}/udp.h | 0
30 files changed, 35 insertions(+), 25 deletions(-)
rename {clients/net-snk/app/netlib => lib/libnet}/Makefile (50%)
rename {clients/net-snk/app/netlib => lib/libnet}/bootp.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/dhcp.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/dhcp.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/dhcpv6.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/dhcpv6.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/dns.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/dns.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ethernet.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ethernet.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/icmpv6.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/icmpv6.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ipv4.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ipv4.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ipv6.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ipv6.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ndp.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/ndp.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/tcp.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/tcp.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/tftp.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/tftp.h (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/udp.c (100%)
rename {clients/net-snk/app/netlib => lib/libnet}/udp.h (100%)
diff --git a/board-js2x/Makefile b/board-js2x/Makefile
index f24a504..db63b91 100644
--- a/board-js2x/Makefile
+++ b/board-js2x/Makefile
@@ -13,7 +13,8 @@
BOARD_TARGETS = tools_build romfs_build clients_build stage1 subdirs
SUBDIRS = slof rtas
-COMMON_LIBS = libc libipmi libbootmsg libbases libnvram libelf libusb libbcm
+COMMON_LIBS = libc libipmi libbootmsg libbases libnvram libelf libusb \
+ libbcm libnet
all: $(BOARD_TARGETS)
$(MAKE) boot_rom.bin
diff --git a/board-qemu/Makefile b/board-qemu/Makefile
index 29ee016..78639cc 100644
--- a/board-qemu/Makefile
+++ b/board-qemu/Makefile
@@ -14,8 +14,8 @@ BOARD_TARGETS = tools_build romfs_build clients_build stage1 subdirs
SUBDIRS = slof
-COMMON_LIBS = libc libbootmsg libbases libnvram libelf libhvcall libvirtio libusb \
- libveth libe1k
+COMMON_LIBS = libc libbootmsg libbases libnvram libelf libhvcall libvirtio \
+ libusb libveth libe1k libnet
all: $(BOARD_TARGETS)
$(MAKE) boot_rom.bin
diff --git a/clients/net-snk/Makefile b/clients/net-snk/Makefile
index c0bb73a..1cab7ae 100644
--- a/clients/net-snk/Makefile
+++ b/clients/net-snk/Makefile
@@ -17,7 +17,7 @@ include $(TOP)/make.rules
OBJS = kernel/kernel.o oflib/oflib.o libc/libc-glue.o app/app.o
.PHONY : subdirs clean depend mrproper
-CLIENTLIBS = $(LIBCMNDIR)/libelf.a $(LIBCMNDIR)/libc.a
+CLIENTLIBS = $(LIBCMNDIR)/libelf.a $(LIBCMNDIR)/libnet.a $(LIBCMNDIR)/libc.a
all: .depend subdirs
$(MAKE) client
diff --git a/clients/net-snk/app/Makefile b/clients/net-snk/app/Makefile
index 8b0c08f..ddddddc 100644
--- a/clients/net-snk/app/Makefile
+++ b/clients/net-snk/app/Makefile
@@ -16,10 +16,10 @@ export TOP
endif
include $(TOP)/make.rules
-CFLAGS +=$(ADDCFLAGS)
+CFLAGS += -I$(LIBCMNDIR)/libnet
OBJS = main.o
-OBJDIRS = netlib/netlib.o netapps/netboot.o
+OBJDIRS = netapps/netboot.o
OBJDIRS += netapps/ping.o
OBJDIRS += netapps/args.o
diff --git a/clients/net-snk/app/netapps/Makefile b/clients/net-snk/app/netapps/Makefile
index 1e50226..5d95346 100644
--- a/clients/net-snk/app/netapps/Makefile
+++ b/clients/net-snk/app/netapps/Makefile
@@ -16,7 +16,7 @@ ifndef TOP
endif
include $(TOP)/make.rules
-CFLAGS += -I.. -I../netlib -I../../../../lib/ -Wall -W
+CFLAGS += -I.. -I$(LIBCMNDIR)/libnet -I$(LIBCMNDIR) -Wall -W
OBJS = netboot.o ping.o args.o
diff --git a/lib/Makefile b/lib/Makefile
index ed8a359..6d9db66 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -11,7 +11,7 @@
# ****************************************************************************/
SUBDIRS = libc libipmi libbootmsg libbases libnvram libelf libhvcall libvirtio \
- libusb libveth libe1k libbcm
+ libusb libveth libe1k libbcm libnet
all: subdirs
diff --git a/clients/net-snk/app/netlib/Makefile b/lib/libnet/Makefile
similarity index 50%
rename from clients/net-snk/app/netlib/Makefile
rename to lib/libnet/Makefile
index 610e189..14c29d3 100644
--- a/clients/net-snk/app/netlib/Makefile
+++ b/lib/libnet/Makefile
@@ -16,27 +16,36 @@ ifndef TOP
endif
include $(TOP)/make.rules
-CFLAGS += -I../netapps
+CFLAGS += -I. -I.. -I../libc/include
+CFLAGS += -I../../clients/net-snk/app/netapps -I../../clients/net-snk/include
-ifeq ($(SNK_USE_MTFTP), 1)
-CFLAGS += -DUSE_MTFTP
-endif
+SRCS = ethernet.c ipv4.c udp.c tcp.c dns.c bootp.c dhcp.c tftp.c \
+ ipv6.c dhcpv6.c icmpv6.c ndp.c
-OBJS = ethernet.o ipv4.o udp.o tcp.o dns.o bootp.o \
- dhcp.o ipv6.o dhcpv6.o icmpv6.o ndp.o
+OBJS = $(SRCS:%.c=%.o)
-ifeq ($(SNK_USE_MTFTP), 1)
-OBJS += mtftp.o
-else
-OBJS += tftp.o
-endif
+TARGET = ../libnet.a
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(AR) -rc $@ $(OBJS)
+ $(RANLIB) $@
+
+clean:
+ $(RM) $(TARGET) $(OBJS)
+
+distclean: clean
+ $(RM) Makefile.dep
-all: netlib.o
-netlib.o: $(OBJS)
- $(LD) $(LDFLAGS) $^ -o $@ -r
+# Rules for creating the dependency file:
+depend:
+ $(RM) Makefile.dep
+ $(MAKE) Makefile.dep
-clean:
- $(RM) -f *.o *.a *.i
+Makefile.dep: Makefile
+ $(CC) -M $(CPPFLAGS) $(CFLAGS) $(SRCS) > Makefile.dep
-include $(TOP)/make.depend
+# Include dependency file if available:
+-include Makefile.dep
diff --git a/clients/net-snk/app/netlib/bootp.c b/lib/libnet/bootp.c
similarity index 100%
rename from clients/net-snk/app/netlib/bootp.c
rename to lib/libnet/bootp.c
diff --git a/clients/net-snk/app/netlib/dhcp.c b/lib/libnet/dhcp.c
similarity index 100%
rename from clients/net-snk/app/netlib/dhcp.c
rename to lib/libnet/dhcp.c
diff --git a/clients/net-snk/app/netlib/dhcp.h b/lib/libnet/dhcp.h
similarity index 100%
rename from clients/net-snk/app/netlib/dhcp.h
rename to lib/libnet/dhcp.h
diff --git a/clients/net-snk/app/netlib/dhcpv6.c b/lib/libnet/dhcpv6.c
similarity index 100%
rename from clients/net-snk/app/netlib/dhcpv6.c
rename to lib/libnet/dhcpv6.c
diff --git a/clients/net-snk/app/netlib/dhcpv6.h b/lib/libnet/dhcpv6.h
similarity index 100%
rename from clients/net-snk/app/netlib/dhcpv6.h
rename to lib/libnet/dhcpv6.h
diff --git a/clients/net-snk/app/netlib/dns.c b/lib/libnet/dns.c
similarity index 100%
rename from clients/net-snk/app/netlib/dns.c
rename to lib/libnet/dns.c
diff --git a/clients/net-snk/app/netlib/dns.h b/lib/libnet/dns.h
similarity index 100%
rename from clients/net-snk/app/netlib/dns.h
rename to lib/libnet/dns.h
diff --git a/clients/net-snk/app/netlib/ethernet.c b/lib/libnet/ethernet.c
similarity index 100%
rename from clients/net-snk/app/netlib/ethernet.c
rename to lib/libnet/ethernet.c
diff --git a/clients/net-snk/app/netlib/ethernet.h b/lib/libnet/ethernet.h
similarity index 100%
rename from clients/net-snk/app/netlib/ethernet.h
rename to lib/libnet/ethernet.h
diff --git a/clients/net-snk/app/netlib/icmpv6.c b/lib/libnet/icmpv6.c
similarity index 100%
rename from clients/net-snk/app/netlib/icmpv6.c
rename to lib/libnet/icmpv6.c
diff --git a/clients/net-snk/app/netlib/icmpv6.h b/lib/libnet/icmpv6.h
similarity index 100%
rename from clients/net-snk/app/netlib/icmpv6.h
rename to lib/libnet/icmpv6.h
diff --git a/clients/net-snk/app/netlib/ipv4.c b/lib/libnet/ipv4.c
similarity index 100%
rename from clients/net-snk/app/netlib/ipv4.c
rename to lib/libnet/ipv4.c
diff --git a/clients/net-snk/app/netlib/ipv4.h b/lib/libnet/ipv4.h
similarity index 100%
rename from clients/net-snk/app/netlib/ipv4.h
rename to lib/libnet/ipv4.h
diff --git a/clients/net-snk/app/netlib/ipv6.c b/lib/libnet/ipv6.c
similarity index 100%
rename from clients/net-snk/app/netlib/ipv6.c
rename to lib/libnet/ipv6.c
diff --git a/clients/net-snk/app/netlib/ipv6.h b/lib/libnet/ipv6.h
similarity index 100%
rename from clients/net-snk/app/netlib/ipv6.h
rename to lib/libnet/ipv6.h
diff --git a/clients/net-snk/app/netlib/ndp.c b/lib/libnet/ndp.c
similarity index 100%
rename from clients/net-snk/app/netlib/ndp.c
rename to lib/libnet/ndp.c
diff --git a/clients/net-snk/app/netlib/ndp.h b/lib/libnet/ndp.h
similarity index 100%
rename from clients/net-snk/app/netlib/ndp.h
rename to lib/libnet/ndp.h
diff --git a/clients/net-snk/app/netlib/tcp.c b/lib/libnet/tcp.c
similarity index 100%
rename from clients/net-snk/app/netlib/tcp.c
rename to lib/libnet/tcp.c
diff --git a/clients/net-snk/app/netlib/tcp.h b/lib/libnet/tcp.h
similarity index 100%
rename from clients/net-snk/app/netlib/tcp.h
rename to lib/libnet/tcp.h
diff --git a/clients/net-snk/app/netlib/tftp.c b/lib/libnet/tftp.c
similarity index 100%
rename from clients/net-snk/app/netlib/tftp.c
rename to lib/libnet/tftp.c
diff --git a/clients/net-snk/app/netlib/tftp.h b/lib/libnet/tftp.h
similarity index 100%
rename from clients/net-snk/app/netlib/tftp.h
rename to lib/libnet/tftp.h
diff --git a/clients/net-snk/app/netlib/udp.c b/lib/libnet/udp.c
similarity index 100%
rename from clients/net-snk/app/netlib/udp.c
rename to lib/libnet/udp.c
diff --git a/clients/net-snk/app/netlib/udp.h b/lib/libnet/udp.h
similarity index 100%
rename from clients/net-snk/app/netlib/udp.h
rename to lib/libnet/udp.h
--
1.8.3.1
More information about the SLOF
mailing list