From e4720e31d3f76528cac465af6ab23d64bdee535e Mon Sep 17 00:00:00 2001 From: Dmitriy Kholkin Date: Wed, 14 Dec 2022 23:53:43 +0300 Subject: [PATCH] grub: disable locale --- profiles/packages/grub/backup.nix | 111 +++++++++++++++++++++++++++++ profiles/packages/grub/default.nix | 54 ++++++++------ 2 files changed, 143 insertions(+), 22 deletions(-) create mode 100644 profiles/packages/grub/backup.nix diff --git a/profiles/packages/grub/backup.nix b/profiles/packages/grub/backup.nix new file mode 100644 index 0000000..ec6e2f2 --- /dev/null +++ b/profiles/packages/grub/backup.nix @@ -0,0 +1,111 @@ +{ ... }: {} +# grub2 = prev.grub2.overrideAttrs (oa: { +# version = "2.06.r291"; +# src = prev.fetchgit { +# url = "https://git.savannah.gnu.org/git/grub.git"; +# rev = "e43f3d93b28cce852c110c7a8e40d8311bcd8bb1"; +# hash = "sha256-8M0WqeDE4Hrwq/zlygfbAWUt7vdDeqfJLX1ADzQGM3I="; +# }; +# patches = [ +# ./packages/grub/fix-bash-completion.patch +# ./packages/grub/add-hidden-menu-entries.patch +# ./packages/grub/license.patch +# ./packages/grub/5000-grub-2.06-luks2-argon2-v4.patch +# ./packages/grub/9500-grub-AUR-improved-luks2.patch +# ]; + +# # GRUB_AUTOGEN="1"; + +# nativeBuildInputs = with prev; [ bison flex python3 pkg-config gettext freetype autoconf automake ]; +# # nativeBuildInputs = oa.nativeBuildInputs ++ [ +# # prev.autoconf prev.automake +# # prev.autogen +# # # prev.libargon2 +# # ]; + +# # buildInputs = oa.buildInputs ++ [ prev.libargon2 ]; +# # CPPFLAGS="-O2"; +# # NIX_CFLAGS_COMPILE = "-Wno-error -O2"; + +# # configureFlags = [ +# # "GRUB_ENABLE_CRYPTODISK=y" +# # "TARGET_CFLAGS=-O2" +# # "--disable-werror" +# # "CFLAGS=\"\${CFLAGS/-fno-plt}\"" +# # "CPPFLAGS=\"-O2\"" +# # "--disable-silent-rules" +# # "--disable-werror" +# # ] ++ oa.configureFlags; +# # NIX_CFLAGS_COMPILE = "-O2"; +# # CFLAGS="-fno-plt"; +# # configureFlags = oa.configureFlags ++ [ +# # # "--enable-boot-time" +# # # "--enable-cache-stats" +# # # "--enable-device-mapper" +# # # "--enable-grub-mkfont" +# # # "--enable-grub-mount" +# # # "--enable-mm-debug" +# # "--disable-silent-rules" +# # "--disable-werror" +# # # "CPPFLAGS=\"$CPPFLAGS -O2\"" +# # ]; +# preConfigure = with prev; '' +# for i in "tests/util/"*.in +# do +# sed -i "$i" -e's|/bin/bash|${stdenv.shell}|g' +# done +# # Apparently, the QEMU executable is no longer called +# # `qemu-system-i386', even on i386. +# # +# # In addition, use `-nodefaults' to avoid errors like: +# # +# # chardev: opening backend "stdio" failed +# # qemu: could not open serial device 'stdio': Invalid argument +# # +# # See . +# sed -i "tests/util/grub-shell.in" \ +# -e's/qemu-system-i386/qemu-system-x86_64 -nodefaults/g' +# unset CPP # setting CPP intereferes with dependency calculation + +# patchShebangs . + +# ./bootstrap --no-git --gnulib-srcdir=${gnulib} # my changes + +# substituteInPlace ./configure --replace '/usr/share/fonts/unifont' '${unifont}/share/fonts' + +# sed -i 's/idx_t/grub_size_t/g' ./grub-core/disk/luks2.c # my changes +# ''; +# # preConfigure = oa.preConfigure + '' +# # echo "I'm here!" +# # ./bootstrap --no-git --gnulib-srcdir=${prev.gnulib} +# # ''; +# # postPatch = let +# # bash-patch = ./packages/grub/fix-bash-completion.patch; +# # menu-patch = ./packages/grub/add-hidden-menu-entries.patch; +# # # alloc-patch = ./packages/grub/4500-grub-2.06-runtime-memregion-alloc.patch; +# # luks-argon2-patch = ./packages/grub/5000-grub-2.06-luks2-argon2-v4.patch; +# # luks2-patch = ./packages/grub/9500-grub-AUR-improved-luks2.patch; +# # argon1-patch = ./packages/grub/argon_1.patch; +# # argon2-patch = ./packages/grub/argon_2.patch; +# # argon3-patch = ./packages/grub/argon_3.patch; +# # argon4-patch = ./packages/grub/argon_4.patch; +# # argon5-patch = ./packages/grub/argon_5.patch; +# # in '' +# # patch -Np1 -i "${bash-patch}" +# # patch -Np1 -i "${menu-patch}" +# # # patch -Np1 -i "${argon1-patch}" +# # # patch -Np1 -i "${argon2-patch}" +# # # patch -Np1 -i "${argon3-patch}" +# # # patch -Np1 -i "${argon4-patch}" +# # # patch -Np1 -i "${argon5-patch}" +# # patch -Np1 -i "${luks-argon2-patch}" +# # patch -Np1 -i "${luks2-patch}" +# # # ls -lah ./ +# # # ls -lah ./grub-core +# # # echo "CFLAGS" +# # # echo $CFLAGS +# # # sed -i 's#rm -f kernel_syms.input#cat kernel_syms.input; rm -f kernel_syms.input#' ./grub-core/Makefile.am +# # # sed -i 's#cat $<#cat $<\n\tcat $<#' ./grub-core/Makefile.am +# # # exit 1 +# # '' + oa.postPatch; +# }); \ No newline at end of file diff --git a/profiles/packages/grub/default.nix b/profiles/packages/grub/default.nix index fe23f99..584ec74 100644 --- a/profiles/packages/grub/default.nix +++ b/profiles/packages/grub/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchgit, flex, bison, python3, gnulib, libtool, bash, autoconf, automake +{ lib, stdenv, fetchgit, flex, bison, python3, gnulib, libtool, bash, autoconf, automake, fetchzip , gettext, ncurses, libusb-compat-0_1, freetype, qemu, lvm2, unifont, pkg-config , buildPackages , fetchpatch @@ -41,6 +41,15 @@ let version = "2.06.r291"; + # release = fetchzip { + # url = "mirror://gnu/grub/grub-2.06.tar.xz"; + # hash = "sha256-y/Q73UZYtIAd2E4DDj04av+hP/Ogy9Qr1Wu5x1TXzPw="; + # }; + + # copy locale files from release tarball + # cp -r ${release}/po ./ + # chmod 644 -R ./po + in ( assert efiSupport -> canEfi; @@ -88,35 +97,36 @@ stdenv.mkDerivation rec { # Work around a bug in the generated flex lexer (upstream flex bug?) NIX_CFLAGS_COMPILE = "-Wno-error"; - preConfigure = - '' for i in "tests/util/"*.in - do - sed -i "$i" -e's|/bin/bash|${stdenv.shell}|g' - done + preConfigure = '' + for i in "tests/util/"*.in + do + sed -i "$i" -e's|/bin/bash|${stdenv.shell}|g' + done - # Apparently, the QEMU executable is no longer called - # `qemu-system-i386', even on i386. - # - # In addition, use `-nodefaults' to avoid errors like: - # - # chardev: opening backend "stdio" failed - # qemu: could not open serial device 'stdio': Invalid argument - # - # See . - sed -i "tests/util/grub-shell.in" \ - -e's/qemu-system-i386/qemu-system-x86_64 -nodefaults/g' + # Apparently, the QEMU executable is no longer called + # `qemu-system-i386', even on i386. + # + # In addition, use `-nodefaults' to avoid errors like: + # + # chardev: opening backend "stdio" failed + # qemu: could not open serial device 'stdio': Invalid argument + # + # See . + sed -i "tests/util/grub-shell.in" \ + -e's/qemu-system-i386/qemu-system-x86_64 -nodefaults/g' - unset CPP # setting CPP intereferes with dependency calculation + unset CPP # setting CPP intereferes with dependency calculation - patchShebangs . + patchShebangs . - ./bootstrap --no-git --gnulib-srcdir=${gnulib} + ./bootstrap --no-git --gnulib-srcdir=${gnulib} - substituteInPlace ./configure --replace '/usr/share/fonts/unifont' '${unifont}/share/fonts' - ''; + substituteInPlace ./configure --replace '/usr/share/fonts/unifont' '${unifont}/share/fonts' + ''; configureFlags = [ "--enable-grub-mount" # dep of os-prober + "--disable-nls" ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # grub doesn't do cross-compilation as usual and tries to use unprefixed # tools to target the host. Provide toolchain information explicitly for