[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MULTIBOOT2 SPEC PATCH v4 13/27] multiboot2: Build arch specific boot co
From: |
Hans Ulrich Niedermann |
Subject: |
[MULTIBOOT2 SPEC PATCH v4 13/27] multiboot2: Build arch specific boot code |
Date: |
Fri, 15 May 2020 05:43:36 +0200 |
Choose the arch specific bootcode for i386 or mips, depending
on what --host is being built for.
Before this, boot_i386.S and boot_mips.S were both in the docs,
but boot_mips.S was the boot code always built regardless of the
actual system being built for.
If the --host system is neither i386 (or x86_64 which is switched
into 32bit mode) or mips, the example kernel build will be skipped.
The mips definitions for kernel_ccasflags and kernel_cflags are
completely untested.
Signed-off-by: Hans Ulrich Niedermann <address@hidden>
diff --git a/.gitignore b/.gitignore
index 631ff668d..e27a3e0e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,9 @@ Makefile.in
/aclocal.m4
/autom4te.cache/
/compile
+/config.guess
/config.h.in
+/config.sub
/configure
/depcomp
/doc/mdate-sh
diff --git a/configure.ac b/configure.ac
index d8e08597d..830b1f57e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,13 +25,37 @@ AM_INIT_AUTOMAKE([1.10.1])
AC_PROG_CC
AM_PROG_AS
-dnl Build the example Multiboot2 kernel.
+dnl Build the example Multiboot2 kernel (if possible on this host)
+AC_CANONICAL_HOST
+kernel_boot_arch=unsupported
+kernel_ccasflags=
+kernel_cflags=
+case "$host_cpu" in #(
+ i[[3456]]86)
+ kernel_boot_arch=i386
+ ;; #(
+ x86_64)
+ kernel_boot_arch=i386
+ kernel_ccasflags="-m32"
+ kernel_cflags="-m32"
+ ;; #(
+ mips*)
+ kernel_boot_arch=mips
+ kernel_ccasflags="-mabi=32"
+ kernel_cflags="-mabi=32"
+ ;;
+esac
+AC_SUBST([kernel_boot_arch])
+AC_SUBST([kernel_ccasflags])
+AC_SUBST([kernel_cflags])
+
AC_ARG_ENABLE([example-kernel], [dnl
AS_HELP_STRING([--enable-example-kernel],
[build the example Multiboot2 kernel])])
AM_CONDITIONAL([BUILD_EXAMPLE_KERNEL],
- [test "x$enable_example_kernel" = xyes])
+ [test "x$enable_example_kernel" = xyes &&
+ test "x$kernel_boot_arch" != "xunsupported"])
CFLAGS="-nostdlib $CFLAGS"
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 08fdbf342..b19fc24bf 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -9,8 +9,9 @@ pkginclude_HEADERS = multiboot2.h
# The example kernel is built if you specify --enable-example-kernel.
if BUILD_EXAMPLE_KERNEL
noinst_PROGRAMS = kernel
-kernel_SOURCES = boot_mips.S kernel.c multiboot2.h
-kernel_CFLAGS = -fno-builtin -nostdinc -O -g -Wall \
+kernel_SOURCES = boot_$(kernel_boot_arch).S kernel.c multiboot2.h
+kernel_CCASFLAGS = $(kernel_ccasflags)
+kernel_CFLAGS = $(kernel_cflags) -fno-builtin -nostdinc -O -g -Wall \
-imacros $(top_builddir)/config.h
kernel_LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,80100000 -Wl,--build-id=none
endif
--
2.26.2
- [MULTIBOOT2 SPEC PATCH v4 03/27] multiboot2: Use m4 quoting and AS_HELP_STRING, (continued)
- [MULTIBOOT2 SPEC PATCH v4 03/27] multiboot2: Use m4 quoting and AS_HELP_STRING, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 04/27] multiboot2: Remove obsolete compat code for ancient Autoconf, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 05/27] multiboot2: Remove CCAS workarounds for pre-2005 Automake, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 06/27] multiboot2: Remove unnecessary definition of CC, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 07/27] multiboot2: Automake generates dependencies automatically, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 08/27] multiboot2: Automake cleans built programs automatically, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 09/27] multiboot2: Use the constants by their proper names, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 10/27] multiboot2: Rename boot.S to boot_i386.S, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 11/27] multiboot2: Add boot_i386.S to shipped files, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 12/27] multiboot2: Add boot_mips.S example code to docs, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 13/27] multiboot2: Build arch specific boot code,
Hans Ulrich Niedermann <=
- [MULTIBOOT2 SPEC PATCH v4 14/27] multiboot2: Fix example kernel header tag alignment, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 15/27] multiboot2: Remove unreferenced AOUT_KLUDGE, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 16/27] multiboot2: Change "Multiboot" in comments to "Multiboot2", Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 17/27] multiboot2: Clean up stack (cdecl calling conventions), Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 18/27] multiboot2: Use predefined #ifdef __ASSEMBLER__, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 19/27] multiboot2: Set -nostdlib before AC_PROG_CC for x-compile, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 20/27] multiboot2: mips build wants __start symbol, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 21/27] multiboot2: "make distcheck" with example kernel enabled, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 22/27] multiboot2: Always define the kernel_* vars, Hans Ulrich Niedermann, 2020/05/14
- [MULTIBOOT2 SPEC PATCH v4 23/27] multiboot2: Generate per object file listings, Hans Ulrich Niedermann, 2020/05/14