Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Mar 2008
How to write a boot program into a floppy image?
OS: Windows XP
Virtual Machine: Bochs-2.4.5
I want to learn some details about linux booting, so I begin writing a small boot program myself.
Yesterday, I was writing a small boot program and planned to use it boot a Bochs virtual machine. The boot program is written in assembly language and compiled with nasm. The src:
org 07c00h ; 告诉编译器程序加载到 7c00处 mov ax, cs mov ds, ax mov es, ax call DispStr ; 调用显示字符串例程 jmp $ ; 无限循环 DispStr: mov ax, BootMessage mov bp, ax ; es:bp = 串地址 mov cx, 16 ; cx = 串长度 mov ax, 01301h ; ah = 13, al = 01h mov bx, 000ch ; 页号为 0(bh = 0) 黑底红字(bl = 0Ch,高亮) mov dl, 0 int 10h ; 10h 号中断 ret BootMessage: db "Hello, OS world!" times 510-($-$$) db 0 ; 填充剩下的空间，使生成的二进制代码恰好为 512字节 dw 0xaa55 ; 结束标志
"nasm boot.asm -o boot.bin "
I use bxiamge.exe in Bochs and create an floppy image called boot.img and configure the Bochs virtual host to boot from this floppy image.
My question is how to write the compiled boot.bin program into the floppy image(boot.img)?
Thanks in advance!!
You do it with the dd command. I think the correct syntax is dd bs=512 if=boot.img of=/dev/fd0 but you'd better check the man page to make sure."I'm just a little old lady; don't try to dazzle me with jargon!"