From 2ccf881b046d02bf4641bb41d6e5a9a69db8ae0b Mon Sep 17 00:00:00 2001 From: Morten Delenk Date: Sun, 23 Apr 2017 16:09:42 +0000 Subject: [PATCH] added kernel configuration --- .gitignore | 1 + config.py | 43 +++++++++++++++++++++++++ kernel/CMakeLists.txt | 1 + kernel/arch/arm/3ds11/config.py | 5 +++ kernel/arch/arm/3ds9/config.py | 3 ++ kernel/arch/arm/config.py | 1 + kernel/arch/x86/config.py | 6 ++++ kernel/arch/x86/pc/config.py | 2 ++ kernel/arch/x86_64/config.py | 5 +++ kernel/arch/x86_64/pc/config.py | 2 ++ kernel/cpu/arm/arm11mpcore/config.py | 0 kernel/cpu/arm/arm946e-s/config.py | 0 kernel/cpu/x86/486/config.py | 0 kernel/cpu/x86/pentium/config.py | 0 kernel/cpu/x86/pentium2/config.py | 0 kernel/cpu/x86/pentium3/config.py | 0 kernel/cpu/x86/pentium4/config.py | 0 kernel/cpu/x86_64/broadwell/config.py | 0 kernel/cpu/x86_64/core2/config.py | 0 kernel/cpu/x86_64/haswell/config.py | 0 kernel/cpu/x86_64/ivybridge/config.py | 0 kernel/cpu/x86_64/kabylake/config.py | 0 kernel/cpu/x86_64/nehalem/config.py | 0 kernel/cpu/x86_64/pentium4/config.py | 0 kernel/cpu/x86_64/sandybridge/config.py | 0 kernel/cpu/x86_64/skylake/config.py | 0 kernel/cpu/x86_64/westmere/config.py | 0 kernel/hw/3ds11/config.py | 6 ++++ kernel/hw/3ds9/config.py | 1 + kernel/hw/config.py | 0 kernel/hw/pc/config.py | 0 31 files changed, 76 insertions(+) create mode 100755 config.py create mode 100644 kernel/arch/arm/3ds11/config.py create mode 100644 kernel/arch/arm/3ds9/config.py create mode 100644 kernel/arch/arm/config.py create mode 100644 kernel/arch/x86/config.py create mode 100644 kernel/arch/x86/pc/config.py create mode 100644 kernel/arch/x86_64/config.py create mode 100644 kernel/arch/x86_64/pc/config.py create mode 100644 kernel/cpu/arm/arm11mpcore/config.py create mode 100644 kernel/cpu/arm/arm946e-s/config.py create mode 100644 kernel/cpu/x86/486/config.py create mode 100644 kernel/cpu/x86/pentium/config.py create mode 100644 kernel/cpu/x86/pentium2/config.py create mode 100644 kernel/cpu/x86/pentium3/config.py create mode 100644 kernel/cpu/x86/pentium4/config.py create mode 100644 kernel/cpu/x86_64/broadwell/config.py create mode 100644 kernel/cpu/x86_64/core2/config.py create mode 100644 kernel/cpu/x86_64/haswell/config.py create mode 100644 kernel/cpu/x86_64/ivybridge/config.py create mode 100644 kernel/cpu/x86_64/kabylake/config.py create mode 100644 kernel/cpu/x86_64/nehalem/config.py create mode 100644 kernel/cpu/x86_64/pentium4/config.py create mode 100644 kernel/cpu/x86_64/sandybridge/config.py create mode 100644 kernel/cpu/x86_64/skylake/config.py create mode 100644 kernel/cpu/x86_64/westmere/config.py create mode 100644 kernel/hw/3ds11/config.py create mode 100644 kernel/hw/3ds9/config.py create mode 100644 kernel/hw/config.py create mode 100644 kernel/hw/pc/config.py diff --git a/.gitignore b/.gitignore index 550f776..3ce8e8d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ gcc/ binutils/ gawk/ builddir/ +config.cmake diff --git a/config.py b/config.py new file mode 100755 index 0000000..3d224df --- /dev/null +++ b/config.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +"This tool is for configuring mtgos" +def get_from_list(p,l): + print("Select one of:") + for i,j in enumerate(l): + print(str(i)+":",j) + if len(l) == 1: + print(p+": 0 (autoselected)") + return l[0] + i=-1 + while (i<0) or (i >= len(l)): + x = input(p+": ") + try: + i = int(x) + except: + i = -1 + print() + return l[i] +def get_yes_no(p, default=None): + x="a" + defaultstr = "[yn]" + if default: + defaultstr = "[Yn]" + elif default == False: + defaultstr = "[yN]" + while x not in "ynYN": + x = input(p+" "+defaultstr+": ") + if (x == "") and default is not None: + return default + return x in "yY" +config={} +config["ARCH"] = get_from_list("Architecture", ["x86","x86_64","arm"]) +exec(open("kernel/arch/"+config["ARCH"]+"/config.py").read()) +exec(open("kernel/arch/"+config["ARCH"]+"/"+config["SYSTEM"]+"/config.py").read()) +exec(open("kernel/cpu/"+config["ARCH"]+"/"+config["LOWEST_CPU"]+"/config.py").read()) +exec(open("kernel/hw/"+config["SYSTEM"]+"/config.py").read()) +exec(open("kernel/hw/config.py").read()) +with open("config.cmake", "w") as f: + for key, val in config.items(): + if val == True: + f.write('SET('+key+' 1)\n') + elif val != False: + f.write('SET('+key+' '+str(val)+')\n') diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 2105e91..616e604 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -1 +1,2 @@ ENABLE_LANGUAGE(C CXX ASM-ATT) +INCLUDE(arch/$ARCH/$SYSTEM/config.cmake) diff --git a/kernel/arch/arm/3ds11/config.py b/kernel/arch/arm/3ds11/config.py new file mode 100644 index 0000000..572e831 --- /dev/null +++ b/kernel/arch/arm/3ds11/config.py @@ -0,0 +1,5 @@ +config["LOWEST_CPU"] = "arm11mpcore" +config["ENABLE_HARD"] = get_yes_no("Enable VFP ABI", True) +if not config["ENABLE_HARD"]: + config["ENABLE_THUMB"] = get_yes_no("Enable Thumb") + diff --git a/kernel/arch/arm/3ds9/config.py b/kernel/arch/arm/3ds9/config.py new file mode 100644 index 0000000..2e7d23e --- /dev/null +++ b/kernel/arch/arm/3ds9/config.py @@ -0,0 +1,3 @@ +config["LOWEST_CPU"] = "arm946e-s" +config["ENABLE_THUMB"] = get_yes_no("Enable Thumb", True) + diff --git a/kernel/arch/arm/config.py b/kernel/arch/arm/config.py new file mode 100644 index 0000000..e31519e --- /dev/null +++ b/kernel/arch/arm/config.py @@ -0,0 +1 @@ +config["SYSTEM"] = get_from_list("System", ["3ds9","3ds11"]) diff --git a/kernel/arch/x86/config.py b/kernel/arch/x86/config.py new file mode 100644 index 0000000..d713781 --- /dev/null +++ b/kernel/arch/x86/config.py @@ -0,0 +1,6 @@ +config["SYSTEM"] = get_from_list("System", ["pc"]) +if not get_yes_no("Build for generic x86"): + config["LOWEST_CPU"] = get_from_list("Lowest supported CPU", ["486", "pentium", "pentium2", "pentium3", "pentium4"]) +else: + config["LOWEST_CPU"] = "486" + diff --git a/kernel/arch/x86/pc/config.py b/kernel/arch/x86/pc/config.py new file mode 100644 index 0000000..188c514 --- /dev/null +++ b/kernel/arch/x86/pc/config.py @@ -0,0 +1,2 @@ +config["ENABLE_FPU"]=get_yes_no("Enable x87 FPU", True) +config["ENABLE_SSE"]=get_yes_no("Enable SSE") diff --git a/kernel/arch/x86_64/config.py b/kernel/arch/x86_64/config.py new file mode 100644 index 0000000..cdd128c --- /dev/null +++ b/kernel/arch/x86_64/config.py @@ -0,0 +1,5 @@ +config["SYSTEM"] = get_from_list("System", ["pc"]) +if not get_yes_no("Build for generic x86_64"): + config["LOWEST_CPU"] = get_from_list("Lowest supported CPU", ["pentium4", "core2", "nehalem", "westmere", "sandybridge", "ivybridge", "haswell", "broadwell", "skylake", "kabylake"]) + + diff --git a/kernel/arch/x86_64/pc/config.py b/kernel/arch/x86_64/pc/config.py new file mode 100644 index 0000000..86e09b9 --- /dev/null +++ b/kernel/arch/x86_64/pc/config.py @@ -0,0 +1,2 @@ +config["ENABLE_FPU"] = True +config["ENABLE_SSE"] = get_yes_no("Enable FPU", True) diff --git a/kernel/cpu/arm/arm11mpcore/config.py b/kernel/cpu/arm/arm11mpcore/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/arm/arm946e-s/config.py b/kernel/cpu/arm/arm946e-s/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86/486/config.py b/kernel/cpu/x86/486/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86/pentium/config.py b/kernel/cpu/x86/pentium/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86/pentium2/config.py b/kernel/cpu/x86/pentium2/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86/pentium3/config.py b/kernel/cpu/x86/pentium3/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86/pentium4/config.py b/kernel/cpu/x86/pentium4/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/broadwell/config.py b/kernel/cpu/x86_64/broadwell/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/core2/config.py b/kernel/cpu/x86_64/core2/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/haswell/config.py b/kernel/cpu/x86_64/haswell/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/ivybridge/config.py b/kernel/cpu/x86_64/ivybridge/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/kabylake/config.py b/kernel/cpu/x86_64/kabylake/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/nehalem/config.py b/kernel/cpu/x86_64/nehalem/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/pentium4/config.py b/kernel/cpu/x86_64/pentium4/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/sandybridge/config.py b/kernel/cpu/x86_64/sandybridge/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/skylake/config.py b/kernel/cpu/x86_64/skylake/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/cpu/x86_64/westmere/config.py b/kernel/cpu/x86_64/westmere/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/hw/3ds11/config.py b/kernel/hw/3ds11/config.py new file mode 100644 index 0000000..b53e08e --- /dev/null +++ b/kernel/hw/3ds11/config.py @@ -0,0 +1,6 @@ +config["ENABLE_N3DS_OVERCLOCK"] = get_yes_no("Enable overclocking on n3ds", True) +config["ENABLE_I2C"] = get_yes_no("Enable i2c driver", True) +if config["ENABLE_I2C"]: + config["PROTECT_MCU"] = get_yes_no("Prevent writes to MCU firmware (Device 3, Register 5)", True) + config["ENABLE_SCREENINIT"] = get_yes_no("Enable screeninit.", True) + diff --git a/kernel/hw/3ds9/config.py b/kernel/hw/3ds9/config.py new file mode 100644 index 0000000..3c38403 --- /dev/null +++ b/kernel/hw/3ds9/config.py @@ -0,0 +1 @@ +config["ENABLE_EXTRA_MEMORY"] = get_yes_no("Enable 512KB of memory on n3DS", True) diff --git a/kernel/hw/config.py b/kernel/hw/config.py new file mode 100644 index 0000000..e69de29 diff --git a/kernel/hw/pc/config.py b/kernel/hw/pc/config.py new file mode 100644 index 0000000..e69de29