OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:25 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: [SOLVED]: Building floppy.img
PostPosted: Wed Jan 26, 2011 7:20 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 06, 2010 10:42 am
Posts: 52
Location: Antwerp (Belgium)
Hi,
I don't have a real floppy driver on my computer anymore, so I always make a floppy.img using "floppy.asc" and FASM. But now I need to store modules into the floppy image so I can use them with grub, but I have no clue how to edit the "floppy.asc" or any other file in there, Does anyone knows what I could do? Or is there maybe an easier way or something? I need to store "initrd.img" in there.

Thx.

SOLVED: I've you have the same problem look at my last post, I edited the "floppy.asc"-file and don't forget to edit the menu.lst file to add your module.


Last edited by LegendDairy on Wed Jan 26, 2011 10:03 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 7:24 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

What platform / tools are you using? If on Windows, you could use VFD to mount a floppy image, format it as FAT12 and then copy over your boot sector using partcopy. Your initRD can be copied as if the floppy image were a real floppy.

If you're using cygwin, you could use a combination of MTools / dd to achieve the same sort of thing.

Cheers,
Adam


Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 7:25 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 06, 2010 10:42 am
Posts: 52
Location: Antwerp (Belgium)
AJ wrote:
Hi,

What platform / tools are you using? If on Windows, you could use VFD to mount a floppy image, format it as FAT12 and then copy over your boot sector using partcopy. Your initRD can be copied as if the floppy image were a real floppy.

If you're using cygwin, you could use a combination of MTools / dd to achieve the same sort of thing.

Cheers,
Adam

I'm on Ubuntu


Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 7:27 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

In that case, the dd / MTools thing should still apply. In addition to these, you can also use losetup.

Cheers,
Adam


Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 8:38 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 24, 2009 8:11 pm
Posts: 1249
Location: Sunnyvale, California
Since you don't have the floppy image thing set up yet, I would personally recommend trying to set up an El-Torito CD image instead. You install the bootloader to a floppy image once, then use that floppy image along with the files you want on the disc to produce the CD image each time. That way, you effectively never run out of space on the boot media, you can do real hardware tests using CDs, and when you want to fetch files using your OS, you write a useful ATAPI driver instead of a now-obsolete floppy driver. There are instructions on the wiki for doing this.


Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 9:05 am 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
See readme.txt from last version of mkfloppy.zip.

For previous version you can use following examples:
GrubOnFloppy.zip
GrubOnFloppy-198.zip

_________________
If you have seen bad English in my words, tell me what's wrong, please.


Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 9:52 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 06, 2010 10:42 am
Posts: 52
Location: Antwerp (Belgium)
egos wrote:
See readme.txt from last version of mkfloppy.zip.

For previous version you can use following examples:
GrubOnFloppy.zip
GrubOnFloppy-198.zip

Is there a simple way the edit the files in GrubOnFloppy to add "initrd.img" from the conten-folder to the floppy-img.


Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 9:56 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
MTools? :wink:

_________________
"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 ]


Top
 Profile  
 
 Post subject: Re: [Help]: Building floppy.img
PostPosted: Wed Jan 26, 2011 10:01 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 06, 2010 10:42 am
Posts: 52
Location: Antwerp (Belgium)
Combuster wrote:
MTools? :wink:

NVM I got it to work with GrubOnFloppy and FASM :D God I'm happy!

I edited the "floppy.asc" file so it would add my module in there :
Code:
include "mkfloppy.inc"



STAGE1_5 equ 0



file "content/boot/grub/stage1", 3

db "MKFLOPPY"

dw 512

db 1

dw 1

db 2

dw 14*512/32

dw 2*80*18

db 0F0h

dw 9

dw 18

dw 2

dd 0

dd 0

db 0

db 0

db 29h

dd 55555555h

db 11 dup 32

db "FAT12", 32, 32, 32

file "content/boot/grub/stage1": $, 512-$



if STAGE1_5

kernel_address=2000h

kernel_sector=fatstage_base/512

kernel_segment=200h

else

kernel_address=8000h

kernel_sector=stage2_base/512

kernel_segment=800h

end if



; store byte 0 at 40h ; boot_drive cell

store word kernel_address at 42h

store dword kernel_sector at 44h

store word kernel_segment at 48h



; fat1

db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0



; fat2

db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0



; root

dent kernel, "KERNEL  BIN", FA_ARC
dent module, "INITRD  IMG", FA_ARC

dent boot, "BOOT", FA_DIR

; ...

rb 33*512-$



defdir boot

{

dent grub, "GRUB", FA_DIR

}



defdir grub

{

if STAGE1_5

lent fatstage, "FAT_ST~1", FA_ARC, "fat_stage1_5"

end if

dent menu, "MENU    LST", FA_ARC

dent stage2, "STAGE2", FA_ARC

}



; data

stof kernel, "content/kernel.bin"
stof module, "content/initrd.img"

stod boot, root

stod grub, boot

if STAGE1_5

stof fatstage, "content/boot/grub/fat_stage1_5"

store dword fatstage_base/512+1 at fatstage_base+1F8h

store word (fatstage_size+511)/512-1 at fatstage_base+1FCh

store word 220h at fatstage_base+1FEh

end if

stof menu, "content/boot/grub/menu.lst"

stof stage2, "content/boot/grub/stage2"

store dword stage2_base/512+1 at stage2_base+1F8h

store word (stage2_size+511)/512-1 at stage2_base+1FCh

store word 820h at stage2_base+1FEh

; ...

rb 2*80*18*512-$
initrd=my module file


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Amazonbot [bot] and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group