summaryrefslogtreecommitdiff
path: root/src/linker.ld
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-07-17 19:20:28 +0200
committerCarlos Maiolino <[email protected]>2025-07-17 19:20:28 +0200
commitd8392002629bc97c05ca82961c7ab3439ed7248e (patch)
treedfd3f7dafd4e9efe10fe87b383c78430379580b9 /src/linker.ld
parent7bcc28cb58e99927e14636fe199c5345f6c63a6f (diff)
Start writing the kernel and add a linker script
Move the code unders [BITS 32] label to its own file to be loaded as a kernel by the boot loader. Add a linker script to link the bootloader and the kernel in a single binary file. Add a build script to make it easier to use the cross compiler Update the Makefile to build everything and pack it into the os.bin Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'src/linker.ld')
-rw-r--r--src/linker.ld27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/linker.ld b/src/linker.ld
new file mode 100644
index 0000000..9ea0171
--- /dev/null
+++ b/src/linker.ld
@@ -0,0 +1,27 @@
+ENTRY(_start)
+OUTPUT_FORMAT(binary)
+
+SECTIONS {
+ . = 1M;
+
+ .text :
+ {
+ *(.text)
+ }
+
+ .rodata :
+ {
+ *(.rodata)
+ }
+
+ .data :
+ {
+ *(.data)
+ }
+
+ .bss :
+ {
+ *(COMMON)
+ *(.bss)
+ }
+}