refind介绍
⾸先,refind⼀般在UEFI启动环境下使⽤,他可以⽤来引导各类的启动(Windows 8+,Linux,Mac OS),不基于任何操作系统平台,总之,当refind被选为系统⾸选引导项的时候,可以实现如下的效果:
⼆、rEFind的使⽤
必须提醒的是:下⾯所述的所有关于rEFInd引导教程都必须要求电脑⽀持UEFI,传统的Legacy引导不可⽤!本部分可以基于两个系统平台来进⾏,⾸先是平台,个⼈推荐Linux下进⾏,简单快捷。
基于debian系的Linux平台的rEFInd安装:(建议选择此种安装⽅式)
sudo apt-add-repository ppa:rodsmith/refind
sudo apt-get update
sudo apt-get install refind
安装过程中会弹出来⼀个选择页⾯,选Yes就对了。
或者⼿动安装,deb包下载链接:
双击安装,或者命令⾏安装,命令⾏逼格⾼⼀点
sudo dpkg -i refind_0.11.4-1_amd64.deb
sudo refind-install
到此,refind的安装已经完毕,⽐Windows不知道快到哪⾥去了。
其实完成到这⼀步,电脑默认会⾸选rEFInd引导,反正我的电脑是。如果没有,可以⾃⼰去BIOS中设置⼀下,这个就不多说了,相信⼤家应该会,如果不会进BIOS的话,也可以在Windows平台通过easyUEFI软件进⾏处理,这⼀步等后⾯介绍Windows平台的使⽤再说。
下⾯是rEFInd的编辑与使⽤:
Refind所有的配置信息位于/boot/efi/EFI/f。
下⾯对这⼀⽂件⽤得到的相关参数说明⼀下:
#
# f
# Configuration file for the rEFInd boot menu
#
# Timeout in seconds for the main menu screen. Setting the timeout to 0
# disables automatic booting (i.e., no timeout). Setting it to -1 causes
# an immediate boot to the default OS *UNLESS* a keypress is in the buffer
# when rEFInd launches, in which case that keypress is interpreted as a
# shortcut key. If no matching shortcut is found, rEFInd displays its
# menu with no timeout.
#
# 设置默认等待时间为5s
# timeout 0代表⽆限等待timeout -1代表⽴即进⼊对应的系统
timeout 5
#
# Set the screen's video resolution. Pass this option either:
# * two values, corresponding to the X and Y resolutions
# * one value, corresponding to a GOP (UEFI) video mode
# Note that not all resolutions are supported. On UEFI systems, passing
# an incorrect value results in a message being shown on the screen to
# that effect, along with a list of supported modes. On EFI 1.x systems
# (e.g., Macintoshes), setting an incorrect mode silently fails. On both
# types of systems, setting an incorrect resolution results in the default
# resolution being used. A resolution of 1024x768 usually works, but higher
# values often don't.
# Default is "0 0" (use the system default resolution, usually 800x600).
#
# 分辨率设置,我建⽴这⾥别动,上⾯注释中也说了。1024*768以上的分辨率并不⽀持,
# 我是默认的,没动它,所以没事别⾃⼰搞个1920 1080
# resolution 1024 768
# resolution 1440 900
# resolution 3
#
# Directories that should NOT be scanned for boot loaders. By default,
# rEFInd doesn't scan its own directory, the EFI/tools directory, the
# EFI/memtest directory, the EFI/memtest86 directory, or the
# very.boot directory. Using the dont_scan_dirs option
# enables you to "blacklist" other directories; but be sure to use "+"
# as the first element if you want to continue blacklisting existing
# directories. You might use this token to keep EFI/boot/bootx64.efi out
# of the menu if that's a duplicate of another boot loader or to exclude
# a directory that holds drivers or non-bootloader utilities provided by
# a hardware manufacturer. If a directory is listed both here and in
# also_scan_dirs, dont_scan_dirs takes precedence. Note that this
# blacklist applies to ALL the filesystems that rEFInd scans, not just
# the ESP, unless you precede the directory name by a filesystem name or
# partition unique GUID, as in "myvol:EFI/somedir" to exclude EFI/somedir
# from the scan on the myvol volume but not on other volumes.
#
# 这部分看注释的意思,应该是不扫描ESP分区的某些⽂件夹,我⾃⼰为了去除某些多余
# 的启动项,于是设置了dont_scan_dirs ESP:/EFI/ubuntu,但不知道为什么,没有⽤,
# 启动项⾥仍会出现Ubuntu的引导项,所以我不建议在这部分选择屏蔽引导项.
# dont_scan_dirs ESP:/EFI/boot,EFI/Dell,EFI/memtest86
# Files that should NOT be included as EFI boot loaders (on the
# first line of the display). If you're using a boot loader that
# relies on support programs or drivers that are installed alongside
# the main binary or if you want to "blacklist" certain loaders by
# name rather than location, use this option. Note that this will
# NOT prevent certain binaries from showing up in the second-row
# set of tools. Most notably, various Secure Boot and recovery
# tools are present in this list, but may appear as second-row
# items.
# items.
# The file may be specified as a bare name (e.g., "notme.efi"), as
# a complete pathname (e.g., "/EFI/somedir/notme.efi"), or as a
# complete pathname with volume (e.g., "SOMEDISK:/EFI/somedir/notme.efi"
# or 2C17D5ED-850D-4F76-BA31-47A561740082:/EFI/somedir/notme.efi").
# OS tags hidden via the Delete or '-' key in the rEFInd menu are
# added to this list, but stored in NVRAM.
# The default is shim.efi,shim-fedora.efi,shimx64.efi,PreLoader.efi,
# TextMode.efi,ebounce.efi,GraphicsConsole.efi,MokManager.efi,HashTool.efi,
# HashTool-signed.efi,bootmgr.efi,fb{arch}.efi
# (where "{arch}" is the architecture code, like "x64").
#
# 这部分和上⾯那部分类似,都是屏蔽之⽤,区别在于上⾯部分是针对⽂件夹,这部分是针
# 对具体⽂件,这部分在去除某些启动项有着极为关键的作⽤,我将详细展开叙述。
# dont_scan_files shim.efi,MokManager.efi
多余启动项的删除策略:
⾸选,我们可以先看⼀下EFI分区的⽂件信息:(Linux系统中的位置:boot/efi/EFI)
refind他针对某些.efi的⽂件会选择⽆脑的引导,因此我们为了简洁或者美观,需要屏蔽某些⽂件的引导,屏蔽不会修改原EFI分区中的系统引导⽂件,换⾔之,安全,针对我的Deepin,引导⽂件位于deepin/grubx64.efi(EFI分区的相对路径),以及我的Windows引导⽂件,位于Microsoft/Boot/bootmgfw.efi,⽽我们需要保留的就这两个,其他的⼀律屏蔽,屏蔽的命令:
dont_scan_files /EFI/ubuntu/grubx64.efi,XXX,XXX
(这代表屏蔽了⽂件夹下的grubx64.efi引导⽂件,还需要屏蔽其他⽂件XXX,直接在上⾯的指令中以英⽂格式下的逗号分隔就好了,最后⼀项不需要逗号)
# Scan for Linux kernels that lack a ".efi" filename extension. This is
# useful for better integration with Linux distributions that provide
# kernels with EFI stub loaders but that don't give those kernels filenames
# that end in ".efi", particularly if the kernels are stored on a
# filesystem that the EFI can read. When set to "1", "true", or "on", this
# option causes all files in scanned directories with names that begin with
# "vmlinuz" or "bzImage" to be included as loaders, even if they lack ".efi"
# extensions. Passing this option a "0", "false", or "off" value causes
# kernels without ".efi" extensions to NOT be scanned.
# Default is "true" -- to scan for kernels without ".efi" extensions.
#
# 此段为屏蔽扫描所有Linux内核,refind启动项包括了扫描的操作系统内核,其实通过
# 扫描的内核启动操作系统更快,因为会直接跳过Linux系统的grub引导⽽直接启动对应
# 的Linux系统,但是考虑到有时候需要系统修复什么的,建议还是通过grub引导的菜单
# 启动吧,屏蔽内核检查的指令如下:
scan_all_linux_kernels false
在f⽂件的最后⼀⾏,需要加⼀⾏指令,这是涉及到refind的主题美化的⽅⾯,指令内容为:
include <;相对路径>/fig
(相对路径是指你的主题配置⽂件fig在以refind⽬录为根⽬录的⽂件路径)
⽐如我的theme⽂件位于refind⽬录下的themes/rEFInd-minimal处,所以我的指令是:include themes/fig
⾄此,关于f⽂件的介绍就完毕了,下⾯是关于theme⽂件的介绍
⾸先,看refind⽂件夹结构(refind⽂件夹位于EFI分区⽬录)
ubuntu安装教程主题⽂件位于theme⽂件夹:
这是我的主题,就⽤了这⼀个,打开:
然后来介绍f⽂件,以下是我的⽂件内容,不长,看中⽂注释信息就好了:
# Minimal refind theme
# Hide user interface elements for personal preference or to increase
# security:
# banner - the rEFInd title banner (built-in or loaded via "banner")
# label - boot option text label in the menu
# singleuser - remove the submenu options to boot Mac OS X in single-user
# or verbose modes; affects ONLY MacOS X
# safemode - remove the submenu option to boot Mac OS X in "safe mode"
# hwtest - the submenu option to run Apple's hardware test
# arrows - scroll arrows on the OS selection tag line
# hints - brief command summary in the menu
# editor - the options editor (+, F2, or Insert on boot options menu)
# all - all of the above
# Default is none of these (all elements active)
#
hideui singleuser,hints,arrows,label,badges
# Set the name of a subdirectory in which icons are stored. Icons must
# have the same names they have in the standard directory. The directory
# name is specified relative to the main rEFInd binary's directory. If
# an icon can't be found in the specified directory, an attempt is made
# to load it from the default directory; thus, you can replace just some
# icons in your own directory and rely on the default for others.
# Default is "icons".
# 各种系统的启动图标
icons_dir themes/rEFInd-minimal/icons
# Use a custom title banner instead of the rEFInd icon and name. The file
# path is relative to the directory where refind.efi is located. The color
# in the top left corner of the image is used as the background color
# for the menu screens. Currently uncompressed BMP images with color
# depths of 24, 8, 4 or 1 bits are supported, as well as PNG images.
# 这是启动界⾯背景图⽚路径,也是相对路径,且暂时似乎只⽀持png格式的图⽚
banner themes/rEFInd-minimal/background.png
# Tells rEFInd whether to display banner images pixel-for-pixel (noscale)
# or to scale banner images to fill the screen (fillscreen). The former is
# the default.
# the default.
# 默认全屏填充
banner_scale fillscreen
# Custom images for the selection background. There is a big one (144 x 144)
# for the OS icons, and a small one (64 x 64) for the function icons in the
# second row. If only a small image is given, that one is also used for
# the big icons by stretching it in the middle. If only a big one is given,
# the built-in default will be used for the small icons.
#
# Like the banner option above, these options take a filename of an
# uncompressed BMP image file with a color depth of 24, 8, 4, or 1 bits,
# or a PNG image. The PNG format is required if you need transparency
# support (to let you "see through" to a full-screen banner).
#
selection_bigthemes/rEFInd-minimal/selection_big.png
selection_small themes/rEFInd-minimal/selection_small.png
# Which non-bootloader tools to show on the tools line, and in what
# order to display them:
# shell - the EFI shell (requires external program; see rEFInd
# documentation for details)
# gptsync - the (dangerous) gptsync.efi utility (requires external
# program; see rEFInd documentation for details)
# apple_recovery - boots the Apple Recovery HD partition, if present
# mok_tool - makes available the Machine Owner Key (MOK) maintenance
# tool, MokManager.efi, used on Secure Boot systems
# about - an "about this program" option
# exit - a tag to exit from rEFInd
# shutdown - shuts down the computer (a bug causes this to reboot
# EFI systems)
# reboot - a tag to reboot the computer
# firmware - a tag to reboot the computer into the firmware's
# user interface (ignored on older computers)
# Default is shell,apple_recovery,mok_tool,about,shutdown,reboot,firmware
#
showtools shutdown
⽂件中还有很多杂七杂⼋的东西,感兴趣的话可以Google⼀下,官⽅⽂档说得也⼗分详细,再有就是refind主题的下载链接,我放⼀下,来源于Github,分享只作学习交流之⽤。
⼤家可以选择⾃⼰感兴趣的主题下载,安装的话,记得在f⽂件末尾改路径哦。
以上针对的是对rEFInd⽐较感兴趣并且动⼿能⼒⽐较强的朋友们的⼀个介绍,你们完全可以⾃⼰去折腾rEFInd的配置,⼜不动EFI分区的其他系统⽂件,所以基本⽆风险,⼤不了在BIOS中改回原来的引导。
再就是,懒⼈版!
我⾃⼰⽤的主题以及⾃⼰配的rEFind⽂件:
感兴趣的朋友可以把我的refind配置拿来⽤,UEFI机器通⽤。你可以⽤我的f⽂件替换官⽅的,也可以把我theme⽂件夹中的主题拿去⽤,也可以替换你EFI⽂件夹中的整个refind⽂件夹。(提取码: cmyj)
记得解压出⾥⾯的refind⽂件夹,将refind⽂件夹放⼊EFI分区即可。⽽如何放⼊EFI分区呢,Linux操作系统很简单,直接取得root权限,将refind⽂件夹移动⾄boot/efi/EFI即可,命令⾏操作:
发布评论