aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config22
-rw-r--r--.gitignore1
-rw-r--r--Kconfig30
-rw-r--r--Makefile16
-rw-r--r--Makefile.config40
-rw-r--r--devices/Makefile2
-rw-r--r--i686/Makefile2
-rw-r--r--i686/toolchain.mk20
-rw-r--r--lib/Makefile2
-rw-r--r--src/Makefile2
10 files changed, 122 insertions, 15 deletions
diff --git a/.config b/.config
new file mode 100644
index 0000000..a843a13
--- /dev/null
+++ b/.config
@@ -0,0 +1,22 @@
+
+#
+# Toolchain
+#
+CONFIG_CCFLAGS=""
+CONFIG_LDFLAGS=""
+# end of Toolchain
+
+#
+# Target
+#
+CONFIG_ARCH_i686=y
+# end of Target
+
+#
+# Devices
+#
+CONFIG_PIC_8259=y
+CONFIG_UART_16550=y
+CONFIG_VGA_TEXT_MODE=y
+CONFIG_KB_PS2=y
+# end of Devices
diff --git a/.gitignore b/.gitignore
index 3f5a238..1796b0a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ build*
*.iso
isodir
src/conf.h
+.config.old
diff --git a/Kconfig b/Kconfig
new file mode 100644
index 0000000..52eba30
--- /dev/null
+++ b/Kconfig
@@ -0,0 +1,30 @@
+menu "Toolchain"
+ config CCFLAGS
+ string "Additional C compiler flags"
+ config LDFLAGS
+ string "Additional linker flags"
+endmenu
+
+menu "Target"
+ choice
+ prompt "Target architecture"
+ config ARCH_i686
+ bool "i686"
+ endchoice
+endmenu
+
+menu "Devices"
+ config PIC_8259
+ bool "PIC 8259"
+ depends on ARCH_i686
+ default y
+ config UART_16550
+ bool "UART 16550"
+ default y
+ config VGA_TEXT_MODE
+ bool "VGA (text mode)"
+ default y
+ config KB_PS2
+ bool "PS/2 keyboard"
+ default y
+endmenu
diff --git a/Makefile b/Makefile
index aa6965e..ca76f48 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,24 @@
MAKE = make
MAKEFLAGS += --no-print-directory
-ARCH = i686
-include ${ARCH}/toolchain.mk
+
+-include Makefile.config
info:
- @echo "this is the all target"
+ @echo "* Build information *"
@echo " ARCH ${ARCH}"
@echo " MAKE $(shell ${MAKE} --version | head -n1)"
@echo " CC $(shell ${CC} --version | head -n1)"
+ @echo " ${CCFLAGS}"
@echo " LD $(shell ${LD} --version | head -n1)"
+ @echo " ${LDFLAGS}"
+
+.config: Kconfig
+ @alldefconfig
+
+Makefile.config: .config
+ @cp .config Makefile.config
+ @echo -e '\n# toolchain.mk' >> Makefile.config
+ @cat $$(sed -nE "s/CONFIG_ARCH_(.+)=y/\1/p" .config)/toolchain.mk >> Makefile.config
.PHONY: all run clean purge
all:
diff --git a/Makefile.config b/Makefile.config
new file mode 100644
index 0000000..8f18c80
--- /dev/null
+++ b/Makefile.config
@@ -0,0 +1,40 @@
+
+#
+# Toolchain
+#
+CONFIG_CCFLAGS=""
+CONFIG_LDFLAGS=""
+# end of Toolchain
+
+#
+# Target
+#
+CONFIG_ARCH_i686=y
+# end of Target
+
+#
+# Devices
+#
+CONFIG_PIC_8259=y
+CONFIG_UART_16550=y
+CONFIG_VGA_TEXT_MODE=y
+CONFIG_KB_PS2=y
+# end of Devices
+
+# toolchain.mk
+ARCH=i686
+
+# define compiler, linker, archiver and strip and their flags
+#
+AS := i686-elf-as
+CC := i686-elf-gcc
+CCFLAGS := -Wall -Wextra -Wpedantic -fanalyzer -ffreestanding -std=gnu11 -mgeneral-regs-only
+CCFLAGS += $(shell echo ${CONFIG_CCFLAGS})
+LD := i686-elf-ld
+LDFLAGS := -static -nostdlib
+LDFLAGS += $(shell echo ${CONFIG_LDFLAGS})
+AR := i686-elf-ar
+ARFLAGS := -crus
+STRIP := i686-elf-strip
+
+
diff --git a/devices/Makefile b/devices/Makefile
index a73645f..30935c5 100644
--- a/devices/Makefile
+++ b/devices/Makefile
@@ -1,4 +1,4 @@
-include ../${ARCH}/toolchain.mk
+include ../Makefile.config
CCFLAGS += -I. -I../${ARCH} -I../lib
diff --git a/i686/Makefile b/i686/Makefile
index 04257dc..431db77 100644
--- a/i686/Makefile
+++ b/i686/Makefile
@@ -1,4 +1,4 @@
-include ../${ARCH}/toolchain.mk
+include ../Makefile.config
CCFLAGS += -I../grub/include -I../lib
diff --git a/i686/toolchain.mk b/i686/toolchain.mk
index 7bef9bc..1c0d922 100644
--- a/i686/toolchain.mk
+++ b/i686/toolchain.mk
@@ -1,12 +1,16 @@
+ARCH=i686
+
# define compiler, linker, archiver and strip and their flags
#
-AS = i686-elf-as
-CC = i686-elf-gcc
-CCFLAGS = -Wall -Wextra -Wpedantic -fanalyzer -ffreestanding -std=gnu11 -mgeneral-regs-only
-LD = i686-elf-ld
-LDFLAGS = -static -nostdlib
-AR = i686-elf-ar
-ARFLAGS = -crus
-STRIP = i686-elf-strip
+AS := i686-elf-as
+CC := i686-elf-gcc
+CCFLAGS := -Wall -Wextra -Wpedantic -fanalyzer -ffreestanding -std=gnu11 -mgeneral-regs-only
+CCFLAGS += $(shell echo ${CONFIG_CCFLAGS})
+LD := i686-elf-ld
+LDFLAGS := -static -nostdlib
+LDFLAGS += $(shell echo ${CONFIG_LDFLAGS})
+AR := i686-elf-ar
+ARFLAGS := -crus
+STRIP := i686-elf-strip
diff --git a/lib/Makefile b/lib/Makefile
index 8645c45..8f27824 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,4 +1,4 @@
-include ../${ARCH}/toolchain.mk
+include ../Makefile.config
CCFLAGS += -I. -I..
diff --git a/src/Makefile b/src/Makefile
index e1fb529..205c4e3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-include ../${ARCH}/toolchain.mk
+include ../Makefile.config
CCFLAGS += -I. -isystem../grub/include -I../${ARCH} -I../lib -I..