grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] Add a new "none" platform that only builds utilities
Date: Sun, 21 Sep 2014 17:58:36 +0200	[thread overview]
Message-ID: <541EF5AC.7090905@gmail.com> (raw)
In-Reply-To: <20140908012205.GE5681@riva.ucam.org>

[-- Attachment #1: Type: text/plain, Size: 8977 bytes --]

Go ahead.
On 08.09.2014 03:22, Colin Watson wrote:
> This makes it possible to build generally-useful utilities such as
> grub-mount even if the rest of GRUB has not been ported to the target
> CPU.
> 
> * configure.ac: Add "none" platform.  Default to it for unsupported
> CPUs rather than stopping with a fatal error.  Don't downgrade
> x86_64-none to i386.  Define COND_real_platform Automake conditional
> if the platform is anything other than "none".  Don't do any include
> directory linking for "none".
> * Makefile.am: Skip building grub-core and all bootcheck targets if
> !COND_real_platform.
> * include/grub/time.h: Don't include <grub/cpu/time.h> if GRUB_UTIL
> is defined.
> ---
>  ChangeLog           | 14 ++++++++++++++
>  Makefile.am         | 14 +++++++++++---
>  configure.ac        | 46 +++++++++++++++++++++++++++++-----------------
>  include/grub/time.h |  2 +-
>  4 files changed, 55 insertions(+), 21 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 572ee50..8d86b3f 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,17 @@
> +2014-09-08  Colin Watson  <cjwatson@ubuntu.com>
> +
> +	Add a new "none" platform that only builds utilities
> +
> +	* configure.ac: Add "none" platform.  Default to it for unsupported
> +	CPUs rather than stopping with a fatal error.  Don't downgrade
> +	x86_64-none to i386.  Define COND_real_platform Automake conditional
> +	if the platform is anything other than "none".  Don't do any include
> +	directory linking for "none".
> +	* Makefile.am: Skip building grub-core and all bootcheck targets if
> +	!COND_real_platform.
> +	* include/grub/time.h: Don't include <grub/cpu/time.h> if GRUB_UTIL
> +	is defined.
> +
>  2014-09-07  Colin Watson  <cjwatson@ubuntu.com>
>  
>  	Support grub-emu on x32 (ILP32 but with x86-64 instruction set)
> diff --git a/Makefile.am b/Makefile.am
> index f02ae0a..cc537a2 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1,7 +1,11 @@
>  AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
>  
>  DEPDIR = .deps-util
> -SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d
> +SUBDIRS = grub-core/gnulib .
> +if COND_real_platform
> +SUBDIRS += grub-core
> +endif
> +SUBDIRS += po docs util/bash-completion.d
>  
>  include $(top_srcdir)/conf/Makefile.common
>  include $(top_srcdir)/conf/Makefile.extra-dist
> @@ -132,6 +136,8 @@ nodist_platform_HEADERS = config.h
>  pkgdata_DATA += grub-mkconfig_lib
>  
>  
> +if COND_real_platform
> +
>  if COND_i386_coreboot
>  QEMU32=qemu-system-i386
>  endif
> @@ -383,8 +389,6 @@ if COND_powerpc_ieee1275
>  BOOTCHECKS = bootcheck-linux-ppc
>  endif
>  
> -EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S
> -
>  .PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \
>         bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \
>         bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \
> @@ -402,6 +406,10 @@ default_payload.elf: grub-mkstandalone grub-mkimage
>  	pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
>  endif
>  
> +endif
> +
> +EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S
> +
>  windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
>  windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
>  	test -d $(windowsdir) && rm -rf $(windowsdir) || true
> diff --git a/configure.ac b/configure.ac
> index 8662bac..fdf0fdc 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -125,7 +125,10 @@ if test "x$with_platform" = x; then
>      ia64-*) platform=efi ;;
>      arm-*) platform=uboot ;;
>      arm64-*) platform=efi ;;
> -    *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
> +    *)
> +      AC_MSG_WARN([unsupported CPU: "$target_cpu" - only building utilities])
> +      platform=none
> +      ;;
>    esac
>  else
>    platform="$with_platform"
> @@ -135,6 +138,7 @@ case "$target_cpu"-"$platform" in
>    x86_64-efi) ;;
>    x86_64-emu) ;;
>    x86_64-xen) ;;
> +  x86_64-none) ;;
>    x86_64-*) target_cpu=i386 ;;
>    powerpc64-ieee1275) target_cpu=powerpc ;;
>  esac
> @@ -167,6 +171,7 @@ case "$target_cpu"-"$platform" in
>    arm-efi) ;;
>    arm64-efi) ;;
>    *-emu) ;;
> +  *-none) ;;
>    *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
>  esac
>  
> @@ -1653,6 +1658,7 @@ AC_SUBST(BUILD_LIBM)
>  # Automake conditionals
>  #
>  
> +AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone])
>  AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
>  AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes])
>  AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
> @@ -1726,24 +1732,30 @@ AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
>  
>  
>  # Output files.
> -cpudir="${target_cpu}"
> -if test x${cpudir} = xmipsel; then
> -  cpudir=mips;
> -fi
> -grub_CHECK_LINK_DIR
> -if test x"$link_dir" = xyes ; then
> -  AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
> -  if test "$platform" != emu ; then
> -    AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
> +if test "$platform" != none; then
> +  cpudir="${target_cpu}"
> +  if test x${cpudir} = xmipsel; then
> +    cpudir=mips;
>    fi
> -else
> -  mkdir -p include/grub 2>/dev/null
> -  rm -rf include/grub/cpu
> -  cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
> -  if test "$platform" != emu ; then
> -    rm -rf include/grub/machine
> -    cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
> +  grub_CHECK_LINK_DIR
> +  if test x"$link_dir" = xyes ; then
> +    AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
> +    if test "$platform" != emu ; then
> +      AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
> +    fi
> +  else
> +    mkdir -p include/grub 2>/dev/null
> +    rm -rf include/grub/cpu
> +    cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
> +    if test "$platform" != emu ; then
> +      rm -rf include/grub/machine
> +      cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
> +    fi
>    fi
> +else
> +  # Just enough to stop the compiler failing with -I$(srcdir)/include.
> +  mkdir -p include 2>/dev/null
> +  rm -rf include/grub
>  fi
>  
>  AC_CONFIG_FILES([Makefile])
> diff --git a/include/grub/time.h b/include/grub/time.h
> index 64ac99a..c919c1f 100644
> --- a/include/grub/time.h
> +++ b/include/grub/time.h
> @@ -21,7 +21,7 @@
>  
>  #include <grub/types.h>
>  #include <grub/symbol.h>
> -#ifndef GRUB_MACHINE_EMU
> +#if !defined(GRUB_MACHINE_EMU) && !defined(GRUB_UTIL)
>  #include <grub/cpu/time.h>
>  #else
>  static inline void
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

  reply	other threads:[~2014-09-21 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08  1:22 [PATCH] Add a new "none" platform that only builds utilities Colin Watson
2014-09-21 15:58 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2014-09-23 11:07   ` Colin Watson
2014-09-25 18:39     ` Andrei Borzenkov
2014-09-25 20:00       ` Colin Watson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=541EF5AC.7090905@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).