提交 071adf0b 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Some Makefile hooks for lwIP.

上级 dfa9c79c
......@@ -86,6 +86,10 @@ UPROGS= \
_halt
UPROGS := $(addprefix $(O)/, $(UPROGS))
all: $(O)/kernel
include net.mk
$(O)/kernel: $(O) $(O)/boot.o $(OBJS)
@echo " LD $@"
$(Q)$(LD) $(LDFLAGS) -T kernel.ld -z max-page-size=4096 -e start \
......
#include "types.h"
#include "kernel.h"
#ifdef LWIP
#include "lwip/tcpip.h"
#endif
static u8 ping_packet[] = {
0x52, 0x55, 0x0a, 0x00, 0x02, 0x02, 0x52, 0x54, 0x00, 0x12,
0x34, 0x56, 0x08, 0x00, 0x45, 0x00, 0x00, 0x54, 0x00, 0x00,
......@@ -45,3 +49,18 @@ nettest(void)
//e1000tx(ping_packet, sizeof(ping_packet));
}
#ifdef LWIP
static void
tcpip_init_done(void *arg)
{
cprintf("tcpip_init_done: %lx\n", arg);
}
void
initnet(void)
{
tcpip_init(&tcpip_init_done, NULL);
cprintf("initnet:\n");
}
#endif
HAVE_LWIP = $(shell (cd lwip 2> /dev/null && echo y) || echo n)
ifeq ($(HAVE_LWIP),y)
OBJS += $(O)/liblwip.a
CFLAGS += -Ilwip/src/include -Inet -Ilwip/src/include/ipv4 -I. -DLWIP
LWIP_CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb \
-m64 -Werror -std=c99 -fms-extensions -mno-sse -mcmodel=large -I$(QEMUSRC) \
-fno-omit-frame-pointer -DHW_$(HW) -include param.h \
-Wno-attributes -Wno-address -Wno-char-subscripts
LWIP_CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
LWIP_INCLUDES := \
-Ilwip/src/include \
-Ilwip/src/include/ipv4 \
-Inet \
-Inet/arch \
-I.
LWIP_SRCFILES += \
lwip/src/api/api_lib.c \
lwip/src/api/api_msg.c \
lwip/src/api/err.c \
lwip/src/api/sockets.c \
lwip/src/api/tcpip.c \
lwip/src/api/netbuf.c \
lwip/src/core/init.c \
lwip/src/core/tcp_in.c \
lwip/src/core/dhcp.c \
lwip/src/core/mem.c \
lwip/src/core/memp.c \
lwip/src/core/netif.c \
lwip/src/core/pbuf.c \
lwip/src/core/raw.c \
lwip/src/core/stats.c \
lwip/src/core/sys.c \
lwip/src/core/tcp.c \
lwip/src/core/ipv4/ip_addr.c \
lwip/src/core/ipv4/icmp.c \
lwip/src/core/ipv4/ip.c \
lwip/src/core/ipv4/ip_frag.c \
lwip/src/core/ipv4/inet_chksum.c \
lwip/src/core/ipv4/inet.c \
lwip/src/core/tcp_out.c \
lwip/src/core/udp.c \
lwip/src/netif/etharp.c \
LWIP_OBJFILES := $(patsubst %.c, $(O)/%.o, $(LWIP_SRCFILES))
LWIP_OBJFILES := $(patsubst %.S, $(O)/%.o, $(LWIP_OBJFILES))
$(O)/lwip/src/%.o: lwip/src/%.c
@echo " CC $@"
$(Q)mkdir -p $(@D)
$(Q)$(CC) $(LWIP_CFLAGS) $(LWIP_INCLUDES) -c -o $@ $<
$(O)/liblwip.a: $(LWIP_OBJFILES)
@echo " AR $@"
$(Q)mkdir -p $(@D)
$(Q)$(AR) r $@ $(LWIP_OBJFILES)
endif
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论