Add a new "none" platform that only builds utilities
PATCH 1/1 Add a new "none" platform that only builds utilities
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(-)
ChangeLog +14 -0
@@ -1,3 +1,17 @@ +2014-09-08 Colin Watson <[email protected]> + + 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 <[email protected]> Support grub-emu on x32 (ILP32 but with x86-64 instruction set)
Makefile.am +11 -3
@@ -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
configure.ac +29 -17
78 lines not on this page · raw message
include/grub/time.h +1 -1
@@ -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
Signature · 1 line
1.9.1
Go ahead.
Quoted 189 lines · Colin Watson
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_platformAutomake 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> ifGRUB_UTILis defined.--- ChangeLog | 14 ++++++++++++++ Makefile.am | 14 +++++++++++--- configure.ac | 46 +++++++++++++++++++++++++++++----------------- include/grub/time.h | 2 +- 4 files changed, 55 insertions(+), 21 deletions(-)ChangeLog +14
-0@@ -1,3 +1,17 @@ +2014-09-08 Colin Watson <[email protected]> + + 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 <[email protected]> Support grub-emu on x32 (ILP32 but with x86-64 instruction set)Makefile.am +11
-3@@ -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) || trueconfigure.ac +29
-17@@ -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])include/grub/time.h +1
-1@@ -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
Colin Watson
AppliedQuoted 1 line · Vladimir 'φ-coder/phcoder' Serbinenko
Go ahead.
Pushed to master, thanks.
Signature · 1 line
Colin Watson [[email protected]]
В Tue, 23 Sep 2014 12:07:31 +0100
Colin Watson <[email protected]> пишет:
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 1 line
Go ahead.
Pushed to master, thanks.
Fails to compile.
bor@opensuse:~/build/grub> ./configure --with-platform=none
...
*******************************************************
GRUB2 will be compiled with following components:
Platform: x86_64-none
With devmapper support: Yes
With memory debugging: No
With disk cache statistics: No
With boot time statistics: No
efiemu runtime: No (only available on i386)
grub-mkfont: Yes
grub-mount: Yes
starfield theme: Yes
With DejaVuSans font from /usr/share/fonts/truetype/DejaVuSans.ttf With libzfs support: No (need zfs library)
Build-time grub-mkfont: Yes
With unifont from /usr/share/fonts/uni/unifont.pcf.gz With liblzma from -llzma (support for XZ-compressed mips images)
*******************************************************
bor@opensuse:~/build/grub> LC_ALL=C LANG=C make
gcc -E -DHAVE_CONFIG_H -I. -Wall -W -I./include -DGRUB_UTIL=1 -DGRUB_FILE=\"grub_script.tab.h\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/minilzo -I./grub-core/lib/xzembed -DMINILZO_HAVE_CONFIG_H -Wall -W -I./include -DGRUB_UTIL=1 -DGRUB_FILE=\"grub_script.tab.h\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib -I./grub-core/gnulib \
-D'GRUB_MOD_INIT(x)=@MARKER@x@' grub_script.tab.h grub_script.yy.h grub-core/commands/blocklist.c grub-core/commands/macbless.c grub-core/commands/xnu_uuid.c grub-core/commands/testload.c grub-core/commands/ls.c grub-core/disk/dmraid_nvidia.c grub-core/disk/loopback.c grub-core/disk/lvm.c grub-core/disk/mdraid_linux.c grub-core/disk/mdraid_linux_be.c grub-core/disk/mdraid1x_linux.c grub-core/disk/raid5_recover.c grub-core/disk/raid6_recover.c grub-core/font/font.c grub-core/gfxmenu/font.c grub-core/normal/charset.c grub-core/video/fb/fbblit.c grub-core/video/fb/fbutil.c grub-core/video/fb/fbfill.c grub-core/video/fb/video_fb.c grub-core/video/video.c grub-core/video/capture.c grub-core/video/colors.c grub-core/unidata.c grub-core/io/bufio.c grub-core/fs/affs.c grub-core/fs/afs.c grub-core/fs/bfs.c grub-core/fs/btrfs.c grub-core/fs/cbfs.c grub-core/fs/archelp.c grub-core/fs/cpio.c grub-core/fs/cpio_be.c grub-core/fs/odc.c grub-core/fs/newc.c grub-core/fs/ext2.c grub-core/fs/fat.c grub-core/fs/exfat.c grub-core/fs/fshelp.c grub-core/fs/hfs.c grub-core/fs/hfsplus.c grub-core/fs/hfspluscomp.c grub-core/fs/iso9660.c grub-core/fs/jfs.c grub-core/fs/minix.c grub-core/fs/minix2.c grub-core/fs/minix3.c grub-core/fs/minix_be.c grub-core/fs/minix2_be.c grub-core/fs/minix3_be.c grub-core/fs/nilfs2.c grub-core/fs/ntfs.c grub-core/fs/ntfscomp.c grub-core/fs/reiserfs.c grub-core/fs/romfs.c grub-core/fs/sfs.c grub-core/fs/squash4.c grub-core/fs/tar.c grub-core/fs/udf.c grub-core/fs/ufs2.c grub-core/fs/ufs.c grub-core/fs/ufs_be.c grub-core/fs/xfs.c grub-core/fs/zfs/zfscrypt.c grub-core/fs/zfs/zfs.c grub-core/fs/zfs/zfsinfo.c grub-core/fs/zfs/zfs_lzjb.c grub-core/fs/zfs/zfs_lz4.c grub-core/fs/zfs/zfs_sha256.c grub-core/fs/zfs/zfs_fletcher.c grub-core/lib/envblk.c grub-core/lib/hexdump.c grub-core/lib/LzFind.c grub-core/lib/LzmaEnc.c grub-core/lib/crc.c grub-core/lib/adler32.c grub-core/lib/crc64.c grub-core/normal/datetime.c grub-core/normal/misc.c grub-core/partmap/acorn.c grub-core/partmap/amiga.c grub-core/partmap/apple.c grub-core/partmap/sun.c grub-core/partmap/plan.c grub-core/partmap/dvh.c grub-core/partmap/sunpc.c grub-core/partmap/bsdlabel.c grub-core/partmap/dfly.c grub-core/script/function.c grub-core/script/lexer.c grub-core/script/main.c grub-core/script/script.c grub-core/script/argv.c grub-core/io/gzio.c grub-core/io/xzio.c grub-core/io/lzopio.c grub-core/kern/ia64/dl_helper.c grub-core/kern/arm/dl_helper.c grub-core/kern/arm64/dl_helper.c grub-core/lib/minilzo/minilzo.c grub-core/lib/xzembed/xz_dec_bcj.c grub-core/lib/xzembed/xz_dec_lzma2.c grub-core/lib/xzembed/xz_dec_stream.c util/misc.c grub-core/kern/command.c grub-core/kern/device.c grub-core/kern/disk.c grub-core/lib/disk.c util/getroot.c grub-core/osdep/unix/getroot.c grub-core/osdep/getroot.c grub-core/osdep/devmapper/getroot.c grub-core/osdep/relpath.c grub-core/kern/emu/hostdisk.c grub-core/osdep/devmapper/hostdisk.c grub-core/osdep/hostdisk.c grub-core/osdep/unix/hostdisk.c grub-core/osdep/exec.c grub-core/osdep/sleep.c grub-core/osdep/password.c grub-core/kern/emu/misc.c grub-core/kern/emu/mm.c grub-core/kern/env.c grub-core/kern/err.c grub-core/kern/file.c grub-core/kern/fs.c grub-core/kern/list.c grub-core/kern/misc.c grub-core/kern/partition.c grub-core/lib/crypto.c grub-core/disk/luks.c grub-core/disk/geli.c grub-core/disk/cryptodisk.c grub-core/disk/AFSplitter.c grub-core/lib/pbkdf2.c grub-core/commands/extcmd.c grub-core/lib/arg.c grub-core/disk/ldm.c grub-core/disk/diskfilter.c grub-core/partmap/gpt.c grub-core/partmap/msdos.c grub-core/fs/proc.c > libgrub.pp || (rm -f libgrub.pp; exit 1)grub-core/commands/blocklist.c:20:21: fatal error: grub/dl.h: No such file or directory
#include <grub/dl.h>
^compilation terminated.
... etc
Could we avoid removing include/grub? I really expect to be able to do
configure
make distclean
configure
which is hopelessly broken now after platform=none.
Quoted 7 lines · Andrei Borzenkov
Could we avoid removing
include/grub? I really expect to be able to doconfigure
make distclean
configurewhich is hopelessly broken now after platform=none.
Whoops, sorry! I always build out of tree (because it makes it much easier to test multiple platforms) and so didn't notice this. I've pushed a fix.
Signature · 1 line
Colin Watson [[email protected]]