All of lore.kernel.org
 help / color / mirror / Atom feed
* grub-setup: error: Non-sector-aligned data is found in the core file
@ 2007-11-06 17:24 UrJiZ
  2007-11-07 20:24 ` Robert Millan
  0 siblings, 1 reply; 9+ messages in thread
From: UrJiZ @ 2007-11-06 17:24 UTC (permalink / raw)
  To: The development of GRUB 2

I've been working on a project of mine, putting GRUB2 to An award BIOS
using ROMOS (http://rayer.ic.cz/romos/romose.htm).
I've succesfully compiled GRUB 2 and generated my first rom disk
image. I used http://grub.enbug.org/TestingOnX86 ,"Creating the
Floppy" as my guide. I followed it mostly but skipping the copying of
all the mods to the image (no space in 62K for 'em),  but adding all
the necesary modules to the core.img.
The succesfull core.img was created using the following command:
./grub-mkimage -d . -v -o core.img biosdisk configfile terminal normal
_chain fat linux ext2 ls font halt pc

The disk had 5.5K of free space on this version, and I as I saw ata.c,
i thought that it could also support CD's by adding ata and iso9660.
So, a new core.img was created like so:
./grub-mkimage -d . -v -o core.img biosdisk configfile terminal normal
_chain fat linux ext2 ls font halt pc ata iso9660

This core.img was a little bit larger, left 1K of free on the disk
(good for grub.cfg when all else is done).
This time grub-setup failed with the error on the subject line. I
googled for it and found nothing, so i thought i could ask here about
it.

So, why is this a problem, and why it worked for the first time but
not with 2 more modules?...

-- 
urjaman



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-06 17:24 grub-setup: error: Non-sector-aligned data is found in the core file UrJiZ
@ 2007-11-07 20:24 ` Robert Millan
  2007-11-08 12:36   ` UrJiZ
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Millan @ 2007-11-07 20:24 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Nov 06, 2007 at 07:24:29PM +0200, UrJiZ wrote:
> I've been working on a project of mine, putting GRUB2 to An award BIOS
> using ROMOS (http://rayer.ic.cz/romos/romose.htm).
> I've succesfully compiled GRUB 2 and generated my first rom disk
> image. I used http://grub.enbug.org/TestingOnX86 ,"Creating the
> Floppy" as my guide. I followed it mostly but skipping the copying of
> all the mods to the image (no space in 62K for 'em),  but adding all
> the necesary modules to the core.img.
> The succesfull core.img was created using the following command:
> ./grub-mkimage -d . -v -o core.img biosdisk configfile terminal normal
> _chain fat linux ext2 ls font halt pc
> 
> The disk had 5.5K of free space on this version, and I as I saw ata.c,
> i thought that it could also support CD's by adding ata and iso9660.
> So, a new core.img was created like so:
> ./grub-mkimage -d . -v -o core.img biosdisk configfile terminal normal
> _chain fat linux ext2 ls font halt pc ata iso9660
> 
> This core.img was a little bit larger, left 1K of free on the disk
> (good for grub.cfg when all else is done).
> This time grub-setup failed with the error on the subject line. I
> googled for it and found nothing, so i thought i could ask here about
> it.
> 
> So, why is this a problem, and why it worked for the first time but
> not with 2 more modules?...

For building a floppy use grub-mkrescue instead.

Btw, could someone update the wiki ?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-07 20:24 ` Robert Millan
@ 2007-11-08 12:36   ` UrJiZ
  2007-11-08 21:19     ` Robert Millan
  0 siblings, 1 reply; 9+ messages in thread
From: UrJiZ @ 2007-11-08 12:36 UTC (permalink / raw)
  To: The development of GRUB 2

On 11/7/07, Robert Millan <rmh@aybabtu.com> wrote:
<snip>
> For building a floppy use grub-mkrescue instead.
>

Used ./grub-mkrescue, but it:
a) seems not to create a filesystem on the disk image (how can i put
grub.cfg on the disk?)
b) creates 1440k floppy images by default
c) In the wiki method, there was the possibility of defining the root
device(fd0 in the guide), in the final installation i might need to
use (fd1) (bios drive 01h or "B:"), is this supported?

so for b i just modified the grub-mkrescue say count=63 in the dd
command and it creates images of the appropriate size.

