...
 
Commits (10)
......@@ -26,6 +26,7 @@ Makefile.out.2
build/bin/s**
.buildconfig
#.stylehlp
cross-cc*
# Linker output
*.ilk
......
......@@ -23,7 +23,7 @@
#=----------------------------------------------------------------------------=#
2018-10-00 @os-k-team <os-k-team@os-k.eu>
Adrien Bourmault and Julian Barathie started talking about making their own OS
Adrien Bourmault and Julian Barathieu started talking about making their own OS
2018-11-00 @os-k-team <os-k-team@os-k.eu>
Name decided & creation of os-k.eu
......
......@@ -22,7 +22,7 @@
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
.PHONY: all test testnokvm testnosnd test32 debug gdb ddd gdbnokvm dddnokvm installonimage dust clean OS/K run
.PHONY: all test testnokvm testnosnd test32 debug gdb ddd gdbnokvm dddnokvm installonimage dust clean OS/K run update-cross-cc
.DELETE_ON_ERROR: $(BINDIR)/kaleid
.DEFAULT_GOAL := all
......@@ -33,6 +33,12 @@ mode ?= debug
ram ?= 4G
cpu ?= core2duo
# Cross-cc
CROSS-CC-DIR := $(shell pwd)/cross-cc
LATEST-CROSS-CC := https://gitlab.os-k.eu/os-k-team/cross-cc-builder/uploads/fcb43b0cc04c75ff89e40b4b24567484/cross-cc.tar.xz
export PATH := $(CROSS-CC-DIR)/bin:$(PATH)
NTHREADS := $(shell nproc)
# Programs
ASM=nasm
LD=x86_64-elf-ld
......@@ -45,7 +51,7 @@ LDFLAGS=-melf_x86_64
COPTIM=-O2
CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type #-Wpadded
CINCLUDES=-Iinclude -Iinclude/drivers -Iinclude/kernel
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-all -fdump-rtl-expand
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-strong -fdump-rtl-expand
CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2
CFLAGS= $(CFLAGS1) $(CFLAGS2)
CFLAGS_MATHS= $(CFLAGS1) -c -mno-red-zone -mno-mmx
......@@ -138,6 +144,12 @@ DriverDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(DriverSources))
## MISC MAKEFILE ------------------------------------------------------------- #
$(CROSS-CC-DIR)/bin/x86_64-elf-gcc:
@echo ${CL2}[$@] ${NC} Downloading and extracting the cross-compiler...${CL3}
@wget $(LATEST-CROSS-CC) -O $(CROSS-CC-DIR).tar.xz -q -c --show-progress
@tar -xaf $(CROSS-CC-DIR).tar.xz --skip-old-files
@echo ${CL2}[$@] ${CL}Success.${CL3}
./ProjectTree: ./.stylehlp_sh
@cat ./.stylehlp_sh > ./ProjectTree
@echo "\n" >> ./ProjectTree
......@@ -242,7 +254,7 @@ $(KOBJDIR)/drivers/ata.o: $(KALEIDDIR)/drivers/ata.c $(KALEIDDIR)/drivers/ata.as
## DEPENDENCIES MAKEFILE ----------------------------------------------------- #
$(KOBJDIR)/%.d: %.c | $(KOBJDIR)
$(KOBJDIR)/%.d: %.c $(CROSS-CC-DIR)/bin/x86_64-elf-gcc | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(KCC) -MM -MT $(@:%.d=%.o) -MF $@ $<
@echo ${CL2}[$@] ${CL}Dependencies generated.${CL3}
......@@ -279,8 +291,8 @@ $(LOBJDIR)/loader.o: $(LOADERDIR)/loader.asm $(LOADERDIR)/*/*.inc
OS/K: $(dep) ./ProjectTree $(BINDIR)/kaleid
@echo ${CL2}[[$@]] ${NC} OS/K successfully made, $(mode) mode.${CL3}
all :
@make OS/K -j 8
all : $(CROSS-CC-DIR)/bin/x86_64-elf-gcc
@make OS/K -j $(NTHREADS)
## QEMU/DEBUG RELATED
test: all installonimage
......@@ -361,3 +373,7 @@ clean:
@rm -Rvf ./ProjectTree $(BUILDDIR)/*.log
@rm -Rvf $(BINDIR) $(OBJDIR)
@echo ${CL2}[$@] ${CL}Cleaned.${CL3}
update-cross-cc:
@rm -rf cross-cc
@echo ${CL2}[$@] ${CL}Ready to update.${CL3}
This diff is collapsed.
......@@ -23,13 +23,13 @@ apt update && apt upgrade
apt install grub-pc-bin dosfstools make nasm qemu tree libisl15 parted udisks2
```
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 :
```
make
```
The OS/K cross-compiler will automatically be installed.
To compile and test, simply use at the root of this project :
```
make test
......
......@@ -12,7 +12,17 @@
# Foundation; with no Invariant Sections, no Front-Cover Texts, and #
# no Back-Cover Texts. A copy of the license is included in the #
# file entitled "COPYING.GFDL" #
#=-----------------------------------------------------------------------------#
#=----------------------------------------------------------------------------=#
This folder contains the GRUB configuration file, `boot/grub/grub.cfg`,
used by GRUB to know which OS to boot and how to boot it.
The GRUB configuration is pretty simple. We choose to use a 0 timeout, a
single entry that starts OS/K.
Because OS/K is a multiboot compliant kernel, we launch it with the multiboot
command.
WIP
\ No newline at end of file
For instance, we ask vbe and vga modules to be provided, but OS/K doesn't use
these modules.
\ No newline at end of file
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K Documentation #
# #
# Desc: OS/K Loader : CPU Management functions #
# #
# #
# Copyright © 2018-2020 The OS/K Team #
# #
# Permission is granted to copy, distribute and/or modify this #
# document under the terms of the GNU Free Documentation License, #
# Version 1.3 or any later version published by the Free Software #
# Foundation; with no Invariant Sections, no Front-Cover Texts, and #
# no Back-Cover Texts. A copy of the license is included in the #
# file entitled "COPYING.GFDL" #
#=----------------------------------------------------------------------------=#
This folder contains two files, `boot/loader/cpu/cpu.inc` and
boot/loader/cpu/cpu32.inc`.
The `boot/loader/cpu/cpu32.inc` is intented to provide 32 bits protected mode
function that can control wether the CPU is qualified to run the OS/K code.
The `boot/loader/cpu/cpu3.inc` provides 64 bits long mode temporization function
used by the loader when necessary.
There is two functions in `cpu32.inc` :
- Is64Bits(), intented to check if the CPU is "ok" with 64 bit code,
if it supports long mode and will not burn if we ask it to execute OS/K
(i.e trigger a #UD fault).
For this check, we use first the 0x80000000 function of the CPUID instruction
that returns the highest CPUID function available. It must return at least
0x80000001, otherwise we can't check the long mode presence and it is most
likely absent. We pass the function number in the eax register.
As soon as 0x80000001 is available, we use it and verify it flips to 1 the bit
29 in edx.
- Check_cpuid(), that check if the CPUID instruction is supported by the CPU
before use it (don't want #UD).
For this, we use the FLAGS register and check if we can flip (overwrite with
a 1 persistantly) the bit 21. If it is possible, then CPUID is supported.
The temporize(), bitemporize() and tritemporize() functions in `cpu.inc`
are juste loops that make the cpu busy to wait. These temporization are not
precise at all, and are not intented to wait for a determined time lapse.
\ No newline at end of file
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K Documentation #
# #
# Desc: OS/K Loader : IO basic functions #
# #
# #
# Copyright © 2018-2020 The OS/K Team #
# #
# Permission is granted to copy, distribute and/or modify this #
# document under the terms of the GNU Free Documentation License, #
# Version 1.3 or any later version published by the Free Software #
# Foundation; with no Invariant Sections, no Front-Cover Texts, and #
# no Back-Cover Texts. A copy of the license is included in the #
# file entitled "COPYING.GFDL" #
#=----------------------------------------------------------------------------=#
This folder contains the basic drivers needed to boot OS/K.
There is one single file in this directory : `boot/loader/io/terminal.inc`
This file provides a basic way to print colored text to the screen, without
advanced functions, for both 32 and 64 bits modes.
\ No newline at end of file
......@@ -12,7 +12,7 @@
# Foundation; with no Invariant Sections, no Front-Cover Texts, and #
# no Back-Cover Texts. A copy of the license is included in the #
# file entitled "COPYING.GFDL" #
#=-----------------------------------------------------------------------------#
#=----------------------------------------------------------------------------=#
This folder contains the source for OS/K's early loader.
......@@ -30,4 +30,8 @@ specified address and prepare it for the hard work it have to do :
- Send a structure for it with memory map, cpu infos, and other devices
infos, prepared by GRUB.
- Switch into long mode.
- Jump to Kaleid kernel.
\ No newline at end of file
- Jump to Kaleid kernel.
Our loader contains the multiboot header used by GRUB to check if the kernel
can be started with the multiboot method. We use an ELF multiboot format, because
it is more convenient.