aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2024-09-16 14:07:41 +0000
committerFelix Morgner <felix.morgner@ost.ch>2024-09-17 08:58:55 +0200
commit8f9b9cd8aac30572b7e275bbeb1b32d2cbb8950a (patch)
tree5e215dd93c34b3d58c287b036ad2d190e0a9a772
parentc16a3739649fa15178df667d610553e93db83e4c (diff)
downloadkernel-8f9b9cd8aac30572b7e275bbeb1b32d2cbb8950a.tar.xz
kernel-8f9b9cd8aac30572b7e275bbeb1b32d2cbb8950a.zip
build: migrate away from conan
-rw-r--r--.clang-format (renamed from source/.clang-format)0
-rw-r--r--.devcontainer/x86-64/devcontainer.json11
-rw-r--r--.vscode/settings.json2
-rw-r--r--CMakeLists.txt (renamed from source/CMakeLists.txt)6
-rw-r--r--CMakePresets.json26
-rw-r--r--README.rst50
-rw-r--r--arch/x86_64/CMakeLists.txt (renamed from source/arch/x86_64/CMakeLists.txt)0
-rw-r--r--arch/x86_64/include/arch/boot/pointers.hpp (renamed from source/arch/x86_64/include/arch/boot/pointers.hpp)0
-rw-r--r--arch/x86_64/include/arch/io/port_io.hpp (renamed from source/arch/x86_64/include/arch/io/port_io.hpp)0
-rw-r--r--arch/x86_64/include/arch/kernel/main.hpp (renamed from source/arch/x86_64/include/arch/kernel/main.hpp)0
-rw-r--r--arch/x86_64/include/arch/video/vga/io.hpp (renamed from source/arch/x86_64/include/arch/video/vga/io.hpp)0
-rw-r--r--arch/x86_64/include/arch/video/vga/text.hpp (renamed from source/arch/x86_64/include/arch/video/vga/text.hpp)0
-rw-r--r--arch/x86_64/scripts/kernel.ld (renamed from source/arch/x86_64/scripts/kernel.ld)0
-rw-r--r--arch/x86_64/src/boot/boot.s (renamed from source/arch/x86_64/src/boot/boot.s)0
-rw-r--r--arch/x86_64/src/boot/crti.s (renamed from source/arch/x86_64/src/boot/crti.s)0
-rw-r--r--arch/x86_64/src/boot/crtn.s (renamed from source/arch/x86_64/src/boot/crtn.s)0
-rw-r--r--arch/x86_64/src/boot/multiboot.s (renamed from source/arch/x86_64/src/boot/multiboot.s)0
-rw-r--r--arch/x86_64/src/kernel/main.cpp (renamed from source/arch/x86_64/src/kernel/main.cpp)0
-rw-r--r--arch/x86_64/src/video/vga/text.cpp (renamed from source/arch/x86_64/src/video/vga/text.cpp)0
-rw-r--r--arch/x86_64/support/grub.cfg.in (renamed from source/arch/x86_64/support/grub.cfg.in)0
-rw-r--r--cmake/Modules/FindSphinx.cmake (renamed from source/cmake/Modules/FindSphinx.cmake)0
-rw-r--r--cmake/Modules/Findgrub-mkrescue.cmake (renamed from source/cmake/Modules/Findgrub-mkrescue.cmake)0
-rw-r--r--cmake/Platforms/x86_64.cmake (renamed from source/cmake/Platforms/x86_64.cmake)10
-rw-r--r--conanfile.py62
-rw-r--r--include/memory/asm_pointer.hpp (renamed from source/include/memory/asm_pointer.hpp)0
-rw-r--r--requirements.txt6
-rw-r--r--src/kernel/main.cpp (renamed from source/src/kernel/main.cpp)0
27 files changed, 57 insertions, 116 deletions
diff --git a/source/.clang-format b/.clang-format
index d4da9626..d4da9626 100644
--- a/source/.clang-format
+++ b/.clang-format
diff --git a/.devcontainer/x86-64/devcontainer.json b/.devcontainer/x86-64/devcontainer.json
new file mode 100644
index 00000000..3c88eae5
--- /dev/null
+++ b/.devcontainer/x86-64/devcontainer.json
@@ -0,0 +1,11 @@
+{
+ "image": "registry.gitlab.ost.ch:45023/teachos/devcontainers/x86-64:14.2.0",
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-vscode.cmake-tools",
+ "ms-vscode.cpptools"
+ ]
+ }
+ }
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index f7a4d599..21d4f5fe 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,6 +1,6 @@
{
- "cmake.sourceDirectory": "/home/sophia/Projects/os/teachos/kernel/source",
"cmake.useCMakePresets": "always",
+ "cmake.options.statusBarVisibility": "visible",
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
diff --git a/source/CMakeLists.txt b/CMakeLists.txt
index beb0c07d..c51ffb99 100644
--- a/source/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,12 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION YES)
+set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")
+
+set(CMAKE_CXX_STANDARD "20")
+set(CMAKE_CXX_STANDARD_REQUIRED YES)
+set(CMAKE_CXX_EXTENSIONS NO)
+
#[============================================================================[
# Documentation
#]============================================================================]
diff --git a/CMakePresets.json b/CMakePresets.json
new file mode 100644
index 00000000..ecac6fbb
--- /dev/null
+++ b/CMakePresets.json
@@ -0,0 +1,26 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "binaryDir": "${sourceDir}/build",
+ "generator": "Ninja Multi-Config",
+ "cacheVariables": {
+ "CMAKE_CONFIGURATION_TYPES": "Debug;MinSizeRel",
+ "CMAKE_TOOLCHAIN_FILE": "cmake/Platforms/x86_64.cmake"
+ }
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "debug",
+ "configurePreset": "default",
+ "configuration": "Debug"
+ },
+ {
+ "name": "release",
+ "configurePreset": "default",
+ "configuration": "MinSizeRel"
+ }
+ ]
+}
diff --git a/README.rst b/README.rst
index c418cd89..fb994bd6 100644
--- a/README.rst
+++ b/README.rst
@@ -11,59 +11,17 @@ Development
Development happens primarily on Linux.
Other platforms (e.g. Windows, macOS) may allow building of the kernel as well, however at the time of this writing they are not officially supported.
-To manage the toolchain and dependencies of the kernel, conan is used as a package manager.
Required Tools
~~~~~~~~~~~~~~
-In orer to build the kernel, the following tools are required:
+In order to build the kernel, the following tools are required:
-- Python 3 to run conan
-- A C and C++ toolchain to build the kernel toolchain
-- GRUB2 to build the bootable ISO image
+- Docker to run the development container
+- Visual Studio Code for development
Setup
~~~~~
-Create an activate a Python virtual environment, for example by using the ``venv`` module:
+Open this directory in Visual Studio Code and then reopen the project in the development container
-.. code-block:: bash
-
- $ python -m venv .venv
- $ source .venv/bin/activate
-
-With the virtual environment activated, install the required Python package from the ``requirements.txt`` file:
-
-.. code-block:: bash
-
- $ pip install -r requirements.txt
-
-Next, prepare the default conan profile and install the required packages (note: the example below assumes x86_64 is being targeted as the kernel's platform):
-
-.. code-block:: bash
-
- $ conan profile new --detect default
- $ conan install -if .conan/install -pr:b default -pr:h .conan/profiles/x86_64-gcc -b missing
-
-The second command may need to be rerun in case the conan dependencies change.
-
-Building
-~~~~~~~~
-
-With the setup performed, the kernel can now be built:
-
-.. code-block:: bash
-
- $ conan build -if .conan/install .
-
-Developing in an IDE
-~~~~~~~~~~~~~~~~~~~~
-
-This repository includes a configuration for Visual Studio Code.
-In order to work on the kernel from within Visual Studio Code, activation of the conan build environment is required:
-
-.. code-block:: bash
-
- $ source build/generators/conanbuild.sh
-
-Afterward the IDE can be started from the same shell and will automatically pick up the required environment variables.
diff --git a/source/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt
index 6ff1332a..6ff1332a 100644
--- a/source/arch/x86_64/CMakeLists.txt
+++ b/arch/x86_64/CMakeLists.txt
diff --git a/source/arch/x86_64/include/arch/boot/pointers.hpp b/arch/x86_64/include/arch/boot/pointers.hpp
index dcd14fe5..dcd14fe5 100644
--- a/source/arch/x86_64/include/arch/boot/pointers.hpp
+++ b/arch/x86_64/include/arch/boot/pointers.hpp
diff --git a/source/arch/x86_64/include/arch/io/port_io.hpp b/arch/x86_64/include/arch/io/port_io.hpp
index 5b61f901..5b61f901 100644
--- a/source/arch/x86_64/include/arch/io/port_io.hpp
+++ b/arch/x86_64/include/arch/io/port_io.hpp
diff --git a/source/arch/x86_64/include/arch/kernel/main.hpp b/arch/x86_64/include/arch/kernel/main.hpp
index 69615941..69615941 100644
--- a/source/arch/x86_64/include/arch/kernel/main.hpp
+++ b/arch/x86_64/include/arch/kernel/main.hpp
diff --git a/source/arch/x86_64/include/arch/video/vga/io.hpp b/arch/x86_64/include/arch/video/vga/io.hpp
index 9226c5cf..9226c5cf 100644
--- a/source/arch/x86_64/include/arch/video/vga/io.hpp
+++ b/arch/x86_64/include/arch/video/vga/io.hpp
diff --git a/source/arch/x86_64/include/arch/video/vga/text.hpp b/arch/x86_64/include/arch/video/vga/text.hpp
index 1e584d6a..1e584d6a 100644
--- a/source/arch/x86_64/include/arch/video/vga/text.hpp
+++ b/arch/x86_64/include/arch/video/vga/text.hpp
diff --git a/source/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld
index 765a4323..765a4323 100644
--- a/source/arch/x86_64/scripts/kernel.ld
+++ b/arch/x86_64/scripts/kernel.ld
diff --git a/source/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.s
index 7b4e193c..7b4e193c 100644
--- a/source/arch/x86_64/src/boot/boot.s
+++ b/arch/x86_64/src/boot/boot.s
diff --git a/source/arch/x86_64/src/boot/crti.s b/arch/x86_64/src/boot/crti.s
index 26878fe4..26878fe4 100644
--- a/source/arch/x86_64/src/boot/crti.s
+++ b/arch/x86_64/src/boot/crti.s
diff --git a/source/arch/x86_64/src/boot/crtn.s b/arch/x86_64/src/boot/crtn.s
index 06fb7cea..06fb7cea 100644
--- a/source/arch/x86_64/src/boot/crtn.s
+++ b/arch/x86_64/src/boot/crtn.s
diff --git a/source/arch/x86_64/src/boot/multiboot.s b/arch/x86_64/src/boot/multiboot.s
index 7ccca56b..7ccca56b 100644
--- a/source/arch/x86_64/src/boot/multiboot.s
+++ b/arch/x86_64/src/boot/multiboot.s
diff --git a/source/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index 0e90264a..0e90264a 100644
--- a/source/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
diff --git a/source/arch/x86_64/src/video/vga/text.cpp b/arch/x86_64/src/video/vga/text.cpp
index f1e74126..f1e74126 100644
--- a/source/arch/x86_64/src/video/vga/text.cpp
+++ b/arch/x86_64/src/video/vga/text.cpp
diff --git a/source/arch/x86_64/support/grub.cfg.in b/arch/x86_64/support/grub.cfg.in
index 86674dde..86674dde 100644
--- a/source/arch/x86_64/support/grub.cfg.in
+++ b/arch/x86_64/support/grub.cfg.in
diff --git a/source/cmake/Modules/FindSphinx.cmake b/cmake/Modules/FindSphinx.cmake
index a0a1c31e..a0a1c31e 100644
--- a/source/cmake/Modules/FindSphinx.cmake
+++ b/cmake/Modules/FindSphinx.cmake
diff --git a/source/cmake/Modules/Findgrub-mkrescue.cmake b/cmake/Modules/Findgrub-mkrescue.cmake
index 036b4fae..036b4fae 100644
--- a/source/cmake/Modules/Findgrub-mkrescue.cmake
+++ b/cmake/Modules/Findgrub-mkrescue.cmake
diff --git a/source/cmake/Platforms/x86_64.cmake b/cmake/Platforms/x86_64.cmake
index 2d419a44..291cbaac 100644
--- a/source/cmake/Platforms/x86_64.cmake
+++ b/cmake/Platforms/x86_64.cmake
@@ -1,4 +1,4 @@
-execute_process(COMMAND "x86_64-none-elf-g++" "-print-file-name=crtbegin.o"
+execute_process(COMMAND "x86_64-elf-g++" "-print-file-name=crtbegin.o"
OUTPUT_VARIABLE CRT_BEGIN
ERROR_QUIET
)
@@ -8,6 +8,13 @@ mark_as_advanced(CRT_BEGIN)
string(REGEX REPLACE "/crtbegin.o" "" CMAKE_SYSROOT "${CRT_BEGIN}")
mark_as_advanced(CMAKE_SYSROOT)
+set(SYSTEM_NAME "Generic")
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
+
+set(CMAKE_C_COMPILER "x86_64-elf-gcc")
+set(CMAKE_CXX_COMPILER "x86_64-elf-g++")
+
set(CMAKE_CXX_FLAGS_INIT "-m64 -mno-red-zone -mcmodel=large -fno-exceptions -ffunction-sections -fdata-sections")
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb3")
set(CMAKE_ASM_FLAGS_DEBUG "-ggdb3")
@@ -23,5 +30,6 @@ set(CMAKE_CXX_LINK_EXECUTABLE
<OBJECTS> \
-o <TARGET> \
<LINK_LIBRARIES> \
+ -lgcc \
${CMAKE_SYSROOT}/crtend.o"
) \ No newline at end of file
diff --git a/conanfile.py b/conanfile.py
deleted file mode 100644
index 9b1d4d3f..00000000
--- a/conanfile.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from conan import ConanFile
-from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
-from conan.tools.env import VirtualBuildEnv
-
-
-class KernelConan(ConanFile):
- name = "kernel"
- description = "The kernel of TeachOS"
- version = "0.0.1"
- package_type = "application"
- homepage = "https://gitlab.ost.ch/teachos/kernel"
-
- settings = [
- "arch",
- "build_type",
- "compiler",
- ]
-
- tool_requires = [
- "cmake/[~3.27]",
- "doxygen/[~1.9]",
- "gcc/13.2.0@teachos/stable",
- "ninja/[~1.11]",
- ]
-
- def build(self):
- cmake = CMake(self)
- cmake.configure()
- if self.settings.arch == "x86_64":
- cmake.build(target="bootable-iso")
- else:
- cmake.build()
-
- def generate(self):
- build_environment = VirtualBuildEnv(self)
- build_environment.generate()
-
- dependencies = CMakeDeps(self)
- dependencies.generate()
-
- toolchain = CMakeToolchain(self, generator="Ninja Multi-Config")
- toolchain.cache_variables["CMAKE_TRY_COMPILE_TARGET_TYPE"] = "STATIC_LIBRARY"
- toolchain.variables["TEACHOS_DESCRIPTION"] = self.description
- toolchain.variables["TEACHOS_HOMEPAGE_URL"] = self.homepage
- toolchain.variables["TEACHOS_VERSION"] = self.version
- toolchain.blocks["teachos_cmake_modules"] = CMakeModulesPathBlock
- toolchain.blocks["teachos_cmake_modules"].values["root"] = self.source_folder
- toolchain.blocks["teachos_platform"] = PlatformIncludeBlock
- toolchain.blocks["teachos_platform"].values["platform"] = self.settings.arch
- toolchain.blocks.remove("cmake_flags_init")
- toolchain.blocks.remove("arch_flags")
- toolchain.generate()
-
- def layout(self):
- cmake_layout(self, src_folder="source", generator="Ninja Multi-Config")
-
-
-class PlatformIncludeBlock:
- template = 'include("{{platform}}")'
-
-class CMakeModulesPathBlock:
- template = 'list(APPEND CMAKE_MODULE_PATH "{{root}}/cmake/Modules" "{{root}}/cmake/Platforms")'
diff --git a/source/include/memory/asm_pointer.hpp b/include/memory/asm_pointer.hpp
index 9ec22182..9ec22182 100644
--- a/source/include/memory/asm_pointer.hpp
+++ b/include/memory/asm_pointer.hpp
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 5468185a..00000000
--- a/requirements.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-black>=23
-conan~=1.61
-mypy~=1.5
-sphinx>=6,<7
-breathe~=4.35
-sphinx-book-theme~=1.0 \ No newline at end of file
diff --git a/source/src/kernel/main.cpp b/src/kernel/main.cpp
index 07a9955d..07a9955d 100644
--- a/source/src/kernel/main.cpp
+++ b/src/kernel/main.cpp