You are not logged in.

#1 2012-03-27 11:24:04

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

[SOLVED] The new grub 2.00, how to disable submenu?

The grub-mkconfig tool makes a submenu for differents kernels, but I don't think it's a good idea.  I have searched google but find nothing to disable submenu.  And the /etc/default/grub file contains nothing to disable submenu.

Solved, the solution is in #6

Last edited by zasdfgbnm (2012-03-28 06:07:07)

Offline

#2 2012-03-27 15:26:08

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [SOLVED] The new grub 2.00, how to disable submenu?

Moving to Newbie Corner


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2012-03-27 15:43:24

masteryod
Member
Registered: 2010-05-19
Posts: 433

Re: [SOLVED] The new grub 2.00, how to disable submenu?

I don't use Grub2 so I'm not an expert but this might help: http://ubuntuforums.org/showthread.php?p=10720316

If it help, please add [SOLVED] to your topic title by editing first post wink

Last edited by masteryod (2012-03-27 15:43:46)

Offline

#4 2012-03-27 17:40:29

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] The new grub 2.00, how to disable submenu?

Edit: useless babbling.

Last edited by .:B:. (2012-03-27 17:44:52)


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2012-03-27 18:28:18

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Offline

#6 2012-03-28 06:03:55

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: [SOLVED] The new grub 2.00, how to disable submenu?

reply to #3:
Thanks for your reply.  The method for ubuntu doesn't support archlinux.
reply to #5:
These topics discussed grub's submenu, but they didn't give the method to disable it.  But they do help me to find a method to disable the submenu.  Thank you!

I add an option called GRUB_ENABLE_SUBMENU and set it to false,here is the patches:
patch for /usr/sbin/grub-mkconfig:

diff --git a/usr/sbin/grub-mkconfig b/usr/sbin/grub-mkconfig
index 81fea9f..124c6a4 100755
--- a/usr/sbin/grub-mkconfig
+++ b/usr/sbin/grub-mkconfig
@@ -184,6 +184,7 @@ export GRUB_DEVICE \
 
 # These are optional, user-defined variables.
 export GRUB_DEFAULT \
+  GRUB_ENABLE_SUBMENU \
   GRUB_HIDDEN_TIMEOUT \
   GRUB_HIDDEN_TIMEOUT_QUIET \
   GRUB_TIMEOUT \

patch for /etc/grub.d/10_linux:

diff --git a/etc/grub.d/10_linux b/etc/grub.d/10_linux
index ee2d032..6f2a55b 100755
--- a/etc/grub.d/10_linux
+++ b/etc/grub.d/10_linux
@@ -249,6 +249,7 @@ while [ "x$list" != "x" ] ; do
     done
   fi
 
+if [ "x${GRUB_ENABLE_SUBMENU}" = xtrue ]; then
   if [ "x$is_first_entry" = xtrue ]; then
     linux_entry "${OS}" "${version}" simple \
     "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
@@ -261,6 +262,7 @@ while [ "x$list" != "x" ] ; do
     # TRANSLATORS: %s is replaced with an OS name
     echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
   fi
+fi
 
   if [[ ! "$(grep "Arch Linux" /etc/os-release)" ]]; then
   linux_entry "${OS}" "${version}" advanced \
@@ -278,10 +280,12 @@ done
 
 # If at least one kernel was found, then we need to
 # add a closing '}' for the submenu command.
+if [ "x${GRUB_ENABLE_SUBMENU}" = xtrue ]; then
 if [[ ! "$(grep "Arch Linux" /etc/os-release)" ]]; then
 if [ x"$is_first_entry" != xtrue ]; then
   echo '}'
 fi
 fi
+fi
 
 echo "$title_correction_code"

patch for /etc/default/grub:

diff --git a/etc/default/grub b/etc/default/grub
index 75be48c..009f91c 100644
--- a/etc/default/grub
+++ b/etc/default/grub
@@ -1,3 +1,4 @@
+GRUB_ENABLE_SUBMENU=false
 GRUB_DEFAULT=0
 GRUB_TIMEOUT=5
 GRUB_DISTRIBUTOR="Arch Linux"

