bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Not a bug] [From help-grub] Problems creating a boot floppy image


From: David Lindsay
Subject: Re: [Not a bug] [From help-grub] Problems creating a boot floppy image
Date: Wed, 10 Jun 2009 23:13:53 +1000

I see.

On Wed, Jun 10, 2009 at 10:30 PM, Felix Zielcke<address@hidden> wrote:
> Am Mittwoch, den 10.06.2009, 14:28 +1000 schrieb David Lindsay:
>> [ I thought I'd copy my post from help-grub over in case anyone here
>> can shed some light on my problem. If this isn't good etiquette,
>> please do tell me! ]
>
> Hm maybe I should subscribe to help-grub.
> bug-grub is actually for reporting bugs inside GRUB, actually only GRUB
> 2 now. We don't accept anymore bug reports for GRUB-legacy.
Eeek :S
> Anyway.
>
>>
>> 1. qemu-img create floppy.img 1440
>> 2. mkfs -t msdos floppy.img (or 'mkfs -t ext2 floppy.img')
>> > 'file' reports that it's a filesystem
>> > image will mount at this point (with a loopback device of course)
>> 3. dd if=stage1 of=floppy.img bs=512 conv=notrunc count=1
>> > 'file' says "x86 boot sector; GRand Unified Bootloader, stage1 version 0x3"
>> > With FAT, image becomes unmountable (mount asks for fs type and complains 
>> > that it's not a valid FAT FS if I hand it '-t msdos', dmesg says "bogus 
>> > number of reserved sectors")
>> > With ext2 the image will still mount
>> 4. dd if=stage2 of=floppy.img bs=512 conv=notrunc seek=1
>> > With ext2 the image will fail to mount at this point
>>
>> After completing all 4 steps I can boot the disk image in QEMU and get
>> a GRUB prompt, but I can't do much more since the disk doesn't have a
>> valid filesystem on it!
>
>
> If I read the source correctly, ext2/ext3/ext4 stores the superblock
> after 1024 byte so this should work.
> But you just can't rely that the first 1024 bytes of a filesystem is
> unused. For example with FAT this just isn't possible.

Right. I'd figured I was poking important parts of FAT when I copied
stage2 onto the disk.

>
> grub2 has a grub-mkrescue script to generate floppy and cd images and
> you can use --overlay to include custom files.
> But with the floppy image they get embed to the grub2 image itself, so
> only grub can access them. There is no filesystem in the floppy image.

So, if I understand you correctly, GRUB floppy disks don't actually
have filesystems on them...?!

Thanks for your reply, Felix :)

To reiterate/expound, I want to put GRUB on a floppy disk image so I
can boot a Linux kernel that will have an initrd compiled in. This is
a personal project to see "how low can you go" in terms of a kernel
(I'm thinking a recent 2.4 version), XFree86 Xvesa, and a few small
homebrew utilities. I honestly have no idea how low I'll be able to
go, but I guess I'll find that out as I go along. :]

To this end, I'm trying to get the disk to boot while using as little
space as possible. I think the most awesome end result I could achieve
would be to boot the disk straight from the MBR of the disk (512 bytes
FTWFTW) but I doubt that's manageable. :P

So I'm hacking and hewing away at GRUB to get it as small as possible,
and in theory that shouldn't be all that hard, since all I need to do
is load a kernel which will have its own initrd compiled into it, and
boot it - if I had enough asm-fu I could probably do something like
that myself (likely a memmove and a simple jmp?). Probably. The fact
I'm saying this probably conveys my ignorance of the subject
tragically well...

Thanks in advance!

-dav7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]