Page 1 of 1

Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by Eponick
I was wondering if someone could point me to som dev tools for linux.
Tools Like:
Writing a boot sector directly to the floppy
and
Getting the floppy and making an image file out of it(For debug without restarting every 2 seconds :P)

Thanks

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by Xenos
You can use rawrite to put your bootsector to the floppy. I am not sure if it can create an image, too.

Instead you can create an image directly from your source code without using a floppy. I use NASM to INCBIN my output files, create FAT and root directory and link the whole thing together with my bootsector using JLoc. The result is the desired image which can be fed into bochs or something similar.

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by Adek336
copy a bootsector:
dd if=bootsector.bin of=/dev/fd0
(dd will copy the whole file, so it should not be more than 1 sector)

crate an image:
dd if=/dev/fd0 of=image.ima

try info dd or man dd.

Cheers,
Adrian

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by Eponick
Thanks about the dd thing.
I didnt know it was a command that came with most linux distros :P

Another problem:
Sometimes when I put the kernel file onto the disk, my computer freezes.
Would anyone know why?

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by Eponick
Eh, disregard that last post.
Question:
After I dd the bootsector, then put the kernel onto the disk, it wont work because its just overwriting the /mnt/fd0 image when I cp the kernel.
Anyway I could put the bootsector and the kernel on the disk with dd?

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by Adek336
not really, unless you changed your bootloader to read the kernel as a group of sectors instead as a file, in a filesystem. but I don´t recommend it, that would be a huge step backwards.

It crashes, you say? the floppy should not be mounted when issuing the dd command. you would unmount the floppy (say, ´umount /mnt/fd0´), install the bootsector, mount floppy: ´mount /dev/fd0 /mnt/fd0´ and copy the kernel file as normally.

Oh, and one more thing: is your floppy in FAT12 or EXT2FS? If it is the latter, I think it will always crash after installing the bootstrap because of the FS arch.

Try a FAT12 floppy or grub, instead. Grub is awsome!

Cheers,
Adrian.

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by knicos
You could just write your own small program to format, and write the kernel to disk. Simple open /dev/fd0 and write to it (simple).

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by carbonBased
Linux has all these tools available in every major distro (that's reason #3 why all OS Developers should write their OS in Linux ;))

As was mentioned, you can use dd to copy to the floppy.

Alternatively, however, if you want a file imagine of a floppy, Linux will allow you to actually mount a file as if it were a real floppy:

mount -o loop floppy.img /mnt/floppy

BTW, you can initially create this floppy image using dd and any linux format utility:

# to initiaze the floppy to the right size (2880 sectors):
dd if=/dev/zero of=floppy.img bs=512 count=2880
# and to format with e2fs
mke2fs ./floppy.img
# and answer yes when it tells you temp.img is not a regular block device

Cheers,
Jeff

RE:Dev tools for Linux?

Posted: Sun Aug 24, 2003 11:00 pm
by Eponick
Thanks, im still having trouble getting the kernel and the bootloader on the floppy though..lol