Last edited by zasdfgbnm (2012-03-28 06:04:45)

Offline

#7 2012-03-28 08:35:05

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: [SOLVED] The new grub 2.00, how to disable submenu?

@zasdfgbnm: Can you rebase your patch to https://bugs.archlinux.org/task/29037?getfile=8444

Offline

#8 2012-03-28 09:37:08

masteryod
Member
Registered: 2010-05-19
Posts: 433

Re: [SOLVED] The new grub 2.00, how to disable submenu?

Hmm so official Grub2 doesn't support this? It smells like an upstream feature request to me

Offline

#9 2012-03-29 00:29:51

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: [SOLVED] The new grub 2.00, how to disable submenu?

Let the path grub-a be the source downloaded from gnu, grub-b be the source patched with archlinux_grub_mkconfig_fixes.patch, grub-c be the source after my modification.

the patch from grub-b to grub-c is:

diff --git a/grub-b/util/grub-mkconfig.in b/grub-c/util/grub-mkconfig.in
index 65a7fff..d33afaf 100644
--- a/grub-b/util/grub-mkconfig.in
+++ b/grub-c/util/grub-mkconfig.in
@@ -184,6 +184,7 @@ export GRUB_DEVICE \
 
 # These are optional, user-defined variables.
 export GRUB_DEFAULT \
+  GRUB_ENABLE_SUBMENU \
   GRUB_HIDDEN_TIMEOUT \
   GRUB_HIDDEN_TIMEOUT_QUIET \
   GRUB_TIMEOUT \
diff --git a/grub-b/util/grub.d/10_linux.in b/grub-c/util/grub.d/10_linux.in
index 0d4a137..06b108b 100644
--- a/grub-b/util/grub.d/10_linux.in
+++ b/grub-c/util/grub.d/10_linux.in
@@ -250,6 +250,7 @@ while [ "x$list" != "x" ] ; do
     done
   fi
 
+if [ "x${GRUB_ENABLE_SUBMENU}" = xtrue ]; then
   if [ "x$is_first_entry" = xtrue ]; then
     linux_entry "${OS}" "${version}" simple \
     "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
@@ -262,6 +263,7 @@ while [ "x$list" != "x" ] ; do
     # TRANSLATORS: %s is replaced with an OS name
     echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
   fi
+fi
 
   if ! test -e "/etc/arch-release" ; then
   linux_entry "${OS}" "${version}" advanced \
@@ -279,10 +281,12 @@ done
 
 # If at least one kernel was found, then we need to
 # add a closing '}' for the submenu command.
+if [ "x${GRUB_ENABLE_SUBMENU}" = xtrue ]; then
 if ! test -e "/etc/arch-release" ; then
 if [ x"$is_first_entry" != xtrue ]; then
   echo '}'
 fi
 fi
+fi
 
 echo "$title_correction_code"

the patch for grub.default is:

diff --git a/grub.default b/grub.default.2
index 75be48c..fac8de4 100644
--- a/grub.default
+++ b/grub.default.2
@@ -1,4 +1,8 @@
 GRUB_DEFAULT=0
+
+# Uncomment to place some kernels into submenu
+#GRUB_ENABLE_SUBMENU=true
+
 GRUB_TIMEOUT=5
 GRUB_DISTRIBUTOR="Arch Linux"
 GRUB_CMDLINE_LINUX_DEFAULT="quiet add_efi_memmap"

Last edited by zasdfgbnm (2012-03-29 00:32:54)

Offline

#10 2012-03-29 00:33:36

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: [SOLVED] The new grub 2.00, how to disable submenu?

masteryod wrote:

Hmm so official Grub2 doesn't support this? It smells like an upstream feature request to me

No option to disable it.  We can only edit the code.

Offline

Board footer

Powered by FluxBB