summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-10-16 19:20:54 +0200
committerRichard Braun <rbraun@sceen.net>2012-10-16 19:20:54 +0200
commiteb21efaacca336929426c3859a715ccdcce07e7e (patch)
tree94f58107c126e8a145ee705c2b18d628daaa06a8
parent396311ff79582e3a78a175d519e5ebcca4e022f4 (diff)
Rework the build system
Architecture specific stuff is now completely isolated in its arch/xxx directory. The install and dist targets have been fixed, as well as the source file list. Autoconf strictness is reduced to foreign, and the now unneeded files have been removed. Additions to the generated config.h header can be added in the global kern/config.h or the architecture specific machine/config.h headers.
-rw-r--r--.gitignore19
-rw-r--r--AUTHORS2
-rw-r--r--ChangeLog1
-rw-r--r--INSTALL9
-rw-r--r--Makefile.am13
-rw-r--r--Makefrag.am86
-rw-r--r--NEWS1
-rw-r--r--README-alpha14
-rw-r--r--arch/x86/Makefrag.am57
-rw-r--r--arch/x86/configfrag.ac80
-rw-r--r--arch/x86/machine/boot.c13
-rw-r--r--arch/x86/machine/config.h26
-rw-r--r--arch/x86/machine/param.h6
-rw-r--r--arch/x86/machine/pmap.c20
-rw-r--r--arch/x86/machine/pmap.h18
-rw-r--r--arch/x86/machine/types.h6
-rw-r--r--arch/x86/x15.lds.S3
-rw-r--r--configure.ac47
-rw-r--r--kern/config.h21
-rw-r--r--kern/kernel.h13
20 files changed, 234 insertions, 221 deletions
diff --git a/.gitignore b/.gitignore
index 66ddd837..fb9eec62 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,14 +2,15 @@
*.a
.deps/
.dirstamp
-aclocal.m4
-autom4te.cache/
-build-aux/
-config.*
-configure
-tags
-stamp-h1
-x15.lds
-x15
Makefile
Makefile.in
+cscope.out
+tags
+x15.lds
+/aclocal.m4
+/autom4te.cache/
+/build-aux/
+/config.*
+/configure
+/stamp-h1
+/x15
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index d5dfaa72..00000000
--- a/AUTHORS
+++ /dev/null
@@ -1,2 +0,0 @@
-X15 is currently being written by Richard Braun. Comments and various
-tips and fixes have been provided by the Hurd community.
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index bc5a4fc7..00000000
--- a/ChangeLog
+++ /dev/null
@@ -1 +0,0 @@
-Use git log to examine the project history.
diff --git a/INSTALL b/INSTALL
index 97c7ae2f..f7158210 100644
--- a/INSTALL
+++ b/INSTALL
@@ -234,14 +234,17 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
X15 Options
-================
+===========
`--disable-debug'
- Disable all debugging facilities. By default, debugging is enabled.
+ Disable all debugging facilities. By default, debugging is enabled.
+
+`--with-max-cpus=MAX_CPUS'
+ Set the maximum number of supported processors.
x86 options
-------------
+-----------
`--with-i386'
Build for a 32-bit IA-32 machine.
diff --git a/Makefile.am b/Makefile.am
index 39a7f68a..fcd0cfb0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LIBRARIES =
+EXTRA_DIST =
MOSTLYCLEANFILES =
AM_CPPFLAGS = \
@@ -6,7 +6,7 @@ AM_CPPFLAGS = \
-std=gnu99 \
-imacros config.h \
-I$(top_srcdir) \
- -I$(top_srcdir)/arch/$(systype)
+ -I$(top_srcdir)/arch/$(arch)
AM_CFLAGS = \
-Wall \
@@ -17,7 +17,6 @@ AM_CFLAGS = \
-ffreestanding \
-fno-stack-protector
-# Silent build support.
LDS_V = $(LDS_V_$(V))
LDS_V_ = $(LDS_V_$(AM_DEFAULT_VERBOSITY))
LDS_V_0 = @echo " LDS $@";
@@ -29,12 +28,10 @@ SUFFIXES = .lds .lds.S
exec_bootdir = $(exec_prefix)/boot
exec_boot_PROGRAMS = x15
-x15_DEPENDENCIES = arch/$(systype)/x15.lds
-MOSTLYCLEANFILES += arch/$(systype)/x15.lds
+x15_DEPENDENCIES = arch/$(arch)/x15.lds
+MOSTLYCLEANFILES += arch/$(arch)/x15.lds
x15_SOURCES =
-nodist_x15_SOURCES =
-x15_LDFLAGS = -nostartfiles -nostdlib -T arch/$(systype)/x15.lds
+x15_LDFLAGS = -nostartfiles -nostdlib -T arch/$(arch)/x15.lds
x15_LDADD = -lgcc
-# Sources
include Makefrag.am
diff --git a/Makefrag.am b/Makefrag.am
index b0c1fed8..fe45ec36 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -1,52 +1,44 @@
-#
-# 'arch/xxx' sources
-#
include arch/x86/Makefrag.am
-#
-# 'kern/' sources
-#
-x15_SOURCES += \
- kern/init.h \
- kern/kernel.c \
- kern/kernel.h \
- kern/kmem.c \
- kern/kmem.h \
- kern/panic.c \
- kern/panic.h \
- kern/printk.c \
- kern/printk.h
+x15_SOURCES += \
+ kern/config.h \
+ kern/error.h \
+ kern/init.h \
+ kern/kernel.c \
+ kern/kernel.h \
+ kern/kmem.c \
+ kern/kmem.h \
+ kern/panic.c \
+ kern/panic.h \
+ kern/param.h \
+ kern/printk.c \
+ kern/printk.h \
+ kern/types.h
-#
-# 'lib/' sources
-#
-x15_SOURCES += \
- lib/assert.h \
- lib/limits.h \
- lib/list.h \
- lib/macros.h \
- lib/rbtree.c \
- lib/rbtree.h \
- lib/rbtree_i.h \
- lib/sprintf.c \
- lib/sprintf.h \
- lib/stddef.h \
- lib/stdint.h \
- lib/string.c \
+x15_SOURCES += \
+ lib/assert.h \
+ lib/limits.h \
+ lib/list.h \
+ lib/macros.h \
+ lib/rbtree.c \
+ lib/rbtree.h \
+ lib/rbtree_i.h \
+ lib/sprintf.c \
+ lib/sprintf.h \
+ lib/stddef.h \
+ lib/stdint.h \
+ lib/string.c \
lib/string.h
-#
-# 'vm/' sources
-#
-x15_SOURCES += \
- vm/vm_kmem.c \
- vm/vm_kmem.h \
- vm/vm_map.c \
- vm/vm_map.h \
- vm/vm_page.h \
- vm/vm_param.h \
- vm/vm_phys.c \
- vm/vm_phys.h \
- vm/vm_setup.c \
- vm/vm_setup.h \
- vm/vm_types.h
+x15_SOURCES += \
+ vm/vm_inherit.h \
+ vm/vm_kmem.c \
+ vm/vm_kmem.h \
+ vm/vm_map.c \
+ vm/vm_map.h \
+ vm/vm_page.h \
+ vm/vm_phys.c \
+ vm/vm_phys.h \
+ vm/vm_prot.h \
+ vm/vm_setup.c \
+ vm/vm_setup.h
diff --git a/NEWS b/NEWS
deleted file mode 100644
index 8a8947c3..00000000
--- a/NEWS
+++ /dev/null
@@ -1 +0,0 @@
-No version released.
diff --git a/README-alpha b/README-alpha
deleted file mode 100644
index f32e2ff1..00000000
--- a/README-alpha
+++ /dev/null
@@ -1,14 +0,0 @@
-X15 is unstable. You should expect it to not work. You should expect it to have
-security problems. The API will likely change. This is the development release.
-A proper release will be made in due time.
-
-Some of the files that are included in the X15 tarball, such as files generated
-by autotools, are not stored in the repository. Therefore, to build X15 you
-need to run "autoreconf" before of anything else:
-
- $ autoreconf -i
- $ ./configure
- ...
-
-This will generate all directories and files needed by the build system. For
-instructions about the build system, check the INSTALL file.
diff --git a/arch/x86/Makefrag.am b/arch/x86/Makefrag.am
index 929c1d33..e4acbbbe 100644
--- a/arch/x86/Makefrag.am
+++ b/arch/x86/Makefrag.am
@@ -1,3 +1,34 @@
+x86_FILES = \
+ arch/x86/machine/acpimp.c \
+ arch/x86/machine/acpimp.h \
+ arch/x86/machine/asm.h \
+ arch/x86/machine/biosmem.c \
+ arch/x86/machine/biosmem.h \
+ arch/x86/machine/boot_asm.S \
+ arch/x86/machine/boot.c \
+ arch/x86/machine/boot.h \
+ arch/x86/machine/config.h \
+ arch/x86/machine/cpu_asm.S \
+ arch/x86/machine/cpu.c \
+ arch/x86/machine/cpu.h \
+ arch/x86/machine/io.h \
+ arch/x86/machine/lapic.c \
+ arch/x86/machine/lapic.h \
+ arch/x86/machine/mps.c \
+ arch/x86/machine/mps.h \
+ arch/x86/machine/multiboot.h \
+ arch/x86/machine/param.h \
+ arch/x86/machine/pit.c \
+ arch/x86/machine/pit.h \
+ arch/x86/machine/pmap.c \
+ arch/x86/machine/pmap.h \
+ arch/x86/machine/trap.h \
+ arch/x86/machine/types.h \
+ arch/x86/machine/vga.c \
+ arch/x86/machine/vga.h
+
+EXTRA_DIST += arch/x86/x15.lds.S $(x86_FILES)
+
if X86
x15_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
@@ -13,30 +44,6 @@ AM_CFLAGS += -mcmodel=kernel -mno-red-zone
x15_LDFLAGS += -m64
endif AMD64
-x15_SOURCES += \
- arch/x86/machine/acpimp.c \
- arch/x86/machine/acpimp.h \
- arch/x86/machine/biosmem.c \
- arch/x86/machine/biosmem.h \
- arch/x86/machine/boot.c \
- arch/x86/machine/boot_asm.S \
- arch/x86/machine/boot.h \
- arch/x86/machine/cpu.c \
- arch/x86/machine/cpu_asm.S \
- arch/x86/machine/cpu.h \
- arch/x86/machine/endian.h \
- arch/x86/machine/io.h \
- arch/x86/machine/lapic.c \
- arch/x86/machine/lapic.h \
- arch/x86/machine/mps.c \
- arch/x86/machine/mps.h \
- arch/x86/machine/multiboot.h \
- arch/x86/machine/param.h \
- arch/x86/machine/pit.c \
- arch/x86/machine/pit.h \
- arch/x86/machine/pmap.c \
- arch/x86/machine/pmap.h \
- arch/x86/machine/vga.c \
- arch/x86/machine/vga.h
+x15_SOURCES += $(x86_FILES)
endif X86
diff --git a/arch/x86/configfrag.ac b/arch/x86/configfrag.ac
index fd4edf1e..af731bff 100644
--- a/arch/x86/configfrag.ac
+++ b/arch/x86/configfrag.ac
@@ -1,46 +1,50 @@
-systype=x86
-
-#
-# Arguments to configure
-#
-AC_ARG_WITH([i386],
- [AS_HELP_STRING([--with-i386],
- [build for a 32-bit IA-32 machine])],
- [opt_i386=$withval],
- [opt_i386=no])
-
-AC_ARG_WITH([amd64],
- [AS_HELP_STRING([--with-amd64],
- [build for a 64-bit AMD64 machine])],
- [opt_amd64=$withval],
- [opt_amd64=no])
-
-AC_ARG_ENABLE([pae],
- [AS_HELP_STRING([--enable-pae],
- [enable physical address extension (i386 only)])])
-
-#
-# Options
-#
-m4_define([i386_ENABLE_PAE],
- [AC_DEFINE([PAE], [1], [use PAE page tables])
+m4_define([x86_ENABLE_PAE],
+ [AC_DEFINE([X86_PAE], [1], [use PAE page translation])
AC_MSG_NOTICE([physical address extension enabled])])
m4_define([x86_SELECT_I386],
- [AC_MSG_NOTICE([build type: i386])
- AS_IF([test x"$enable_pae" = xyes], [i386_ENABLE_PAE])])
+ [machine=i386
+ AS_IF([test x"$enable_pae" = xyes], [x86_ENABLE_PAE])])
m4_define([x86_SELECT_AMD64],
- [AC_MSG_NOTICE([build type: amd64])
+ [machine=amd64
AS_IF([test x"$enable_pae" = xyes],
[AC_MSG_WARN([pae option available for i386 only, ignoring])])])
-AS_IF([test x"$opt_i386$opt_amd64" = xyesyes],
- [AC_MSG_ERROR([select only one of i386 or amd64])],
- [test x"$opt_i386$opt_amd64" = xnono],
- [AS_CASE(["$host_cpu"],
- [i?86], [opt_i386=yes],
- [x86_64], [opt_amd64=yes])])
-
-AS_IF([test x"$opt_i386" = xyes], [x86_SELECT_I386],
- [test x"$opt_amd64" = xyes], [x86_SELECT_AMD64])
+m4_define([x86_SELECT],
+ [arch=x86
+ AC_ARG_WITH([i386],
+ [AS_HELP_STRING([--with-i386],
+ [build for a 32-bit IA-32 machine])],
+ [opt_i386=$withval],
+ [opt_i386=no])
+
+ AC_ARG_WITH([amd64],
+ [AS_HELP_STRING([--with-amd64],
+ [build for a 64-bit AMD64 machine])],
+ [opt_amd64=$withval],
+ [opt_amd64=no])
+
+ AC_ARG_ENABLE([pae],
+ [AS_HELP_STRING([--enable-pae],
+ [enable physical address extension (i386 only)])])
+
+ AS_IF([test x"$opt_i386$opt_amd64" = xyesyes],
+ [AC_MSG_ERROR([select only one of i386 or amd64])],
+ [test x"$opt_i386$opt_amd64" = xnono],
+ [AS_CASE(["$host_cpu"],
+ [i?86], [opt_i386=yes],
+ [x86_64], [opt_amd64=yes])])
+
+ AS_IF([test x"$opt_i386" = xyes], [x86_SELECT_I386],
+ [test x"$opt_amd64" = xyes], [x86_SELECT_AMD64])
+
+ AC_DEFINE_UNQUOTED([X86_MACHINE], [$machine], [machine])
+ AC_MSG_NOTICE([machine type: $arch ($machine)])])
+
+AS_CASE(["$host_cpu"],
+ [i?86|x86_64], [x86_SELECT])
+
+AM_CONDITIONAL([X86], [test "$arch" = x86])
+AM_CONDITIONAL([I386], [test x"$opt_i386" = xyes])
+AM_CONDITIONAL([AMD64], [test x"$opt_amd64" = xyes])
diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c
index 27b07b29..de0700a1 100644
--- a/arch/x86/machine/boot.c
+++ b/arch/x86/machine/boot.c
@@ -47,6 +47,7 @@
#include <kern/kernel.h>
#include <kern/panic.h>
#include <kern/param.h>
+#include <kern/printk.h>
#include <lib/stddef.h>
#include <lib/stdint.h>
#include <lib/string.h>
@@ -135,6 +136,16 @@ boot_setup_paging(const struct multiboot_raw_info *mbi, unsigned long eax)
return pmap_setup_paging();
}
+static void __init
+boot_show_version(void)
+{
+ printk(KERNEL_NAME "/" QUOTE(X86_MACHINE) " " KERNEL_VERSION
+#ifdef X86_PAE
+ " PAE"
+#endif /* X86_PAE */
+ "\n");
+}
+
static void * __init
boot_save_memory(uint32_t addr, size_t size)
{
@@ -255,7 +266,7 @@ boot_main(void)
cpu_setup();
pmap_bootstrap();
vga_setup();
- kernel_show_banner();
+ boot_show_version();
cpu_check(cpu_current());
cpu_info(cpu_current());
biosmem_setup();
diff --git a/arch/x86/machine/config.h b/arch/x86/machine/config.h
new file mode 100644
index 00000000..4dd788ee
--- /dev/null
+++ b/arch/x86/machine/config.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2012 Richard Braun.
+ *
+ * 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/>.
+ *
+ *
+ * Architecture specific additions to the build system config.h header.
+ */
+
+/*
+ * Avoid obscure bugs due to this historical built-in macro.
+ */
+#ifdef i386
+#undef i386
+#endif
diff --git a/arch/x86/machine/param.h b/arch/x86/machine/param.h
index 814e71b8..e7241fd6 100644
--- a/arch/x86/machine/param.h
+++ b/arch/x86/machine/param.h
@@ -94,14 +94,14 @@
#define VM_PHYS_NORMAL_LIMIT DECL_CONST(0x100000000, UL)
#define VM_PHYS_HIGHMEM_LIMIT DECL_CONST(0x10000000000000, UL)
#else /* __LP64__ */
-#ifdef PAE
+#ifdef X86_PAE
#define VM_MAX_PHYS_SEG 2
#define VM_PHYS_NORMAL_LIMIT DECL_CONST(0x100000000, ULL)
#define VM_PHYS_HIGHMEM_LIMIT DECL_CONST(0x10000000000000, ULL)
-#else /* PAE */
+#else /* X86_PAE */
#define VM_MAX_PHYS_SEG 1
#define VM_PHYS_NORMAL_LIMIT DECL_CONST(0xfffff000, UL)
-#endif /* PAE */
+#endif /* X86_PAE */
#endif /* __LP64__ */
/*
diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c
index dafa6b70..8365b8a8 100644
--- a/arch/x86/machine/pmap.c
+++ b/arch/x86/machine/pmap.c
@@ -77,13 +77,13 @@ struct pmap *kernel_pmap = &kernel_pmap_store;
unsigned long pmap_klimit;
-#ifdef PAE
+#ifdef X86_PAE
/*
* "Hidden" root page table for PAE mode.
*/
static pmap_pte_t pmap_boot_pdpt[PMAP_NR_RPTPS] __aligned(32) __initdata;
static pmap_pte_t pmap_pdpt[PMAP_NR_RPTPS] __aligned(32);
-#endif /* PAE */
+#endif /* X86_PAE */
/*
* Physical address of the page table root, used during bootstrap.
@@ -239,16 +239,16 @@ pmap_setup_paging(void)
pmap_setup_recursive_mapping(root_pt);
-#ifdef PAE
+#ifdef X86_PAE
for (i = 0; i < PMAP_NR_RPTPS; i++)
pmap_boot_pdpt[i] = ((unsigned long)root_pt + (i * PAGE_SIZE))
| PMAP_PTE_P;
pmap_boot_root_pt = pmap_boot_pdpt;
cpu_enable_pae();
-#else /* PAE */
+#else /* X86_PAE */
pmap_boot_root_pt = root_pt;
-#endif /* PAE */
+#endif /* X86_PAE */
return pmap_boot_root_pt;
}
@@ -256,9 +256,9 @@ pmap_setup_paging(void)
pmap_pte_t * __init
pmap_ap_setup_paging(void)
{
-#ifdef PAE
+#ifdef X86_PAE
cpu_enable_pae();
-#endif /* PAE */
+#endif /* X86_PAE */
return pmap_boot_root_pt;
}
@@ -308,14 +308,14 @@ pmap_bootstrap(void)
{
memcpy(pmap_pt_levels, pmap_boot_pt_levels, sizeof(pmap_pt_levels));
-#ifdef PAE
+#ifdef X86_PAE
memcpy(pmap_pdpt, pmap_boot_pdpt, sizeof(pmap_pdpt));
pmap_boot_root_pt = (void *)BOOT_VTOP((unsigned long)pmap_pdpt);
kernel_pmap->root_pt = (unsigned long)pmap_boot_root_pt;
cpu_set_cr3(kernel_pmap->root_pt);
-#else /* PAE */
+#else /* X86_PAE */
kernel_pmap->root_pt = (unsigned long)pmap_boot_root_pt;
-#endif /* PAE */
+#endif /* X86_PAE */
pmap_prot_table[VM_PROT_NONE] = 0;
pmap_prot_table[VM_PROT_READ] = 0;
diff --git a/arch/x86/machine/pmap.h b/arch/x86/machine/pmap.h
index fcd8b617..b42a0ec2 100644
--- a/arch/x86/machine/pmap.h
+++ b/arch/x86/machine/pmap.h
@@ -58,21 +58,21 @@
#define PMAP_L3_MASK PMAP_L2_MASK
#define PMAP_L4_MASK PMAP_L2_MASK
#else /* __LP64__ */
-#ifdef PAE
+#ifdef X86_PAE
#define PMAP_NR_RPTPS 4 /* Assume two levels with a 4-page root table */
#define PMAP_NR_LEVELS 2
#define PMAP_L1_BITS 9
#define PMAP_L2_BITS 11
#define PMAP_VA_MASK DECL_CONST(0xffffffff, UL)
#define PMAP_PA_MASK DECL_CONST(0x000ffffffffff000, ULL)
-#else /* PAE */
+#else /* X86_PAE */
#define PMAP_NR_RPTPS 1
#define PMAP_NR_LEVELS 2
#define PMAP_L1_BITS 10
#define PMAP_L2_BITS 10
#define PMAP_VA_MASK DECL_CONST(0xffffffff, UL)
#define PMAP_PA_MASK DECL_CONST(0xfffff000, UL)
-#endif /* PAE */
+#endif /* X86_PAE */
#endif /* __LP64__ */
#define PMAP_L1_SHIFT 12
@@ -91,11 +91,11 @@
#ifdef __LP64__
#define PMAP_PTEMAP_SIZE DECL_CONST(0x8000000000, UL)
#else /* __LP64__ */
-#ifdef PAE
+#ifdef X86_PAE
#define PMAP_PTEMAP_SIZE DECL_CONST(0x800000, UL)
-#else /* PAE */
+#else /* X86_PAE */
#define PMAP_PTEMAP_SIZE DECL_CONST(0x400000, UL)
-#endif /* PAE */
+#endif /* X86_PAE */
#endif /* __LP64__ */
#ifndef __ASSEMBLY__
@@ -103,11 +103,11 @@
#include <kern/types.h>
#include <lib/stdint.h>
-#ifdef PAE
+#ifdef X86_PAE
typedef uint64_t pmap_pte_t;
-#else /* PAE */
+#else /* X86_PAE */
typedef unsigned long pmap_pte_t;
-#endif /* PAE */
+#endif /* X86_PAE */
/*
* Physical address map.
diff --git a/arch/x86/machine/types.h b/arch/x86/machine/types.h
index 03c9723b..91e31095 100644
--- a/arch/x86/machine/types.h
+++ b/arch/x86/machine/types.h
@@ -18,10 +18,10 @@
#ifndef _X86_TYPES_H
#define _X86_TYPES_H
-#ifdef PAE
+#ifdef X86_PAE
typedef unsigned long long phys_addr_t;
-#else /* PAE */
+#else /* X86_PAE */
typedef unsigned long phys_addr_t;
-#endif /* PAE */
+#endif /* X86_PAE */
#endif /* _X86_TYPES_H */
diff --git a/arch/x86/x15.lds.S b/arch/x86/x15.lds.S
index 39d5cf7a..26fe4931 100644
--- a/arch/x86/x15.lds.S
+++ b/arch/x86/x15.lds.S
@@ -1,6 +1,3 @@
-/* Don't replace i386 */
-#undef i386
-
#ifdef __LP64__
OUTPUT_FORMAT("elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
diff --git a/configure.ac b/configure.ac
index 33109df9..7982258c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,25 +1,25 @@
AC_INIT([X15], [0.1], [rbraun@sceen.net], [x15])
-AC_CONFIG_SRCDIR([kern/printk.c])
+AC_CONFIG_SRCDIR([kern/config.h])
AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([gnu check-news subdir-objects 1.10])
+AM_INIT_AUTOMAKE([foreign subdir-objects 1.10])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
AC_PREFIX_DEFAULT([])
AC_CANONICAL_HOST
-AM_PROG_AS
-AC_PROG_CC([gcc])
AC_PROG_CPP
-AC_PROG_RANLIB
+AC_PROG_CC
+AM_PROG_AS
AM_PROG_CC_C_O
+m4_include([arch/x86/configfrag.ac])
+
+AS_IF([test x"$arch" = x], [AC_MSG_ERROR([unsupported architecture])])
+AC_SUBST([arch])
-#
-# Arguments to configure
-#
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--disable-debug],
[disable the debugging facilities])])
@@ -30,37 +30,14 @@ AC_ARG_WITH([max-cpus],
[opt_max_cpus=$withval],
[opt_max_cpus=32])
-
-#
-# Deduce the output variable `systype' from the configuration parameters.
-#
-AS_CASE(["$host_cpu"],
- [i?86|x86_64], [m4_include([arch/x86/configfrag.ac])],
- [AC_MSG_ERROR([unsuported CPU type])])
-
-AC_SUBST([systype])
-
-# XXX Should be in an arch-specific file.
-AM_CONDITIONAL([X86], [test "$systype" = x86])
-AM_CONDITIONAL([I386], [test x"$opt_i386" = xyes])
-AM_CONDITIONAL([AMD64], [test x"$opt_amd64" = xyes])
-
-
-#
-# Options
-#
-AS_IF([test x"$enable_debug" = xno],
- [AC_DEFINE([NDEBUG], [1], [general debugging])])
-
AC_DEFINE([__KERNEL__], [1], [kernel code])
-AC_DEFINE_UNQUOTED([ARCH], [$systype], [arch])
+AC_DEFINE_UNQUOTED([ARCH], [$arch], [arch])
+AS_IF([test x"$enable_debug" = xno],
+ [AC_DEFINE([NDEBUG], [1], [disable debugging])])
AC_DEFINE_UNQUOTED([MAX_CPUS], [$opt_max_cpus],
[maximum number of supported processors])
-
-#
-# Output
-#
+AH_BOTTOM([#include <kern/config.h>])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/kern/config.h b/kern/config.h
new file mode 100644
index 00000000..e91b6e14
--- /dev/null
+++ b/kern/config.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2012 Richard Braun.
+ *
+ * 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/>.
+ *
+ *
+ * Additions to the build system config.h header.
+ */
+
+#include <machine/config.h>
diff --git a/kern/kernel.h b/kern/kernel.h
index f4f99d30..2505541d 100644
--- a/kern/kernel.h
+++ b/kern/kernel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Richard Braun.
+ * Copyright (c) 2010, 2012 Richard Braun.
*
* 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
@@ -18,20 +18,15 @@
#ifndef _KERN_KERNEL_H
#define _KERN_KERNEL_H
-#include <kern/printk.h>
-
/*
* Kernel properties.
*/
#define KERNEL_NAME PACKAGE_NAME
#define KERNEL_VERSION PACKAGE_VERSION
-static inline void
-kernel_show_banner(void)
-{
- printk(KERNEL_NAME " " KERNEL_VERSION "\n");
-}
-
+/*
+ * Machine-independent entry point.
+ */
void kernel_main(void);
#endif /* _KERN_KERNEL_H */