Make nob run display serial output to stdin
This commit is contained in:
@@ -53,9 +53,9 @@ bool build_assembly(Nob_Cmd *cmd) {
|
||||
}
|
||||
|
||||
bool build_c(Nob_Cmd *cmd) {
|
||||
const char *inputFiles[] = {SRC_FOLDER "kernel.c", SRC_FOLDER "serial.h"};
|
||||
const char *output = BUILD_FOLDER "kernel.o";
|
||||
const char *input = SRC_FOLDER "kernel.c";
|
||||
int rebuild = nob_needs_rebuild1(output, input);
|
||||
int rebuild = nob_needs_rebuild(output, inputFiles, NOB_ARRAY_LEN(inputFiles));
|
||||
|
||||
if (!rebuild)
|
||||
return true;
|
||||
@@ -69,6 +69,7 @@ bool build_c(Nob_Cmd *cmd) {
|
||||
"-O2",
|
||||
"-o", BUILD_FOLDER "kernel.o",
|
||||
"-c", SRC_FOLDER "kernel.c");
|
||||
|
||||
if (!nob_cmd_run(cmd))
|
||||
return false;
|
||||
|
||||
@@ -83,9 +84,7 @@ bool link_everything(Nob_Cmd *cmd) {
|
||||
if (!rebuild)
|
||||
return true;
|
||||
|
||||
Nob_File_Paths objectFiles = {0};
|
||||
nob_da_append(&objectFiles, BUILD_FOLDER "kernel.o");
|
||||
nob_da_append(&objectFiles, BUILD_FOLDER "boot.o");
|
||||
const char *objectFiles[] = {BUILD_FOLDER "kernel.o", BUILD_FOLDER "boot.o"};
|
||||
nob_cmd_append(cmd,
|
||||
"i686-elf-gcc",
|
||||
"-T", SRC_FOLDER "linker.ld",
|
||||
@@ -95,8 +94,8 @@ bool link_everything(Nob_Cmd *cmd) {
|
||||
"-nostdlib");
|
||||
|
||||
// Add objectFiles as input
|
||||
for (size_t i = 0; i < objectFiles.count; ++i) {
|
||||
nob_cmd_append(cmd, objectFiles.items[i]);
|
||||
for (size_t i = 0; i < NOB_ARRAY_LEN(objectFiles); i++) {
|
||||
nob_cmd_append(cmd, objectFiles[i]);
|
||||
}
|
||||
|
||||
nob_cmd_append(cmd, "-lgcc");
|
||||
@@ -168,7 +167,7 @@ bool build_bootable_image(Nob_Cmd *cmd) {
|
||||
}
|
||||
|
||||
bool runQemu(Nob_Cmd *cmd) {
|
||||
nob_cmd_append(cmd, "qemu-system-i386", "-cdrom", BUILD_FOLDER "kernel.iso");
|
||||
nob_cmd_append(cmd, "qemu-system-i386", "-cdrom", BUILD_FOLDER "kernel.iso", "-serial", "stdio");
|
||||
if (!nob_cmd_run(cmd))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user