I was using dd till now . And I don't have any file system for the binary. I wasn't using any till now either. Here is the dump of my build script
Code: Select all
rm *.o
rm *.bin
rm floppy.img
nasm -f bin -o boot.bin boot.asm
nasm -f bin -o gdt.bin gdt.asm
nasm -f elf -o desc_flush.o desc_flush.asm
nasm -f elf -o intr.o intr.asm
nasm -f elf -o paging_helper.o paging.asm
gcc -c -g -Os -march=i686 -ffreestanding -Wall -Werror -fno-toplevel-reorder -I. -o pic.o pic.c
gcc -c -g -Os -march=i686 -ffreestanding -Wall -Werror -fno-toplevel-reorder -I. -o vbr.o vbr.c
gcc -c -g -Os -march=i686 -ffreestanding -Wall -Werror -fno-toplevel-reorder -I. -o descriptors.o descriptors.c
gcc -c -g -Os -march=i686 -ffreestanding -Wall -Werror -fno-toplevel-reorder -I. -o kernel_main.o kernel_main.c
gcc -c -g -Os -march=i686 -ffreestanding -Wall -Werror -fno-toplevel-reorder -I. -o monitor.o monitor.c
gcc -c -g -Os -march=i686 -ffreestanding -Wall -Werror -fno-toplevel-reorder -I. -o pmm.o pmm.c
gcc -c -g -Os -march=i686 -ffreestanding -Wall -Werror -fno-toplevel-reorder -I. -o paging.o paging.c
ld -static -Tlink.ld -nostdlib --nmagic -o vbr.elf vbr.o
ld -static -Tlink_kernel.ld -nostdlib --nmagic -o kernel_main.elf kernel_main.o monitor.o desc_flush.o descriptors.o intr.o pic.o pmm.o paging.o paging_helper.o
objcopy -O binary vbr.elf vbr.bin
objcopy -O binary kernel_main.elf kernel_main.bin
dd if=/dev/zero of=floppy.img bs=512 count=2880
dd if=boot.bin of=floppy.img bs=512 count=1 conv=notrunc
dd if=vbr.bin of=floppy.img bs=512 count=1 conv=notrunc seek=1
dd if=gdt.bin of=floppy.img bs=512 count=2 conv=notrunc seek=2
dd if=kernel_main.bin of=floppy.img conv=notrunc bs=512 seek=4
Here is the output of the chain of dd commands
Code: Select all
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB) copied, 0.170441 s, 8.7 MB/s
1+0 records in
1+0 records out
512 bytes (512 B) copied, 6.0998e-05 s, 8.4 MB/s
0+1 records in
0+1 records out
446 bytes (446 B) copied, 8.2063e-05 s, 5.4 MB/s
1+1 records in
1+1 records out
978 bytes (978 B) copied, 8.3641e-05 s, 11.7 MB/s
28+1 records in
28+1 records out
14548 bytes (15 kB) copied, 0.000285953 s, 50.9 MB/s
Code: Select all
;Code to load the second sector on the disk into memory location 0x2000:0x0000
mov bx, 0x60 ; Segment location to read into (remember can't load direct to segment register)
mov es, bx
mov bx, 0 ; Offset to read into
mov ah, 02 ; BIOS read sector function
mov al, 0x11 ; read 17 sectors on the beginning of the floppy disk
mov ch, 0 ; Track to read
mov cl, 02 ; Sector to read
mov dh, 0 ; Head to read
mov dl, 00 ; Drive to read
int 0x13 ; Make the BIOS call (int 13h contains mainly BIOS drive functions)
;Set up the data segment
jnc repeat_read_success_first
mov si , error_message
call print_string
jmp repeat_read
ret