Making the GRUB auxiliary disk

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
ImPerfection
Posts: 1
Joined: Sun Oct 19, 2008 5:43 pm

Making the GRUB auxiliary disk

Post by ImPerfection »

I'm trying to make a bootable floppy with GRUB. Following the instructions on the GRUB page for this has posed a problem: I can't even get stage1 onto the floppy. I've gone and gotten cygwin and typed the command correctly, but it can't find stage1. I tried changing directories to it's location, but it can't find /dev/fd0 after that.

Can someone help me make my own auxiliary GRUB disk or provide a disk image of one?
User avatar
cr2
Member
Member
Posts: 162
Joined: Fri Jun 27, 2008 8:05 pm
Location: ND, USA

Re: Making the GRUB auxiliary disk

Post by cr2 »

Give us more information and we might be able to solve the problem.
OS-LUX V0.0
Working on...
Memory management: the Pool
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Making the GRUB auxiliary disk

Post by egos »

The existing of stage1 in view of file is not requested, because it's stored as a first stage bootloader in the boot sector. All you need on the floppy are stage2, menu.lst and possibly fat_stage1_5. You can use GRUB-installer to install GRUB to the fd0. You can use this fasm source to make the floppy disk image with GRUB.

Code: Select all

; include "getsum.inc"
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 "BOOTABLEDEV"
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 for GRUB 1.90
store word kernel_address at 42h ; for GRUB 1.90
store dword kernel_sector at 44h ; for GRUB 1.90
store word kernel_segment at 48h ; for GRUB 1.90

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

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

; root
dent boot, "BOOT", FA_DIR
; ...
rb 33*512-$

defdir boot
{
dent grub, "GRUB", FA_DIR
}

defdir grub
{
if STAGE1_5
; getsum "FAT_ST~1"
; db 41h, "f", 0, "a", 0, "t", 0, "_", 0, "s", 0, 0Fh, 0, sum, "t", 0 ; LFN for "fat_stage1_5"
; db "a", 0, "g", 0, "e", 0, "1", 0, "_", 0, 0, 0, "5", 0, 0, 0
dent fatstage, "FAT_ST~1", FA_ARC
end if
dent menu, "MENU    LST", FA_ARC
dent stage2, "STAGE2", FA_ARC
}

; data
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-$
If you have seen bad English in my words, tell me what's wrong, please.
Post Reply