aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gdbinit1
-rw-r--r--CMakeLists.txt37
-rw-r--r--cmake/properties.cmake50
-rw-r--r--kernel/CMakeLists.txt58
-rw-r--r--kernel/boot/grub.cfg4
-rw-r--r--kernel/boot/init/boot.s144
-rw-r--r--kernel/boot/init/crti.s44
-rw-r--r--kernel/boot/init/crtn.s44
-rw-r--r--kernel/boot/link.ld82
-rw-r--r--kernel/drivers/vga_text_buffer/vga_text_buffer.c106
-rw-r--r--kernel/include/driver/vga_text_buffer.h64
-rw-r--r--kernel/include/libk/io.h32
-rw-r--r--kernel/include/libk/string.h32
-rw-r--r--kernel/kernel/kernel.c36
-rw-r--r--kernel/libk/printk.c34
-rw-r--r--kernel/libk/strlen.c40
-rw-r--r--toolchain/Makefile8
-rw-r--r--toolchain/cross_binutils.mk30
-rw-r--r--toolchain/cross_gcc.mk46
-rw-r--r--toolchain/host_binutils.mk26
-rw-r--r--toolchain/host_gcc.mk32
21 files changed, 476 insertions, 474 deletions
diff --git a/.gdbinit b/.gdbinit
index 3485691..2c6f791 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,2 +1,3 @@
file build/kernel/kernel
target remote localhost:1234
+tui enable
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 24cb5b4..c1ac5b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,38 +13,39 @@ get_target_property(KERNEL_SOURCE kernel SOURCE_DIR)
set(QEMU_SYSTEM_CMD qemu-system-i386)
set(QEMU_ARGUMENTS
- -cdrom ${CMAKE_BINARY_DIR}/cmos.iso
+ -cdrom ${CMAKE_BINARY_DIR}/cmos.iso
)
add_custom_target(iso
- mkdir -p ${CMAKE_BINARY_DIR}/iso/boot/grub &&
- cp ${KERNEL_BINARY_DIR}/kernel ${CMAKE_BINARY_DIR}/iso/boot &&
- cp ${KERNEL_SOURCE}/boot/grub.cfg ${CMAKE_BINARY_DIR}/iso/boot/grub &&
- grub-mkrescue -o ${CMAKE_BINARY_DIR}/cmos.iso ${CMAKE_BINARY_DIR}/iso
+ rm -rf ${CMAKE_BINARY_DIR}/iso &&
+ mkdir -p ${CMAKE_BINARY_DIR}/iso/boot/grub &&
+ cp ${KERNEL_BINARY_DIR}/kernel ${CMAKE_BINARY_DIR}/iso/boot &&
+ cp ${KERNEL_SOURCE}/boot/grub.cfg ${CMAKE_BINARY_DIR}/iso/boot/grub &&
+ grub-mkrescue -o ${CMAKE_BINARY_DIR}/cmos.iso ${CMAKE_BINARY_DIR}/iso
- DEPENDS kernel
+ DEPENDS kernel
)
add_custom_target(run
- ${QEMU_SYSTEM_CMD}
- ${QEMU_ARGUMENTS}
+ ${QEMU_SYSTEM_CMD}
+ ${QEMU_ARGUMENTS}
- DEPENDS iso
+ DEPENDS iso
)
add_custom_target(run-gdb
- ${QEMU_SYSTEM_CMD}
- ${QEMU_ARGUMENTS}
- -s
- -S
+ ${QEMU_SYSTEM_CMD}
+ ${QEMU_ARGUMENTS}
+ -s
+ -S
- DEPENDS iso
+ DEPENDS iso
)
add_custom_target(clean-custom
- rm -rf
- ${CMAKE_BINARY_DIR}/iso
- ${CMAKE_BINARY_DIR}/cmos.iso
+ rm -rf
+ ${CMAKE_BINARY_DIR}/iso
+ ${CMAKE_BINARY_DIR}/cmos.iso
- DEPENDS clean
+ DEPENDS clean
)
diff --git a/cmake/properties.cmake b/cmake/properties.cmake
index 22bccae..5f5824e 100644
--- a/cmake/properties.cmake
+++ b/cmake/properties.cmake
@@ -1,34 +1,34 @@
if(NOT CMAKE_PROPERTY_LIST)
- execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST)
-
- # Convert command output into a CMake list
- string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
- string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
- list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST)
+ execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST)
+
+ # Convert command output into a CMake list
+ string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
+ string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
+ list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST)
endif()
-
+
function(print_properties)
- message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}")
+ message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}")
endfunction()
-
+
function(print_target_properties target)
- if(NOT TARGET ${target})
- message(STATUS "There is no target named '${target}'")
- return()
- endif()
+ if(NOT TARGET ${target})
+ message(STATUS "There is no target named '${target}'")
+ return()
+ endif()
- foreach(property ${CMAKE_PROPERTY_LIST})
- string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" property ${property})
+ foreach(property ${CMAKE_PROPERTY_LIST})
+ string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" property ${property})
- # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i
- if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$")
- continue()
- endif()
+ # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i
+ if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$")
+ continue()
+ endif()
- get_property(was_set TARGET ${target} PROPERTY ${property} SET)
- if(was_set)
- get_target_property(value ${target} ${property})
- message("${target} ${property} = ${value}")
- endif()
- endforeach()
+ get_property(was_set TARGET ${target} PROPERTY ${property} SET)
+ if(was_set)
+ get_target_property(value ${target} ${property})
+ message("${target} ${property} = ${value}")
+ endif()
+ endforeach()
endfunction()
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
index 272fc5b..47b1ac2 100644
--- a/kernel/CMakeLists.txt
+++ b/kernel/CMakeLists.txt
@@ -2,55 +2,55 @@ cmake_minimum_required(VERSION 3.21)
project(kernel C ASM)
set(KERNEL_SRC
- boot/init/boot.s
+ boot/init/boot.s
- kernel/kernel.c
- kernel/stack_smashing_protector/stack_smashing_protector.c
+ kernel/kernel.c
+ kernel/stack_smashing_protector/stack_smashing_protector.c
- drivers/vga_text_buffer/vga_text_buffer.c
+ drivers/vga_text_buffer/vga_text_buffer.c
- libk/strlen.c
- libk/printk.c
+ libk/strlen.c
+ libk/printk.c
)
add_executable(kernel ${KERNEL_SRC})
target_include_directories(kernel PRIVATE include)
set(C_COMPILE_OPTIONS
- -ffreestanding
+ -ffreestanding
- -fstack-protector
- -fstack-protector-all
+ -fstack-protector
+ -fstack-protector-all
- -O2
+ -O2
- -Wall
- -Wextra
- -pedantic
+ -Wall
+ -Wextra
+ -pedantic
- -g
+ -g
)
target_compile_options(kernel PRIVATE
- $<$<COMPILE_LANGUAGE:C>: ${C_COMPILE_OPTIONS}>
+ $<$<COMPILE_LANGUAGE:C>: ${C_COMPILE_OPTIONS}>
)
set(LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/boot/link.ld")
set(LINKER_FLAGS
- -T ${LINKER_SCRIPT}
- -nostdlib
+ -T ${LINKER_SCRIPT}
+ -nostdlib
)
execute_process(COMMAND ${CMAKE_C_COMPILER}
- -print-file-name=crtbegin.o
- OUTPUT_VARIABLE CRTBEGIN_O
- OUTPUT_STRIP_TRAILING_WHITESPACE
+ -print-file-name=crtbegin.o
+ OUTPUT_VARIABLE CRTBEGIN_O
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND ${CMAKE_C_COMPILER}
- -print-file-name=crtend.o
- OUTPUT_VARIABLE CRTEND_O
- OUTPUT_STRIP_TRAILING_WHITESPACE
+ -print-file-name=crtend.o
+ OUTPUT_VARIABLE CRTEND_O
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_library(crti OBJECT boot/init/crti.s)
@@ -66,12 +66,12 @@ set(CRTI_O "${CRTI_OUT}/CMakeFiles/crti.dir/${CRTI_SRC}.o")
set(CRTN_O "${CRTN_OUT}/CMakeFiles/crtn.dir/${CRTN_SRC}.o")
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <CMAKE_C_LINK_FLAGS> <FLAGS> <LINK_FLAGS> \
- ${CRTI_O} \
- ${CRTBEGIN_O} \
- <OBJECTS> \
- ${CRTEND_O} \
- ${CRTN_O} \
- -o <TARGET> <LINK_LIBRARIES>"
+ ${CRTI_O} \
+ ${CRTBEGIN_O} \
+ <OBJECTS> \
+ ${CRTEND_O} \
+ ${CRTN_O} \
+ -o <TARGET> <LINK_LIBRARIES>"
)
target_link_options(kernel PRIVATE ${LINKER_FLAGS})
diff --git a/kernel/boot/grub.cfg b/kernel/boot/grub.cfg
index 9bc495d..73a002c 100644
--- a/kernel/boot/grub.cfg
+++ b/kernel/boot/grub.cfg
@@ -2,5 +2,5 @@ set timeout=0
set default=0
menuentry "cmos" {
- multiboot /boot/kernel
-} \ No newline at end of file
+ multiboot /boot/kernel
+}
diff --git a/kernel/boot/init/boot.s b/kernel/boot/init/boot.s
index 001e254..c9c6dd5 100644
--- a/kernel/boot/init/boot.s
+++ b/kernel/boot/init/boot.s
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/* Adapted from https://wiki.osdev.org/Bare_Bones */
@@ -65,70 +65,70 @@ stack_top:
.global _start
.type _start, @function
_start:
- /*
- The bootloader has loaded us into 32-bit protected mode on a x86
- machine. Interrupts are disabled. Paging is disabled. The processor
- state is as defined in the multiboot standard. The kernel has full
- control of the CPU. The kernel can only make use of hardware features
- and any code it provides as part of itself. There's no printf
- function, unless the kernel provides its own <stdio.h> header and a
- printf implementation. There are no security restrictions, no
- safeguards, no debugging mechanisms, only what the kernel provides
- itself. It has absolute and complete power over the
- machine.
- */
+ /*
+ The bootloader has loaded us into 32-bit protected mode on a x86
+ machine. Interrupts are disabled. Paging is disabled. The processor
+ state is as defined in the multiboot standard. The kernel has full
+ control of the CPU. The kernel can only make use of hardware features
+ and any code it provides as part of itself. There's no printf
+ function, unless the kernel provides its own <stdio.h> header and a
+ printf implementation. There are no security restrictions, no
+ safeguards, no debugging mechanisms, only what the kernel provides
+ itself. It has absolute and complete power over the
+ machine.
+ */
- /*
- To set up a stack, we set the esp register to point to the top of the
- stack (as it grows downwards on x86 systems). This is necessarily done
- in assembly as languages such as C cannot function without a stack.
- */
- movl $stack_top, %esp
+ /*
+ To set up a stack, we set the esp register to point to the top of the
+ stack (as it grows downwards on x86 systems). This is necessarily done
+ in assembly as languages such as C cannot function without a stack.
+ */
+ movl $stack_top, %esp
- /*
- This is a good place to initialize crucial processor state before the
- high-level kernel is entered. It's best to minimize the early
- environment where crucial features are offline. Note that the
- processor is not fully initialized yet: Features such as floating
- point instructions and instruction set extensions are not initialized
- yet. The GDT should be loaded here. Paging should be enabled here.
- C++ features such as global constructors and exceptions will require
- runtime support to work as well.
- */
+ /*
+ This is a good place to initialize crucial processor state before the
+ high-level kernel is entered. It's best to minimize the early
+ environment where crucial features are offline. Note that the
+ processor is not fully initialized yet: Features such as floating
+ point instructions and instruction set extensions are not initialized
+ yet. The GDT should be loaded here. Paging should be enabled here.
+ C++ features such as global constructors and exceptions will require
+ runtime support to work as well.
+ */
- /* TODO: Initialize global descriptor table */
+ /* TODO: Initialize global descriptor table */
- /* Call the global constructors. */
- call _init
+ /* Call the global constructors. */
+ call _init
- /*
- Enter the high-level kernel. The ABI requires the stack is 16-byte
- aligned at the time of the call instruction (which afterwards pushes
- the return pointer of size 4 bytes). The stack was originally 16-byte
- aligned above and we've pushed a multiple of 16 bytes to the
- stack since (pushed 0 bytes so far), so the alignment has thus been
- preserved and the call is well defined.
- */
- call kernel_main
+ /*
+ Enter the high-level kernel. The ABI requires the stack is 16-byte
+ aligned at the time of the call instruction (which afterwards pushes
+ the return pointer of size 4 bytes). The stack was originally 16-byte
+ aligned above and we've pushed a multiple of 16 bytes to the
+ stack since (pushed 0 bytes so far), so the alignment has thus been
+ preserved and the call is well defined.
+ */
+ call kernel_main
- /*
- If the system has nothing more to do, put the computer into an
- infinite loop. To do that:
- 1) Disable interrupts with cli (clear interrupt enable in eflags).
- They are already disabled by the bootloader, so this is not needed.
- Mind that you might later enable interrupts and return from
- kernel_main (which is sort of nonsensical to do).
- 2) Wait for the next interrupt to arrive with hlt (halt instruction).
- Since they are disabled, this will lock up the computer.
- 3) Jump to the hlt instruction if it ever wakes up due to a
- non-maskable interrupt occurring or due to system management mode.
- */
- cli
- jmp quit
+ /*
+ If the system has nothing more to do, put the computer into an
+ infinite loop. To do that:
+ 1) Disable interrupts with cli (clear interrupt enable in eflags).
+ They are already disabled by the bootloader, so this is not needed.
+ Mind that you might later enable interrupts and return from
+ kernel_main (which is sort of nonsensical to do).
+ 2) Wait for the next interrupt to arrive with hlt (halt instruction).
+ Since they are disabled, this will lock up the computer.
+ 3) Jump to the hlt instruction if it ever wakes up due to a
+ non-maskable interrupt occurring or due to system management mode.
+ */
+ cli
+ jmp quit
quit:
- hlt
- jmp quit
+ hlt
+ jmp quit
/*
Set the size of the _start symbol to the current location '.' minus its start.
diff --git a/kernel/boot/init/crti.s b/kernel/boot/init/crti.s
index 8ea5c60..2819b76 100644
--- a/kernel/boot/init/crti.s
+++ b/kernel/boot/init/crti.s
@@ -1,33 +1,33 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
.section .init
.global _init
.type _init, @function
_init:
- push %ebp
- mov %esp, %ebp
- /* gcc will nicely put the contents of crtbegin.o's .init section here. */
+ push %ebp
+ mov %esp, %ebp
+ /* gcc will nicely put the contents of crtbegin.o's .init section here. */
.section .fini
.global _fini
.type _fini, @function
_fini:
- push %ebp
- mov %esp, %ebp
- /* gcc will nicely put the contents of crtbegin.o's .fini section here. */
+ push %ebp
+ mov %esp, %ebp
+ /* gcc will nicely put the contents of crtbegin.o's .fini section here. */
diff --git a/kernel/boot/init/crtn.s b/kernel/boot/init/crtn.s
index 7109b57..f5186e2 100644
--- a/kernel/boot/init/crtn.s
+++ b/kernel/boot/init/crtn.s
@@ -1,27 +1,27 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
.section .init
- /* gcc will nicely put the contents of crtend.o's .init section here. */
- popl %ebp
- ret
+ /* gcc will nicely put the contents of crtend.o's .init section here. */
+ popl %ebp
+ ret
.section .fini
- /* gcc will nicely put the contents of crtend.o's .fini section here. */
- popl %ebp
- ret
+ /* gcc will nicely put the contents of crtend.o's .fini section here. */
+ popl %ebp
+ ret
diff --git a/kernel/boot/link.ld b/kernel/boot/link.ld
index 75239d2..e2ae26c 100644
--- a/kernel/boot/link.ld
+++ b/kernel/boot/link.ld
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/* The bootloader will look at this image and start execution at the symbol
designated as the entry point. */
@@ -24,7 +24,7 @@ ENTRY(_start)
kernel image. */
SECTIONS
{
- /* It used to be universally recommended to use 1M as a start offset,
+ /* It used to be universally recommended to use 1M as a start offset,
as it was effectively guaranteed to be available under BIOS systems.
However, UEFI has made things more complicated, and experimental data
strongly suggests that 2M is a safer place to load. In 2016, a new
@@ -35,36 +35,36 @@ SECTIONS
memory which is verified to be available by the firmware, in order to
work around this issue. This does not use that feature, so 2M was
chosen as a safer option than the traditional 1M. */
- . = 2M;
+ . = 2M;
- /* First put the multiboot header, as it is required to be put very early
+ /* First put the multiboot header, as it is required to be put very early
in the image or the bootloader won't recognize the file format.
Next we'll put the .text section. */
- .text BLOCK(4K) : ALIGN(4K)
- {
- *(.multiboot)
- *(.text)
- }
+ .text BLOCK(4K) : ALIGN(4K)
+ {
+ *(.multiboot)
+ *(.text)
+ }
- /* Read-only data. */
- .rodata BLOCK(4K) : ALIGN(4K)
- {
- *(.rodata)
- }
+ /* Read-only data. */
+ .rodata BLOCK(4K) : ALIGN(4K)
+ {
+ *(.rodata)
+ }
- /* Read-write data (initialized) */
- .data BLOCK(4K) : ALIGN(4K)
- {
- *(.data)
- }
+ /* Read-write data (initialized) */
+ .data BLOCK(4K) : ALIGN(4K)
+ {
+ *(.data)
+ }
- /* Read-write data (uninitialized) and stack */
- .bss BLOCK(4K) : ALIGN(4K)
- {
- *(COMMON)
- *(.bss)
- }
+ /* Read-write data (uninitialized) and stack */
+ .bss BLOCK(4K) : ALIGN(4K)
+ {
+ *(COMMON)
+ *(.bss)
+ }
- /* The compiler may produce other sections, by default it will put them in
+ /* The compiler may produce other sections, by default it will put them in
a segment with the same name. Simply add stuff here as needed. */
}
diff --git a/kernel/drivers/vga_text_buffer/vga_text_buffer.c b/kernel/drivers/vga_text_buffer/vga_text_buffer.c
index d400f2d..0c05f0e 100644
--- a/kernel/drivers/vga_text_buffer/vga_text_buffer.c
+++ b/kernel/drivers/vga_text_buffer/vga_text_buffer.c
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stddef.h>
#include <stdint.h>
@@ -33,75 +33,75 @@ bool vga_text_buffer_initialized = false;
static uint8_t
vga_entry_color(vga_color fg, vga_color bg)
{
- /*
- * bg fg
- * 1110 0101
- */
- return bg << 4 | fg;
+ /*
+ * bg fg
+ * 1110 0101
+ */
+ return bg << 4 | fg;
}
static uint16_t
vga_entry(unsigned char character, uint8_t color)
{
- /*
- * color character
- * 1110 0101 1001 1010
- */
- return (uint16_t) color << 8 | (uint16_t) character;
+ /*
+ * color character
+ * 1110 0101 1001 1010
+ */
+ return (uint16_t) color << 8 | (uint16_t) character;
}
bool
vga_text_buffer_is_initialized(void)
{
- return vga_text_buffer_initialized;
+ return vga_text_buffer_initialized;
}
static void
vga_text_buffer_write_entry_at(char c, uint8_t color, uint8_t x, uint8_t y)
{
- size_t index = y * VGA_WIDTH + x;
- vga_text_buffer_buffer[index] = vga_entry(c, color);
+ size_t index = y * VGA_WIDTH + x;
+ vga_text_buffer_buffer[index] = vga_entry(c, color);
}
void
vga_text_buffer_initialize(void)
{
- vga_text_buffer_row = 0;
- vga_text_buffer_column = 0;
- vga_text_buffer_color = vga_entry_color(
- VGA_COLOR_LIGHT_GREY,
- VGA_COLOR_BLACK
- );
- vga_text_buffer_buffer = (uint16_t *) 0xB8000;
+ vga_text_buffer_row = 0;
+ vga_text_buffer_column = 0;
+ vga_text_buffer_color = vga_entry_color(
+ VGA_COLOR_LIGHT_GREY,
+ VGA_COLOR_BLACK
+ );
+ vga_text_buffer_buffer = (uint16_t *) 0xB8000;
- for (uint8_t y = 0; y < VGA_HEIGHT; y++)
- for (uint8_t x = 0; x < VGA_WIDTH; x++)
- vga_text_buffer_write_entry_at(' ', vga_text_buffer_color, x, y);
+ for (uint8_t y = 0; y < VGA_HEIGHT; y++)
+ for (uint8_t x = 0; x < VGA_WIDTH; x++)
+ vga_text_buffer_write_entry_at(' ', vga_text_buffer_color, x, y);
- vga_text_buffer_initialized = true;
+ vga_text_buffer_initialized = true;
}
void
vga_text_buffer_write_char(char c)
{
- if (c == '\n') {
- vga_text_buffer_row++;
- vga_text_buffer_column = 0;
- } else {
- vga_text_buffer_write_entry_at(c, vga_text_buffer_color, vga_text_buffer_column, vga_text_buffer_row);
+ if (c == '\n') {
+ vga_text_buffer_row++;
+ vga_text_buffer_column = 0;
+ } else {
+ vga_text_buffer_write_entry_at(c, vga_text_buffer_color, vga_text_buffer_column, vga_text_buffer_row);
- if (++vga_text_buffer_column == VGA_WIDTH) {
- vga_text_buffer_column = 0;
- if (++vga_text_buffer_row == VGA_HEIGHT)
- vga_text_buffer_row = 0;
- }
+ if (++vga_text_buffer_column == VGA_WIDTH) {
+ vga_text_buffer_column = 0;
+ if (++vga_text_buffer_row == VGA_HEIGHT)
+ vga_text_buffer_row = 0;
}
+ }
}
void
vga_text_buffer_write_string(char *data)
{
- size_t size = strlen(data);
- for (size_t i = 0; i < size; i++)
- vga_text_buffer_write_char(data[i]);
+ size_t size = strlen(data);
+ for (size_t i = 0; i < size; i++)
+ vga_text_buffer_write_char(data[i]);
}
diff --git a/kernel/include/driver/vga_text_buffer.h b/kernel/include/driver/vga_text_buffer.h
index 7d46b54..0dcc911 100644
--- a/kernel/include/driver/vga_text_buffer.h
+++ b/kernel/include/driver/vga_text_buffer.h
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef __drivers_vga_text_buffer_h
#define __drivers_vga_text_buffer_h
@@ -32,22 +32,22 @@
/* Hardware text mode color constants. */
typedef enum {
- VGA_COLOR_BLACK = 0,
- VGA_COLOR_BLUE = 1,
- VGA_COLOR_GREEN = 2,
- VGA_COLOR_CYAN = 3,
- VGA_COLOR_RED = 4,
- VGA_COLOR_MAGENTA = 5,
- VGA_COLOR_BROWN = 6,
- VGA_COLOR_LIGHT_GREY = 7,
- VGA_COLOR_DARK_GREY = 8,
- VGA_COLOR_LIGHT_BLUE = 9,
- VGA_COLOR_LIGHT_GREEN = 10,
- VGA_COLOR_LIGHT_CYAN = 11,
- VGA_COLOR_LIGHT_RED = 12,
- VGA_COLOR_LIGHT_MAGENTA = 13,
- VGA_COLOR_LIGHT_BROWN = 14,
- VGA_COLOR_WHITE = 15,
+ VGA_COLOR_BLACK = 0,
+ VGA_COLOR_BLUE = 1,
+ VGA_COLOR_GREEN = 2,
+ VGA_COLOR_CYAN = 3,
+ VGA_COLOR_RED = 4,
+ VGA_COLOR_MAGENTA = 5,
+ VGA_COLOR_BROWN = 6,
+ VGA_COLOR_LIGHT_GREY = 7,
+ VGA_COLOR_DARK_GREY = 8,
+ VGA_COLOR_LIGHT_BLUE = 9,
+ VGA_COLOR_LIGHT_GREEN = 10,
+ VGA_COLOR_LIGHT_CYAN = 11,
+ VGA_COLOR_LIGHT_RED = 12,
+ VGA_COLOR_LIGHT_MAGENTA = 13,
+ VGA_COLOR_LIGHT_BROWN = 14,
+ VGA_COLOR_WHITE = 15,
} vga_color;
bool vga_text_buffer_is_initialized(void);
diff --git a/kernel/include/libk/io.h b/kernel/include/libk/io.h
index ac31038..7cda8a4 100644
--- a/kernel/include/libk/io.h
+++ b/kernel/include/libk/io.h
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef __libk_io_h
#define __libk_io_h
diff --git a/kernel/include/libk/string.h b/kernel/include/libk/string.h
index 7a92dfa..3c19fa4 100644
--- a/kernel/include/libk/string.h
+++ b/kernel/include/libk/string.h
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef __libk_string_h
#define __libk_string_h
diff --git a/kernel/kernel/kernel.c b/kernel/kernel/kernel.c
index a650a31..ccab4f8 100644
--- a/kernel/kernel/kernel.c
+++ b/kernel/kernel/kernel.c
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <libk/io.h>
@@ -23,6 +23,6 @@
void
kernel_main(void)
{
- vga_text_buffer_initialize();
- printk("kernel_main: Started\n");
+ vga_text_buffer_initialize();
+ printk("kernel_main: Started\n");
}
diff --git a/kernel/libk/printk.c b/kernel/libk/printk.c
index 4326d01..1465ea1 100644
--- a/kernel/libk/printk.c
+++ b/kernel/libk/printk.c
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <libk/io.h>
#include <driver/vga_text_buffer.h>
@@ -22,5 +22,5 @@
void
printk(char *msg)
{
- vga_text_buffer_write_string(msg);
+ vga_text_buffer_write_string(msg);
}
diff --git a/kernel/libk/strlen.c b/kernel/libk/strlen.c
index 656b06f..c203099 100644
--- a/kernel/libk/strlen.c
+++ b/kernel/libk/strlen.c
@@ -1,20 +1,20 @@
/*
-* CMOS
-* Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * CMOS
+ * Copyright (C) 2024 Raghuram Subramani <raghus2247@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stddef.h>
@@ -23,9 +23,9 @@
size_t
strlen(const char *str)
{
- size_t len = 0;
- while (str[len])
- len++;
+ size_t len = 0;
+ while (str[len])
+ len++;
- return len;
+ return len;
}
diff --git a/toolchain/Makefile b/toolchain/Makefile
index 142132b..8652bdb 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -22,7 +22,7 @@ export OUT_DIR := $(ROOT_DIR)
export PARALLEL_CORES := 16
all:
- # $(MAKE) -f host_binutils.mk
- # $(MAKE) -f host_gcc.mk
- $(MAKE) -f cross_binutils.mk
- $(MAKE) -f cross_gcc.mk
+ # $(MAKE) -f host_binutils.mk
+ # $(MAKE) -f host_gcc.mk
+ $(MAKE) -f cross_binutils.mk
+ $(MAKE) -f cross_gcc.mk
diff --git a/toolchain/cross_binutils.mk b/toolchain/cross_binutils.mk
index 71ed0d5..c8bb68d 100644
--- a/toolchain/cross_binutils.mk
+++ b/toolchain/cross_binutils.mk
@@ -36,28 +36,28 @@ all: install
$(call add-to-path,$(shell pwd)/host/bin)
$(FILE):
- mkdir -p $(DIR)
- wget $(URL) -O $(FILE)
+ mkdir -p $(DIR)
+ wget $(URL) -O $(FILE)
unpack: $(FILE)
- tar xf $(FILE) -C $(DIR)
+ tar xf $(FILE) -C $(DIR)
configure: unpack
- mkdir -p $(BUILD)
- cd $(BUILD)
- $(SRC)/configure \
- --prefix=$(OUT) \
- --target=$(TOOLCHAIN_TARGET) \
- --disable-nls \
- --with-sysroot
+ mkdir -p $(BUILD)
+ cd $(BUILD)
+ $(SRC)/configure \
+ --prefix=$(OUT) \
+ --target=$(TOOLCHAIN_TARGET) \
+ --disable-nls \
+ --with-sysroot
build: configure
- cd $(BUILD)
- $(MAKE) -j$(PARALLEL_CORES)
+ cd $(BUILD)
+ $(MAKE) -j$(PARALLEL_CORES)
install: build
- cd $(BUILD)
- $(MAKE) install
+ cd $(BUILD)
+ $(MAKE) install
clean:
- rm -rf $(DIR) $(FILE) $(OUT)
+ rm -rf $(DIR) $(FILE) $(OUT)
diff --git a/toolchain/cross_gcc.mk b/toolchain/cross_gcc.mk
index f82a6d6..06d128a 100644
--- a/toolchain/cross_gcc.mk
+++ b/toolchain/cross_gcc.mk
@@ -37,36 +37,36 @@ $(call add-to-path,$(shell pwd)/cross/bin)
$(call add-to-path,$(shell pwd)/host/bin)
$(FILE):
- mkdir -p $(DIR)
- wget $(URL) -O $(FILE)
+ mkdir -p $(DIR)
+ wget $(URL) -O $(FILE)
unpack: $(FILE)
- tar xf $(FILE) -C $(DIR)
+ tar xf $(FILE) -C $(DIR)
configure: unpack
- cd $(SRC)
- ./contrib/download_prerequisites
- mkdir -p $(BUILD)
- cd $(BUILD)
- $(SRC)/configure \
- --prefix=$(OUT) \
- --target=$(TOOLCHAIN_TARGET) \
- --disable-nls \
- --enable-languages=c,c++ \
- --without-headers \
- --disable-hosted-libstdcxx
+ cd $(SRC)
+ ./contrib/download_prerequisites
+ mkdir -p $(BUILD)
+ cd $(BUILD)
+ $(SRC)/configure \
+ --prefix=$(OUT) \
+ --target=$(TOOLCHAIN_TARGET) \
+ --disable-nls \
+ --enable-languages=c,c++ \
+ --without-headers \
+ --disable-hosted-libstdcxx
build: configure
- cd $(BUILD)
- $(MAKE) -j$(PARALLEL_CORES) all-gcc
- $(MAKE) -j$(PARALLEL_CORES) all-target-libgcc
- $(MAKE) -j$(PARALLEL_CORES) all-target-libstdc++-v3
+ cd $(BUILD)
+ $(MAKE) -j$(PARALLEL_CORES) all-gcc
+ $(MAKE) -j$(PARALLEL_CORES) all-target-libgcc
+ $(MAKE) -j$(PARALLEL_CORES) all-target-libstdc++-v3
install: build
- cd $(BUILD)
- $(MAKE) install-gcc
- $(MAKE) install-target-libgcc
- $(MAKE) install-target-libstdc++-v3
+ cd $(BUILD)
+ $(MAKE) install-gcc
+ $(MAKE) install-target-libgcc
+ $(MAKE) install-target-libstdc++-v3
clean:
- rm -rf $(DIR) $(FILE) $(OUT)
+ rm -rf $(DIR) $(FILE) $(OUT)
diff --git a/toolchain/host_binutils.mk b/toolchain/host_binutils.mk
index 6d24f88..1f8e23c 100644
--- a/toolchain/host_binutils.mk
+++ b/toolchain/host_binutils.mk
@@ -30,26 +30,26 @@ all: install
.ONESHELL:
$(FILE):
- mkdir -p $(DIR)
- wget $(URL) -O $(FILE)
+ mkdir -p $(DIR)
+ wget $(URL) -O $(FILE)
unpack: $(FILE)
- tar xf $(FILE) -C $(DIR)
+ tar xf $(FILE) -C $(DIR)
configure: unpack
- mkdir -p $(BUILD)
- cd $(BUILD)
- $(SRC)/configure \
- --prefix=$(OUT) \
- --disable-nls
+ mkdir -p $(BUILD)
+ cd $(BUILD)
+ $(SRC)/configure \
+ --prefix=$(OUT) \
+ --disable-nls
build: configure
- cd $(BUILD)
- $(MAKE) -j$(PARALLEL_CORES)
+ cd $(BUILD)
+ $(MAKE) -j$(PARALLEL_CORES)
install: build
- cd $(BUILD)
- $(MAKE) install
+ cd $(BUILD)
+ $(MAKE) install
clean:
- rm -rf $(DIR) $(FILE) $(OUT)
+ rm -rf $(DIR) $(FILE) $(OUT)
diff --git a/toolchain/host_gcc.mk b/toolchain/host_gcc.mk
index 422a96b..0feb33e 100644
--- a/toolchain/host_gcc.mk
+++ b/toolchain/host_gcc.mk
@@ -30,29 +30,29 @@ all: install
.ONESHELL:
$(FILE):
- mkdir -p $(DIR)
- wget $(URL) -O $(FILE)
+ mkdir -p $(DIR)
+ wget $(URL) -O $(FILE)
unpack: $(FILE)
- tar xf $(FILE) -C $(DIR)
+ tar xf $(FILE) -C $(DIR)
configure: unpack
- cd $(SRC)
- ./contrib/download_prerequisites
- mkdir -p $(BUILD)
- cd $(BUILD)
- $(SRC)/configure \
- --prefix=$(OUT) \
- --disable-nls \
- --enable-languages=c,c++
+ cd $(SRC)
+ ./contrib/download_prerequisites
+ mkdir -p $(BUILD)
+ cd $(BUILD)
+ $(SRC)/configure \
+ --prefix=$(OUT) \
+ --disable-nls \
+ --enable-languages=c,c++
build: configure
- cd $(BUILD)
- $(MAKE) -j$(PARALLEL_CORES)
+ cd $(BUILD)
+ $(MAKE) -j$(PARALLEL_CORES)
install: build
- cd $(BUILD)
- $(MAKE) install
+ cd $(BUILD)
+ $(MAKE) install
clean:
- rm -rf $(DIR) $(FILE) $(OUT)
+ rm -rf $(DIR) $(FILE) $(OUT)