More cleanup. Remove redundant folders

This commit is contained in:
Curle 2021-06-15 22:00:30 +01:00
parent 6bba27ce4f
commit e025a723a5
Signed by: TheCurle
GPG Key ID: 5942F13718443F79
42 changed files with 18 additions and 242 deletions

View File

@ -13,31 +13,31 @@ project(chroma)
SET(src_files SET(src_files
${CMAKE_SOURCE_DIR}/src/chroma/kernel.c ${CMAKE_SOURCE_DIR}/src/kernel.c
${CMAKE_SOURCE_DIR}/src/chroma/video/draw.c ${CMAKE_SOURCE_DIR}/src/video/draw.c
${CMAKE_SOURCE_DIR}/src/chroma/video/print.c ${CMAKE_SOURCE_DIR}/src/video/print.c
${CMAKE_SOURCE_DIR}/src/chroma/system/cpu.c ${CMAKE_SOURCE_DIR}/src/system/cpu.c
${CMAKE_SOURCE_DIR}/src/chroma/system/rw.c ${CMAKE_SOURCE_DIR}/src//system/rw.c
${CMAKE_SOURCE_DIR}/src/chroma/system/serial.c ${CMAKE_SOURCE_DIR}/src/system/serial.c
${CMAKE_SOURCE_DIR}/src/chroma/system/pci.c ${CMAKE_SOURCE_DIR}/src/system/pci.c
${CMAKE_SOURCE_DIR}/src/chroma/system/memory/stack.c ${CMAKE_SOURCE_DIR}/src/system/memory/stack.c
${CMAKE_SOURCE_DIR}/src/chroma/system/memory/paging.c ${CMAKE_SOURCE_DIR}/src/system/memory/paging.c
${CMAKE_SOURCE_DIR}/src/chroma/system/memory/abstract_allocator.c ${CMAKE_SOURCE_DIR}/src/system/memory/abstract_allocator.c
${CMAKE_SOURCE_DIR}/src/chroma/system/memory/physmem.c ${CMAKE_SOURCE_DIR}/src/system/memory/physmem.c
${CMAKE_SOURCE_DIR}/src/chroma/system/drivers/keyboard.c ${CMAKE_SOURCE_DIR}/src/system/drivers/keyboard.c
${CMAKE_SOURCE_DIR}/src/chroma/system/drivers/elf.c ${CMAKE_SOURCE_DIR}/src/system/drivers/elf.c
) )
SET(lib_files SET(lib_files
${CMAKE_SOURCE_DIR}/src/chroma/lainlib/list/basic_list.c ${CMAKE_SOURCE_DIR}/src/lainlib/list/basic_list.c
${CMAKE_SOURCE_DIR}/src/chroma/lainlib/mutex/ticketlock.c ${CMAKE_SOURCE_DIR}/src/lainlib/mutex/ticketlock.c
${CMAKE_SOURCE_DIR}/src/chroma/lainlib/compression/lzgmini.c ${CMAKE_SOURCE_DIR}/src/lainlib/compression/lzgmini.c
) )
include_directories("src/chroma/inc") include_directories("inc")
SET(src_no_sse SET(src_no_sse
${CMAKE_SOURCE_DIR}/src/chroma/system/interrupts.c ${CMAKE_SOURCE_DIR}/src/system/interrupts.c
) )
SET(src_preamble SET(src_preamble

View File

@ -1,87 +0,0 @@
{
"name": "Chroma",
"target": "x86_64-elf-gcc",
"author": "Curle",
"source": {
"inc": [
"$root/chroma/inc/"
],
"font": [
"$root/font.o"
],
"linkerscript": [
"$root/linker.ld"
],
"preamble": [
"$root/global/crt0.o",
"$root/global/crti.o",
"$root/global/crtbegin.o"
],
"main": [
"$root/chroma/kernel.c",
"$root/chroma/video/draw.c",
"$root/chroma/video/print.c",
"$root/chroma/system/cpu.c",
"$root/chroma/system/rw.c",
"$root/chroma/system/serial.c",
"$root/chroma/system/pci.c",
"$root/chroma/system/memory/stack.c",
"$root/chroma/system/memory/abstract_allocator.c",
"$root/chroma/system/memory/physmem.c",
"$root/chroma/system/memory/paging.c",
"$root/chroma/system/memory/liballoc.c",
"$root/chroma/system/drivers/keyboard.c",
"$root/chroma/system/drivers/elf.c"
],
"no-sse": [
"$root/chroma/system/interrupts.c"
],
"lib": [
"$root/chroma/lainlib/list/basic_list.c",
"$root/chroma/lainlib/mutex/ticketlock.c",
"$root/chroma/lainlib/compression/lzgmini.c"
],
"epilogue": [
"$root/global/crtend.o",
"$root/global/crtn.o"
]
},
"build": {
"compile-main": [
"-I$inc -ffreestanding -O0 -Wall -Wextra -Wall -Werror -pedantic -fPIC -fno-exceptions -fno-omit-frame-pointer -mno-red-zone -fno-stack-protector -ggdb3",
"$preamble",
"$main",
"$lib",
"$font"
],
"compile-no-sse": [
"-I$inc -ffreestanding -O0 -Wall -Wextra -Wall -Werror -pedantic -fPIC -fno-exceptions -fno-omit-frame-pointer -mno-red-zone -fno-stack-protector -ggdb3 -mgeneral-regs-only",
"$no-sse"
],
"compile-last": [
"$epilogue"
],
"link": [
"-T $linkerscript -ffreestanding -O2 -nostdlib -nostartfiles -lgcc",
"%.o"
],
"output": [
"kernel"
]
}
}

View File

@ -1,137 +0,0 @@
const child = require("child_process");
const fs = require("fs");
let defaultCompiler = "gcc";
let tempDir;
let defaultLinkFlags = "%.o"
let defaultOutput = "$name"
let linkCache = "";
module.exports = {
/**
* Preprocess the buildscript.
* If it contains compile, assemble and link steps, it does nothing
* If it contains compile but no build, it implicitly adds it with the default arguments.
* @param {object} buildscript the JSON buildscript object
*/
extensionC: function(buildscript) {
console.log("c.js processing buildscript");
if(!("link" in buildscript.build)) {
console.log("Inserting link step for gcc");
buildscript.build["link"] = [defaultLinkFlags];
}
if(!("output" in buildscript.build)) {
console.log("Inserting output step");
buildscript.build["output"] = [defaultOutput];
}
tempDir = process.cwd() + "/bsTemp/";
if(!fs.existsSync(tempDir)) {
console.log("Creating temporary dir for object files");
fs.mkdirSync(tempDir);
}
},
extensionH: function() {},
extensionO: function() {},
extensionLD: function() {},
/**
* Called when it is time to execute the compile step.
* It is passed the array of strings associated with the step in the buildscript.
* @param {...string} params the list of strings
*/
stepCompile: function(...params) {
let cwd = process.cwd().replace(/\\/g, "/");
let compileFlags = "";
// Check whether we're doubly listed
if(Array.isArray(params[0])) {
params = params[0];
}
for(var param of params) {
console.log("stepCompile: param", param);
if(param.startsWith("-")) {
compileFlags = param;
} else {
let binPath = param.substr(param.lastIndexOf(cwd) + cwd.length + 1);
binPath = binPath.substr(0, binPath.lastIndexOf("."));
binPath = cwd + "/bsTemp/" + binPath;
// generate the file structure for it to go into
fs.mkdirSync(binPath.substr(0, binPath.lastIndexOf("/")), {recursive: true});
if(param.substr(param.lastIndexOf(".") + 1) != "c"
&& param.substr(param.lastIndexOf(".") + 1) != "s") {
fs.copyFileSync(param, binPath + ".o");
} else {
let compilerCommand =
defaultCompiler +
" -c " + param +
" -o " + binPath + ".o "
+ compileFlags;
child.execSync(compilerCommand);
}
}
}
},
/**
* Take in the compiled binary object files,
* prepare the link command, and save it for the link execution.
* @param {...string} params the object files to link.
*/
stepLink: function(...params) {
let linkerCommand = "";
// Check whether we're doubly listed
if(Array.isArray(params[0])) {
params = params[0];
}
for(var param of params) {
console.log("stepLink: param", param);
linkerCommand += param + " ";
}
linkCache = linkerCommand;
},
/**
* Take in the name of a file, execute the link command to save the output.
* @param {string} output the name of the wanted file
*/
stepOutput: function(output) {
// Check whether we're doubly listed
if(Array.isArray(output[0])) {
output = output[0];
}
let linkerCommand = defaultCompiler + " -o " + process.cwd() + "/" + output + " " + linkCache;
console.log("stepOutput: param", output, "command", linkerCommand);
child.execSync(linkerCommand);
},
/**
* Set the name of the compiler to be used.
* @param {string} comp
*/
setCompiler: function(comp) {
// Check whether we're doubly listed
if(Array.isArray(comp[0])) {
comp = comp[0];
}
defaultCompiler = comp;
console.log("Set compiler to", comp);
}
}