LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-05-2014, 08:49 PM   #1
cezarrangel
Member
 
Registered: Dec 2011
Posts: 77

Rep: Reputation: Disabled
simplifying the /boot/grub/grub.cfg file


Hi everyone.
This is how the grub.cfg looks like after I have edited the 40_custom file. I also have removed the 10_linux, 20_linux_xen, 30_os_prober and the 41_custom entries. After that I edited the 40_custom file and added its entry I have run the grub.mkconfig command. Then, below is the version of the grub.cfg file that I have now.
the four distros and windows7 are booting perfectly.
I have copied these data from former grub.cfg file and edited the 40_custom adding the data I copied.
However,I think it is too full of information.
Which lines of each entry can be removed? Is there a more simple example of these entries I could apply to make it more simple?
how can I simplify the file?

Quote:
GNU nano 2.3.2 File: /mnt/sda2/boot/grub/grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}

if [ x$feature_default_font_path = xy ] ; then
font=dejavusansmono
else
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 a4818efe-2e15-4599-8797-c4f269329eaf
else
search --no-floppy --fs-uuid --set=root a4818efe-2e15-4599-8797-c4f269329eaf
fi
font="/usr/share/grub/dejavusansmono.pf2"
fi

if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
set timeout=10
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

menuentry 'Slackware64 current GNU/Linux, with Linux generic' --class slackware-14.1 --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 a4818efe-2e15-4599-8797-c4f269329eaf
else
search --no-floppy --fs-uuid --set=root a4818efe-2e15-4599-8797-c4f269329eaf
fi
echo 'Loading Linux generic ...'
linux /boot/vmlinuz-generic root=UUID=a4818efe-2e15-4599-8797-c4f269329eaf ro
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.gz
}

menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-9C7AC58F7AC5671C' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 9C7AC58F7AC5671C
else
search --no-floppy --fs-uuid --set=root 9C7AC58F7AC5671C
fi
chainloader +1
}

menuentry 'Arch Linux, com o Linux linux (on /dev/sdb1)' --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 6ea90d2a-f445-4dc2-88ae-cdedcd2be530
else
search --no-floppy --fs-uuid --set=root 6ea90d2a-f445-4dc2-88ae-cdedcd2be530
fi
linux /boot/vmlinuz-linux root=UUID=6ea90d2a-f445-4dc2-88ae-cdedcd2be530 rw quiet
initrd /boot/initramfs-linux.img
}

menuentry 'Slackware Linux (Slackware64 14.1) Microlinux (on /dev/sdc1)' --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='hd2,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1 9bb6f931-b14c-4a09-be04-77cf908351b1
else
search --no-floppy --fs-uuid --set=root 9bb6f931-b14c-4a09-be04-77cf908351b1
fi
linux /boot/vmlinuz-generic-3.10.17 root=/dev/sdc1
initrd /boot/initrd.gz
}

menuentry 'Slackware Linux (Slackware64 14.1) (on /dev/sdd1)' --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='hd3,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd3,msdos1 --hint-efi=hd3,msdos1 --hint-baremetal=ahci3,msdos1 251245f5-041c-49ea-b427-fe18674d7735
else
search --no-floppy --fs-uuid --set=root 251245f5-041c-49ea-b427-fe18674d7735
fi
linux /boot/vmlinuz-generic-3.10.17 root=/dev/sdd1
initrd /boot/initrd.gz
}

### END /etc/grub.d/40_custom ###

Last edited by cezarrangel; 12-06-2014 at 04:25 AM.
 
Old 12-05-2014, 09:31 PM   #2
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Looks correct to me. Remember Grub2 uses more of a script style than a general configuration file.
 
Old 12-06-2014, 04:15 AM   #3
cezarrangel
Member
 
Registered: Dec 2011
Posts: 77

Original Poster
Rep: Reputation: Disabled
thank you so much reaperX7. what I mean are the lines of the menuentries inside " begin /etc/grub.d/40_custom"part . Not above this part. I have seen other possibilities with less information.

Last edited by cezarrangel; 12-06-2014 at 04:16 AM.
 
Old 12-06-2014, 06:31 AM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
The very minimium would be the menuentry, root, linux, and initrd lines. What other options are needed would depend on the hardware and distro.

Last edited by colorpurple21859; 12-06-2014 at 06:34 AM.
 
Old 12-06-2014, 07:05 AM   #5
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Yeah, most are options, disk detection, etc. It's best to use /etc/defaults/grub rather than editing /boot/grub/grub.cfg directly if you aren't comfortable reading scripts. Best to leave it as is.
 
Old 12-06-2014, 07:46 AM   #6
cezarrangel
Member
 
Registered: Dec 2011
Posts: 77

Original Poster
Rep: Reputation: Disabled
I thank you all. Colorpurple21859: this grub.cfg above is the result of the solution you gave me in another thread and now I will improve it even more with the suggestion below:

Quote:
menuentry 'Slackware on sdd1'{
set root=(hd4)
chainloader +1
}
maybe I should replace the chainloader +1 line (if I would not use its function) by the linux and inirt lines and that would be a very simple entry for 40_custom

besides, without the "--class gnu-linux --class gnu --class os" references
 
Old 12-06-2014, 07:40 PM   #7
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
What you have is the very minimal needed to chainload to another boot loader. The chainloader +1 line is needed if your handing off the boot process to another bootloader. When booting a kernel, The linux line tells the bootloader the location of the kernel to be booted and options to pass to the kernel. The initrd line, like wise, tells the the bootloader the location of the initrd file, if one is required to boot the kernel. In both cases the set root line tells the bootloader what disk/partition to use.

Last edited by colorpurple21859; 12-06-2014 at 07:49 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] i didn't find "grub.cfg" file on /boot/grub/ Carl_cj Slackware 14 11-16-2014 09:21 AM
[SOLVED] Boot menu not matching grub.cfg spoovy Linux - Newbie 10 02-01-2011 03:45 PM
grub.cfg file in grub2 sheine Linux - Software 2 01-22-2011 12:06 PM
[SOLVED] Grub can't find grub.cfg when booting - error: no such device Breagha Linux - Software 8 03-14-2010 12:40 PM
grub.cfg file configuration help niravshah Linux - Newbie 4 09-19-2009 09:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration