final.iso insted of flopyboot.img

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
machka
Posts: 9
Joined: Sun Mar 28, 2010 7:50 am

final.iso insted of flopyboot.img

Post by machka »

hi all, my computer does not have any floppy device so i want to create .iso image to test my own os. so anybody know how could i create an iso image from two files like bsect and sect2.

regards
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: final.iso insted of flopyboot.img

Post by Combuster »

This question and others are answered on the wiki: Bootable CD - please look there first before posting.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
machka
Posts: 9
Joined: Sun Mar 28, 2010 7:50 am

Re: final.iso insted of flopyboot.img

Post by machka »

so my computer does not create bootable floppy from write.c due to floppy drive doesn't existed so could you help me to create floppy.img from bsect.o and sect2.o files.

regards
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: final.iso insted of flopyboot.img

Post by neon »

If Windows, look into using VFD.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
machka
Posts: 9
Joined: Sun Mar 28, 2010 7:50 am

Re: final.iso insted of flopyboot.img

Post by machka »

no i use it in ubuntu 10.4 this part of the code "floppy_desc = open("/dev/sdc1", O_RDWR);" is wrong because my usb floppy is mounted on sdc but code use fd0 so i change write.c to write usb floppy but it isn't working. so i decide to create final.img in order to write it on a floppy disk. but i cant create img file from two files like bsec and sect2. my write.c code is below;

regards


#include <sys/types.h> /* unistd.h needs this */
#include <unistd.h> /* contains read/write */
#include <fcntl.h>

int main()
{
char boot_buf[512];
int floppy_desc, file_desc;

file_desc = open("./bsect", O_RDONLY);

read(file_desc, boot_buf, 510);
close(file_desc);

boot_buf[510] = 0x55;
boot_buf[511] = 0xaa;

floppy_desc = open("/dev/sdc1", O_RDWR);

lseek(floppy_desc, 0, SEEK_SET);
write(floppy_desc, boot_buf, 512);

file_desc = open("./sect2", O_RDONLY);
read(file_desc, boot_buf, 512);
close(file_desc);

lseek(floppy_desc, 512, SEEK_SET);
write(floppy_desc, boot_buf, 512);

close(floppy_desc);
}
montrom
Member
Member
Posts: 86
Joined: Thu May 13, 2010 1:45 pm

Re: final.iso insted of flopyboot.img

Post by montrom »

Visit the Montrom user page for more info.
machka
Posts: 9
Joined: Sun Mar 28, 2010 7:50 am

Re: final.iso insted of flopyboot.img

Post by machka »

ok i solve it.

thanks for help
machka
Posts: 9
Joined: Sun Mar 28, 2010 7:50 am

Re: final.iso insted of flopyboot.img

Post by machka »

so the solution is floppy_desc = open("final.img", O_RDWR); but you have to create final.img before execute the ./write

otherwise floppy_desc equals -1

regards
Post Reply