2006-07-16 15:35:18 +00:00
|
|
|
OBJS = \
|
2007-08-28 04:20:40 +00:00
|
|
|
bio.o\
|
2006-07-16 15:35:18 +00:00
|
|
|
console.o\
|
2007-08-28 04:20:40 +00:00
|
|
|
exec.o\
|
2006-09-06 18:40:28 +00:00
|
|
|
file.o\
|
2007-08-28 04:20:40 +00:00
|
|
|
fs.o\
|
2006-07-16 15:35:18 +00:00
|
|
|
ide.o\
|
2007-08-28 04:20:40 +00:00
|
|
|
ioapic.o\
|
2006-07-16 15:35:18 +00:00
|
|
|
kalloc.o\
|
2007-08-28 04:20:40 +00:00
|
|
|
kbd.o\
|
2006-07-16 15:35:18 +00:00
|
|
|
lapic.o\
|
|
|
|
main.o\
|
|
|
|
mp.o\
|
|
|
|
picirq.o\
|
|
|
|
pipe.o\
|
|
|
|
proc.o\
|
|
|
|
spinlock.o\
|
|
|
|
string.o\
|
2007-08-28 12:48:33 +00:00
|
|
|
swtch.o\
|
2006-07-16 15:35:18 +00:00
|
|
|
syscall.o\
|
2006-09-06 18:18:43 +00:00
|
|
|
sysfile.o\
|
|
|
|
sysproc.o\
|
2007-08-28 04:41:20 +00:00
|
|
|
timer.o\
|
2006-07-16 15:35:18 +00:00
|
|
|
trapasm.o\
|
|
|
|
trap.o\
|
2009-05-31 00:28:45 +00:00
|
|
|
uart.o\
|
2006-07-16 15:35:18 +00:00
|
|
|
vectors.o\
|
2010-07-02 18:51:53 +00:00
|
|
|
vm.o\
|
2011-07-28 00:35:46 +00:00
|
|
|
log.o\
|
2006-06-12 15:22:12 +00:00
|
|
|
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 01:07:40 +00:00
|
|
|
# Cross-compiling (e.g., on Mac OS X)
|
2010-08-31 19:01:26 +00:00
|
|
|
#TOOLPREFIX = i386-jos-elf-
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 01:07:40 +00:00
|
|
|
|
|
|
|
# Using native tools (e.g., on X86 Linux)
|
2010-07-02 18:51:53 +00:00
|
|
|
#TOOLPREFIX =
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 01:07:40 +00:00
|
|
|
|
2010-08-31 19:01:26 +00:00
|
|
|
# Try to infer the correct TOOLPREFIX if not set
|
|
|
|
ifndef TOOLPREFIX
|
|
|
|
TOOLPREFIX := $(shell if i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
|
|
|
then echo 'i386-jos-elf-'; \
|
|
|
|
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
|
|
|
|
then echo ''; \
|
|
|
|
else echo "***" 1>&2; \
|
|
|
|
echo "*** Error: Couldn't find an i386-*-elf version of GCC/binutils." 1>&2; \
|
|
|
|
echo "*** Is the directory with i386-jos-elf-gcc in your PATH?" 1>&2; \
|
|
|
|
echo "*** If your i386-*-elf toolchain is installed with a command" 1>&2; \
|
|
|
|
echo "*** prefix other than 'i386-jos-elf-', set your TOOLPREFIX" 1>&2; \
|
|
|
|
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
|
|
|
|
echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \
|
|
|
|
echo "***" 1>&2; exit 1; fi)
|
|
|
|
endif
|
|
|
|
|
2010-08-31 19:05:27 +00:00
|
|
|
# If the makefile can't find QEMU, specify its path here
|
|
|
|
#QEMU =
|
|
|
|
|
|
|
|
# Try to infer the correct QEMU
|
|
|
|
ifndef QEMU
|
|
|
|
QEMU = $(shell if which qemu > /dev/null; \
|
|
|
|
then echo qemu; exit; \
|
|
|
|
else \
|
|
|
|
qemu=/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu; \
|
|
|
|
if test -x $$qemu; then echo $$qemu; exit; fi; fi; \
|
|
|
|
echo "***" 1>&2; \
|
|
|
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
|
|
|
echo "*** Is the directory containing the qemu binary in your PATH" 1>&2; \
|
|
|
|
echo "*** or have you tried setting the QEMU variable in Makefile?" 1>&2; \
|
|
|
|
echo "***" 1>&2; exit 1)
|
|
|
|
endif
|
|
|
|
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 01:07:40 +00:00
|
|
|
CC = $(TOOLPREFIX)gcc
|
2007-08-28 04:20:40 +00:00
|
|
|
AS = $(TOOLPREFIX)gas
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 01:07:40 +00:00
|
|
|
LD = $(TOOLPREFIX)ld
|
|
|
|
OBJCOPY = $(TOOLPREFIX)objcopy
|
|
|
|
OBJDUMP = $(TOOLPREFIX)objdump
|
2011-08-10 01:37:35 +00:00
|
|
|
#CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer
|
|
|
|
CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer
|
2007-08-28 04:20:40 +00:00
|
|
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
2011-08-09 20:09:15 +00:00
|
|
|
ASFLAGS = -m32 -gdwarf-2 -Wa,-divide
|
2007-09-19 23:49:52 +00:00
|
|
|
# FreeBSD ld wants ``elf_i386_fbsd''
|
|
|
|
LDFLAGS += -m $(shell $(LD) -V | grep elf_i386 2>/dev/null)
|
2006-06-12 15:22:12 +00:00
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
xv6.img: bootblock kernel fs.img
|
2006-06-12 15:22:12 +00:00
|
|
|
dd if=/dev/zero of=xv6.img count=10000
|
|
|
|
dd if=bootblock of=xv6.img conv=notrunc
|
|
|
|
dd if=kernel of=xv6.img seek=1 conv=notrunc
|
|
|
|
|
2011-01-11 18:27:45 +00:00
|
|
|
xv6memfs.img: bootblock kernelmemfs
|
|
|
|
dd if=/dev/zero of=xv6memfs.img count=10000
|
|
|
|
dd if=bootblock of=xv6memfs.img conv=notrunc
|
|
|
|
dd if=kernelmemfs of=xv6memfs.img seek=1 conv=notrunc
|
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
bootblock: bootasm.S bootmain.c
|
2009-09-02 17:07:59 +00:00
|
|
|
$(CC) $(CFLAGS) -fno-pic -O -nostdinc -I. -c bootmain.c
|
|
|
|
$(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c bootasm.S
|
2007-09-18 00:41:34 +00:00
|
|
|
$(LD) $(LDFLAGS) -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o
|
2006-06-12 15:22:12 +00:00
|
|
|
$(OBJDUMP) -S bootblock.o > bootblock.asm
|
2009-09-02 06:03:46 +00:00
|
|
|
$(OBJCOPY) -S -O binary -j .text bootblock.o bootblock
|
2006-06-12 15:22:12 +00:00
|
|
|
./sign.pl bootblock
|
|
|
|
|
2011-08-15 16:02:59 +00:00
|
|
|
entryother: entryother.S
|
|
|
|
$(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c entryother.S
|
|
|
|
$(LD) $(LDFLAGS) -N -e start -Ttext 0x7000 -o bootblockother.o entryother.o
|
|
|
|
$(OBJCOPY) -S -O binary -j .text bootblockother.o entryother
|
|
|
|
$(OBJDUMP) -S bootblockother.o > entryother.asm
|
2007-08-28 04:20:40 +00:00
|
|
|
|
|
|
|
initcode: initcode.S
|
2007-09-18 00:41:34 +00:00
|
|
|
$(CC) $(CFLAGS) -nostdinc -I. -c initcode.S
|
|
|
|
$(LD) $(LDFLAGS) -N -e start -Ttext 0 -o initcode.out initcode.o
|
2007-08-21 19:22:08 +00:00
|
|
|
$(OBJCOPY) -S -O binary initcode.out initcode
|
|
|
|
$(OBJDUMP) -S initcode.o > initcode.asm
|
2007-08-28 04:20:40 +00:00
|
|
|
|
2011-09-02 18:51:55 +00:00
|
|
|
kernel: $(OBJS) entry.o entryother initcode
|
|
|
|
$(LD) $(LDFLAGS) -T kernel.ld -e entry -o kernel entry.o $(OBJS) -b binary initcode entryother
|
2006-06-12 15:22:12 +00:00
|
|
|
$(OBJDUMP) -S kernel > kernel.asm
|
2007-08-28 12:48:33 +00:00
|
|
|
$(OBJDUMP) -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
|
2006-06-12 15:22:12 +00:00
|
|
|
|
2011-01-11 18:27:45 +00:00
|
|
|
# kernelmemfs is a copy of kernel that maintains the
|
|
|
|
# disk image in memory instead of writing to a disk.
|
|
|
|
# This is not so useful for testing persistent storage or
|
|
|
|
# exploring disk buffering implementations, but it is
|
|
|
|
# great for testing the kernel on real hardware without
|
|
|
|
# needing a scratch disk.
|
|
|
|
MEMFSOBJS = $(filter-out ide.o,$(OBJS)) memide.o
|
2011-09-02 18:51:55 +00:00
|
|
|
kernelmemfs: $(MEMFSOBJS) entry.o entryother initcode fs.img
|
|
|
|
$(LD) $(LDFLAGS) -Ttext 0x100000 -e main -o kernelmemfs entry.o $(MEMFSOBJS) -b binary initcode entryother fs.img
|
2011-01-11 18:27:45 +00:00
|
|
|
$(OBJDUMP) -S kernelmemfs > kernelmemfs.asm
|
|
|
|
$(OBJDUMP) -t kernelmemfs | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernelmemfs.sym
|
|
|
|
|
2011-08-15 16:02:59 +00:00
|
|
|
tags: $(OBJS) entryother.S _init
|
2006-08-28 18:31:33 +00:00
|
|
|
etags *.S *.c
|
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
vectors.S: vectors.pl
|
2006-06-13 15:50:06 +00:00
|
|
|
perl vectors.pl > vectors.S
|
|
|
|
|
2006-08-24 02:44:41 +00:00
|
|
|
ULIB = ulib.o usys.o printf.o umalloc.o
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 01:07:40 +00:00
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
_%: %.o $(ULIB)
|
2007-09-18 00:41:34 +00:00
|
|
|
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^
|
2007-08-28 04:20:40 +00:00
|
|
|
$(OBJDUMP) -S $@ > $*.asm
|
2007-08-28 12:48:33 +00:00
|
|
|
$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
|
2007-08-08 08:38:55 +00:00
|
|
|
|
2007-08-24 20:20:23 +00:00
|
|
|
_forktest: forktest.o $(ULIB)
|
|
|
|
# forktest has less library code linked in - needs to be small
|
|
|
|
# in order to be able to max out the proc table.
|
2007-09-18 00:41:34 +00:00
|
|
|
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
|
2007-08-24 20:20:23 +00:00
|
|
|
$(OBJDUMP) -S _forktest > forktest.asm
|
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
mkfs: mkfs.c fs.h
|
2010-08-31 19:11:10 +00:00
|
|
|
gcc -m32 -Werror -Wall -o mkfs mkfs.c
|
2007-08-28 04:20:40 +00:00
|
|
|
|
|
|
|
UPROGS=\
|
|
|
|
_cat\
|
2007-08-28 04:26:34 +00:00
|
|
|
_echo\
|
2007-08-28 04:20:40 +00:00
|
|
|
_forktest\
|
2007-08-28 04:26:34 +00:00
|
|
|
_grep\
|
2007-08-28 04:20:40 +00:00
|
|
|
_init\
|
|
|
|
_kill\
|
|
|
|
_ln\
|
|
|
|
_ls\
|
|
|
|
_mkdir\
|
|
|
|
_rm\
|
|
|
|
_sh\
|
2009-11-23 22:27:26 +00:00
|
|
|
_stressfs\
|
2007-08-28 04:20:40 +00:00
|
|
|
_usertests\
|
|
|
|
_wc\
|
|
|
|
_zombie\
|
|
|
|
|
|
|
|
fs.img: mkfs README $(UPROGS)
|
2007-08-08 08:38:55 +00:00
|
|
|
./mkfs fs.img README $(UPROGS)
|
2006-07-21 13:18:04 +00:00
|
|
|
|
2006-06-15 19:58:01 +00:00
|
|
|
-include *.d
|
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
clean:
|
2007-08-30 18:33:48 +00:00
|
|
|
rm -f *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
|
2007-08-28 04:20:40 +00:00
|
|
|
*.o *.d *.asm *.sym vectors.S parport.out \
|
2011-08-16 00:32:04 +00:00
|
|
|
bootblock entryother kernel xv6.img fs.img kernelmemfs mkfs \
|
2007-08-08 08:38:55 +00:00
|
|
|
$(UPROGS)
|
2006-09-07 20:06:15 +00:00
|
|
|
|
|
|
|
# make a printout
|
2007-08-30 14:12:19 +00:00
|
|
|
FILES = $(shell grep -v '^\#' runoff.list)
|
2011-09-02 20:36:08 +00:00
|
|
|
PRINT = runoff.list runoff.spec README toc.hdr toc.ftr $(FILES)
|
2006-09-07 20:06:15 +00:00
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
xv6.pdf: $(PRINT)
|
2006-09-07 20:06:15 +00:00
|
|
|
./runoff
|
2009-08-08 08:07:30 +00:00
|
|
|
ls -l xv6.pdf
|
2006-09-07 20:06:15 +00:00
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
print: xv6.pdf
|
2006-09-07 20:06:15 +00:00
|
|
|
|
|
|
|
# run in emulators
|
|
|
|
|
|
|
|
bochs : fs.img xv6.img
|
|
|
|
if [ ! -e .bochsrc ]; then ln -s dot-bochsrc .bochsrc; fi
|
|
|
|
bochs -q
|
|
|
|
|
2009-09-15 21:15:36 +00:00
|
|
|
# try to generate a unique GDB port
|
|
|
|
GDBPORT = $(shell expr `id -u` % 5000 + 25000)
|
2010-08-30 16:22:08 +00:00
|
|
|
# QEMU's gdb stub command line changed in 0.11
|
2010-08-31 19:05:27 +00:00
|
|
|
QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
|
2010-08-30 16:22:08 +00:00
|
|
|
then echo "-gdb tcp::$(GDBPORT)"; \
|
|
|
|
else echo "-s -p $(GDBPORT)"; fi)
|
2010-09-01 06:14:35 +00:00
|
|
|
ifndef CPUS
|
2011-08-11 16:25:10 +00:00
|
|
|
CPUS := 2
|
2010-09-01 06:14:35 +00:00
|
|
|
endif
|
2011-09-04 19:19:33 +00:00
|
|
|
QEMUOPTS = -hdb fs.img xv6.img -smp $(CPUS) -m 512 $(QEMUEXTRA)
|
2009-09-15 21:15:36 +00:00
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
qemu: fs.img xv6.img
|
2010-08-31 19:05:27 +00:00
|
|
|
$(QEMU) -serial mon:stdio $(QEMUOPTS)
|
2006-09-07 20:06:15 +00:00
|
|
|
|
2011-01-11 18:27:45 +00:00
|
|
|
qemu-memfs: xv6memfs.img
|
|
|
|
$(QEMU) xv6memfs.img -smp $(CPUS)
|
|
|
|
|
2009-10-01 02:09:48 +00:00
|
|
|
qemu-nox: fs.img xv6.img
|
2010-08-31 19:05:27 +00:00
|
|
|
$(QEMU) -nographic $(QEMUOPTS)
|
2009-09-15 21:15:36 +00:00
|
|
|
|
|
|
|
.gdbinit: .gdbinit.tmpl
|
|
|
|
sed "s/localhost:1234/localhost:$(GDBPORT)/" < $^ > $@
|
|
|
|
|
|
|
|
qemu-gdb: fs.img xv6.img .gdbinit
|
|
|
|
@echo "*** Now run 'gdb'." 1>&2
|
2010-08-31 19:05:27 +00:00
|
|
|
$(QEMU) -serial mon:stdio $(QEMUOPTS) -S $(QEMUGDB)
|
2009-05-31 00:28:45 +00:00
|
|
|
|
2010-08-30 16:22:08 +00:00
|
|
|
qemu-nox-gdb: fs.img xv6.img .gdbinit
|
2009-10-01 02:09:48 +00:00
|
|
|
@echo "*** Now run 'gdb'." 1>&2
|
2010-08-31 19:05:27 +00:00
|
|
|
$(QEMU) -nographic $(QEMUOPTS) -S $(QEMUGDB)
|
2009-10-01 02:09:48 +00:00
|
|
|
|
2006-09-08 14:41:06 +00:00
|
|
|
# CUT HERE
|
|
|
|
# prepare dist for students
|
|
|
|
# after running make dist, probably want to
|
|
|
|
# rename it to rev0 or rev1 or so on and then
|
|
|
|
# check in that version.
|
2007-08-30 14:12:19 +00:00
|
|
|
|
|
|
|
EXTRA=\
|
2009-11-23 22:50:58 +00:00
|
|
|
mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\
|
|
|
|
ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\
|
|
|
|
printf.c umalloc.c\
|
2007-08-30 14:12:19 +00:00
|
|
|
README dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\
|
2009-11-23 22:50:58 +00:00
|
|
|
.gdbinit.tmpl gdbutil\
|
2007-08-30 14:12:19 +00:00
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
dist:
|
2006-09-08 14:41:06 +00:00
|
|
|
rm -rf dist
|
|
|
|
mkdir dist
|
2009-11-23 22:50:58 +00:00
|
|
|
for i in $(FILES); \
|
2006-09-08 14:41:06 +00:00
|
|
|
do \
|
|
|
|
grep -v PAGEBREAK $$i >dist/$$i; \
|
|
|
|
done
|
|
|
|
sed '/CUT HERE/,$$d' Makefile >dist/Makefile
|
2007-08-30 14:12:19 +00:00
|
|
|
echo >dist/runoff.spec
|
|
|
|
cp $(EXTRA) dist
|
2006-09-08 14:41:06 +00:00
|
|
|
|
2007-08-28 04:20:40 +00:00
|
|
|
dist-test:
|
2007-08-30 14:12:19 +00:00
|
|
|
rm -rf dist
|
|
|
|
make dist
|
2006-09-08 14:41:06 +00:00
|
|
|
rm -rf dist-test
|
|
|
|
mkdir dist-test
|
|
|
|
cp dist/* dist-test
|
2011-02-20 02:17:55 +00:00
|
|
|
cd dist-test; $(MAKE) print
|
|
|
|
cd dist-test; $(MAKE) bochs || true
|
|
|
|
cd dist-test; $(MAKE) qemu
|
2006-09-08 14:41:06 +00:00
|
|
|
|
2011-02-20 02:17:55 +00:00
|
|
|
# update this rule (change rev#) when it is time to
|
2006-09-08 14:41:06 +00:00
|
|
|
# make a new revision.
|
2007-08-28 04:20:40 +00:00
|
|
|
tar:
|
2006-09-08 14:41:06 +00:00
|
|
|
rm -rf /tmp/xv6
|
|
|
|
mkdir -p /tmp/xv6
|
2009-09-15 23:15:59 +00:00
|
|
|
cp dist/* dist/.gdbinit.tmpl /tmp/xv6
|
2011-02-20 02:17:55 +00:00
|
|
|
(cd /tmp; tar cf - xv6) | gzip >xv6-rev5.tar.gz
|
|
|
|
|
|
|
|
.PHONY: dist-test dist
|