使用grub setup_var给600g1DM解锁CFG LOCK, 修改DVMT Pre-Allocated

目录

要用到的工具

UEFITool Universal IFR Extractor grub_setupvar.efi 如果你的机型为800g1DM或者600g1DM,可以直接跳到制作grub启动盘 这一步。

提取cfg lock所在的模块

  1. 打开UEFITool,找到file -> open image file, 导入用编程器从中读取出来的二进制文件
  2. 搜索cfg lock,找到file -> search… 选项,搜索"cfg lock” MMTool1
  3. 双击下面搜索结果,会自动定位到cfglock所在的位置 MMTool2
  4. 右键Extract body导出模块保存为cfglock.bin

查找cfg lock和DVMT Pre-Allocated选项在bios中的位置

  1. 打开Universal IFR Extractor, 载入刚刚导出的cfglock.bin,点击Extract将模块转换为txt Universal IFR Extractor
  2. 打开刚刚转换好的txt文件,搜索关键词"cfg lock”, 可以看到Variable为0x4A3 cfglock_location 这里还记录了变量值的含义, 例如0x00为Disabled(禁用), 0x01为Enabled(启用)
1
2
3
4
0xBF518 				Setting: CFG lock, Variable: 0x4A3 {05 A6 0F 02 10 02 5C 00 01 00 A3 04 10 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00}
0xBF53E 					Option: Disabled, Value: 0x0 {09 0E CC 01 00 00 00 00 00 00 00 00 00 00}
0xBF54C 					Option: Enabled, Value: 0x1 {09 0E CB 01 30 00 01 00 00 00 00 00 00 00}
0xBF55A 				End of Options {29 02}
  1. 搜索关键词"DVMT Pre-Allocated”, 可以看到Variable为0x233 Universal IFR Extractor 此处也记录了变量值的含义,我们要改的96M就是0x3
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
0xCDC94 			Setting: DVMT Pre-Allocated, Variable: 0x233 {05 A6 01 05 13 05 11 01 01 00 33 02 10 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00}
0xCDCBA 				Option: 32M, Value: 0x1 {09 0E 02 05 30 00 01 00 00 00 00 00 00 00}
0xCDCC8 				Option: 64M, Value: 0x2 {09 0E 03 05 00 00 02 00 00 00 00 00 00 00}
0xCDCD6 				Option: 96M, Value: 0x3 {09 0E 04 05 00 00 03 00 00 00 00 00 00 00}
0xCDCE4 				Option: 128M, Value: 0x4 {09 0E 05 05 00 00 04 00 00 00 00 00 00 00}
0xCDCF2 				Option: 160M, Value: 0x5 {09 0E 06 05 00 00 05 00 00 00 00 00 00 00}
0xCDD00 				Option: 192M, Value: 0x6 {09 0E 07 05 00 00 06 00 00 00 00 00 00 00}
0xCDD0E 				Option: 224M, Value: 0x7 {09 0E 08 05 00 00 07 00 00 00 00 00 00 00}
0xCDD1C 				Option: 256M, Value: 0x8 {09 0E 09 05 00 00 08 00 00 00 00 00 00 00}
0xCDD2A 				Option: 288M, Value: 0x9 {09 0E 0A 05 00 00 09 00 00 00 00 00 00 00}
0xCDD38 				Option: 320M, Value: 0xA {09 0E 0B 05 00 00 0A 00 00 00 00 00 00 00}
0xCDD46 				Option: 352M, Value: 0xB {09 0E 0C 05 00 00 0B 00 00 00 00 00 00 00}
0xCDD54 				Option: 384M, Value: 0xC {09 0E 0D 05 00 00 0C 00 00 00 00 00 00 00}
0xCDD62 				Option: 416M, Value: 0xD {09 0E 0E 05 00 00 0D 00 00 00 00 00 00 00}
0xCDD70 				Option: 448M, Value: 0xE {09 0E 0F 05 00 00 0E 00 00 00 00 00 00 00}
0xCDD7E 				Option: 480M, Value: 0xF {09 0E 10 05 00 00 0F 00 00 00 00 00 00 00}
0xCDD8C 				Option: 512M, Value: 0x10 {09 0E 11 05 00 00 10 00 00 00 00 00 00 00}
0xCDD9A 				Option: 1024M, Value: 0x11 {09 0E 12 05 00 00 11 00 00 00 00 00 00 00}
0xCDDA8 			End of Options {29 02}

制作grub启动盘

  1. 将u盘格式化为FAT32格式,建立文件夹EFI/BOOT/
  2. 将grub_setupvar.efi重命名为bootx64.efi, 放到EFI分区的EFI/BOOT/bootx64.efi.
  3. 此时从u盘启动就可以进入grub命令行界面了

注意,这里的grub_setupvar.efi为特制的grub,也就是给普通的grub添加了一个setup_var模块

修改值cfglock和DVMT

此处需要修改cfg lock和DVMT Pre-Allocated的值,前面的工作已经找到了这两个变量的地址,以800g1DM或600g1DM为例,这两个变量的地址为0x4A30x233

我们要关闭cfg lock并且把DVMT Pre-Allocated改为96M,在grub命令行中输入以下命令即可。

1
2
3
4
#关闭CFG锁
setup_var 0x4A3 0x0
#设置DVMT为96M
setup_var 0x233 0x3

附:

setup_var命令的用法

1
2
3
4
# 查看0x233处的值
setup_var 0x233
# 设置0x233处为0x03
setup_var 0x233 0x3

工具下载链接

此处的工具只包含了grub_setupvar.efi 和 Universal IFR Extractor,UEFITool可以去网上自行下载 cfglock-dvmt-tools.zip