|
|
本帖最后由 holts 于 2026-1-13 15:37 编辑
- ## grub4dos for uefi 优化启动菜单
- ## 作者:AI助手
- ## 日期:2026-01-13
- # 设置调试模式
- debug off
- # 初始化变量
- set bt=Unknown
- set ph=
- set win=
- set hdn=0
- set pt=
- set root2=
- set uefi_v=
- # 图形模式与背景设置(避免重复加载)
- calc *0x8312&1 > nul || graphicsmode -1 800
- calc *0x8312&2 > nul || splashimage ()/efi/grub/background.jpg
- calc *0x8312&4 > nul || font /efi/grub/unifont.hex.gz
- # 判断启动环境(BIOS/UEFI)
- if %@uefi%#==# && set bt=BIOS && set ph=/boot ! set bt=EFI_x%@uefi% && set ph=/EFI/grub
- # UEFI环境下加载截图模块
- if %bt%==EFI_x64 load -n /EFI/grub/CrScreenshotDxe.efi
- # 定位Windows系统分区
- if "%@boot%"=="(pd)" || find --set-root /windows | set win=
- set uefi-v=1
- if "%@boot%"=="(pd)" && echo --uefi-v | set uefi_v=
- # 硬盘与分区检测
- rootnoverify (hd-1)
- set /a hdn=*0x82a0&0xff-127
- find checkrange 0xEE parttype && set pt="警告:存在GPT类型的硬盘!!!" ! set pt=""
- if "%@boot%"=="(pd)" && set bt=PXE_V_%uefi_v:~15,5% && set hdn=未知 && set pt=""
- # 根分区一致性检查
- root %@boot%
- set root2==%@root%
- if not %root2%==%@boot% && echo "启动分区与目前根分区不一致,将查找启动分区并设置为根分区!!!" && pause --wait=5
- find --set-root /efi/grub/unifont.hex.gz
- # 热键配置(需在字库加载后执行)
- %ph%/ext/hotkey -A [F4] commandline
- %ph%/ext/hotkey -A [F3] reboot
- setmenu --hotkey-color=0xffff00
- # 菜单颜色配置
- color normal=0x0F highlight=0x0A helptext=0x05 heading=02 border=01
- # 菜单布局设置
- setmenu --box x=9 w=0 y=8 h=10 l=10 --ver-on
- # 菜单项定义
- title 启动维护工具
- commandline
- title 重启计算机
- reboot
- title 关机
- halt
- title 运行诊断工具
- %ph%/ext/diag_tool
- title 网络启动 (iPXE)
- if %bt%==BIOS && chainloader /ipxe.bios && boot
- if %bt%==EFI_x64 && chainloader /ipxe.efi && boot
- title 文件管理器 (grubfm)
- %ph%/ext/grubfm
- title 返回上级菜单
- configfile /efi/grub/main_menu.lst
- # 版权与帮助信息
- help grub4dos UEFI启动菜单 v2.0
- help 优化日期: 2026-01-13
- help 支持BIOS/UEFI双模式启动
复制代码
我让AI优化楼主这个菜单,整出个上面的东西,不轮不论,弱智。 |
|