代替カーネルの起動オプションをトップレベルの GRUB メニューに表示するにはどうすればよいですか?

代替カーネルの起動オプションをトップレベルの GRUB メニューに表示するにはどうすればよいですか?

私は Gentoo Linux を唯一の OS として使用しているため、最上位レベル (つまり、GRUB が起動するレベル。下位レベルのメニューは、"Gentoo Linux の詳細オプション" オプションを選択して Enter キーを押したときに表示されるメニューです) の GRUB メニューの "Gentoo Linux の詳細オプション" エントリに隠れている Gentoo ブート オプションを表示したいのですが、これは可能ですか? 手動で編集してこれを行うことはできますが、再実行するたびに手動でファイル/boot/grub/grub.cfgを編集し続けなくてもよいように、より永続的なソリューションが必要です。"Gentoo Linux の詳細オプション" メニュー内でオプションを探すことなく、GRUB が起動したらすぐに代替カーネルを選択できるようにしたいからです。明確にするために、私は GRUB Legacy ではなく GRUB2 を使用しています。/boot/grub/grub.cfggrub-mkconfig -o /boot/grub/grub.cfg

答え1

私は Gentoo に慣れていません (Ubuntu のみ)。ただし、/etc/grub.d/10_linuxで定義された変数を使用して構成が行われます/etc/default/grub(パスは Gentoo では異なる場合があります)。 または を参照してください。後者は次のように述べていますman grub-mkconfig: info -f grub -n 'Simple configuration'

The file '/etc/default/grub' controls the operation of
'grub-mkconfig'.  It is sourced by a shell script, and so must be valid
POSIX shell input; normally, it will just be a sequence of 'KEY=value'
lines...

'GRUB_DISABLE_SUBMENU'
     Normally, 'grub-mkconfig' will generate top level menu entry for
     the kernel with highest version number and put all other found
     kernels or alternative menu entries for recovery mode in submenu.
     For entries returned by 'os-prober' first entry will be put on top
     level and all others in submenu.  If this option is set to 'y',
     flat menu with all entries on top level will be generated instead.
     Changing this option will require changing existing values of
     'GRUB_DEFAULT', 'fallback' (*note fallback::) and 'default' (*note
     default::) environment variables as well as saved default entry
     using 'grub-set-default' and value used with 'grub-reboot'.

/etc/default/grubしたがって、 (またはそれがどこにあるか)を探してを設定しますGRUB_DISABLE_SUBMENU=y。その後、 を再実行しますgrub-mkconfig

関連情報