Install Gentoo on Mac-Mini

| 分类 Utility 

最近因为工作原因,需要装个 Linux,作为砖头用户的死衷,必须继续 emerge。另外由于台式机要用来处理邮件和文档,所以选择了在 Mac-Mini 上来安装 Gentoo。这里简单记安装的过程和注意事项。

1 准备安装媒介

从网上下载 Gentoo 所需的文件 install-cd 和 stage3 的归档包:

另准备 U 盘一个, 并将 install-amd64-minimal-20140904.iso 制作成启动 U 盘,并将后面两者拷贝进 U 盘。 启动 U 盘的制作可通过 unetbootin 来完成,或者自行 google 其他方法。

2 准备分区

用 OS X 自带的磁盘工具来准备分区,可以参考:http://www.howtogeek.com/187410/how-to-install-and-dual-boot-linux-on-a-mac/

Partition Your Mac

You’ll now need to resize your Mac OS X system partition to make room for your Linux distribution of choice. From within Mac OS X, press Command + Space, type Disk Utility, and press Enter to open the Disk Utility. Select your Mac’s hard drive in the list on the left and select Partition on the right.

resize-mac-os-x-partition-to-make-room-for-ubuntu-linux

Shrink the current Mac OS X partition to make space for your Linux system. How much space you want for Linux is up to you. Ubuntu’s system requirements say it requires at least 5 GB of space, but something like 20 GB is much more reasonable. Drag and drop the handle on the partition volume or enter a final size for the partition and click Partition to partition it.

Don’t create a new partition after shrinking your current partition — just leave the space empty for now.

mac-os-x-system-with-room-for-ubuntu-linux

3 安装配置 rEFInd

3.1 安装 rEFind

rEFInd 是一个启动管理器,可以简化双系统的启动,安装方法可以参考 http://www.howtogeek.com/187410/how-to-install-and-dual-boot-linux-on-a-mac 里面的 Install rEFInd:

Install rEFInd

rEFInd is a boot manager that will allow you to choose between Mac OS X, Linux, Windows, and other operating systems when you boot your computer. Installing rEFInd makes the dual-boot process easier. (Some older how-to’s will instruct you to use rEFIt, but it’s no longer maintained. rEFInd is a currently maintained boot manager based on rEFIt.)

Full-disk encryption causes problems with rEFIt, so you’ll need to disable full-disk encryption or do some extra work before installing rEFInd.

First, visit the rEFInd page on SourceForge and click the Download button to download the latest refind-bin-[version].zip file. Open a Terminal window by pressing Command + Space and, typing Terminal, and pressing Enter. Drag and drop the install.sh file from the downloaded zip file into the terminal window and press Enter to run it.

install-rEFInd-on-mac

Shut down your Mac — a full shut down, not a restart — and boot it back up again. You should see the rEFInd boot manager screen.

install-rEFInd-on-mac-for-linux

上述介绍中,并没有安装 ext4 的驱动,最好在 install.sh 后面加上选项“–alldrivers”来安装上所有的驱动:

cd PATH_OF_REFIND && ./install --alldrivers

3.2 配置 rEFind

安装完成之后,在 /EFI 里面会出现一个 refind 目录,里面有个文件名为 refind.conf,打开该文件,找到其中的 "scan_all_linux_kernels" 这一行,并打开注释。

关于 refind 的更多配置,refind.conf 里面介绍的很详细,或者也可以参考 这里

4 U 盘启动安装

关机,插入 U 盘,启动。此时会进入 rEFind ,从其中选择带有 U 盘标记的启动项,会进入 minial cd ,此后的安装过程就可以参考 Gentoo Install Guide 了,参考其 1 ~ 9。

第 7 步里面的内核配置有两个地方需要注意:

  • EFI stub kernel

    EFI Stub Kernel 可以通过 EFI 来直接启动 Linux,换句话说,可以直接从 rEFind 来启动 Gentoo,配置过程可以参考 Gentoo Wiki.

  • Garaphic Support 配置
    Device Drivers -->
             Graphic Support -->
                      <*> /dev/agpgart (AGP Support)  ----
                      <M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
                          I2C encoder or helper chips  --->
                      <M> ATI Radeon
                           [ ]   Enable userspace modesetting on radeon (DEPRECATED)
                      {*} Support for frame buffer devices  --->
                           [*]   EFI-based Framebuffer Support
    

    这里启用了 KMS,但要注意的是,一定要将 EFI-based FB 编译进内核,否则无法进 CommandLine Mode.

  • Command Line Parameters

    可以在这里设置好启动时需要传给内核的参数,例如:

    Processor type and features  --->
          [*] Built-in kernel command line
                 (root=/dev/sda5 rootfstype=ext4 ro quiet) Built-in kernel command string
    

启用上述配置之后生成的内核,可以直接用于从 rEFind 来启动 Linux , 因为我们可以用 rEFind 来引导启动 http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=1&chap=10 之后的步骤,则可以省略了。

上述步骤完成之后,拔下 U 盘,重启系统, rEFind 就应该可以扫描到新安装的 gentoo 并启动它了。


上一篇     下一篇