2012年9月17日 星期一

BIOS設定為 UEFI 時安裝 linux

    (第一次安裝請用 ubuntu 12.04 會比較有感覺)
  1. BIOS : legacy mode
  2. support parted」指令的開機隨身碟
  3. # parted /dev/sda
    (parted) print
      Partiton Table: gpt注意一下,如果是gpt的話,直接跳 step 4.
    (parted) mklabel
      New disk label type? gpt
      Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
      Yes/No? Yes
      (parted)
      q
      Information: You may need to update /etc/fstab.
  4. (parted) print看是否有改成「gpt
  5. (parted) mkpart開始分割磁區
      Partition name []? a_name用「print」看時,會顯示在「Name」欄
      File system type? [ext2]? ext4ext3ext4linux-swapfat32
      Start? ← 可以打單位(MBGB)
      End?
  6. (parted) print ← 確定都沒問題後,就壓「q」離開
以上是有裝win8的情況
如果沒有裝win8的話,必需再加入一個約100MBfat32 EFI partition。設定好後,記得在「Flags」設定「boot」,如下:
  1. (parted) set a_num boot on
Ok後,依一般步驟安裝Ubuntu 12.04
安裝完ubuntu後,然後如下:
  1. sudo mkdir /boot/efi
  2. sudo mount /dev/sda2 /boot/efi (efi partition)
  3. install grub-efi-amd64
  4. grub-install /dev/sda
  5. update-grub
  6. cd /boot/efi/EFI/boot/  (應該會有EFI這個目錄)
  7. cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/boot/bootx64.efi
接下來重新開機即可
(debian 6.0.5
的話,請再用 chroot 如上修改)


ps:
  1. 可以再用 gdisk 把「code」欄位修改成 8300 (Linux filesystem)
    parted 2.3 目前在「file system」有錯誤
    。parted 的「file system」跟  gdisk 的「code」是對應的。

  2. 修改Boot menu (BIOS時,按F12所看到的選單)
  3. 新增一個MiniOS的選單
        # efibootmgr --creat --gpt --disk /dev/sda --part 2 ( EFI partition )
           --write-signature --label  "Name" --loader "\\EFI\\Boot\\bootx64.efi"
    列出目前所有選單,並刪除原本建立的
        #efibootmgr
        #efibootmgr -b xxxx -B

ref:
  1. Here 
  2. aaron-kelley.net
  3. Gentoo-Grub 2 Guide
ps:
parted 指令用法:

沒有留言:

張貼留言