diff --git a/.stylehlp b/.stylehlp deleted file mode 100644 index ec5e145..0000000 --- a/.stylehlp +++ /dev/null @@ -1,74 +0,0 @@ -//----------------------------------------------------------------------------// -// GNU GPL OS/K // -// // -// Desc: // -// // -// // -// Copyright © 2018-2019 The OS/K Team // -// // -// This file is part of OS/K. // -// // -// OS/K is free software: you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation, either version 3 of the License, or // -// any later version. // -// // -// OS/K is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY//without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with OS/K. If not, see . // -//----------------------------------------------------------------------------// - -//------------------------------------------// - - -;=----------------------------------------------------------------------------=; -; GNU GPL OS/K ; -; ; -; Desc: ; -; ; -; ; -; Copyright © 2018-2019 The OS/K Team ; -; ; -; This file is part of OS/K. ; -; ; -; OS/K is free software: you can redistribute it and/or modify ; -; it under the terms of the GNU General Public License as published by ; -; the Free Software Foundation, either version 3 of the License, or ; -; (at your option) any later version. ; -; ; -; OS/K is distributed in the hope that it will be useful, ; -; but WITHOUT ANY WARRANTY; without even the implied warranty of ; -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; -; GNU General Public License for more details. ; -; ; -; You should have received a copy of the GNU General Public License ; -; along with OS/K. If not, see . ; -;=----------------------------------------------------------------------------=; - -#=----------------------------------------------------------------------------=# -# GNU GPL OS/K # -# # -# Desc: # -# # -# # -# Copyright © 2018-2019 The OS/K Team # -# # -# This file is part of OS/K. # -# # -# OS/K is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# any later version. # -# # -# OS/K is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY# without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with OS/K. If not, see . # -#=----------------------------------------------------------------------------=# diff --git a/Makefile b/Makefile index 4c91176..eddffe6 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,8 @@ MBRDIR=boot/grub LOADERDIR=boot/loader KERNELDIR=kaleid OBJDIR=build/obj +KOBJDIR=build/obj/kaleid +LOBJDIR=build/obj/boot BINDIR=build/bin #Color codes @@ -59,96 +61,102 @@ all : OS/K ## KALEID MAKEFILE ----------------------------------------------------------- # # Common objects -kal_com_obj= $(OBJDIR)/kaleid/atoi.o $(OBJDIR)/kaleid/ctype.o \ - $(OBJDIR)/kaleid/itoa.o $(OBJDIR)/kaleid/memory.o \ - $(OBJDIR)/kaleid/rand.o $(OBJDIR)/kaleid/sprintf.o \ - $(OBJDIR)/kaleid/status.o $(OBJDIR)/kaleid/string.o \ - $(OBJDIR)/kaleid/strtol.o $(OBJDIR)/kaleid/argv.o \ - $(OBJDIR)/kaleid/prog.o $(OBJDIR)/kaleid/atol.o \ - $(OBJDIR)/kaleid/atou.o $(OBJDIR)/kaleid/atoul.o \ - $(OBJDIR)/kaleid/utoa.o $(OBJDIR)/kaleid/ltoa.o \ - $(OBJDIR)/kaleid/ultoa.o +kal_com_obj= $(KOBJDIR)/atoi.o $(KOBJDIR)/ctype.o \ + $(KOBJDIR)/itoa.o $(KOBJDIR)/memory.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 -$(OBJDIR)/kaleid/atoi.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atoi.o: $(KERNELDIR)/crtlib/atoi.c @$(KCC) -D_NEED_ATOI $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/atol.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atol.o: $(KERNELDIR)/crtlib/atoi.c @$(KCC) -D_NEED_ATOL $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/atou.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atou.o: $(KERNELDIR)/crtlib/atoi.c @$(KCC) -D_NEED_ATOU $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/atoul.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atoul.o: $(KERNELDIR)/crtlib/atoi.c @$(KCC) -D_NEED_ATOUL $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/ctype.o: $(KERNELDIR)/crtlib/ctype.c +$(KOBJDIR)/ctype.o: $(KERNELDIR)/crtlib/ctype.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/itoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/itoa.o: $(KERNELDIR)/crtlib/itoa.c @$(KCC) -D_NEED_ITOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/ltoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/ltoa.o: $(KERNELDIR)/crtlib/itoa.c @$(KCC) -D_NEED_LTOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/utoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/utoa.o: $(KERNELDIR)/crtlib/itoa.c @$(KCC) -D_NEED_UTOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/ultoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/ultoa.o: $(KERNELDIR)/crtlib/itoa.c @$(KCC) -D_NEED_ULTOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/memory.o: $(KERNELDIR)/crtlib/memory.c +$(KOBJDIR)/memory.o: $(KERNELDIR)/crtlib/memory.c @$(KCC) -fno-strict-aliasing $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/rand.o: $(KERNELDIR)/crtlib/rand.c +$(KOBJDIR)/rand.o: $(KERNELDIR)/crtlib/rand.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/sprintf.o: $(KERNELDIR)/crtlib/sprintf.c +$(KOBJDIR)/sprintf.o: $(KERNELDIR)/crtlib/sprintf.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/status.o: $(KERNELDIR)/crtlib/status.c +$(KOBJDIR)/status.o: $(KERNELDIR)/crtlib/status.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/string.o: $(KERNELDIR)/crtlib/string.c +$(KOBJDIR)/string.o: $(KERNELDIR)/crtlib/string.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/strtol.o: $(KERNELDIR)/crtlib/strtol.c +$(KOBJDIR)/strtol.o: $(KERNELDIR)/crtlib/strtol.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/argv.o: $(KERNELDIR)/extras/argv.c +$(KOBJDIR)/argv.o: $(KERNELDIR)/extras/argv.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/prog.o: $(KERNELDIR)/extras/prog.c +$(KOBJDIR)/prog.o: $(KERNELDIR)/extras/prog.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} # Kernel objects -kal_kern_obj= $(OBJDIR)/kaleid/kernel/cpuid.o $(OBJDIR)/kaleid/kernel/init.o \ - $(OBJDIR)/kaleid/kernel/table.o $(OBJDIR)/kaleid/kernel/cursor.o \ - $(OBJDIR)/kaleid/kernel/term.o $(OBJDIR)/kaleid/kernel/vga.o \ - $(OBJDIR)/kaleid/kernel/panic.o +kal_kern_obj= $(KOBJDIR)/kernel/cpuid.o $(KOBJDIR)/kernel/init.o \ + $(KOBJDIR)/kernel/table.o $(KOBJDIR)/kernel/cursor.o \ + $(KOBJDIR)/kernel/term.o $(KOBJDIR)/kernel/vga.o \ + $(KOBJDIR)/kernel/panic.o -$(OBJDIR)/kaleid/kernel/cpuid.o: $(KERNELDIR)/kernel/cpu/cpuid.c +$(KOBJDIR)/kernel/cpuid.o: $(KERNELDIR)/kernel/cpu/cpuid.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/kernel/init.o: $(KERNELDIR)/kernel/init/init.c +$(KOBJDIR)/kernel/init.o: $(KERNELDIR)/kernel/init/init.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/kernel/table.o: $(KERNELDIR)/kernel/init/table.c +$(KOBJDIR)/kernel/table.o: $(KERNELDIR)/kernel/init/table.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/kernel/cursor.o: $(KERNELDIR)/kernel/io/cursor.c +$(KOBJDIR)/kernel/cursor.o: $(KERNELDIR)/kernel/io/cursor.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/kernel/term.o: $(KERNELDIR)/kernel/io/term.c +$(KOBJDIR)/kernel/term.o: $(KERNELDIR)/kernel/io/term.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/kernel/vga.o: $(KERNELDIR)/kernel/io/vga.c +$(KOBJDIR)/kernel/vga.o: $(KERNELDIR)/kernel/io/vga.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(OBJDIR)/kaleid/kernel/panic.o: $(KERNELDIR)/kernel/ke/panic.c +$(KOBJDIR)/kernel/panic.o: $(KERNELDIR)/kernel/ke/panic.c @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} +## MISC MAKEFILE ------------------------------------------------------------- # +./ProjectTree: ./.stylehlp_sh + @cat ./.stylehlp_sh > ./ProjectTree + @echo "\n" >> ./ProjectTree + @tree >> ./ProjectTree + @echo ${CL2}[$@] ${CL}Generated.${CL3} ## MAIN MAKEFILE ------------------------------------------------------------- # .PHONY: test @@ -168,52 +176,42 @@ debug: all @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm -.PHONY:OS/K -OS/K: $(BINDIR)/kaleid $(BINDIR)/disk.img - @mkdir -p $(BINDIR)/disk - @echo ${CL2}[[$@]] ${NC}Integrating kernel...${CL3} - -@$(MBRDIR)/umount.sh $(BINDIR)/disk - @$(MBRDIR)/mount.sh $(BINDIR)/disk.img $(BINDIR)/disk - @cp $(BINDIR)/kaleid $(BINDIR)/disk/boot/kaleid - @$(MBRDIR)/umount.sh $(BINDIR)/disk - @echo ${CL2}[[$@]] ${CL}Success.${CL3} - @rmdir $(BINDIR)/disk - .PHONY: install_mbr install_mbr: $(BINDIR)/disk.img $(MBRDIR)/grub.cfg @mkdir -p $(BINDIR)/disk @echo ${CL2}[$@] ${NC}Installing MBR on image...${CL3} -@$(MBRDIR)/umount.sh $(BINDIR)/disk @$(MBRDIR)/grub-install.sh $(BINDIR)/disk.img $(BINDIR)/disk $(MBRDIR)/grub.cfg - @tail -1 grub.log | head -1 | grep "Installation terminée, sans erreur." @rmdir $(BINDIR)/disk @echo ${CL2}[$@] ${CL}Success.${CL3} .PHONY: clean clean: -@$(MBRDIR)/umount.sh $(BINDIR)/disk + @rm -Rvf ./ProjectTree @rm -Rvf $(BINDIR)/*.* @rm -Rvf $(OBJDIR)/*.o @rm -Rvf $(OBJDIR)/*/*.o @rm -Rvf $(OBJDIR)/*/*/*.o + @echo ${CL2}[[$@]] ${CL}Cleaned.${CL3} -$(BINDIR)/kaleid: $(OBJDIR)/boot/kaleid.x86_64 +$(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64 @echo ${CL2}[$@] ${NC}Objcopy...${CL3} - @x86_64-elf-objcopy -I elf64-x86-64 -O elf32-i386 $(OBJDIR)/boot/kaleid.x86_64 $(BINDIR)/kaleid + @x86_64-elf-objcopy -I elf64-x86-64 -O elf32-i386 $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid @echo ${CL2}[$@] ${CL}Success.${CL3} -$(OBJDIR)/boot/kaleid.x86_64: $(kal_kern_obj) $(kal_com_obj) $(OBJDIR)/boot/loader.o +$(LOBJDIR)/kaleid.x86_64: $(kal_kern_obj) $(kal_com_obj) $(LOBJDIR)/loader.o @echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3} @$(LD) $(LDFLAGS) -T build/kernel.ld \ - $(OBJDIR)/boot/loader.o \ - $(OBJDIR)/kaleid/*.o \ - $(OBJDIR)/kaleid/kernel/*.o \ - -o $(OBJDIR)/boot/kaleid.x86_64 + $(LOBJDIR)/loader.o \ + $(KOBJDIR)/*.o \ + $(KOBJDIR)/kernel/*.o \ + -o $(LOBJDIR)/kaleid.x86_64 @echo ${CL2}[$@] ${CL}Success.${CL3} -$(OBJDIR)/boot/loader.o: $(LOADERDIR)/loader.asm +$(LOBJDIR)/loader.o: $(LOADERDIR)/loader.asm @echo ${CL2}[$@] ${NC}Making loader...${CL3} - @$(ASM) $(ASMFLAGS) $(LOADERDIR)/loader.asm -o $(OBJDIR)/boot/loader.o > /dev/null + @$(ASM) $(ASMFLAGS) $(LOADERDIR)/loader.asm -o $(LOBJDIR)/loader.o > /dev/null @echo ${CL2}[$@] ${CL}Success.${CL3} $(BINDIR)/disk.img: $(MBRDIR)/create_disk.sh @@ -222,3 +220,14 @@ $(BINDIR)/disk.img: $(MBRDIR)/create_disk.sh @$(MBRDIR)/create_disk.sh $(BINDIR)/disk.img @make install_mbr @echo ${CL2}[$@]${NC} Constructing disk image...${CL3} + +.PHONY:OS/K +OS/K: $(BINDIR)/kaleid $(BINDIR)/disk.img ./ProjectTree + @mkdir -p $(BINDIR)/disk + @echo ${CL2}[[$@]] ${NC}Integrating kernel...${CL3} + -@$(MBRDIR)/umount.sh $(BINDIR)/disk + @$(MBRDIR)/mount.sh $(BINDIR)/disk.img $(BINDIR)/disk + @cp $(BINDIR)/kaleid $(BINDIR)/disk/boot/kaleid + @$(MBRDIR)/umount.sh $(BINDIR)/disk + @echo ${CL2}[[$@]] ${CL}Success.${CL3} + @rmdir $(BINDIR)/disk diff --git a/ProjectTree b/ProjectTree index 6ff3997..134aab8 100644 --- a/ProjectTree +++ b/ProjectTree @@ -1,7 +1,7 @@ #=----------------------------------------------------------------------------=# # GNU GPL OS/K # # # -# Desc: Project Tree # +# Desc: # # # # # # Copyright © 2018-2019 The OS/K Team # @@ -22,6 +22,7 @@ # along with OS/K. If not, see . # #=----------------------------------------------------------------------------=# + . ├── AUTHORS ├── boot @@ -50,7 +51,46 @@ │   ├── bin │   │   ├── disk.img │   │   └── kaleid -│   └─── kernel.ld +│   ├── kernel.ld +│   └── obj +│   ├── boot +│   │   ├── kaleid.x86_64 +│   │   └── loader.o +│   └── kaleid +│   ├── argv.o +│   ├── atoi.o +│   ├── atol.o +│   ├── atoul.o +│   ├── atou.o +│   ├── ctype.o +│   ├── itoa.o +│   ├── kernel +│   │   ├── cpuid.o +│   │   ├── cursor.o +│   │   ├── init +│   │   │   ├── init.o +│   │   │   └── table.o +│   │   ├── init.o +│   │   ├── io +│   │   │   ├── cursor.o +│   │   │   ├── term.o +│   │   │   └── vga.o +│   │   ├── ke +│   │   │   └── panic.o +│   │   ├── panic.o +│   │   ├── table.o +│   │   ├── term.o +│   │   └── vga.o +│   ├── ltoa.o +│   ├── memory.o +│   ├── prog.o +│   ├── rand.o +│   ├── sprintf.o +│   ├── status.o +│   ├── string.o +│   ├── strtol.o +│   ├── ultoa.o +│   └── utoa.o ├── ChangeLog ├── COPYING ├── grub.log @@ -121,5 +161,4 @@ ├── qemu.log └── Readme.md -28 directories, 99 files - +31 directories, 105 files