Slackware で rEFInd を利用し複数の EFI ブートエントリを切り替える ＋ Desktop 向け BSD ディストリ用おまけアイコン


[当方執筆の技術情報に関するライセンス、免責事項、禁止事項](https://qiita.com/EarthSimilarityIndex/items/6b9bb2ccacb38aae15b1)

****

# Slackware で rEFInd を利用し複数の EFI ブートエントリを切り替える

![screenshot_002.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/ea8f1f7c-c2fa-f826-d012-f6c13608e31f.png)

[UEFI](https://ja.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface) な実験環境にごちゃぁっと OS が入っている場合に重宝します。

※ rEFInd は Intel Mac 専用というわけではなく、UEFI マザーな PC/AT 互換機で問題なく使えます。

## 本稿執筆における参考文献
**UEFI dual or more boot using rEFInd - SlackDocs**
https://docs.slackware.com/howtos:slackware_admin:uefi_triple_boot_with_refind_on_slackware

**The rEFInd Boot Manager**
http://www.rodsbooks.com/refind/

## 安全のために
・大切なデータのバックアップをとっていること
・ブート用 USB メディア等、ローダー破損によるブート不能時の復旧手段を持っていること

## 手順
1. UEFI マシンへの Slackware インストール時に LILO ではなく ELILO を選択。 
2. SlackBuilds.org から [rEFInd を導入](https://slackbuilds.org/repository/14.2/system/refind/)。
3. ルートで ```/usr/share/refind-0.11.4/refind-install``` を実行。

※ 上記手順 3. はインストール済みのrEFInd のバージョンが 0.11.4 の場合
※ SlackBuilds.org の使い方は[こちら](https://slackbuilds.org/howto/)（日本語の説明記事を[書いてみました](https://qiita.com/EarthSimilarityIndex/items/0bbd1cea3425fe0f6a66)）。

## 注意点

EFI システムパーティションの容量が小さい、もしくは容量を使い切っている場合、F10 キーによるスクリーンショットが撮影出来なくなる場合があります。

複数のドライブがブート可能かつ EFI システムパーティション（ESP[^esp]）を持っている場合、OS のインストーラーや ELILO 及び rEFInd が**正しくインストール操作を行えない**場合があります。


[^esp]: [超感覚的知覚](https://ja.wikipedia.org/wiki/%E8%B6%85%E6%84%9F%E8%A6%9A%E7%9A%84%E7%9F%A5%E8%A6%9A)……ではない。

## パッケージ付属 README

<details>
<summary>**/usr/share/doc/refind-0.11.4/README.txt**</summary>
<div>

```
Brief Installation Instructions (Binary Package)
================================================

This is rEFInd, an EFI boot manager. The binary package includes the
following files and subdirectories:

   File                             Description
   -----------------------------    -----------------------------
   refind/refind_ia32.efi           The main IA32 rEFInd binary
   refind/refind_x64.efi            The main x86-64 rEFInd binary
   refind/refind.conf-sample        A sample configuration file
   refind/icons/                    Subdirectory containing icons
   refind/drivers_ia32/             Subdirectory containing IA32 drivers
   refind/drivers_x64/              Subdirectory containing x86-64 drivers
   keys/                            Subdirectory containing MOKs
   refind-install                   Linux/MacOS installation script
   refind-mkdefault                 Script to make rEFInd the default
   mkrlconf                         A script to create refind_linux.conf
   mvrefind                         A script to move a rEFInd installation
   README.txt                       This file
   NEWS.txt                         A summary of program changes
   LICENSE.txt                      The original rEFIt license
   COPYING.txt                      The rEFInd license
   CREDITS.txt                      Acknowledgments of code sources
   docs/                            Documentation in HTML format

The easiest way of installing rEFInd is generally to use the refind-install
script; however, you must be running under Linux or OS X to do this. If
you're using either of those OSes, simply typing "./refind-install" will
generally install rEFInd. If you have problems with this method, though,
you'll have to do a manual installation. The refind-install script supports
a number of options that you might want to use; consult the
docs/refind/installing.html file for details.

To install the binary package manually, you must first access your EFI
System Partition (ESP). You can then place the files from the refind
subdirectory in a subdirectory of the ESP's EFI directory. You may omit the
.efi binary for the type of computer you're NOT using, and you may
optionally rename the .efi file for the binary you are using. If this is an
initial installation, you should rename refind.conf-sample to refind.conf;
but if you're replacing an existing installation, you should leave your
existing refind.conf intact. The end result might include the following
files on the ESP:

 EFI/refind/refind_x64.efi
 EFI/refind/refind.conf
 EFI/refind/icons/

Unfortunately, dropping the files in the ESP is not sufficient; as
described in the docs/refind/installing.html file, you must also tell your
EFI about rEFInd. Precisely how to do this varies with your OS or, if you
choose to do it through the EFI, your EFI implementation. In some cases you
may need to rename the EFI/refind directory as EFI/boot, and rename
refind_x86.efi to bootx64.efi (or refind_ia32.efi to bootia32.efi on 32-bit
systems). Consult the installing.html file for full details.

If you want to use any of the filesystem drivers, you must install them,
too. Creating a subdirectory of the rEFInd binary directory called
drivers_x64 (for x86-64 systems), drivers_ia32 (for x86 systems), or
drivers (for any architecture) and copying the drivers you want to this
location should do the trick. When you next launch it, rEFInd should load
the drivers, giving you access to the relevant filesystems.

Brief Installation Instructions (Source Package)
================================================

rEFInd source code can be obtained from
https://sourceforge.net/projects/refind/. Consult the BUILDING.txt file in
the source code package for build instructions. Once  you've built the
source code, you can use the refind-install script to install the binaries
you've built. Alternatively, you can duplicate the directory tree described
above by copying the individual files and the icons directory to the ESP.

```

</div>
</details>

折りたたみは便利ですね。

<details>
<summary>**参考文献：折りたたみ**</summary>
<div>

details tag
https://www.w3schools.com/TAGS/tag_details.asp

summary tag
https://www.w3schools.com/TAGS/tag_summary.asp

div tag
https://www.w3schools.com/TAGS/tag_div.asp

collapsible markdown · GitHub
https://gist.github.com/joyrexus/16041f2426450e73f5df9391f7f7ae5f

Qiita Markdown で折りたたみを表現する方法
https://qiita.com/matagawa/items/31e26e9cd53c3e61ae07

[Qiita Markdown記法]ページ内リンク・注釈・折りたたみ等
https://qiita.com/aymikmts/items/71e550bf2c10f36883e9

Markdown記法 チートシート
https://qiita.com/Qiita/items/c686397e4a0f4f11683d

</div>
</details>

# おまけ：Desktop 向け BSD ディストリ用アイコン
Desktop-oriented な BSD 向け。

rEFInd パッケージ内の os_○○○.png や各 OS のロゴから適当に作成。
著作権及び使用許諾は素材とした画像に準じます。

**rEFInd のテーマに関しての詳細：**
http://www.rodsbooks.com/refind/themes.html

## おまけアイコンの使い方
ESP が /boot/efi にマウントされている場合、/boot/efi/EFI/ 以下のターゲット OS のフォルダ名と配置した /boot/efi/EFI/refind/icons/os_○○○.png の ○○○ を揃えることでカスタムロゴ画像を表示出来ました。

例:
/boot/efi/EFI/**ghostbsd**/
と
/boot/efi/EFI/refind/icons/os_**ghostbsd**.png

## GhostBSD
![os_ghostbsd.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/94ec9c50-46b3-f8cd-ebd4-6004a03ba6bd.png)
https://ghostbsd.org/

## Project Trident
![os_projecttident.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/87cb77c1-7e2a-9aa7-22c1-1dd75c28d03a.png)
https://project-trident.org/

## NomadBSD
![os_nomadbsd.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/61dafa05-76ba-1bc3-de3e-1efde768fed6.png)
http://nomadbsd.org/
https://github.com/nomadbsd/NomadBSD/tree/master/nomad/Wallpapers

## MidnightBSD
![os_midnightbsd.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/0bc3879c-c1a7-a63d-2655-2810a2bb700e.png)
https://www.midnightbsd.org/
https://www.midnightbsd.org/art/

## OS108
![os_os108.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/a1b823ff-d132-75cd-f7b8-903ac985b444.png)

https://os108.org/
https://github.com/OS108/OS108/tree/master/OS108_logo

## OpenBSD
![os_openbsd.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/ff878dd6-2fa4-7475-5ff8-8f7d45527e2d.png)


https://www.openbsd.org/
https://www.openbsd.org/art4.html
https://commons.wikimedia.org/wiki/File:Poisson-lune.jpg

## DragonFlyBSD
![os_dragonflybsd.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/b4cc41b4-63ca-6eb4-aaa9-4fd941807f89.png)


https://www.dragonflybsd.org/
https://www.dragonflybsd.org/images/
https://commons.wikimedia.org/wiki/File:Nannophya_pygmaea_male.JPG