Page 1 of 1
[SOLVED]: Building floppy.img
Posted: Wed Jan 26, 2011 7:20 am
by LegendDairy
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.
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 7:24 am
by AJ
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
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 7:25 am
by LegendDairy
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
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 7:27 am
by AJ
Hi,
In that case, the dd / MTools thing should still apply. In addition to these, you can also use losetup.
Cheers,
Adam
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 8:38 am
by NickJohnson
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.
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 9:05 am
by egos
See readme.txt from last version of mkfloppy.zip.
For previous version you can use following examples:
GrubOnFloppy.zip
GrubOnFloppy-198.zip
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 9:52 am
by LegendDairy
Is there a simple way the edit the files in GrubOnFloppy to add "initrd.img" from the conten-folder to the floppy-img.
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 9:56 am
by Combuster
MTools?
Re: [Help]: Building floppy.img
Posted: Wed Jan 26, 2011 10:01 am
by LegendDairy
Combuster wrote:MTools?
NVM I got it to work with GrubOnFloppy and FASM
God I'm happy!
I edited the "floppy.asc" file so it would add my module in there :
Code: Select all
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