0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Boot Campで起動画面から直接Windows Recovery Environment(Windows 回復環境)を呼び出す方法

Last updated at Posted at 2020-06-06

記事を書いた経緯

僕はBoot Campを使ってWindows 10をMacBook Proに入れています。
Windows Recovery Environmentを起動する必要がある場面に遭遇した時、Boot CampではWindows Recovery Environmentを起動時に呼び出すキーコンビネーションが存在しないため、Windows 10を一旦起動して、その後にShiftキーを押しながら電源メニューを開いて再起動を押す方法しか見つからず、他にいい方法はないのか探したところ、rEFIndを使って呼び出す方法を見つけたので、備忘録的な感じで書くことにしました。

rEFIndのインストール

  • Apple T2チップを搭載したMacをお使いの方は、まずこのページを参考に、**安全な起動の項目をセキュリティなしに、外部起動**の項目を外部メディアからの起動を許可に変更してください。
  • macOS 10.12以降をお使いの方で、ターミナルでcsrutil statusを実行して、enabledと出てきた方は、先にこちらを参考にSIPを無効化してください。
  1. ここ のページに掲載されている、A binary zip fileのリンクからrEFIndをダウンロードします。
Screenshot_2020-06-06 The rEFInd Boot Manager Getting rEFInd.png
  1. ダウンロードしたら、解凍します。
  2. 解凍したら、以下のコマンドを実行して、インストールします。
  • 本記事では、rEFIndのzipを保存した場所は~/Downloads、ダウンロードしたバージョンは最新版の0.12.0とします。

    hoge@hogeMac:~$ sudo mountesp && sudo rm -rf /Volumes/ESP/Boot /Volumes/ESP/BOOT
    hoge@hogeMac:~$ cd ~/Downloads
    hoge@hogeMac:~/Downloads$ unzip ./refind-bin-0.12.0.zip
    hoge@hogeMac:~/Downloads$ cd ./refind-bin-0.12.0
    hoge@hogeMac:~/Downloads/refind-bin-0.12.0$ ./refind-install --usedefault # usedefaltオプションをつけると/ESP/EFI/BOOTにインストールされるので色々と楽です。
    Not running as root; attempting to elevate privileges via sudo....
    ShimSource is none
    Installing rEFInd on macOS....
    Installing rEFInd to the partition mounted at /Volumes/ESP
    Found rEFInd installation in /Volumes/ESP/EFI/BOOT; upgrading it.
    Copied rEFInd binary files
    (中略)
    sed: 1: "/Volumes/ESP//EFI/BOOT/ ...": invalid command code E # インストールは正常にできているのでスルーして大丈夫です。
    
  • 以上でインストールは完了です。

rEFIndの設定

rEFIndインストール直後、EFIという名前のボリュームがマウントされていると思います。マウントされていないという方は、sudo mountespを実行することでマウントができます。マウントされた状態で、/Volumes/ESP/EFI/BOOT/refind.confの末尾に以下の内容を追記します。

/Volumes/ESP/EFI/BOOT/refind.conf
menuentry "macOS" {
    icon \EFI\BOOT\icons\os_mac.png
    volume "Preboot"
    loader \hogefuga-fugafuga\System\Library\CoreServices\boot.efi
    enabled
}

menuentry "Windows 10" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
    enabled
    submenuentry "Windows Recovery Environment" {
        loader \EFI\Microsoft\Boot\bootmgfw.efi
	    options "/RecoveryBCD"
    }
}

scanfor external,optical,manual,biosexternal,cd

showtools shell, gdisk, csr_rotate, bootorder, memtest, apple_recovery, windows_recovery, about, hidden_tags, reboot, shutdown
csr_values 10,77

  • loader \hogefuga-fugafuga\System\Library\CoreServices\boot.efiの、hogefuga-fugafugaの部分は、環境によって異なります。diskutil mount Preboot && ls /Volumes/Prebootを実行して出てきた文字列に変えてください。
  • デフォルトでは20秒経つと自動的にmacOSが起動するようになっているので、無効化したい方はrefind.confの先頭にあるtimeout 20timeout 0にすると無効化できます。

Windows Recovery Environmentの起動

  • Macを再起動すると、rEFIndの画面が出てくるようになると思います。その状態で、矢印キーを使ってWindowsのアイコンへと移動し、移動したらtabキーを押してサブメニューを表示させます。Windows Recovery Environmentという項目があると思うので、それを選んでエンターキーを押すとWindows Recovery Environmentが立ち上がります。

Windows Recovery Environmentが起動する仕組み

詳しい仕組みはこちら に書いていますが、EFI領域にあるbootmgfwに、/RecoveryBCDというオプションをつけて実行するとWindows Recovery Environmentが立ち上がるようになっているようです。
そのため上記の設定ファイルでは、サブメニューエントリーを作成し、optionsというキーにRecoveryBCDを設定しています。そうすることでサブメニューエントリーのWindows Recovery Environmentが起動するようになっている、というわけです。

セーフモードの起動

(おまけ)「なんかrEFIndの画面ダセエ」という方へ

rEFIndには、rEFIndの画面に表示されるアイコン類や、rEFIndの画面の背景を自由に変えられる機能があります。
ネットに色々なテーマが公開されていますが、僕がおすすめするテーマはrefind-theme-regularrefind-theme-oledです。
Macのデフォルトの起動画面が白い方はrefind-theme-regular、黒い方はrefind-theme-oledが良いと思います。

  • refind-theme-regular

image.png

  • refind-theme-oled
image.png

なお、rEFIndのインストールで--usedefaultオプションをつけてインストールした場合、refind.conf内のinclude文が認識されません。そのため、テーマを導入する際はrefind.confの中に各テーマのtheme.confの内容を直貼りする必要があります。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?