Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jZRJj-0005Do-LY for mharc-grub-devel@gnu.org; Thu, 14 May 2020 23:47:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZRJh-00058E-8z for grub-devel@gnu.org; Thu, 14 May 2020 23:47:21 -0400 Received: from mailout02.mx.bawue.net ([193.7.176.63]:52938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZRJg-0000X1-AJ for grub-devel@gnu.org; Thu, 14 May 2020 23:47:20 -0400 Received: from infty.fritz.box (p5b17584c.dip0.t-ipconnect.de [91.23.88.76]) (Authenticated sender: pdim@bawue.de) by smtp.bawue.net (Postfix) with ESMTPSA id 1B30D2266E; Fri, 15 May 2020 05:47:13 +0200 (CEST) From: Hans Ulrich Niedermann To: grub-devel@gnu.org Cc: 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 Message-Id: <20200515034349.133092-14-hun@n-dimensional.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200515034349.133092-1-hun@n-dimensional.de> References: <20200515034349.133092-1-hun@n-dimensional.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanner: SAV Dynamic Interface 2.6.0, Engine: 3.77.1, SAV: 5.75 (A93B943C) on relay01.mx.bawue.net using milter-sssp 0.1.0 X-Virus-Scan: Found to be clean. Received-SPF: pass client-ip=193.7.176.63; envelope-from=hun@n-dimensional.de; helo=mailout02.mx.bawue.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/14 23:46:06 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2020 03:47:21 -0000 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 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