From 5bf0f9742adaaf62e999eee85a33fa51f2306d9e Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 16 Oct 2023 01:37:12 +0300 Subject: [PATCH] Toolchain: Build grub with efi capabilities --- toolchain/build.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/toolchain/build.sh b/toolchain/build.sh index 5b351eea97..1b9ec77d9f 100755 --- a/toolchain/build.sh +++ b/toolchain/build.sh @@ -3,6 +3,7 @@ set -e BINUTILS_VERSION="binutils-2.39" GCC_VERSION="gcc-12.2.0" +GRUB_VERSION="grub-2.06" cd $(dirname "$0") @@ -74,7 +75,7 @@ if [ ! -f ${PREFIX}/bin/${TARGET}-g++ ]; then fi mkdir -p build/${GCC_VERSION}/ - cd build/${GCC_VERSION}/ + pushd build/${GCC_VERSION}/ ../../${GCC_VERSION}/configure \ --target="$TARGET" \ @@ -87,4 +88,34 @@ if [ ! -f ${PREFIX}/bin/${TARGET}-g++ ]; then make -j $(nproc) all-target-libgcc CFLAGS_FOR_TARGET='-g -O2 -mcmodel=large -mno-red-zone' make install-gcc install-target-libgcc + popd + +fi + +if [ ! -f ${PREFIX}/bin/grub-mkstandalone ]; then + + echo "Building ${GRUB_VERSION}" + + if [ ! -f ${GRUB_VERSION}.tar.xz ]; then + wget https://ftp.gnu.org/gnu/grub/${GRUB_VERSION}.tar.xz + fi + + if [ ! -d $GRUB_VERSION ]; then + tar xvf ${GRUB_VERSION}.tar.xz + fi + + mkdir -p build/${GRUB_VERSION}/ + pushd build/${GRUB_VERSION}/ + + ../../${GRUB_VERSION}/configure \ + --target="$ARCH" \ + --prefix="$PREFIX" \ + --with-platform="efi" \ + --disable-werror + + make -j $(nproc) + make install + + popd + fi