Commit Graph

99 Commits

Author SHA1 Message Date
Peter Jones 42f4054faf Makefile: Make libgrub.pp depend on config-util.h
If you build with "make -j48" a lot, sometimes you see:

gcc -E -DHAVE_CONFIG_H -I. -I..  -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -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 -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -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 -I/builddir/build/BUILD/grub-2.02/grub-aarch64-efi-2.02 -D_FILE_OFFSET_BITS=64 \
  -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/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 ../grub-core/fs/archelp.c > libgrub.pp || (rm -f libgrub.pp; exit 1)
rm -f stamp-h1
touch ../config-util.h.in
cd . && /bin/sh ./config.status config-util.h
config.status: creating config-util.h
In file included from ../include/grub/mm.h:25:0,
                 from ../include/grub/disk.h:29,
                 from ../include/grub/file.h:26,
                 from ../grub-core/fs/btrfs.c:21:
./config.h:38:10: fatal error: ./config-util.h: No such file or directory
 #include <config-util.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:13098: libgrub.pp] Error 1

This is because libgrub.pp is built with -DGRUB_UTIL=1, which means
it'll try to include config-util.h, but a parallel make is actually
building that file.  I think.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-03-10 21:39:53 +01:00
Paul Menzel 6c5ee45548 Makefile: Allow to set file systems modules for default_payload.elf
By default all file system modules are added to the GRUB coreboot
payload `default_payload.elf`. This makes the image quite big,
especially as often not all modules are needed.

Introduce the variable `FS_PAYLOAD_MODULES`, which can be used to
explicitly set file systems modules to be added.

    $ make default_payload.elf
    test -f default_payload.elf && rm default_payload.elf || true
    pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o default_payload.elf --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos 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 syslinuxcfg xnu affs afs bfs btrfs cbfs cpio cpio_be exfat ext2 f2fs fat hfs hfsplus iso9660 jfs minix minix2 minix2_be minix3 minix3_be minix_be newc nilfs2 ntfs odc procfs reiserfs romfs sfs squash4 tar udf ufs1 ufs1_be ufs2 xfs zfs password_pbkdf2 ' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=./coreboot.cfg
    $ ls -l default_payload.elf
    -rw-rw---- 1 joey joey 1199568 Mar  6 13:58 default_payload.elf

    $ make default_payload.elf FS_PAYLOAD_MODULES="" # ext2 already in `--modules`
    test -f default_payload.elf && rm default_payload.elf || true
    pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o default_payload.elf --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos 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 syslinuxcfg xnu  password_pbkdf2 ' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=./coreboot.cfg
    $ ls -l default_payload.elf
    -rw-rw---- 1 joey joey 832976 Mar  7 12:13 default_payload.elf

So, the resulting payload size is around 370 kB smaller. (Adding it to
the CBFS, it will be compressed, so the effective size difference will
be smaller.)

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-03-12 20:04:07 +01:00
Colin Watson 35b909062e gnulib: Upgrade Gnulib and switch to bootstrap tool
Upgrade Gnulib files to 20190105.

It's much easier to maintain GRUB's use of portability support files
from Gnulib when the process is automatic and driven by a single
configuration file, rather than by maintainers occasionally running
gnulib-tool and committing the result.  Removing these
automatically-copied files from revision control also removes the
temptation to hack the output in ways that are difficult for future
maintainers to follow.  Gnulib includes a "bootstrap" program which is
designed for this.

The canonical way to bootstrap GRUB from revision control is now
"./bootstrap", but "./autogen.sh" is still useful if you just want to
generate the GRUB-specific parts of the build system.

GRUB now requires Autoconf >= 2.63 and Automake >= 1.11, in line with
Gnulib.

Gnulib source code is now placed in grub-core/lib/gnulib/ (which should
not be edited directly), and GRUB's patches are in
grub-core/lib/gnulib-patches/.  I've added a few notes to the developer
manual on how to maintain this.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-03-05 10:48:12 +01:00
Colin Watson f8f35acb5b syslinux: Fix syslinux_test in out-of-tree builds
syslinux_parse simplifies some filenames by removing things like ".."
segments, but the tests assumed that @abs_top_srcdir@ would be
untouched, which is not true in the case of out-of-tree builds where
@abs_top_srcdir@ may contain ".." segments.

