$ cat /usr/sbin/grub-mkconfig for i in"${grub_mkconfig_dir}"/* ; do case"$i"in *) if grub_file_is_not_garbage "$i" && test -x "$i" ; then echo echo"### BEGIN $i ###" "$i" echo"### END $i ###" fi ;; esac done
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
$ cat /etc/grub.d/00_header if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
if [ -s $prefix/grubenv ]; then set have_grubenv=true load_env fi
set default="${GRUB_DEFAULT}"
if [ x"\${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" else menuentry_id_option="" fi
$ sudo grub-mkconfig -o /boot/grub/grub.cfg Warning: Please don't use old title `Ubuntu, with Linux 5.15.0-50-generic'for GRUB_DEFAULT, use `Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-50-generic' (for versions before 2.00) or `gnulinux-advanced-2f06ea74-37e9-46d4-b3d7-eef0eeb8e1db>gnulinux-5.15.0-50-generic-advanced-2f06ea74-37e9-46d4-b3d7-eef0eeb8e1db' (for 2.00 or later)
这只是一个警告信息,10_linux 脚本会进行相应的规避处理:
1 2 3 4 5 6 7 8
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)""$GRUB_ACTUAL_DEFAULT""$replacement_title""gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" fi
echo"$title_correction_code"
这样会在生成的 grub.cfg 文件中会增加对 default 环境变量的修改操作:
1 2 3
if [ "x$default" = 'Ubuntu, with Linux 5.15.0-50-generic' ]; then default='Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-50-generic'; fi;