2013年6月22日 星期六

製作Winpe x86與x64二合一的開機選單 (2)

前一篇文章製作Winpe x86與x64二合一的開機選單 (1) 介紹使用BCDedit來製作多重開機選單,使用Winpe 3.0的BCD檔,不知是否有發現多了一個"Windows Setup [EMS Enable]"的選單呢?
如果這個選單有放置對應的Image,基本上是可以操作的,但如果沒有放置Image的話,將會覺得這個開機選項是多餘。
接下來將介紹自行製作一個從零到可以使用多重開機選項的BCD檔。
參考以下的方法即可以順利製作出屬於自己的BCD檔,相關參考資料可至微軟官網
set bcd_path=e:\test\bcd
if exist %bcd_path% del /q %bcd_path%

::建立新的空白的BCD檔
bcdedit /createstore %bcd_path%

::建立 RAMDISK 設定
bcdedit /store %bcd_path% /create {ramdiskoptions}
::bcdedit /store %bcd_path% /create {ramdiskoptions} /d "Ramdisk options" ::如要製作多重開機選單,千萬不要添加/d "Ramdisk options",不然看不到開機選單名稱
bcdedit /store %bcd_path% /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /store %bcd_path% /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi

::建立核心偵錯程式設定(選用)
Bcdedit /store %bcd_path% /create {dbgsettings}
Bcdedit /store %bcd_path% /set {dbgsettings} debugtype serial
Bcdedit /store %bcd_path% /set {dbgsettings} baudrate 115200
Bcdedit /store %bcd_path% /set {dbgsettings} debugport 1

::建立Winpe 3.0 x86 OSLoader 設定
::若 Create 成功,電腦會傳回 GUID 值
for /f "tokens=1-3 delims={}" %%i in ('bcdedit /store %bcd_path% /create /d "Winpe 3.0 x86" /application osloader') do set guid1=%%j
bcdedit /store %bcd_path% /set {%guid1%} device ramdisk=[boot]\sources\pe_x86.wim,{ramdiskoptions}
bcdedit /store %bcd_path% /set {%guid1%} osdevice ramdisk=[boot]\sources\pe_x86.wim,{ramdiskoptions}
bcdedit /store %bcd_path% /set {%guid1%} locale en-US
bcdedit /store %bcd_path% /set {%guid1%} path \windows\system32\boot\winload.exe
bcdedit /store %bcd_path% /set {%guid1%} systemroot \windows
bcdedit /store %bcd_path% /set {%guid1%} detecthal Yes
bcdedit /store %bcd_path% /set {%guid1%} winpe Yes
bcdedit /store %bcd_path% /set {%guid1%} ems Yes
::bcdedit /store %bcd_path% /set {bootmgr} default {%guid1%}

::建立Winpe 3.0 x64 OSLoader 設定
for /f "tokens=1-3 delims={}" %%i in ('bcdedit /store %bcd_path% /create /d "Winpe 3.0 x64" /application osloader') do set guid2=%%j
bcdedit /store %bcd_path% /set {%guid2%} device ramdisk=[boot]\sources\pe_x64.wim,{ramdiskoptions}
bcdedit /store %bcd_path% /set {%guid2%} osdevice ramdisk=[boot]\sources\pe_x64.wim,{ramdiskoptions}
bcdedit /store %bcd_path% /set {%guid2%} locale en-US
bcdedit /store %bcd_path% /set {%guid2%} path \windows\system32\boot\winload.exe
bcdedit /store %bcd_path% /set {%guid2%} systemroot \windows
bcdedit /store %bcd_path% /set {%guid2%} detecthal Yes
bcdedit /store %bcd_path% /set {%guid2%} winpe Yes
bcdedit /store %bcd_path% /set {%guid2%} ems Yes
::bcdedit /store %bcd_path% /set {bootmgr} default {%guid1%}

::建立 BOOTMGR 設定
bcdedit /store %bcd_path% /create {bootmgr}
bcdedit /store %bcd_path% /set {bootmgr} description "Windows Boot Manager"
bcdedit /store %bcd_path% /set {bootmgr} inherit {dbgsettings}  
bcdedit /store %bcd_path% /set {bootmgr} locale en-US
bcdedit /store %bcd_path% /set {bootmgr} device boot
bcdedit /store %bcd_path% /set {bootmgr} timeout 20
bcdedit /store %bcd_path% /set {bootmgr} displayorder {%guid1%} {%guid2%}

::調整開機順序(選用)
bcdedit /store %bcd_path% /set {bootmgr} displayorder {%guid1%} /addlast

bcdedit /store %bcd_path% /enum all
開機畫面

沒有留言:

張貼留言