Performing the substitution requires some awkwardness in Makefile.am due
to details of how config.status works.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-03-05 10:27:53 +01:00
Colin Watson bcfa0f08bb build: Capitalise *freetype_* variables
Using FREETYPE_CFLAGS and FREETYPE_LIBS is more in line with the naming
scheme used by pkg-config macros.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2018-09-27 14:45:09 +02:00
Vladimir Serbinenko fcea891e17 Use core2duo for bootcheck test on 64-bit EFI.
Obviously pentium2 can't run efi64.
2017-03-15 09:20:14 +01:00
Vladimir Serbinenko 1402cdd96a i386-ieee1275: Add missing bootcheck target. 2017-02-02 21:41:33 +01:00
Vladimir Serbinenko 31932a267c bootcheck-linux-i386: Use -cpu pentium2.
Most modern kernels are compiled for i686, so use -cpu pentium2
to avoid spurious failures.
2017-02-02 21:41:18 +01:00
Vladimir Serbinenko 68c6cec061 Fix bootcheck-related files compilation.
We need -static as otherwise linker will set interpreter field and ld.so
is not available on our initrd's.
Strip all sections we don't need on binary tests.
2017-02-01 15:57:08 +01:00
Vladimir Serbinenko 5486a4e12b Makefile: Don't delete default_payload.elf if it doesn't exist. 2016-02-26 11:14:46 +01:00
Vladimir Serbinenko e3745f9087 default_payload.elf: Always rebuild and remove before build.
It's difficult to know all dependencies. Since it's manual and cheap
target anyway, simply always rebuild it.
2016-02-17 18:19:18 +01:00
Vladimir Serbinenko 01d50c2539 default_payload.elf: Include password_pbkdf2.
Withoout this module we may end up in a system where no password is
accepted.
2016-02-17 18:11:51 +01:00
Vladimir Serbinenko 8d69065f52 default_payload.elf: Add modules from $(EXTRA_PAYLOAD_MODULES).
This allows coreboot building system to add extra modules depending
on user config.
2016-02-17 18:10:31 +01:00
Vladimir Serbinenko 127cfea8be default_payload: Include syslinuxcfg, all filesystems and xnu. 2016-02-12 12:41:28 +01:00
Vladimir Serbinenko 06c94739a5 Disable NetBSD bootcheck on EFI until it supports ACPI on EFI. 2016-01-07 19:27:10 +01:00
Vladimir Serbinenko 716c9f2675 Adjust bootcheck tests for multiboot/coreboot/qemu to match real support.
coreboot has ACPI while 2 others don't. *BSD need ACPI and have trouble
without it. Don't even attempt to boot *BSD on multiboot or qemu targets.

On coreboot boot all *BSD except 32-bit NetBSD which apparently does some
early BIOS calls.
2016-01-07 15:51:03 +01:00
Andrei Borzenkov ba83ed1538 Add missing BUILD_EXEEXT 2016-01-01 12:06:40 +03:00
Andrey Borzenkov af23303cbd add dejavu built fonts to cleanfiles 2015-12-31 22:23:12 +03:00
Andrei Borzenkov 35a492e4a2 tests: remove hardcoded paths from syslinux_test
abs_top_srcdir appeared in Autoconf 2.52f. Minimal grub requirement
is 2.60 so we should be good here.
2015-02-16 22:24:05 +03:00
Vladimir Serbinenko b8f537199a Generate empty ChangeLog if no .git is available.
When making dist from a git snapshot without repo available make dist would
fail to find ChangeLog. Generate empty ChangeLog if no ChangeLog is already
present and repo is not available.

