mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-05-03 13:00:30 +08:00
my solution to lab 6
This commit is contained in:
@@ -94,6 +94,10 @@ CFLAGS += -Wall -Wno-format -Wno-unused -Werror -gstabs -m32
|
||||
# mon_backtrace()'s function prologue on gcc version: (Debian 4.7.2-5) 4.7.2
|
||||
CFLAGS += -fno-tree-ch
|
||||
|
||||
CFLAGS += -I$(TOP)/net/lwip/include \
|
||||
-I$(TOP)/net/lwip/include/ipv4 \
|
||||
-I$(TOP)/net/lwip/jos
|
||||
|
||||
# Add -fno-stack-protector if the option exists.
|
||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||
|
||||
@@ -142,16 +146,22 @@ include kern/Makefrag
|
||||
include lib/Makefrag
|
||||
include user/Makefrag
|
||||
include fs/Makefrag
|
||||
include net/Makefrag
|
||||
|
||||
|
||||
CPUS ?= 1
|
||||
|
||||
PORT7 := $(shell expr $(GDBPORT) + 1)
|
||||
PORT80 := $(shell expr $(GDBPORT) + 2)
|
||||
|
||||
QEMUOPTS = -drive file=$(OBJDIR)/kern/kernel.img,index=0,media=disk,format=raw -serial mon:stdio -gdb tcp::$(GDBPORT)
|
||||
QEMUOPTS += $(shell if $(QEMU) -nographic -help | grep -q '^-D '; then echo '-D qemu.log'; fi)
|
||||
IMAGES = $(OBJDIR)/kern/kernel.img
|
||||
QEMUOPTS += -smp $(CPUS)
|
||||
QEMUOPTS += -drive file=$(OBJDIR)/fs/fs.img,index=1,media=disk,format=raw
|
||||
IMAGES += $(OBJDIR)/fs/fs.img
|
||||
QEMUOPTS += -net user -net nic,model=e1000 -redir tcp:$(PORT7)::7 \
|
||||
-redir tcp:$(PORT80)::80 -redir udp:$(PORT7)::7 -net dump,file=qemu.pcap
|
||||
QEMUOPTS += $(QEMUEXTRA)
|
||||
|
||||
.gdbinit: .gdbinit.tmpl
|
||||
@@ -161,6 +171,8 @@ gdb:
|
||||
$(GDB) -n -x .gdbinit
|
||||
|
||||
pre-qemu: .gdbinit
|
||||
# QEMU doesn't truncate the pcap file. Work around this.
|
||||
@rm -f qemu.pcap
|
||||
|
||||
qemu: $(IMAGES) pre-qemu
|
||||
$(QEMU) $(QEMUOPTS)
|
||||
@@ -308,6 +320,7 @@ myapi.key:
|
||||
# @./handin-prep
|
||||
|
||||
# For test runs
|
||||
prep-net_%: override INIT_CFLAGS+=-DTEST_NO_NS
|
||||
|
||||
prep-%:
|
||||
$(V)$(MAKE) "INIT_CFLAGS=${INIT_CFLAGS} -DTEST=`case $* in *_*) echo $*;; *) echo user_$*;; esac`" $(IMAGES)
|
||||
@@ -324,6 +337,23 @@ run-%-nox: prep-% pre-qemu
|
||||
run-%: prep-% pre-qemu
|
||||
$(QEMU) $(QEMUOPTS)
|
||||
|
||||
# For network connections
|
||||
which-ports:
|
||||
@echo "Local port $(PORT7) forwards to JOS port 7 (echo server)"
|
||||
@echo "Local port $(PORT80) forwards to JOS port 80 (web server)"
|
||||
|
||||
nc-80:
|
||||
nc localhost $(PORT80)
|
||||
|
||||
nc-7:
|
||||
nc localhost $(PORT7)
|
||||
|
||||
telnet-80:
|
||||
telnet localhost $(PORT80)
|
||||
|
||||
telnet-7:
|
||||
telnet localhost $(PORT7)
|
||||
|
||||
# This magic automatically generates makefile dependencies
|
||||
# for header files included from C source files we compile,
|
||||
# and keeps those dependencies up-to-date every time we recompile.
|
||||
|
||||
Reference in New Issue
Block a user