平台 : Ubuntu(Virtualbox) Windows7
工具 : Bochs
1.開啟終端機,創立一個資料夾,並進入該資料夾
2.製作Floppy.img (兩者皆可)
# dd if=/dev/zero of=Floppy.img bs=1024 count=1440
# dd if=/dev/zero of=Floppy.img bs=512 count=2880
3.格式化Floppy.img
# mkdosfs Floppy.img
4.建立一個讓Floppy.img可以掛在的目錄 floppy
# mkdir floppy
5.掛載Floppy.img
# mount –o loop Floppy.img floppy
6.來這裡抓GRUB原始檔
7. 解壓縮(用0.96)
# tar zxvf grub-0.96-i386-pc.tar.gz
8.複製GRUB目錄
# sudo cp –r grub-0.96-i386-pc/* floppy
9.卸載floppy
# sudo umount floppy
10.安裝Grub
# sudo apt-get install grub
11.進入GRUB修改
# grub
12.輸入下列資訊
grub> device (fd0) floppy.img
grub> root (fd0)
grub> setup (fd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/fat_stage1_5" exists... yes
Running "embed /boot/grub/fat_stage1_5 (fd0)"... failed (this is not fatal)
Running "embed /boot/grub/fat_stage1_5 (fd0)"... failed (this is not fatal)
Running "install /boot/grub/stage1 (fd0) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.
grub> quit
13.把檔案複製回Window7介面,開啟Bochs載入floppy.img 如圖設定
14.執行畫面
到此就告一段落
(1) 如果已經開發好作業系統者,做完第8個步驟後,加入menu.lst與kernel.elf於指定位址
kernel.elf (boot/kernel.elf)
menu.lst ( boot/grub/menu.lst )
title DclabOS
root (fd0)
kernel /boot/kernel.elf
boot
(2)然後接著做步驟9之後的動作即可
沒有留言:
張貼留言