Grub Version: GRUB2
Basic knowledge:
related file and directory structure :
A. /etc/grub.d/
There is a 40_custom script: You can add a custom startup item by modifying the 40_custom scripts.
B. /etc/grub2.cfg or/etc/grub2-efi.cfg (which file depends on how the system starts)
These two files contain some startup items (different kernel versions)
Start to say the right thing:
How to add a custom startup item
Outline
Modify the file 40_custom in the/etc/grub.d/directory first, and then execute the GRUB2-MKCONFIG program to generate the GRUB2 configuration file grub2-efi.cfg
1. How to modify: Find a ready-made menu entry template in the section related to the menu entry (in the configuration file grub2-efi.cfg), copy and paste into the new file
Vim a newentry, use it instead of/etc/grub.d/40_custom
(OK this custom startup item, just copy the contents of the previous startup item)
Menuentry ' Custom content '
2. Generate a new grub configuration file
Executes the Grub2-mkconfig-o/etc/grub2.cfg command, which generates a new grub2-efi.cfg configuration file.
3.reboot Restart to detect if a new startup item is available.
Successful, the cursor is the new startup item.
Reference: <linux Kernel fundamentals> 019 Challenge solution Instructional video.
To add a new startup item using GRUB (menu entry)