the image works fine if used in qemu just with "qemu -fda image.img
-boot a", but if it is emulated truly with ROMOS using qemu option
-option-rom it halts to
"GRUB Loading kernel.......
" (eq there's a newline after "kernel....")

-- 
urjaman



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-08 12:36   ` UrJiZ
@ 2007-11-08 21:19     ` Robert Millan
  2007-11-10 16:22       ` Marco Gerards
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Millan @ 2007-11-08 21:19 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Nov 08, 2007 at 02:36:28PM +0200, UrJiZ wrote:
> On 11/7/07, Robert Millan <rmh@aybabtu.com> wrote:
> <snip>
> > For building a floppy use grub-mkrescue instead.
> >
> 
> Used ./grub-mkrescue, but it:
> a) seems not to create a filesystem on the disk image (how can i put
> grub.cfg on the disk?)

I was thinking we could have some way to embed filesystems in a GRUB image
(we might need this for LinuxBIOS port).

> c) In the wiki method, there was the possibility of defining the root
> device(fd0 in the guide), in the final installation i might need to
> use (fd1) (bios drive 01h or "B:"), is this supported?

Never tried, but I suppose it should work.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-08 21:19     ` Robert Millan
@ 2007-11-10 16:22       ` Marco Gerards
  2007-11-11 12:47         ` UrJiZ
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Gerards @ 2007-11-10 16:22 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan <rmh@aybabtu.com> writes:

> On Thu, Nov 08, 2007 at 02:36:28PM +0200, UrJiZ wrote:
>> On 11/7/07, Robert Millan <rmh@aybabtu.com> wrote:
>> <snip>
>> > For building a floppy use grub-mkrescue instead.
>> >
>> 
>> Used ./grub-mkrescue, but it:
>> a) seems not to create a filesystem on the disk image (how can i put
>> grub.cfg on the disk?)
>
> I was thinking we could have some way to embed filesystems in a GRUB image
> (we might need this for LinuxBIOS port).

We could just add files using grub-mkimage.  If a file isn't a module,
it won't be loaded but accessible.  We can use (host) or so for
this...

