diff --git a/cfg/kernels.cfg b/cfg/kernels.cfg index d212246..99e54ef 100644 --- a/cfg/kernels.cfg +++ b/cfg/kernels.cfg @@ -1,30 +1,41 @@ +# Initialize variables +have_kernel="false" +have64="false" +have32="false" + +# Check for 64-bit kernel in /boot for kk in /boot/vmlinu*-*64; do -if [ "$kk" != "/boot/vmlinu*-*64" ]; then - have64="true" - if cpuid -l; then - have_kernel="true" - else - have_kernel="false" - fi -fi -done -for kk in /boot/vmlinu*-*86; do -if [ "$kk" != "/boot/vmlinu*-*86" ]; then - have32="true" - have_kernel="true" -fi -done -if [ "${have_kernel}" != "true" ]; then - menuentry --class=find.none "NO SUITABLE KERNELS AVAILABLE" {echo $@ echo "There are no kernels suitable for this machine available." - echo "" - if ! cpuid -l; then - echo "This machine is NOT 64bit capable." - echo "" + if [ -f "$kk" ]; then + have64="true" + # Check if the system supports 64-bit + if cpuid -l; then + have_kernel="true" fi - echo "There are no suitable kernels available" - if [ "${have64}" == "true" ]; then - echo "" - echo "It appears you are trying to boot a 64bit release on a 32bit machine" + break + fi +done + +# Check for 32-bit kernel in /boot +for kk in /boot/vmlinu*-*86; do + if [ -f "$kk" ]; then + have32="true" + have_kernel="true" + break + fi +done + +# If no suitable kernel found +if [ "$have_kernel" != "true" ]; then + menuentry --class=find.none "NO SUITABLE KERNELS AVAILABLE" { + echo "There are no kernels suitable for this machine available." + echo "" + # Check if the machine is 64-bit capable + if ! cpuid -l; then + echo "This machine is NOT 64-bit capable." + fi + echo "" + if [ "$have64" == "true" ]; then + echo "It appears you are trying to boot a 64-bit release on a 32-bit machine." echo "This cannot work!" fi echo "" @@ -33,19 +44,16 @@ if [ "${have_kernel}" != "true" ]; then menu_reload } else - title="" - for kopt in @ARCH@ $kopts @DEFAULT_ARGS@ @BOOT_ARGS@; do - if [ -n "$title" ] ; then - title="$title $kopt"; - else - title="$kopt"; - fi; - done - menuentry "Boot with open source drivers" --class=@DIST_NAME@.@ARCH@ "$title" {# set arguments above with the editor + # Construct boot parameters + title="@ARCH@ @DEFAULT_ARGS@ @BOOT_ARGS@" + + # Boot menu entries + menuentry "Boot with open source drivers" --class=@DIST_NAME@.@ARCH@ "$title" { linux /boot/vmlinuz-$2 driver=free nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 initrd /boot/amd_ucode.img /boot/intel_ucode.img /boot/initramfs-@ARCH@.img } - menuentry "Boot allowing proprietary drivers (NVIDIA)" --class=@DIST_NAME@.@ARCH@ "$title" {# set arguments above with the editor + + menuentry "Boot allowing proprietary drivers (NVIDIA)" --class=@DIST_NAME@.@ARCH@ "$title" { linux /boot/vmlinuz-$2 driver=nonfree nouveau.modeset=0 i915.modeset=1 radeon.modeset=1 initrd /boot/amd_ucode.img /boot/intel_ucode.img /boot/initramfs-@ARCH@.img }