2011-01-01

讓 Windows Bootloader 載入 GRUB

為避免格式化 Ubuntu 後導致不能起動 Windows ,所以不讓 GRUB 成為 MBR
但使用 Windows 預設的 Bootloader 又不能列出非 Windows 的作業系統,所以需要改寫 C:\boot.ini
注意:胡亂改寫 C:\boot.ini 的會導致所有作業系統不能起動
If you use GRUB as MBR, after format Ubuntu partition GRUB will erase also
However, after re-build Windows Bootloader as MBR, GRUB2 will be replaced, and Ubuntu cannot be started for booting
So, how could let Windows Bootloader as MBR and boot up Ubuntu after GRUB2 is replaces

見下文
在設定 C:\boot.ini 先到 Ubuntu 準備一些資料
先掛載 Windows Partition 可用 修復 Ubuntu 的 MBR 提及的方法掛載
掛載 Windows Partition 後輸入
Before re-build Windows Bootloader as MBR, we need to boot to Ubuntu to do some preparations.
Mount the Windows Partition, you can use Recover Ubuntu GRUB‘s instruction to mount Windows Partition.
After mount the Windows Partition, type
sudo dd if=/dev/sda of=/mnt/sda1/grubboot bs=512 count=1
同樣注意指令會根據設定而改變
if 是指 GRUB 的位置
of 是指 GRUB 的開機程序會以一個檔案形式輸出至該位置
bs 是指 block size ,預設定 512 bytes 因為 1 個 block = 512 bytes
count 是指拿取 bs 的次數
例如 bs=4M count=256 ,意思是每次取 4M 重覆 256 次
最後會取得 1GB 資料

/mnt/sda1 其實即是掛載的 Windows 系統的 %systemdrive% 位置 (一般情況下為 C:\)
/mnt/sda1/grubboot 即是將檔案名為 grubboot 並輸出在 %systemdrive%
檔案名不一定要 grubboot 只是方便知道這個檔案的用途,而檔案必須放置在 Windows 可以存取的位置
in terminal
The above command:
if is the partition / harddisk where GRUB2 installed.
of is the location where does the file output to.
bs is the block size, default is 512 bytes, because 1 block = 512 bytes
count is number of times of bs
For example, bs=4M count=256 means capture 4MBytes block size repeat 256 times
So it will capture 1GBytes data at the end.
(As I know, bs is number of bytes of boot sector, you can found the source from Master boot record @ Wiki)
/mnt/sda1 is the Windows System Drive which equal to DOS environment variable – %systemdrive% in Windows (In general situation is C:)
/mnt/sda1/grubboot which means "Output the GRUB as a file and named grubboot in %systemdrive%"
"grubboot" is just a filename for GRUB in general, you can rename and relocation the file as you like, but you need to locate the file for Windows’s scope

見下文
重新開機並切換使用系統至 Windows
發現剛才提及的 grubboot 檔案在 %systemdrive% (C:)
在執行輸入
Reboot the computer and switch to Windows Partition.
You can see grubboot in your %systemdrive% (C:)
Open System Run and Type
notepad %systemdrive%\boot.ini
or
notepad C:\boot.ini
留意!如果使用 Windows VISTA 或 Windows 7 ,需要使用管理員帳戶來執行此指令
Caution! If you are using Windows VISTA or Windows 7, you need to run this command with Administrator

見下文
在 boot.ini 檔案最後加上 C:\grubboot="GRUB Boot"
同樣地 C:\grubboot 是指 GRUB 檔案的位置,若 grubboot 不在 C:\ 則自行指派
而雙引號的文字則是 Windows Bootloader 顯示的文字,可以自行改寫
Type C:\grubboot="GRUB Boot" at the end of boot.ini.
C:\grubboot is the location of GRUB file.
GRUB Boot is the description of this option in Windows Bootloader menu.
Save boot.ini and then reboot the computer

見下文
見下文
設定完畢後,GRUB 及 Windows Bootloader 便可以交互選擇
When Windows Bootloader is loaded, you can select GRUB Boot option to switch to GRUB2 and GRUB2 also can switch to Windows Bootloader

小提示:
Windows Bootloader 可以像 GRUB 一般設定自動登入時間及預設登入系統項目
timeout 後的數值變更便可以設定自動登入時間
default 後的資料以其他 OS 或 Bootloader 便可以變更預設登入系統項目
You can edit countdown and default boot up partition in boot.ini
timeout is the countdown, the value represent the seconds.
default is the default boot up partition if you don’t press any button on keyboard.

沒有留言 :

張貼留言