* Make the graphical boot work on GRUB 2 in the case where /nix/store
is not on the same partition as /boot (i.e. when boot.loader.grub.bootDevice is set): just copy the background image and the font to /boot. svn path=/nixos/trunk/; revision=18979
This commit is contained in:
parent
79073c7b3d
commit
79bcc7618e
@ -28,32 +28,25 @@ esac
|
|||||||
|
|
||||||
|
|
||||||
prologue() {
|
prologue() {
|
||||||
if test -n "@splashImage@"; then
|
|
||||||
splashLocation="@splashImage@"
|
|
||||||
if test "$grubVersion" -eq 1 ; then
|
|
||||||
# Splash images in /nix/store don't seem to work, so copy them.
|
|
||||||
cp -f $splashLocation /boot/background.xpm.gz
|
|
||||||
splashLocation="$bootDevice/background.xpm.gz"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$grubVersion" in
|
case "$grubVersion" in
|
||||||
1)
|
1)
|
||||||
|
cp -f "@splashImage@" /boot/background.xpm.gz
|
||||||
cat > "$1" << GRUBEND
|
cat > "$1" << GRUBEND
|
||||||
# Automatically generated. DO NOT EDIT THIS FILE!
|
# Automatically generated. DO NOT EDIT THIS FILE!
|
||||||
default @default@
|
default @default@
|
||||||
timeout @timeout@
|
timeout @timeout@
|
||||||
GRUBEND
|
GRUBEND
|
||||||
if test -n "@splashImage@"; then
|
if test -n "@splashImage@"; then
|
||||||
echo "splashimage $splashLocation" >> "$1"
|
echo "splashimage $bootDevice/background.xpm.gz" >> "$1"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
|
cp -f @grub@/share/grub/unicode.pf2 /boot/grub/unicode.pf2
|
||||||
cat > "$1" <<EOF
|
cat > "$1" <<EOF
|
||||||
# Automatically generated. DO NOT EDIT THIS FILE!
|
# Automatically generated. DO NOT EDIT THIS FILE!
|
||||||
set default=@default@
|
set default=@default@
|
||||||
set timeout=@timeout@
|
set timeout=@timeout@
|
||||||
if loadfont @grub@/share/grub/unicode.pf2 ; then
|
if loadfont $bootDevice/grub/unicode.pf2; then
|
||||||
set gfxmode=640x480
|
set gfxmode=640x480
|
||||||
insmod gfxterm
|
insmod gfxterm
|
||||||
insmod vbe
|
insmod vbe
|
||||||
@ -61,13 +54,14 @@ if loadfont @grub@/share/grub/unicode.pf2 ; then
|
|||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
if test -n "@splashImage@"; then
|
if test -n "@splashImage@"; then
|
||||||
|
cp -f "@splashImage@" /boot/background.png
|
||||||
# FIXME: GRUB 1.97 doesn't resize the background image
|
# FIXME: GRUB 1.97 doesn't resize the background image
|
||||||
# if it doesn't match the video resolution.
|
# if it doesn't match the video resolution.
|
||||||
cat >> "$1" <<EOF
|
cat >> "$1" <<EOF
|
||||||
insmod png
|
insmod png
|
||||||
if background_image $splashLocation ; then
|
if background_image $bootDevice/background.png; then
|
||||||
set color_normal=black/black
|
set color_normal=white/black
|
||||||
set color_highlight=magenta/black
|
set color_highlight=black/white
|
||||||
else
|
else
|
||||||
set menu_color_normal=cyan/blue
|
set menu_color_normal=cyan/blue
|
||||||
set menu_color_highlight=white/blue
|
set menu_color_highlight=white/blue
|
||||||
@ -244,8 +238,7 @@ for generation in $(
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Atomically update /boot/grub/menu.lst. !!! should do an fsync()
|
# Atomically update the GRUB configuration file.
|
||||||
# here on $tmp, especially on ext4.
|
|
||||||
mv $tmp $target
|
mv $tmp $target
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@ with pkgs.lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
grub = if config.boot.loader.grub.version == 1 then pkgs.grub else pkgs.grub2;
|
||||||
|
|
||||||
grubMenuBuilder = pkgs.substituteAll {
|
grubMenuBuilder = pkgs.substituteAll {
|
||||||
src = ./grub-menu-builder.sh;
|
src = ./grub-menu-builder.sh;
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
grub = if config.boot.loader.grub.version == 1
|
inherit grub;
|
||||||
then pkgs.grub
|
|
||||||
else pkgs.grub2;
|
|
||||||
inherit (pkgs) bash;
|
inherit (pkgs) bash;
|
||||||
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
|
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
|
||||||
inherit (config.boot.loader.grub) copyKernels extraEntries extraEntriesBeforeNixOS
|
inherit (config.boot.loader.grub) copyKernels extraEntries extraEntriesBeforeNixOS
|
||||||
@ -156,17 +156,8 @@ in
|
|||||||
system.boot.loader.id = "grub";
|
system.boot.loader.id = "grub";
|
||||||
system.boot.loader.kernelFile = "vmlinuz";
|
system.boot.loader.kernelFile = "vmlinuz";
|
||||||
|
|
||||||
environment.systemPackages =
|
environment.systemPackages = mkIf config.boot.loader.grub.enable [ grub ];
|
||||||
mkIf config.boot.loader.grub.enable
|
|
||||||
(let version = config.boot.loader.grub.version; in
|
|
||||||
assert version != 1 -> version == 2;
|
|
||||||
|
|
||||||
if version == 1
|
|
||||||
then [ pkgs.grub ]
|
|
||||||
else [ pkgs.grub2 ]);
|
|
||||||
|
|
||||||
# and many other things that have to be moved inside this file.
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user