Reported by: Andrei Borzenkov <arvidjaar@gmail.com>
2015-01-24 20:14:59 +01:00
Vladimir Serbinenko 14c9a72039 Makefile.am: Fix Changelog cutoff address.
gitlog-to-changelog Doesn't generate entries for cutoff day, only
for days after the cutoff date, adjust by one to compensate.
2015-01-24 20:12:51 +01:00
Vladimir Serbinenko 3bd0868364 Autogenerate ChangeLog from git changelog.
Old ChangeLog is moved to ChangeLog-2015. For all changes starting from
this one ChangeLog will be generated from gitlog only on explicit make
invocation and make dist.
2015-01-24 17:29:50 +01:00
Colin Watson 5d90f6e533 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.
2014-09-23 12:06:30 +01:00
Andrey Borzenkov eec4237a32 add GRUB_WINDOWS_EXTRA_DIST to allow shipping runtime files
Not all toolkits provide static libraries. This patch enables creation of self
contained distribution that does not require pre-existing runtime libraries.
Intended usage is

export GRUB_WINDOWS_EXTRA_DIST="/path/to/liblzma.dll /path/to/libintl.dll"
make
make windowszip

As those libraries and locations are dependent on toolchain in use, trying
to autodetect them is likely impossible. So just provide a simple way to
package everything in one step.

Also remove $(windowsdir) after ZIP was created same as other "make dist"
targets.
2014-01-21 20:54:09 +04:00
Vladimir Serbinenko 0b47c57ad6 * Makefile.am (default_payload.elf): Add modules
multiboot cbmemc linux16 gzio echo help.
2014-01-18 19:43:19 +01:00
Andrey Borzenkov 1ecf96fcc4 add BUILD_EXEEXT support to fix make clean on Windows
Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
appropriate.
2014-01-18 20:41:24 +04:00
Andrey Borzenkov dcecae1a49 reintroduce BUILD_LDFLAGS for the cross-compile case
This allows providing separate LDFLAGS for build and host environments, which
are not necessary the same for cross-compile case. In particular, it allows
building host programs statically to not depend on presence of libraries at
run-time (e.g. MinGW DLLs on Windows) while continue to use default dynamic
linking at build time.

Also fix obsolete comments in confgure.ac - we do use different environment
for build and host now.
2014-01-18 19:50:54 +04:00
Colin Watson 5b83ef97e5 Don't distribute config.h.
* Makefile.am (platform_HEADERS): Move to ...
(nodist_platform_HEADERS): ... here.  Fixes gettext_strings_test
failure when building from a distributed tarball.
2013-12-23 14:30:35 +00:00
Vladimir Serbinenko 1482975549 Include serial module in default_payload.elf. 2013-12-17 14:52:36 +01:00
Vladimir Serbinenko 4861b6c851 * Makefile.am: Remove partial font files if generation failed. 2013-12-07 11:39:35 +01:00
Andrey Borzenkov f65e14dc3a add util/garbage-gen.c to EXTRA_DIST 2013-11-23 14:39:35 +04:00
Vladimir Serbinenko 7f20dbbcd2 * Makefile.am: Allow STRIP to be empty when creating windowszip. 2013-11-19 23:48:46 +01:00
Vladimir Serbinenko 7d44ff7de6 Add automated filesystem checking based on scripts I've used now for
quite some time locally. Most of the test require root so they are
	skipped when run without necessarry privelegies.
2013-11-19 21:05:59 +01:00
Vladimir Serbinenko b7526e7806 * Makefile.am (default_payload.elf): Add pata to loaded modules.
Load config file from (cbfsdisk)/etc/grub.cfg.
2013-11-18 16:05:47 +01:00
Vladimir Serbinenko cd46aa6cef Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir
the function of these files exceeds what can be sanely handled in shell
	in posix-comaptible way. Also writing it in C extends the functionality
	to non-UNIX-like OS and minimal environments.
