
我有興趣學習如何從頭開始建立作業系統,我找到了這個指南:http://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf。
第 4 頁解釋如何建立簡單的開機磁區,第 6 頁說明如何使用 Bochs 模擬從開機磁區引導的 CPU。我已經嘗試過這個,一切正常。
現在我想在真實的 PC 或虛擬機器軟體(例如 VirtualBox)上嘗試相同的操作。我以為我可以創建一張帶有我的引導扇區的可引導 CD,但直到現在我還沒有成功。我嘗試建立包含開機磁區的 CD 的 ISO 映像,但正如預期的那樣,我在執行此操作時收到錯誤(VirtualBox 顯示「致命:找不到可開機媒體!系統已停止。」錯誤)。
我應該怎麼做才能正確建立具有引導磁區的可引導 CD?先感謝您。
答案1
看一看:http://wiki.osdev.org/El-Torito
Writing an El-Torito Boot Sector
At the start of your El-Torito boot sector, you simply need to set segment registers to known values (as usual) and use the BIOS to load files from the CD as per ISO 9660. As with a normal floppy or hard disk, DL contains the BIOS drive number.
Using Mkisofs, you can write your boot sector to a CD image (.iso) as follows:
mkisofs -R -b path/to/loader.sys -no-emul-boot -boot-load-size 4 -o [IsoFile.iso] [IsoDirectory]
簡單地使用您自己寫的Loader.sys和Mkisofs(http://wiki.osdev.org/Mkisofs)。