--
Marco




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-10 16:22       ` Marco Gerards
@ 2007-11-11 12:47         ` UrJiZ
  2007-11-18  6:02           ` Robert Millan
  0 siblings, 1 reply; 9+ messages in thread
From: UrJiZ @ 2007-11-11 12:47 UTC (permalink / raw)
  To: The development of GRUB 2

On Nov 10, 2007 6:22 PM, Marco Gerards <mgerards@xs4all.nl> wrote:
> Robert Millan <rmh@aybabtu.com> writes:
>
> > On Thu, Nov 08, 2007 at 02:36:28PM +0200, UrJiZ wrote:
> >> On 11/7/07, Robert Millan <rmh@aybabtu.com> wrote:
> >> <snip>
> >> > For building a floppy use grub-mkrescue instead.
> >> >
> >>
> >> Used ./grub-mkrescue, but it:
> >> a) seems not to create a filesystem on the disk image (how can i put
> >> grub.cfg on the disk?)
> >
> > I was thinking we could have some way to embed filesystems in a GRUB image
> > (we might need this for LinuxBIOS port).
>
> We could just add files using grub-mkimage.  If a file isn't a module,
> it won't be loaded but accessible.  We can use (host) or so for
> this...
>

I just had the first success of loading grub from an Option ROM in
qemu. I modified ROMOS code mostly just removing the disk emulation
system and making it a simple core.img loader (the loading is a memory
copy + setting dl to what the user has defined +  jmp 0:8200h). I can
post this code if someone is interested. It is written in assembler,
x86 intel syntax, compiled using nasm and at the moment the rom
checksum fixing is done by the same dos tool(romchk.exe) as for romos,
i ran this with dosbox.

Now i have both biosdisk and ata modules in the core, and the
dl-register-based rootdisk detection just uses fd if dl < 80h or hd if
dl > 80h. Having the possibility of selecting an ata drive via some
special value of dl would be great, i was thinking of F0h = ata0 ...
FFh = ata15 (although ata15 is not yet possible, but maybe possible in
future).

Also, I'm not sure of this, but it seems that the ata driver blocks
out the hd*-devices and i understand this, but it also blocks
fd*-devices and this is something i don't really understand, I'd
really like to access both cdrom's and floppy disks.

And for the including of files in core.img, all i really need is a way
to include grub.cfg in there so that my ROM grub can display a menu
even without a root disk. I would be willing to attempt to work on
this, but i'd like to hear some suggestions/specification of how it
should be done (eq in what layer of grub, whether to have only
grub.cfg possible or to be able to have an entire filesystem (will
propably take more time for me), etc..).

-- 
urjaman



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-11 12:47         ` UrJiZ
@ 2007-11-18  6:02           ` Robert Millan
  2007-11-18  6:10             ` Robert Millan
  2007-11-18 15:04             ` UrJiZ
  0 siblings, 2 replies; 9+ messages in thread
From: Robert Millan @ 2007-11-18  6:02 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Nov 11, 2007 at 02:47:21PM +0200, UrJiZ wrote:
> 
> I just had the first success of loading grub from an Option ROM in
> qemu. I modified ROMOS code mostly just removing the disk emulation
> system and making it a simple core.img loader (the loading is a memory
> copy + setting dl to what the user has defined +  jmp 0:8200h). I can
> post this code if someone is interested.

Might be useful for us, but in that case...

> It is written in assembler,
> x86 intel syntax, compiled using nasm

If you want that code in GRUB, it needs to be converted to AT&T syntax.

> and at the moment the rom
> checksum fixing is done by the same dos tool(romchk.exe) as for romos,

Is romchk.exe free software?

> Now i have both biosdisk and ata modules in the core, and the
> dl-register-based rootdisk detection just uses fd if dl < 80h or hd if
> dl > 80h. Having the possibility of selecting an ata drive via some
> special value of dl would be great, i was thinking of F0h = ata0 ...
> FFh = ata15 (although ata15 is not yet possible, but maybe possible in
> future).

I don't understand.  Isn't setting rootdisk in %dl a BIOS task?  Or you
changed that?

> Also, I'm not sure of this, but it seems that the ata driver blocks
> out the hd*-devices and i understand this, but it also blocks
> fd*-devices and this is something i don't really understand, I'd
> really like to access both cdrom's and floppy disks.

ata and biosdisk can't really coexist.  The block is just there to prevent
undefined results.  You probably just want to only load biosdisk and discard
the ata module for now.

> And for the including of files in core.img, all i really need is a way
> to include grub.cfg in there so that my ROM grub can display a menu
> even without a root disk. I would be willing to attempt to work on
> this, but i'd like to hear some suggestions/specification of how it
> should be done (eq in what layer of grub, whether to have only
> grub.cfg possible or to be able to have an entire filesystem (will
> propably take more time for me), etc..).

My idea is to allow grub-mkimage to include an image (at least one) with
arbitrary content, which will later be dumped in memory.  Then make sure
the runtime module loader won't attempt to treat it as a module, and find
a way to locate it in memory.

At that point, it's as simple as writing a disk/ driver that just maps
accesses to that memory region.

Then of course, the image would normally contain a filesystem, with anything
grub might need (grub.cfg, unifont.pff, ...).

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-18  6:02           ` Robert Millan
@ 2007-11-18  6:10             ` Robert Millan
  2007-11-18 15:04             ` UrJiZ
  1 sibling, 0 replies; 9+ messages in thread
From: Robert Millan @ 2007-11-18  6:10 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Nov 18, 2007 at 07:02:59AM +0100, Robert Millan wrote:
> 
> My idea is to allow grub-mkimage to include an image (at least one) with
> arbitrary content, which will later be dumped in memory.  Then make sure
> the runtime module loader won't attempt to treat it as a module, and find
> a way to locate it in memory.

I forgot to mention that the image ought to be wrapped in some way, to prevent
breakage in case it contains something deceitful, like an ELF image.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: grub-setup: error: Non-sector-aligned data is found in the core file
  2007-11-18  6:02           ` Robert Millan
  2007-11-18  6:10             ` Robert Millan
