This commit is contained in:
Julian Barathieu 2019-04-13 09:28:18 +02:00
commit c0507e2128
9 changed files with 152 additions and 193 deletions

View File

@ -40,4 +40,8 @@
- We have implemented a buffer library for our terminal - We have implemented a buffer library for our terminal
- The stack is now 8MB long and isn't anymore in conflict with the kernel space xD - The stack is now 8MB long and isn't anymore in conflict with the kernel space xD
- The terminal is now better (with sprintf functions) - The terminal is now better (with sprintf functions)
2019/04/09 More improvements
- The terminal is now buffered (static) and we have made a big reorganization of the project
- The Makefile suffered a lot, so we improved it
- panic doesn't need to lock the terminal
- We have a (basic) heap and memory allocator

248
Makefile
View File

@ -22,24 +22,38 @@
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. # # along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=# #=----------------------------------------------------------------------------=#
.PHONY: all test test32 debug gdb install_mbr dust clean OS/K
## VARIABLES ----------------------------------------------------------------- # ## VARIABLES ----------------------------------------------------------------- #
#Programs # Debug
ASM=nasm mode ?= debug
LD=ld
CCNAME=x86_64-elf-gcc
# Programs
ASM=nasm
LD=x86_64-elf-ld
OBJCOPY=x86_64-elf-objcopy
CCNAME=x86_64-elf-gcc
ASMFLAGS=-f elf64 ASMFLAGS=-f elf64
LDFLAGS=-melf_x86_64 LDFLAGS=-melf_x86_64
COPTIM=-O2 COPTIM=-O2
CWARNS=-Wall -Wextra -Werror=implicit-function-declaration CWARNS=-Wall -Wextra -Werror=implicit-function-declaration
CINCLUDES=-Iinclude CINCLUDES=-Iinclude
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11
CFLAGS2= -c -g -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -fno-strict-aliasing CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2
CFLAGS=$(CFLAGS1) $(CFLAGS2) CFLAGS=$(CFLAGS1) $(CFLAGS2)
ifeq ($(mode), release)
CFLAGS += -D_NO_DEBUG
dep += dust
endif
ifeq ($(mode), debug)
CFLAGS += -g
endif
KCC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES) -D_OSK_SOURCE -D_KALEID_KERNEL KCC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES) -D_OSK_SOURCE -D_KALEID_KERNEL
#Folders # Folders
MBRDIR=boot/grub MBRDIR=boot/grub
LOADERDIR=boot/loader LOADERDIR=boot/loader
KALEIDDIR=kaleid KALEIDDIR=kaleid
@ -49,141 +63,43 @@ KOBJDIR=build/obj/kaleid
LOBJDIR=build/obj/boot LOBJDIR=build/obj/boot
BINDIR=build/bin BINDIR=build/bin
BUILDDIR=build BUILDDIR=build
vpath %.c $(KALEIDDIR)
#Color codes # Color codes
CL='\033[0;32m' CL='\033[0;32m'
CL2='\033[1;36m' CL2='\033[1;36m'
CL3='\033[0m' CL3='\033[0m'
NC='\033[1;37m' NC='\033[1;37m'
.PHONY: all
all : OS/K ## SOURCES INSCRIPTION-------------------------------------------------------- #
# Lib C sources
LibCSources= libc/atoi.c libc/itoa.c \
libc/mem.c libc/ctype.c \
libc/rand.c libc/sprintf.c \
libc/status.c libc/string.c \
libc/strtol.c extras/argv.c \
extras/prog.c
KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources))
# Kernel sources
KernSources= libbuf/buf.c libbuf/bput.c \
libbuf/bprint.c kernel/cpu/cpuid.c \
kernel/cpu/idt.c kernel/init/init.c \
kernel/init/table.c kernel/io/cursor.c \
kernel/ke/log.c kernel/io/vga.c \
kernel/ke/panic.c kernel/mm/map.c \
kernel/mm/heap.c kernel/mm/malloc.c \
kernel/mm/gdt.c kernel/ps/sched.c \
LibCObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(LibCSources))
## KALEID MAKEFILE ----------------------------------------------------------- # ## KALEID MAKEFILE ----------------------------------------------------------- #
# Common objects all : OS/K $(dep)
kal_com_obj= $(KOBJDIR)/atoi.o $(KOBJDIR)/ctype.o \
$(KOBJDIR)/itoa.o $(KOBJDIR)/mem.o \
$(KOBJDIR)/rand.o $(KOBJDIR)/sprintf.o \
$(KOBJDIR)/status.o $(KOBJDIR)/string.o \
$(KOBJDIR)/strtol.o $(KOBJDIR)/argv.o \
$(KOBJDIR)/prog.o $(KOBJDIR)/atol.o \
$(KOBJDIR)/atou.o $(KOBJDIR)/atoul.o \
$(KOBJDIR)/utoa.o $(KOBJDIR)/ltoa.o \
$(KOBJDIR)/ultoa.o
$(KOBJDIR)/atoi.o: $(KALEIDDIR)/libc/atoi.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_ATOI $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/atol.o: $(KALEIDDIR)/libc/atoi.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_ATOL $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/atou.o: $(KALEIDDIR)/libc/atoi.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_ATOU $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/atoul.o: $(KALEIDDIR)/libc/atoi.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_ATOUL $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/ctype.o: $(KALEIDDIR)/libc/ctype.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/itoa.o: $(KALEIDDIR)/libc/itoa.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_ITOA $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/ltoa.o: $(KALEIDDIR)/libc/itoa.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_LTOA $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/utoa.o: $(KALEIDDIR)/libc/itoa.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_UTOA $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/ultoa.o: $(KALEIDDIR)/libc/itoa.c $(INCLUDEDIR)/*/*.h
@$(KCC) -D_NEED_ULTOA $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/mem.o: $(KALEIDDIR)/libc/mem.c $(INCLUDEDIR)/*/*.h
@$(KCC) -fno-strict-aliasing $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/rand.o: $(KALEIDDIR)/libc/rand.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/sprintf.o: $(KALEIDDIR)/libc/sprintf.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/status.o: $(KALEIDDIR)/libc/status.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/string.o: $(KALEIDDIR)/libc/string.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/strtol.o: $(KALEIDDIR)/libc/strtol.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/argv.o: $(KALEIDDIR)/extras/argv.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/prog.o: $(KALEIDDIR)/extras/prog.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/buf.o: $(KALEIDDIR)/libbuf/buf.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/bput.o: $(KALEIDDIR)/libbuf/bput.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/bprint.o: $(KALEIDDIR)/libbuf/bprint.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
# Kernel objects
kal_kern_obj= $(KOBJDIR)/kernel/cpuid.o $(KOBJDIR)/kernel/init.o \
$(KOBJDIR)/kernel/table.o $(KOBJDIR)/kernel/cursor.o \
$(KOBJDIR)/kernel/log.o $(KOBJDIR)/kernel/vga.o \
$(KOBJDIR)/kernel/panic.o $(KOBJDIR)/kernel/map.o \
$(KOBJDIR)/kernel/heap.o $(KOBJDIR)/kernel/malloc.o \
$(KOBJDIR)/kernel/buf.o $(KOBJDIR)/kernel/sched.o \
$(KOBJDIR)/kernel/bput.o $(KOBJDIR)/kernel/bprint.o \
$(KOBJDIR)/kernel/gdt.o
$(KOBJDIR)/kernel/cpuid.o: $(KALEIDDIR)/kernel/cpu/cpuid.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/idt.o: $(KALEIDDIR)/kernel/cpu/idt.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/init.o: $(KALEIDDIR)/kernel/init/init.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/table.o: $(KALEIDDIR)/kernel/init/table.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/cursor.o: $(KALEIDDIR)/kernel/io/cursor.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/log.o: $(KALEIDDIR)/kernel/ke/log.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/vga.o: $(KALEIDDIR)/kernel/io/vga.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/panic.o: $(KALEIDDIR)/kernel/ke/panic.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/map.o: $(KALEIDDIR)/kernel/mm/map.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/heap.o: $(KALEIDDIR)/kernel/mm/heap.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/malloc.o: $(KALEIDDIR)/kernel/mm/malloc.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
$(KOBJDIR)/kernel/gdt.o: $(KALEIDDIR)/kernel/mm/gdt.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/sched.o: $(KALEIDDIR)/kernel/ps/sched.c $(INCLUDEDIR)/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
## MISC MAKEFILE ------------------------------------------------------------- # ## MISC MAKEFILE ------------------------------------------------------------- #
./ProjectTree: ./.stylehlp_sh ./ProjectTree: ./.stylehlp_sh
@ -192,24 +108,55 @@ $(KOBJDIR)/kernel/sched.o: $(KALEIDDIR)/kernel/ps/sched.c $(INCLUDEDIR)/*/*.h
@tree --dirsfirst >> ./ProjectTree @tree --dirsfirst >> ./ProjectTree
@echo ${CL2}[$@] ${CL}Generated.${CL3} @echo ${CL2}[$@] ${CL}Generated.${CL3}
$(KOBJDIR):
@mkdir -p $(KOBJDIR)
## LIB C MAKEFILE ------------------------------------------------------------ #
$(KOBJDIR)/libc/atoi.o: $(KALEIDDIR)/libc/atoi.c $(INCLUDEDIR)/*/*.h | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(KCC) -D_NEED_ATOI $< -o $@.1
@$(KCC) -D_NEED_ATOL $< -o $@.2
@$(KCC) -D_NEED_ATOU $< -o $@.3
@$(KCC) -D_NEED_ATOUL $< -o $@.4
@$(LD) -r $@.1 $@.2 $@.3 $@.4 -o $@
@rm -f $@.1 $@.2 $@.3 $@.4
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/libc/itoa.o: $(KALEIDDIR)/libc/itoa.c $(INCLUDEDIR)/*/*.h | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(KCC) -D_NEED_ITOA $< -o $@.1
@$(KCC) -D_NEED_LTOA $< -o $@.2
@$(KCC) -D_NEED_UTOA $< -o $@.3
@$(KCC) -D_NEED_ULTOA $< -o $@.4
@$(LD) -r $@.1 $@.2 $@.3 $@.4 -o $@
@rm -f $@.1 $@.2 $@.3 $@.4
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/libc/mem.o: $(KALEIDDIR)/libc/mem.c $(INCLUDEDIR)/*/*.h | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(KCC) -fno-strict-aliasing $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
## MAIN MAKEFILE ------------------------------------------------------------- # ## MAIN MAKEFILE ------------------------------------------------------------- #
.PHONY: test $(KOBJDIR)/%.o: %.c $(INCLUDEDIR)/*/*.h | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
test: all test: all
@qemu-system-x86_64 -m 5G -hda $(BUILDDIR)/bin/disk.img \ @qemu-system-x86_64 -m 4G -hda $(BUILDDIR)/bin/disk.img \
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log & -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
.PHONY: test32
test32: all test32: all
@qemu-system-i386 -hda $(BUILDDIR)/bin/disk.img -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log & @qemu-system-i386 -hda $(BUILDDIR)/bin/disk.img -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
.PHONY: debug
debug: all debug: all
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \ @qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
-no-shutdown -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log & -no-shutdown -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > $(BUILDDIR)/kaleid64_disasm.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > $(BUILDDIR)/kaleid64_disasm.asm
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > $(BUILDDIR)/kaleid32_disasm.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > $(BUILDDIR)/kaleid32_disasm.asm
.PHONY: gdb
gdb: all gdb: all
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \ @qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
-no-shutdown -d cpu_reset,guest_errors,pcall,int -s 2> $(BUILDDIR)/qemu.log & -no-shutdown -d cpu_reset,guest_errors,pcall,int -s 2> $(BUILDDIR)/qemu.log &
@ -221,7 +168,6 @@ gdb: all
-ex "symbol-file $(BINDIR)/kaleid" \ -ex "symbol-file $(BINDIR)/kaleid" \
-ex "break BtStartKern" \ -ex "break BtStartKern" \
.PHONY: install_mbr
install_mbr: $(BINDIR)/disk.img $(MBRDIR)/grub.cfg install_mbr: $(BINDIR)/disk.img $(MBRDIR)/grub.cfg
@mkdir -p $(BINDIR)/disk @mkdir -p $(BINDIR)/disk
@echo ${CL2}[$@] ${NC}Installing MBR on image...${CL3} @echo ${CL2}[$@] ${NC}Installing MBR on image...${CL3}
@ -230,30 +176,31 @@ install_mbr: $(BINDIR)/disk.img $(MBRDIR)/grub.cfg
@rmdir $(BINDIR)/disk @rmdir $(BINDIR)/disk
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}
.PHONY: clean dust:
-@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true
@rm -Rf $(OBJDIR)/*
@echo ${CL2}[$@] ${CL}Cleaned.${CL3}
clean: clean:
-@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true -@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true
@rm -Rvf ./ProjectTree @rm -Rvf ./ProjectTree $(BUILDDIR)/*.log
@rm -Rvf $(BINDIR)/* $(OBJDIR)/*.o \ @rm -Rvf $(BINDIR)/* $(OBJDIR)/*
$(OBJDIR)/*/*.o $(OBJDIR)/*/*.x86_64 $(OBJDIR)/*/*/*.o @echo ${CL2}[$@] ${CL}Cleaned.${CL3}
@echo ${CL2}[[$@]] ${CL}Cleaned.${CL3}
$(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64
@echo ${CL2}[$@] ${NC}Objcopy...${CL3} @echo ${CL2}[$@] ${NC}Objcopy...${CL3}
@x86_64-elf-objcopy -I elf64-x86-64 -O elf32-i386 $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid @$(OBJCOPY) -I elf64-x86-64 -O elf32-i386 $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}
$(LOBJDIR)/kaleid.x86_64: $(kal_kern_obj) $(kal_com_obj) $(LOBJDIR)/loader.o $(LOBJDIR)/kaleid.x86_64: $(LibCObj) $(KernObj) $(LOBJDIR)/loader.o
@echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3} @echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3}
@$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \ @$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \
$(LOBJDIR)/loader.o \ $(LOBJDIR)/loader.o $(KernObj) $(LibCObj) \
$(KOBJDIR)/*.o \
$(KOBJDIR)/kernel/*.o \
-o $(LOBJDIR)/kaleid.x86_64 -o $(LOBJDIR)/kaleid.x86_64
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}
$(LOBJDIR)/loader.o: $(LOADERDIR)/loader.asm $(LOADERDIR)/*/*.inc $(LOBJDIR)/loader.o: $(LOADERDIR)/loader.asm $(LOADERDIR)/*/*.inc
@echo ${CL2}[$@] ${NC}Making loader...${CL3} @echo ${CL2}[$@] ${NC}Making loader...${CL3}
@mkdir -p $(shell dirname $@)
@$(ASM) $(ASMFLAGS) $(LOADERDIR)/loader.asm -o $(LOBJDIR)/loader.o > /dev/null @$(ASM) $(ASMFLAGS) $(LOADERDIR)/loader.asm -o $(LOBJDIR)/loader.o > /dev/null
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}
@ -264,10 +211,9 @@ $(BINDIR)/disk.img: $(MBRDIR)/create_disk.sh
@make install_mbr @make install_mbr
@echo ${CL2}[$@]${NC} Constructing disk image...${CL3} @echo ${CL2}[$@]${NC} Constructing disk image...${CL3}
.PHONY:OS/K
OS/K: $(BINDIR)/kaleid $(BINDIR)/disk.img ./ProjectTree OS/K: $(BINDIR)/kaleid $(BINDIR)/disk.img ./ProjectTree
@mkdir -p $(BINDIR)/disk @mkdir -p $(BINDIR)/disk
@echo ${CL2}[[$@]] ${NC}Integrating kernel...${CL3} @echo ${CL2}[[$@]] ${NC}Integrating kernel, $(mode) mode.${CL3}
-@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true -@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true
@$(MBRDIR)/mount.sh $(BINDIR)/disk.img $(BINDIR)/disk @$(MBRDIR)/mount.sh $(BINDIR)/disk.img $(BINDIR)/disk
@cp $(BINDIR)/kaleid $(BINDIR)/disk/boot/kaleid @cp $(BINDIR)/kaleid $(BINDIR)/disk/boot/kaleid

View File

@ -55,42 +55,53 @@
│   │   │   ├── kaleid.x86_64 │   │   │   ├── kaleid.x86_64
│   │   │   └── loader.o │   │   │   └── loader.o
│   │   └── kaleid │   │   └── kaleid
│   │   ├── extras
│   │   │   ├── argv.o
│   │   │   └── prog.o
│   │   ├── kernel │   │   ├── kernel
│   │   │   ├── cpu
│   │   │   │   ├── cpuid.o
│   │   │   │   └── idt.o
│   │   │   ├── init
│   │   │   │   ├── init.o
│   │   │   │   └── table.o
│   │   │   ├── io
│   │   │   │   ├── cursor.o
│   │   │   │   └── vga.o
│   │   │   ├── ke
│   │   │   │   ├── log.o
│   │   │   │   └── panic.o
│   │   │   ├── mm
│   │   │   │   ├── gdt.o
│   │   │   │   ├── heap.o
│   │   │   │   ├── malloc.o
│   │   │   │   └── map.o
│   │   │   └── ps
│   │   │   └── sched.o
│   │   ├── libbuf
│   │   │   ├── bprint.o │   │   │   ├── bprint.o
│   │   │   ├── bput.o │   │   │   ├── bput.o
│   │   │   ├── buf.o │   │   │   └── buf.o
│   │   │   ├── cpuid.o │   │   └── libc
│   │   │   ├── cursor.o │   │   ├── atoi.o
│   │   │   ├── gdt.o │   │   ├── atoi.o.1
│   │   │   ├── heap.o │   │   ├── atoi.o.2
│   │   │   ├── init.o │   │   ├── atoi.o.3
│   │   │   ├── log.o │   │   ├── atoi.o.4
│   │   │   ├── malloc.o │   │   ├── ctype.o
│   │   │   ├── map.o │   │   ├── itoa.o
│   │   │   ├── panic.o │   │   ├── itoa.o.1
│   │   │   ├── sched.o │   │   ├── itoa.o.2
│   │   │   ├── table.o │   │   ├── itoa.o.3
│   │   │   └── vga.o │   │   ├── itoa.o.4
│   │   ├── argv.o │   │   ├── mem.o
│   │   ├── atoi.o │   │   ├── rand.o
│   │   ├── atol.o │   │   ├── sprintf.o
│   │   ├── atoul.o │   │   ├── status.o
│   │   ├── atou.o │   │   ├── string.o
│   │   ├── ctype.o │   │   └── strtol.o
│   │   ├── itoa.o
│   │   ├── ltoa.o
│   │   ├── mem.o
│   │   ├── prog.o
│   │   ├── rand.o
│   │   ├── sprintf.o
│   │   ├── status.o
│   │   ├── string.o
│   │   ├── strtol.o
│   │   ├── ultoa.o
│   │   └── utoa.o
│   ├── grub.log │   ├── grub.log
│   ├── kernel.ld │   └── kernel.ld
│   └── qemu.log
├── include ├── include
│   ├── base │   ├── base
│   │   ├── assert.h │   │   ├── assert.h
@ -167,4 +178,4 @@
├── ProjectTree ├── ProjectTree
└── README.md └── README.md
28 directories, 114 files 37 directories, 116 files

View File

@ -11,21 +11,21 @@ For changelog, see [ChangeLog](ChangeLog)
For structure of the sources, see [ProjectTree](ProjectTree) For structure of the sources, see [ProjectTree](ProjectTree)
For our IRC channel, see `#os.k-devel` on [Freenode](https://webchat.freenode.net)
Note that every file within OS/K is written using spaces for tabulation, with each Note that every file within OS/K is written using spaces for tabulation, with each
tabulation being 4 spaces long. tabulation being 4 spaces long.
IRC Channel: #os.k-devel on Freenode
#### Compile from sources #### Compile from sources
To compile this project from sources, you must first install the dependencies To compile this project from sources, you must first install the dependencies
``` ```
apt update && apt upgrade apt update && apt upgrade
apt install grub-pc dosfstools make nasm qemu apt install grub-pc-bin dosfstools make nasm qemu tree
``` ```
You also need to have the [x86-64 ELF gcc cross-compiler](https://www.os-k.eu/build-tools/cross-cc.tar.xz) and its "bin" repertory in your PATH. You also need to have the [x86-64 ELF gcc cross-compiler](https://www.os-k.eu/build-tools/cross-cc.tar.xz) and its ``bin`` directory in your PATH.
To compile, simply use at the root of this project : To compile, simply use at the root of this project :
``` ```

View File

@ -22,7 +22,7 @@
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. # # along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=# #=----------------------------------------------------------------------------=#
set timeout=5 set timeout=0
set default=0 #Set the default menu entry set default=0 #Set the default menu entry

View File

@ -21,7 +21,7 @@
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <kernel/base.h>
// //
// Registers the new idt in the idtr register. // Registers the new idt in the idtr register.

View File

@ -151,8 +151,6 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic)
MmInitHeap(); MmInitHeap();
PsInitSched(); PsInitSched();
pstest();
// End this machine's suffering // End this machine's suffering
BFlushBuf(BStdOut); BFlushBuf(BStdOut);
KeCrashSystem(); KeCrashSystem();