UEFI + GPT + Win10 + Ubuntu + rEFInd

前言

刚好赶上 win10 更新 1709 和 Ubuntu 更新 17.10,心血来潮给我的 Windows 笔记本重装一下系统并加上 Ubuntu,这里记录一下过程,以留备用。我的配置是 256G SSD+1T HHD,两个系统都装在固态盘,如果需要把 Ubuntu 装在机械硬盘里,可能还需要额外做一下引导:https://www.zhihu.com/question/33461827


安装 win10

工具:

制作启动盘

  1. 打开 rufus,选择 U 盘
  2. 分区方案和目标系统类型 选择 用于 UEFI 计算机的 GPT 分区方案
  3. 文件系统默认 fat32(这个不能改,uefi 只识别这个格式)
  4. 下面的 创建一个启动盘使用 默认选中的即是 ISO 镜像,然后点击右侧的磁盘图标在电脑中找到下载好的 Win10 正式版 ISO 镜像
  5. 最后点击 “开始” 按钮即可开始制作支持 UEFI 启动的 Win10 系统安装 U 盘

开始安装

  1. 插上 U 盘重启电脑,进入 BIOS 选择开机启动项为自己做好的的 uefi U 盘,保存重启
  2. 能进入 win10 安装界面则成功了一半,如果进不去需要检查一下之前 U 盘是否写入成功,还有 bios 的 uefi 是否打开
  3. 进入 win10 安装界面,选择安装,提示输入密钥,可以先跳过
  4. 接受许可条款后,提示选择 安装类型,点击自定义安装进入分区界面

image

这里网上找的图,实际情况按自身需求处理,我的是驱动器 0 代表固态,1 代表机械,然后我把固态的分区全删除,在未分配的空间上新建分区,给 win10 系统盘 C 盘分配 80GB(uefi 会在系统盘的基础上自动多创建几个分区用于 uefi 引导),再划分 100GB 做 D 盘,留 50GB 未分配的空间 (之后安装 Ubuntu),分完区 注意选中你要安装系统的盘即第一个分的 C 盘,再点下一步进入正式安装

⚠️如果这里点新建,如果新建不了可能是硬盘格式不对,mbr 格式的磁盘需要先全部删除才能转成 GPT 格式,然后再新建

  1. 安装完正常会自动进入系统,如果没有进去,可能得进 BIOS 把开机启动项改回系统,并退出 U 盘
  2. 进入系统,刚开始没有桌面图标可以到主题设置里找,我的电脑没有硬盘可以右键 系统菜单 或者 我的电脑 选择并进入磁盘管理给分区分配盘符,联网后系统更新会自动下载安装电脑驱动,分享一些我常年收藏的工具:https://mega.nz/#F!AOwwyaZY!iR2HEt15jl2chNbEfs6_Nw

安装 Ubuntu

准备工作

开始安装

  1. 还是插上 U 盘改启动项进入 Ubuntu 安装界面,一样的套路
  2. 刚开始会选择 try Ubuntu 或者 install Ubuntu,那个都可以,try 就是先尝试一下然后再安装
  3. 正式进入安装程序后,出现 为图形或无线硬件安装第三方软件 不勾选,直接继续,避免安装过程下载东西
  4. 出现 已安装 Windows10,准备如何安装 Ubuntu,选择 其他选项
  5. 出现选择分区时,选中之前留下来的 50GB 未分配的空闲空间,千万别选错了。选中后点 + 号新建分区,分区可以按下图示例 (盗的图) 进行分,/ 是 linux 根目录的空间大小、交换空间 swap 是虚拟内存大小 (按个人需求调整大小)、/boot 是启动引导的分区 (一般 200MB 足够)、/home 是给 home 目录分配独立分区并分配一定大小,也可以不分把所有空间放到根目录下
    image
    image
    image
    image
    ⚠️分好区后 安装启动引导器的设备 时要选中 / boot 分区所在的设备
  6. 点安装下一步确认改动,等待安装完成
  7. 安装完退出 U 盘重启,可以选择启动项,点 Ubuntu 进 linux,点 Windows boot manager 进 win10,但这个 grub 引导界面太丑,下面会使用 rEFInd 引导
  8. 进入 Ubuntu 后一些基础设置可以参考这篇文章:http://www.jianshu.com/p/62d947731401

rEFInd 引导

安装 rEFInd

这是官网的安装简介:
Ubuntu—Two Ubuntu-specific methods of installing rEFInd in this distribution exist:

  • Ubuntu 17.04 (“Zesty Zapus”) includes rEFInd 0.10.4. Note that, like the Debian package, this one is not signed for use with Secure Boot, but if your system includes the sbsigntool package, the installer will generate a local key for this purpose. If you want a more recent version, you can use my PPA or install my Debian package.
  • I’ve created a rEFInd PPA for Ubuntu. To use it, open a Terminal window and type the following commands:
    $ sudo apt-add-repository ppa:rodsmith/refind
    $ sudo apt-get update
    $ sudo apt-get install refind
    
    You’ll be asked whether to install rEFInd to the ESP when you first install it. Thereafter, the rEFInd version will update along with your other software. This package is built with GNU-EFI and is not signed with a Secure Boot key; however, the install script should sign the binary with a locally-generated key if it detects that your system uses Secure Boot. Thus, if you’ve previously installed one of my binaries on a Secure Boot system and added its key as a MOK, you’ll have to add your local key when you reboot.

对于 Ubuntu 而言就是关掉 BIOS 里的 Secure Boot 选项(最好关掉),运行上述三条命令即可安装。

安装好后,文件目录默认是 /boot/efi/efi/refind,我的是这样,安装方式不同可能目录也不一样。之后要修改这里面的配置文件

更换引导主题

找到自己想要的主题:http://www.rodsbooks.com/refind/themes.html
比如我用的就是 Minimal theme

  1. 找到 refind 安装目录,比如 [/boot/efi/efi/refind]
  2. 如果不存在 themes 则创建一个 themes 文件夹
  3. 在 themes 目录下创建 minimal 文件夹,把克隆或下载下来的主题文件拷进来
  4. 修改 refind 目录下的 refind.conf 文件,修改配置。注释里有介绍,也可以找官网的介绍,或者其他例子:https://tieba.baidu.com/p/4459857693

我的配置是这样的,可供参考:

# 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,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/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.
#
banner themes/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.
#
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_big   themes/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,reboot

最终效果:
image


参考文章

文章目录
  1. 前言
  2. 安装 win10
    1. 工具:
    2. 制作启动盘
    3. 开始安装
  3. 安装 Ubuntu
    1. 准备工作
    2. 开始安装
  4. rEFInd 引导
    1. 安装 rEFInd
    2. 更换引导主题
  5. 参考文章