8088584b37
When 'make clean' is executed and there is no source code cloned for GRUB2 in payloads/external/GRUB2/grub2 (so GRUB2 has never been used on this tree) an error message is thrown: "fatal: cannot change to 'grub2': No such file or directory" This error happens when there is no grub2 directory and is caused by line 20 in payloads/external/GRUB2/Makefile where a shell command is used to check the state of the git repo for grub2. Thought the target for this code (checkout) is not executed by 'make clean' the shell evaluates the command as part of the Makefile sourcing and encounters a missing directory. This patch fixes this error by checking for the project directory before the git status of the repo is evaluated. Change-Id: Ieaa919e1ee5ec2a1ec3c840fa07a6ec16d230e88 Signed-off-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36750 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner Reviewed-by: Patrick Georgi <pgeorgi@google.com>
56 lines
1.8 KiB
Makefile
56 lines
1.8 KiB
Makefile
TAG-$(CONFIG_GRUB2_MASTER)=origin/HEAD
|
|
TAG-$(CONFIG_GRUB2_REVISION)=$(CONFIG_GRUB2_REVISION_ID)
|
|
TAG-$(CONFIG_GRUB2_STABLE)=grub-2.04
|
|
NAME-$(CONFIG_GRUB2_MASTER)=HEAD
|
|
NAME-$(CONFIG_GRUB2_REVISION)=$(CONFIG_GRUB2_REVISION_ID)
|
|
NAME-$(CONFIG_GRUB2_STABLE)=2.04
|
|
|
|
project_git_repo=https://git.savannah.gnu.org/git/grub.git/
|
|
project_dir=grub2
|
|
|
|
unexport HOSTCC CC LD OBJCOPY STRIP
|
|
MAKEOVERRIDES :=
|
|
|
|
all: grub2
|
|
|
|
checkout:
|
|
echo " GIT GRUB2 $(NAME-y)"
|
|
test -d $(project_dir) || git clone $(project_git_repo) $(project_dir)
|
|
git -C $(project_dir) fetch
|
|
ifeq ("$(shell test -d $(project_dir) && \
|
|
(git -C $(project_dir) status --ignored=no --untracked-files=no --porcelain))",)
|
|
git -C $(project_dir) checkout -f $(TAG-y)
|
|
else
|
|
echo "WARNING: index/tree not clean, skipping update / force checkout."
|
|
echo " Checkout manually with `git -C $(project_dir) checkout -f`."
|
|
endif
|
|
|
|
grub2/build/config.h: $(CONFIG_DEP) | checkout
|
|
echo " CONFIG GRUB2 $(NAME-y)"
|
|
rm -rf grub2/build
|
|
mkdir grub2/build
|
|
cd grub2 && ./bootstrap ; ./autogen.sh
|
|
cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \
|
|
FREETYPE="pkg-config freetype2" BUILD_FREETYPE="pkg-config freetype2" \
|
|
TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \
|
|
CFLAGS=-O2 TARGET_CFLAGS=-Os \
|
|
--with-platform=coreboot --enable-boot-time --disable-werror
|
|
|
|
config: grub2/build/config.h checkout
|
|
|
|
grub2: config
|
|
echo " MAKE GRUB2 $(NAME-y)"
|
|
$(MAKE) -C grub2/build
|
|
$(MAKE) -C grub2/build default_payload.elf \
|
|
EXTRA_PAYLOAD_MODULES="$(CONFIG_GRUB2_EXTRA_MODULES)"
|
|
|
|
clean:
|
|
test -f grub2/build/Makefile && $(MAKE) -C grub2/build clean || exit 0
|
|
|
|
distclean:
|
|
rm -rf grub2
|
|
|
|
print-repo-info:
|
|
echo "$(project_git_repo) $(project_dir)"
|
|
|
|
.PHONY: checkout config grub2 clean distclean print-repo-info
|