編譯 linux 0.01

1.下載linux-0.11-devel-060625(這個有gar,編譯時要用),bochs 2.5

2.建新硬盤img
? 用bochs自帶的bxp_w_picpath建,按<linux-0.11內核完全解析>里的說明進行,也是256M.
? 然后fdisk,mkfs,然后把mkdir root, 然后把/bin,/dev,/usr復制過來,這樣硬盤的minix系統就OK了。

2.按這個patch修改內核代碼:
? http://www.oldlinux.org/oldlinux/viewthread.php?tid=4827?? ?
? 只能手動改,那個patch從網頁上COPY下來,不能用了。
? boot.s里的|改!,用vi的一個命令就搞定了,好在用不了幾分鐘.

? *** 為了防止將來的linux0.01啟動后報 HD controller not ready.??? ***
? *** 需要修改hd.c -> controller_ready()????????????????????????? ***
? *** 1000改為100000????????????????????????????????????????????? ***
? *** (inb(HD_STATUS)&0xc0)!=0x40 改為 (inb(HD_STATUS)&0x80)????? ***
? *** 這個參考 http://www.eetop.cn/blog/html/15/193015-21187.html ***

? *** 還要改下硬盤的參數:(config.h)???????? ***
? *** #elif?? ?defined(LINUS_HD)??????????? ***
? *** #define HD_TYPE { 16,63,520,300,980,0} ***

3.把修改后的代碼放到linux-0.11-devel-060625
? 修改后的代碼打個包:
? tar cf linux.tar linux (在centos或redhat打包,然后用WinSCP取出來)
? 然后把linux.tar通過winp_w_picpath放入rootp_w_picpath-0.11,(也可以在centos,或redhat里進行)
? 然后啟動bochs(用bochs-hd那個),啟動后,把rootp_w_picpath放入A盤,(最初放在B盤,怎么都不好用).
? 然后mdir a:看一下,會看到linux.tar
? 然后mcopy a:linux.tar /usr/src2(在哪里都行,在/mnt里也行)
? 另外,刪除文件可用mdel a:filename

4.然后就進入/usr/src2,解開linux.tar: tar xf linux.tar
? 然后cd linux,然后make

5.把生成的Image再通過rootp_w_picpath-0.11傳出來.
? mcopy Image a:
? 再用winp_w_picpath從rootp_w_picpath-0.11里取出這個Image,新建個目錄linux0.01,把linux-0.01-devel-060625里的bochs-hd.bxrc弄過來。
? 改里面的參數:
? floppya: 1_44="Image", status=inserted? #這個Image就是編譯生成的,只要和實際的文件對應就行了。
? ata0-master: type=disk, path="hd256.img", mode=flat, cylinders=520, heads=16, spt=63

6.啟動,OK了.