Update markdown and tabs and stuff
This commit is contained in:
@@ -12,11 +12,11 @@ First point today was making a directory structure and creating a [git
|
||||
repository](http://github.com/thomasloven/os5). The directory structure starts
|
||||
off as follows
|
||||
|
||||
os5/
|
||||
|-- build/
|
||||
|-- include/
|
||||
`-- kernel/
|
||||
`-- include/
|
||||
os5/
|
||||
|-- build/
|
||||
|-- include/
|
||||
`-- kernel/
|
||||
`-- include/
|
||||
|
||||
A difference from previous times is that the _include_ directory is outside the
|
||||
kernel directory. That's because last time I realized I had a lot of include
|
||||
@@ -24,12 +24,12 @@ files that were used both in the kernel and many other parts. I'll probably
|
||||
move it into some library directory later. Know what? Let's move it into
|
||||
a library directory right now...
|
||||
|
||||
os5/
|
||||
|-- build/
|
||||
|-- kernel/
|
||||
| `-- include/
|
||||
`-- library/
|
||||
`-- include/
|
||||
os5/
|
||||
|-- build/
|
||||
|-- kernel/
|
||||
| `-- include/
|
||||
`-- library/
|
||||
`-- include/
|
||||
|
||||
The build/ directory contains some scripts needed for building and testing the
|
||||
os as well as a floppy image preinstalled with the GRUB bootloader.
|
||||
@@ -38,83 +38,83 @@ Next, basic Makefiles were added to os5/ and kernel/. The standard procedure of
|
||||
the main makefile is to run the makefile in kernel/, copy the kernel image into
|
||||
the floppy and then run bochs-term.
|
||||
|
||||
|
||||
BUILDDIR := $(PWD)
|
||||
|
||||
PATH := /usr/local/cross/bin:$(PATH)
|
||||
DIRS := kernel
|
||||
TARGET := i386-elf
|
||||
:::make
|
||||
BUILDDIR := $(PWD)
|
||||
|
||||
AS := nasm
|
||||
CC := i386-elf-gcc
|
||||
LD := i386-elf-ld
|
||||
|
||||
ASFLAGS := -f elf
|
||||
CCFLAGS := -nostdlib -nostdinc -fno-builtin -fno-exceptions -m32
|
||||
CCFLAGS += -fomit-frame-pointer -fno-asynchronous-unwind-tables
|
||||
CCFLAGS += -fno-unwind-tables -I$(BUILDDIR)/library/include
|
||||
LDFLAGS := -T $(BUILDDIR)/library/include/Link.ld
|
||||
|
||||
export BUILDDIR AS CC LD ASFLAGS CCFLAGS LDFLAGS
|
||||
|
||||
.SILENT:
|
||||
|
||||
.PHONY: $(DIRS) floppy emul
|
||||
.default: all floppy emul
|
||||
|
||||
l: all floppy emul
|
||||
|
||||
all: $(DIRS)
|
||||
|
||||
$(DIRS): force
|
||||
@echo " MAKE " $@
|
||||
@cd $@; $(MAKE) $(MFLAGS)
|
||||
|
||||
clean:
|
||||
@for DIR in $(DIRS); do echo " CLEAN " $$DIR; cd $(BUILDDIR)/$$DIR; make clean; done;
|
||||
|
||||
floppy: force
|
||||
@echo " UPDATING IMAGE"
|
||||
@build/update_image.sh
|
||||
PATH := /usr/local/cross/bin:$(PATH)
|
||||
DIRS := kernel
|
||||
TARGET := i386-elf
|
||||
|
||||
emul: force
|
||||
@echo " STARTING EMULATOR"
|
||||
@build/emul.sh
|
||||
AS := nasm
|
||||
CC := i386-elf-gcc
|
||||
LD := i386-elf-ld
|
||||
|
||||
force:
|
||||
true
|
||||
{: .prettyprint}
|
||||
ASFLAGS := -f elf
|
||||
CCFLAGS := -nostdlib -nostdinc -fno-builtin -fno-exceptions -m32
|
||||
CCFLAGS += -fomit-frame-pointer -fno-asynchronous-unwind-tables
|
||||
CCFLAGS += -fno-unwind-tables -I$(BUILDDIR)/library/include
|
||||
LDFLAGS := -T $(BUILDDIR)/library/include/Link.ld
|
||||
|
||||
export BUILDDIR AS CC LD ASFLAGS CCFLAGS LDFLAGS
|
||||
|
||||
.SILENT:
|
||||
|
||||
.PHONY: $(DIRS) floppy emul
|
||||
.default: all floppy emul
|
||||
|
||||
l: all floppy emul
|
||||
|
||||
all: $(DIRS)
|
||||
|
||||
$(DIRS): force
|
||||
@echo " MAKE " $@
|
||||
@cd $@; $(MAKE) $(MFLAGS)
|
||||
|
||||
clean:
|
||||
@for DIR in $(DIRS); do echo " CLEAN " $$DIR; cd $(BUILDDIR)/$$DIR; make clean; done;
|
||||
|
||||
floppy: force
|
||||
@echo " UPDATING IMAGE"
|
||||
@build/update_image.sh
|
||||
|
||||
emul: force
|
||||
@echo " STARTING EMULATOR"
|
||||
@build/emul.sh
|
||||
|
||||
force:
|
||||
true
|
||||
|
||||
The makefile in the kernel/ directory is pretty much straight forward.
|
||||
|
||||
|
||||
TARGET := kernel
|
||||
SUBDIR := kernel
|
||||
|
||||
SOURCES := kinit.o boot.o
|
||||
SOURCES += $(patsubst %.s,%.o,$(shell find . -name "*.s" | grep -v boot.s))
|
||||
SOURCES += $(patsubst %.c,%.0,$(shell find . -name "*.c" | grep -v kinit.c))
|
||||
|
||||
CCFLAGS += -Iinclude
|
||||
LDFLAGS := -T $(BUILDDIR)/$(SUBDIR)/include/Link.ld
|
||||
|
||||
.SUFFICES: .o .s .c
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(SOURCES)
|
||||
@echo " ln " $(TARGET)
|
||||
@$(LD) $(LDFLAGS) -o $(TARGET) $(SOURCES)
|
||||
|
||||
.c.o:
|
||||
@echo " gcc " $<
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
.s.o:
|
||||
@echo " nasm " $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
-@rm $(SOURCES) 2>/dev/null
|
||||
-@rm $(TARGET) 2>/dev/null
|
||||
{: .prettyprint}
|
||||
:::make
|
||||
TARGET := kernel
|
||||
SUBDIR := kernel
|
||||
|
||||
SOURCES := kinit.o boot.o
|
||||
SOURCES += $(patsubst %.s,%.o,$(shell find . -name "*.s" | grep -v boot.s))
|
||||
SOURCES += $(patsubst %.c,%.0,$(shell find . -name "*.c" | grep -v kinit.c))
|
||||
|
||||
CCFLAGS += -Iinclude
|
||||
LDFLAGS := -T $(BUILDDIR)/$(SUBDIR)/include/Link.ld
|
||||
|
||||
.SUFFICES: .o .s .c
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(SOURCES)
|
||||
@echo " ln " $(TARGET)
|
||||
@$(LD) $(LDFLAGS) -o $(TARGET) $(SOURCES)
|
||||
|
||||
.c.o:
|
||||
@echo " gcc " $<
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
.s.o:
|
||||
@echo " nasm " $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
-@rm $(SOURCES) 2>/dev/null
|
||||
-@rm $(TARGET) 2>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user