@ 2007-11-18 15:04             ` UrJiZ
  1 sibling, 0 replies; 9+ messages in thread
From: UrJiZ @ 2007-11-18 15:04 UTC (permalink / raw)
  To: The development of GRUB 2

On Nov 18, 2007 8:02 AM, Robert Millan <rmh@aybabtu.com> wrote:
> On Sun, Nov 11, 2007 at 02:47:21PM +0200, UrJiZ wrote:
> >
> > I just had the first success of loading grub from an Option ROM in
> > qemu. I modified ROMOS code mostly just removing the disk emulation
> > system and making it a simple core.img loader (the loading is a memory
> > copy + setting dl to what the user has defined +  jmp 0:8200h). I can
> > post this code if someone is interested.
>
> Might be useful for us, but in that case...
>
> > It is written in assembler,
> > x86 intel syntax, compiled using nasm
> If you want that code in GRUB, it needs to be converted to AT&T syntax.

 I'm not a real fan of gas and AT&T syntax. I'll propably make this my
project an external "add-on" which an user can download and extract to
his grub2 directory, atleast if no-one is willing to do the
conversion. (btw, can gas do "incbin"? ) ATM everything specific to
this project is (on my computer) in a folder called romboot.

> > and at the moment the rom
> > checksum fixing is done by the same dos tool(romchk.exe) as for romos,
>
> Is romchk.exe free software?

I don't know, but i rewrote it from scratch (only looking at it's
textual output) to prevent using dosbox (didn't look at any source).

> > Now i have both biosdisk and ata modules in the core, and the
> > dl-register-based rootdisk detection just uses fd if dl < 80h or hd if
> > dl > 80h. Having the possibility of selecting an ata drive via some
> > special value of dl would be great, i was thinking of F0h = ata0 ...
> > FFh = ata15 (although ata15 is not yet possible, but maybe possible in
> > future).
>
> I don't understand.  Isn't setting rootdisk in %dl a BIOS task?  Or you
> changed that?

Well, for an ISA Option ROM, bios doesn't provide any value for us
(because the rom isn't really a booted device, bios would continue
after the ROM executes RETF), the loader i wrote can choose this
arbitarily. As background, ISA Option ROM's were used for example in
SCSI controllers to provide "bios" disk services for scsi disks, etc.

> > Also, I'm not sure of this, but it seems that the ata driver blocks
> > out the hd*-devices and i understand this, but it also blocks
> > fd*-devices and this is something i don't really understand, I'd
> > really like to access both cdrom's and floppy disks.
>
> ata and biosdisk can't really coexist.  The block is just there to prevent
> undefined results.  You probably just want to only load biosdisk and discard
> the ata module for now.

Well, I prefer to dump the biosdisk module instead of ata. A native
floppy disk driver would be great.

> > And for the including of files in core.img, all i really need is a way
> > to include grub.cfg in there so that my ROM grub can display a menu
> > even without a root disk. I would be willing to attempt to work on
> > this, but i'd like to hear some suggestions/specification of how it
> > should be done (eq in what layer of grub, whether to have only
> > grub.cfg possible or to be able to have an entire filesystem (will
> > propably take more time for me), etc..).
>
> My idea is to allow grub-mkimage to include an image (at least one) with
> arbitrary content, which will later be dumped in memory.  Then make sure
> the runtime module loader won't attempt to treat it as a module, and find
> a way to locate it in memory.
>
> At that point, it's as simple as writing a disk/ driver that just maps
> accesses to that memory region.
>
> Then of course, the image would normally contain a filesystem, with anything
> grub might need (grub.cfg, unifont.pff, ...).

I played around and got a menu-only solution ready, but I'm not happy
about it (more a hack than a real solution). Modified init.c to map
dl=0x10 => (host) and made a fs driver called cfgfs (from hostfs.c)
that provides only static /boot/grub/grub.cfg. Added host disk driver
and cfgfs fs driver to the build and now i can get a menu.

What i'm worried about in your solution is that the overhead of any fs
image (several sectors) in core.img would make me drop many useful
modules. (64k of space) Of course, this would be very useful for any
other type of loading. (real diskette, netbooting (could carry kernel
and initrd over network withing core.img), etc...)


-- 
urjaman



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-11-18 15:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-06 17:24 grub-setup: error: Non-sector-aligned data is found in the core file UrJiZ
2007-11-07 20:24 ` Robert Millan
2007-11-08 12:36   ` UrJiZ
2007-11-08 21:19     ` Robert Millan
2007-11-10 16:22       ` Marco Gerards
2007-11-11 12:47         ` UrJiZ
2007-11-18  6:02           ` Robert Millan
2007-11-18  6:10             ` Robert Millan
2007-11-18 15:04             ` UrJiZ

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.