2013-11-16 20:21:16 +01:00
Vladimir Serbinenko da45f43ce3 * Makefile.am (default_payload.elf): Add uhci, ohci and usb_keyboard. 2013-11-14 18:41:41 +01:00
Vladimir Serbinenko 93fcc7ad73 * Makefile.am (default_payload.elf): New target for easier coreboot
build.
2013-11-14 11:28:38 +01:00
Paulo Flabiano Smorigo da7703286a
fix make clean
* Makefile.am: Remove build-grub-* in make clean.
2013-11-13 23:03:22 -02:00
Vladimir 'phcoder' Serbinenko 58e211ccf2 * Makefile.am: Use TARGET_OBJCOPY when doing objcopy for target. 2013-10-14 18:29:57 +02:00
Vladimir 'phcoder' Serbinenko 7b780018f5 Handle grub-pe2elf and grub-mkfont for cases when build != host.
* Makefile.am (build-grub-mkfont): Don't include gnulib.
	(build-grub-gen-asciih): Likewise.
	(build-grub-gen-widthspec): Likewise.
	* Makefile.util.def (grub-pe2elf): Remove.
	* config.h.in [GRUB_BUILD]: Use build rather than host constants.
	* configure.ac: Separate tests for build.
	Move ./build-grub-pe2elf to grub-core.
	Fix typo.
	* grub-core/Makefile.am (build-grub-pe2elf): New target.
	* grub-core/kern/emu/misc.c (xasprintf): Don't compile if GRUB_BUILD is
	defined.
	* include/grub/types.h [GRUB_BUILD]: Use build rather than host
	constants.
	* util/grub-mkfont.c [GRUB_BUILD]: Simplify not to rely on argp.
	* util/grub-pe2elf.c: Simplify not to rely on getopt.
	* util/misc.c (program_name) [GRUB_BUILD]: Define to static string.
2013-08-22 17:00:59 +02:00
Vladimir 'phcoder' Serbinenko e733cf52f4 * Makefile.am (widthspec.h): Fix typo.
* util/grub-gen-widthspec.c: Likewise.
2013-08-21 20:26:26 +02:00
Vladimir 'phcoder' Serbinenko c6b066f2e9 Move ascii.h and widthspec.h generation to a separate build-time-only
tool.
2013-08-21 19:53:59 +02:00
Vladimir 'phcoder' Serbinenko 7c9d0c39af Fix handling of build-time grub-bin2h and grub-mkfont when doing
full Canadian cross. Tested with build=x86_64, host=arm,
	target=ppc-ieee1275.
2013-08-14 10:56:55 +02:00
Vladimir 'phcoder' Serbinenko 57e0c20cb5 * Makefile.am, conf/Makefile.common: Fix compilation problem with some
automake versions.
2013-05-30 21:36:12 +02:00
Vladimir 'phcoder' Serbinenko 62b15edfd1 Fix distfiles list.
Reported by: Andrey Borzenkov <arvidjaar@gmail.com>
2013-05-11 15:48:08 +02:00
Vladimir 'phcoder' Serbinenko f93e89ef90 Add test to check that different boot mediums work. 2013-04-26 14:33:31 +02:00
Vladimir 'phcoder' Serbinenko 5121223465 Turn off QEMU ACPI-way since new releases don't have shutdown port
anymore.
2013-04-12 14:49:33 +02:00
Colin Watson 265c162a28 * Makefile.am (EXTRA_DIST): Add linguas.sh. It's only strictly
required for checkouts from bzr, but it may be useful for users or
distributors wishing to update translations against a tarball
distribution, and it can be helpful for the tarball to be a superset
of what's in bzr.
2012-09-04 23:35:38 +01:00
Colin Watson 3d171e951a * Makefile.am (EXTRA_DIST): Add
grub-core/tests/boot/linux.init-mips.S,
grub-core/tests/boot/linux.init-ppc.S, and
grub-core/tests/boot/linux-ppc.cfg.
2012-09-04 18:59:41 +01:00
Vladimir 'phcoder' Serbinenko eac49cffc8 Add loongson tests.
* tests/util/grub-shell.in: Handle loongson.
	* tests/partmap_test.in: Add loongson to the list of platform using ATA
	drivers.
	* grub-core/tests/boot/linux.init-mips.S (SHUTDOWN_MAGIC3) [REBOOT]:
	Reboot instead of shutdown if REBOOT is defined.
2012-06-15 19:42:25 +02:00