113a366848
Since a long time GRUB 2 is a viable payload alternative to SeaBIOS and FILO. So make it easy for coreboot users to use GRUB 2 as a payload by integrating it into coreboot’s build system, so it can be selected in Kconfig. As the last GRUB 2 release 2.00 is too old and has several bugs when used as a coreboot payload only allow to build GRUB 2 master until a new GRUB release is done. The downside is, that accidental breakage in GRUB’s upstream does not affect coreboot users. Currently the GRUB 2 payload is built with the default modules which results in an uncompressed size of around 730 kB. Compressed it has a size of 340 kB, so it should be useable with 512 kB flash ROMs. Tested with QEMU. Change-Id: Ie75d5a2cb230390cd5a063d5f6a5d5e3fab6b354 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/4058 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
43 lines
1.2 KiB
Makefile
43 lines
1.2 KiB
Makefile
TAG-$(CONFIG_GRUB2_MASTER)=
|
|
NAME-$(CONFIG_GRUB2_MASTER)=HEAD
|
|
|
|
unexport KCONFIG_AUTOCONFIG
|
|
|
|
all: grub2
|
|
|
|
checkout:
|
|
echo " GIT GRUB2 $(NAME-y)"
|
|
test -d grub2 || \
|
|
git clone git://git.sv.gnu.org/grub.git grub2
|
|
cd grub2 && \
|
|
git checkout master && \
|
|
git pull; \
|
|
test -n "$(TAG-y)" && \
|
|
git branch -f $(NAME-y) $(TAG-y) && \
|
|
git checkout $(NAME-y) || true
|
|
|
|
config: checkout
|
|
echo " CONFIG GRUB2 $(NAME-y)"
|
|
rm -rf grub2/build
|
|
mkdir grub2/build
|
|
cd grub2 && ./autogen.sh
|
|
cd grub2/build && ../configure BUILD_CC="$(HOSTCC)" CC="$(HOSTCC)" \
|
|
TARGET_CC="$(CC)" \
|
|
TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" CFLAGS=-O2 TARGET_CFLAGS=-Os --with-platform=coreboot
|
|
|
|
grub2: config
|
|
echo " MAKE GRUB2 $(NAME-y)"
|
|
$(MAKE) -C grub2/build BUILD_CC="$(HOSTCC)" CC="$(HOSTCC)" \
|
|
TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" \
|
|
TARGET_STRIP="$(STRIP)" CFLAGS=-O2 TARGET_CFLAGS=-Os \
|
|
&& $(MAKE) -C grub2/build BUILD_CC="$(HOSTCC)" CC="$(HOSTCC)" \
|
|
TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \
|
|
CFLAGS=-O2 TARGET_CFLAGS=-Os default_payload.elf
|
|
|
|
clean:
|
|
test -d grub2 && $(MAKE) -C grub2 clean || exit 0
|
|
|
|
distclean:
|
|
rm -rf grub2
|
|
|
|
.PHONY: checkout config grub2 clean distclean
|