Making the easiest OS
First, generate .bin file
1. Create Boot.asm file, enter the appropriate assembly code
org 07c00h ;
mov ax, cs
mov ds, ax
mov es, ax
call DispStr ;
jmp $
DispStr:
mov ax, BootMessage
mov bp, ax
mov cx, 16
mov ax, 01301h
mov bx, 00ch
mov dl, 0
int 10h
ret
BootMessage: db "Hello,OS world!"
times 510-($-$$) db 0
dw 0xaa55
2. Using NASM compiled Boot.asm file Boot.bin
nasm Boot.asm -o Boot.bin
Two, dd floppy image production
1. Copy the Boot.bin to Boot.img
dd if=Boot.bin of=Boot.img bs=512 count=1
2. Create a blank floppy disk image file diska.img
dd if=/dev/zero of=diska.img bs=512 count=2880
3. Copy the contents diska.img added subsequent to the first 512 bytes of Boot.img
dd if=diska.img of=Boot.img skip=1 seek=1 bs=512 count=2879
(seek=x从输出文件开头跳过x个扇区,skip=x从输入文件开头跳过x个扇区)