ºìÁªLinuxÃÅ»§
Linux°ïÖú

×Ô¼ºÓûã±à³ÌÐòдµÄÒ»¸ö¼òµ¥BIOS³ÌÐò(»ùÓÚubuntuºÍBochs2.2.1)

·¢²¼Ê±¼ä:2007-11-19 21:48:56À´Ô´:ºìÁª×÷Õß:jhx0301
[align=center][/color][/align][color=#ff0000] Ïêϸ²½ÖèÇë¿´ÎÒµÄblog http://blog.sina.com.cn/jhx0301
½ñÌìͻȻÓÐÁËÒ»ÖÖÏëдBIOSµÄÏë·¨,Ò²ÐíÊÇÐÄѪÀ´³±,ºÇºÇ.¿´ÁËЩ×ÊÁÏ,¾ö¶¨Ð´Ò»¸ö¼òµ¥µÄBIOS³ÌÐò.
Ò».×¼±¸:
1.¸öÈËÈÏΪBochs·ÂÕæÈí¼þ±È½ÏºÃ,ÒòΪBochs·ÂÕæÁËx86µÄÓ²¼þ»·¾³(CPUµÄÖ¸Áî)¼«ÆäÍâΧÉ豸,Òò´ËºÜÈÝÒ×±»ÒÆÖ²µ½ÆäËûƽ̨.
ÎÒ´ÓBochs¹Ù·½ÍøÕ¾http://bochs.sourceforge.netÏÂÔØÁËBochs2.2.1°æ±¾,ÏÖÔÚÒѾ­·¢²¼ÁË2.3.5°æ±¾ÁË,µ«ÎÒϲ»¶ÓÃÀϵÄ,˵²»ÉÏΪʲô,´¿´â¸öÈËϲºÃ.
2.ubuntu7.10ϵͳ,ûʲôºÃ˵µÄ.
¶þ.¿ªÊ¼:
1.ÔÚubuntu7.10±àдÒÔÏ´úÂë,±£´æΪbootsect.sÎļþ:
[font=ËÎÌå].globl begtext,begdata,begbss,endtext,enddata,endbss
.text !ÕýÎĶÎ
begtext:
.data !Êý¾Ý¶Î
begdata:
.bss !δ³õʼ»¯Êý¾Ý¶Î
begbss:
.text
[/font]
[font=ËÎÌå]BOOTSEG = 0x07c0 !BIOS¼ÓÔØbootsect´úÂëµÄԭʼ¶ÎµØÖ·[/font]
[font=ËÎÌå]entry start
start:
jmpi go,BOOTSEG !¶Î¼äÌøת
go: mov ax,cs
mov ds,ax
mov es,ax
mov [msg1+17],ah !0x07->Ìæ»»×Ö·û´®ÖÐÒ»¸öµã·ûºÅ,À®°È¾Í»á½ÐÒ»Éù
mov cx,#20 !¹²ÏÔʾ20¸ö×Ö·û,°üÀ¨»Ø³µ»»ÐÐ
mov dx,#0x1010 !msg1×Ö·û´®½«ÏÔʾÔÚÆÁÄ»µÚ17ÐÐ,µÚ17ÁÐ
mov bx,#0x000c !×Ö·ûÏÔʾΪºìÉ«
mov bp,#msg1 !Ö¸ÏòÒªÏÔʾµÄ×Ö·û´®(ÒÔºóµÄÖжÏÒªÓõ½µÄ)
mov ax,#0x1301 !д×Ö·û´®²¢Òƶ¯¹â±êµ½´®½áβ´¦
int 0x10 !BIOSÖжϵ÷ÓÃ0x10,¹¦ÄÜ0x13,×Ó¹¦ÄÜ0x01
[/font]
[font=ËÎÌå] mov ax,#10000
loop1: dec ax
jnz loop1 !ÑÓʱ

mov cx,#40
mov dx,#0x1210
mov bx,#0x000c
mov bp,#msg2
mov ax,#0x1301
int 0x10
loop0:jmp loop0
[/font]
[font=ËÎÌå]msg1: .ascii "Loading system......"
.byte 13,10
msg2:.ascii "Welcom To jhx0301's Space! ! !"
.byte 13,10
.org 510
.word 0xAA55
.text
endtext:
.data
enddata:
.bss
endbss:
[/font]
¹Ø¼ü´úÂëÎÒÒѾ­×¢ÊÍÁË,ÏàÐÅ´ó¼Ò¶¼ÄÜ¿´¶®.
2.±àÒë
[font=ËÎÌå]root@jhx-ubuntu:~# as86 -0 -a -o bootsect.o bootsect.s[/font]
[font=ËÎÌå]Õâ¸öÃüÁîÀûÓÃas86»ã±àÆ÷¶Ôbootsect.s½øÐбàÒëÉú³Ébootsect.oÎļþ
root@jhx-ubuntu:~# ld86 -0 -s -o bootsect bootsect.o
[/font]
[font=ËÎÌå]Õâ¸öÃüÁîʹÓÃld86¶ÔÄ¿±êÎļþÖ´ÐÐÁ´½Ó²Ù×÷,×îºóÉú³ÉMINIX½á¹¹µÄ¿ÉÖ´ÐÐÎļþbootsect.[/font]
[font=ËÎÌå]
root@jhx-ubuntu:~# ls
bootsect bootsect.o bootsect.s bootsect.s~ whatsnew.txt
root@jhx-ubuntu:~# ls -l
×ÜÓÃÁ¿ 28
-rwxr-xr-x 1 root root [color=#0080ff]544
2007-11-19 20:30 bootsect
-rw-r--r-- 1 root root 318 2007-11-19 20:30 bootsect.o
-rwxr-xr-x 1 root root 654 2007-11-19 20:30 bootsect.s
-rw-r--r-- 1 root root 641 2007-11-19 20:27 bootsect.s~
-rw-r--r-- 1 root root 11789 2007-11-18 15:04 whatsnew.txt[/color][/font]
ÒòΪ×îºóÎÒÊÇͨ¹ýÈíÅÌÀ´Æô¶¯Õâ¸öbootµÄ,ËùÒÔ´óС²»Äܳ¬¹ý512×Ö½Ú,µ«ÊÇͨ¹ýls
ÃüÁî·¢ÏÖbootsectÏÖÔÚÓÐ544×Ö½Ú,³¤ÁË32×Ö½Ú,ÆäʵÕâ¶à³öÀ´µÄ32×Ö½Ú¾ÍÊÇMINIX¿ÉÖ´ÐÐÎļþµÄÍ·½á¹¹,ÎÒÊÇͨ¹ýÊÖ¹¤È¥µôÕâ32¸ö×Ö½ÚµÄ,ÃüÁîÈçÏÂ:
root@jhx-ubuntu:~# dd bs=32 if=bootsect of=jhx skip=1
¼Ç¼ÁË 16+0 µÄ¶ÁÈë
¼Ç¼ÁË 16+0 µÄд³ö
512 ×Ö½Ú (512 B) ÒѸ´ÖÆ£¬0.000338889 Ã룬1.5 MB/Ãë

ÀûÓÃddÃüÁbootsect¶à³öÀ´µÄ32×Ö½Úɾµô²¢ÇÒ½«µÃµ½µÄ512×ֽڵĿÉÖ´ÐÐÎļþÒÔjhxµÄÃû×ÖÊä³ö,jhx¾ÍÊÇÎÒÃû×ÖµÄËõдÁË,ºÙºÙ......
ÏÖÔÚÔÙÓÃls -l²é¿´,¹ûÈ»Éú³ÉÁË´óСΪ512×Ö½ÚµÄjhx¿ÉÖ´ÐÐÎļþÁË,ÎÒÒªµÄ¾ÍÊÇËüÁË
root@jhx-ubuntu:~# ls -l
×ÜÓÃÁ¿ 32
-rwxr-xr-x 1 root root 544 2007-11-19 20:30 bootsect
-rw-r--r-- 1 root root 318 2007-11-19 20:30 bootsect.o
-rwxr-xr-x 1 root root 654 2007-11-19 20:30 bootsect.s
-rw-r--r-- 1 root root 641 2007-11-19 20:27 bootsect.s~
-rw-r--r-- 1 root root [color=#0080ff]512
2007-11-19 20:31 jhx
-rw-r--r-- 1 root root 11789 2007-11-18 15:04 whatsnew.txt[/color]
ÓÉÓÚÎÒÔÚVMwareÉÏ°²×°µÄÐéÄâ»ú,²¢ÇÒûÓÐÆô¶¯samba·þÎñ,Ö»ÄÜÓù²ÏíÎļþ¼ÐÁË
½«jhx¿½±´µ½¹²ÏíÎļþ¼ÐÏÂ:
root@jhx-ubuntu:~# cp jhx /mnt/hgfs/Untitled-1/

3.ÅäÖÃBochs
ÎÒ°²×°µÄBochsÊÇwindows°æ±¾µÄ,µ±È»ÄãÒ²¿ÉÒÔÓÃlinux°æ±¾µÄ,»¹ÊǸöÈËϲºÃÁË.
×¢:Ê×ÏÈÒ»¶¨Òª°ÑÔÚubuntuϱàÒëͨ¹ýµÄ¿ÉÖ´ÐÐÎļþjhx¿½±´µ½BochsµÄ°²×°Ä¿Â¼ÏÂ
³É¹¦°²×°Bochsºó,ÔÚËûµÄ°²×°Ä¿Â¼ÏÂÓÐÒ»¸öbochsrc-simpel.txtÎļþ,Õâ¸öÊÇÒ»¸öÅäÖÃÎļþµÄÄ£°å,Äã¿ÉÒÔ¸ù¾ÝÄãµÄÐèÒª½øÐмô²Ã:Ò»°ãÈç¹ûͬÈíÅÌÀ´Æô¶¯µÄ»°,Ö»Òª±£ÁôÒÔϼ¸¸ö±ØÒªµÄÅäÖþͿÉÒÔÁË:
[font=ËÎÌå]vgaromimage: file=$BXSHARE/VGABIOS-elpin-2.40//ĬÈÏ[/font]
[font=ËÎÌå]romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000//ĬÈÏ[/font]
[font=ËÎÌå]megs: 16 //ÓÉÓÚÎÒµÄboot³ÌÐòС,ÄÚ´æÉêÇë16M×ã¹»ÁË[/font]
[font=ËÎÌå]floppya: 1_44="jhx", status=inserted//ÎÒµÄÆô¶¯´úÂëµÄÃû×Ö[/font]
[font=ËÎÌå][font=ËÎÌå]ata0-master: type=disk, path="jhx", mode=flat,cylinders=227, heads=16, spt=63 //һЩÆô¶¯µÄÊôÐÔ,ÈçÆô¶¯Ê±Æô¶¯µÄ·¾¶,ÊÇÒÔ°²×°Ä¿Â¼Îª¸ù·¾¶µÄ[/font][/font]

Õâ¸öÅäÖÃÎļþÊÇtxt¸ñʽµÄ,ÄãÒª°ÑËûµÄºó׺Ãû¸ÄΪ.bxrc,¼´bochsrc.bxrc,ϵͳÔËÐеÄʱºò²ÅÄÜÕýȷʶ±ð.
µ±ºó׺Ãû¸Ä¹ýÖ®ºó,Äã»á·¢ÏÖbochsrc.bxrc±ä³ÉÁËÒ»¸ö¿ÉÖ´ÐÐÎļþ,Ë«»÷ºó³É¹¦½øÈëϵͳ,´ó¹¦¸æ³É!!!

[align=center][/color][/align]
[align=center][color=#ff0000][img=594,321]http://album.sina.com.cn/pic_3/4b8f6be743f484b517a28[/img][/align]

ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