BCD: {ramdiskoptions} 句を使用して複数の WinPE に名前を付ける

BCD: {ramdiskoptions} 句を使用して複数の WinPE に名前を付ける

複数の WinPE バージョンがあり、その説明が表示される BCD ブート メニューが必要です。私はサム ドライブ (後に PXE) を作成し、複数の WinPE 環境 (バージョン 3.1 から 10、x64 および x32) へのブートをサポートしました。問題は、PE へのブート用に BCD ストアを作成するときに、{ramdiskoptions} 句を使用する必要があることです。この場合、ブート時にメニューに各エ​​ントリの「説明」が表示されず、{ramdiskoptions} エントリの説明のみが表示されるため、「Ramdisk Options」という名前の複数のオプションが表示されることになります。これをどのように行ったかを説明します ( %STR%BCD ストアへのフル パスを想定し、%GUID% は以下の例で説明されています)。

1) bcdedit /createstore %STR%
2) bcdedit /store %STR% /create {ramdiskoptions} /d "Ramdisk Options"
3) bcdedit /store %STR% /set {ramdiskoptions} ramdisksdidevice Boot
4) bcdedit /store %STR% /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
5) bcdedit /store %STR% /create /d "WinPE x86 3.1" /application osloader
6) bcdedit /store %STR% /set %GUID% systemroot \Windows
7) bcdedit /store %STR% /set %GUID% detecthal Yes
8) bcdedit /store %STR% /set %GUID% winpe Yes
9) bcdedit /store %STR% /set %GUID% osdevice ramdisk=[boot]\Boot\winpex86-31.wim,{ramdiskoptions}
10) bcdedit /store %STR% /set %GUID% device ramdisk=[boot]\Boot\winpex86-31.wim,{ramdiskoptions}
11) (repeat lines 5 to 10 as needed)
12) bcdedit /store %STR% /create {bootmgr} /d "Windows Boot Manager"
13) bcdedit /store %STR% /set {bootmgr} displayorder %GUID% ........

そこで、WinPE v5 x86、v3.1 x64、v5 x64、v10 の 5 行目から 10 行目を繰り返します。5 行目で新しい説明を設定するたびに、新しい %GUID% を取得し、9 行目と 10 行目で適切なイメージを設定し、最後に、作成したすべての %GUID% で displayorder を実行します。次に、ドライブを起動します。次のように表示されます。

Ramdisk Options
Ramdisk Options
Ramdisk Options
Ramdisk Options
Ramdisk Options

のように、すべてのエントリの説明を表示したいのですが、WinPE x86 3.1何が間違っているのか教えてください。また、easy-bcd を使用してエントリを変更しようとしましたが、成功しませんでした。

編集

さらに少しいじって、別のストアを作成し、そこに {ramdiskoptions} のみを作成しました。2 つのコマンドを発行しましたが、その出力は次のとおりです (ID とタイプのみを表示)。

d:\!@>bcdedit /store %str% /enum all /V
Setup Ramdisk Options
---------------------
identifier              {ae5534e0-a924-466c-b836-758539a3ee3a}
d:\!@>bcdedit /store %str% /enum all
Setup Ramdisk Options
---------------------
identifier              {ramdiskoptions}

つまり、結局のところ、「セットアップ Ramdisk オプション」タイプの別のエントリを作成することになると思いますが、bcdeditor のヘルプで適切なコマンドを見つけることができません。ちなみに、Visual BCD は、外部プログラムがストアを変更するというランダムなエラーを出力し、役に立ちません。

答え1

これを見て記事基本的に、1 つの RAM ディスク デバイスの下に複数のエントリを持つ代わりに、複数の RAM ディスク デバイスを定義できます。

作成できる {ramdiskoptions} オブジェクトは 1 つだけですが、次の回避策を使用して、{ramdiskoptions} ramdisksdipath で指定されたものと異なる .sdi ファイルを使用できます。現時点では、これを実装する実際の用途は見つかっていませんが、cdob が指摘しているように、将来必要になるかもしれません。

bcdedit.exe /store C:\Boot\BCD /create /device

この最初のコマンドを実行すると、グローバル一意識別子 (GUID) 値が返されます - 例: {e05b4c23-618a-11df-89c6-001d925a73cf}。後続のすべてのコマンドでは、{ramdisk_guid} をこの値に置き換えます -

bcdedit.exe /store C:\Boot\BCD /set {ramdisk_guid} ramdisksdidevice partition=C:

bcdedit.exe /store C:\Boot\BCD /set {ramdisk_guid} ramdisksdipath \Boot\different.sdi

これを使ってWinPEを起動するには -

bcdedit.exe /store C:\Boot\BCD /create /application osloader

このコマンドを実行すると、グローバル一意識別子 (GUID) 値が返されます - 例: {bdaf610c-622d-11df-a7ee-a711d7fae90e}。以降のすべてのコマンドでは、{guid} をこの値に置き換え、{ramdisk_guid} を手順 1 のコマンドを実行して作成した GUID に置き換えます -

