diff --git a/modules/installer/grub/grub-menu-builder.sh b/modules/installer/grub/grub-menu-builder.sh index 27ad6860403..0605df5f52c 100644 --- a/modules/installer/grub/grub-menu-builder.sh +++ b/modules/installer/grub/grub-menu-builder.sh @@ -52,8 +52,8 @@ default @default@ timeout @timeout@ GRUBEND if test -n "@splashImage@"; then - echo "splashimage $bootRoot/background.xpm.gz" >> "$1" - fi + echo "splashimage $bootRoot/background.xpm.gz" >> "$1" + fi ;; 2) cp -f @grub@/share/grub/unicode.pf2 /boot/grub/unicode.pf2 @@ -154,6 +154,7 @@ addEntry() { local kernel=$(readlink -f $path/kernel) local initrd=$(readlink -f $path/initrd) + local xen=$([ -f $path/xen.gz ] && readlink -f $path/xen.gz) if test "$path" = "$defaultConfig"; then cp "$kernel" /boot/nixos-kernel @@ -181,28 +182,34 @@ EOF if test -n "$copyKernels"; then copyToKernelsDir $kernel; kernel=$result copyToKernelsDir $initrd; initrd=$result + if [ -n "$xen" ]; then copyToKernelsDir $xen; xen=$result; fi fi - + local confName=$(cat $path/configuration-name 2>/dev/null || true) if test -n "$confName"; then name="$confName $3" fi + local kernelArgs="systemConfig=$(readlink -f $path) init=$(readlink -f $path/init) $(cat $path/kernel-params)" + local xenArgs="loglvl=all guest_loglvl=all" + case "$grubVersion" in 1) cat >> "$tmp" << GRUBEND title $name @extraPerEntryConfig@ - kernel $kernel systemConfig=$(readlink -f $path) init=$(readlink -f $path/init) $(cat $path/kernel-params) - initrd $initrd + ${xen:+kernel $xen $xenArgs} + $(if [ -z "$xen" ]; then echo kernel; else echo module; fi) $kernel $kernelArgs + module $initrd GRUBEND ;; 2) cat >> "$tmp" << GRUBEND menuentry "$name" { @extraPerEntryConfig@ - linux $kernel systemConfig=$(readlink -f $path) init=$(readlink -f $path/init) $(cat $path/kernel-params) - initrd $initrd + ${xen:+multiboot $xen $xenArgs} + $(if [ -z "$xen" ]; then echo linux; else echo module; fi) $kernel $kernelArgs + $(if [ -z "$xen" ]; then echo initrd; else echo module; fi) $initrd } GRUBEND ;;