bcdedit.exe /store C:\Boot\BCD /set {guid} detecthal Yes
bcdedit.exe /store C:\Boot\BCD /set {guid} winpe Yes
bcdedit.exe /store C:\Boot\BCD /set {guid} osdevice ramdisk=[C:]\Sources\boot.wim,{ramdisk_guid}
bcdedit.exe /store C:\Boot\BCD /set {guid} device ramdisk=[C:]\Sources\boot.wim,{ramdisk_guid}
bcdedit.exe /store C:\Boot\BCD /set {guid} description "Windows PE"
bcdedit.exe /store C:\Boot\BCD /displayorder {guid} /addlast

答え2

Windows BCD ストア内のすべてのオブジェクトには GUID があり、適切な場所でそのオブジェクトをリンクするために使用できます。

使用できますビジュアル BCD エディターすべての wim ローダーに対して個別のデバイス オプション オブジェクトを作成します。必要に応じて、これらのオブジェクト内の説明要素に名前を付けます。

次に、必要に応じて、各ローダーのすべてのアプリケーション デバイスおよび OS デバイス要素の対応する GUID を置き換えます。

{ramdiskoptions} は、事前定義された固定 GUID を持つデバイス オプション オブジェクトです。

BCD内のオブジェクトがどのようにリンクされるかについては、以下も参照してください。Windows 7 VHD ブート

答え3

バグのため、{ramdiskoptions} の説明が設定されている場合、後続の WinPE ベースのオブジェクトでは独自の説明が表示されません。

それで

2) bcdedit /store %STR% /create {ramdiskoptions} /d "Ramdisk Options"

次のように変更する必要があります

2) bcdedit /store %STR% /create {ramdiskoptions} 

この小さなトリックにより、Win8/Win10 から最新の Win10 2004 エディションまでのすべての PE で「Ramdisk オプション」として表示されるブート マネージャー項目の問題が完全に修正されました。

サンプルスクリプトはこちらです。

rem Creates BCD (boot configuration data) for three Windows PE 2.0 images or later
rem This script must be running in windows 7/8/10 and run as administrator
rem Or you can run it in the PE 2.or later environment
rem
Rem This script based on the Win10 Installation USB drive
Rem Put you PE wim file inside the \boot folder
Rem Put this script inside the \boot folder
Rem Modifi this script, change the description and the wim file name the match you wim file
Rem At last, run this script to generate BCD file.
Rem ** If you want to change the Boot menut of the UEFI boot, copy the new BCD file to \efi\microsoft\boot\ folder


set BCD-File=.\BCD
del %BCD-File%.bak
ren %BCD-File%  bcd.bak
pause
Bcdedit -createstore %BCD-File%
Bcdedit -store %BCD-File% -create {ramdiskoptions} 
Bcdedit -store %BCD-File% -set {ramdiskoptions} ramdisksdidevice  boot
Bcdedit -store %BCD-File% -set {ramdiskoptions} ramdisksdipath  \boot\boot.sdi


for /f "tokens=1-3" %%a in ('Bcdedit -store %BCD-File% -create /d "1. Win8PEx64 XiaoBai" /application osloader') do set guid4=%%c
Bcdedit -store %BCD-File% -set %guid4% systemroot \Windows
Bcdedit -store %BCD-File% -set %guid4% detecthal Yes
Bcdedit -store %BCD-File% -set %guid4% winpe Yes
Bcdedit -store %BCD-File% -set %guid4% osdevice ramdisk=[boot]\Boot\xiaobaiNT63PEX64.WIM,{ramdiskoptions} 
Bcdedit -store %BCD-File% -set %guid4% device ramdisk=[boot]\Boot\xiaobaiNT63PEX64.WIM,{ramdiskoptions}



for /f "tokens=1-3" %%a in ('Bcdedit -store %BCD-File% -create /d "2. Windows 10 x64 Installation" /application osloader') do set guid6=%%c
Bcdedit -store %BCD-File% -set %guid6% device ramdisk=[boot]\sources\boot.WIM,{ramdiskoptions} 
Bcdedit -store %BCD-File% -set %guid6% path \windows\system32\boot\winload.exe 
Bcdedit -store %BCD-File% -set %guid6% osdevice ramdisk=[boot]\sources\boot.WIM,{ramdiskoptions} 
Bcdedit -store %BCD-File% -set %guid6% systemroot \Windows
Bcdedit -store %BCD-File% -set %guid6% detecthal Yes
Bcdedit -store %BCD-File% -set %guid6% winpe Yes

Bcdedit -store %BCD-File% -create {bootmgr} /d "Windows PE Boot Manager"
Bcdedit -store %BCD-File% -set {bootmgr} timeout 10
Bcdedit -store %BCD-File% -set {bootmgr} displayorder %guid4%  %guid6%
Bcdedit -store %BCD-File% /enum all

関連情報