grub-devel
[Top][All Lists]
Advanced

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

Re: i386/pc/grub-setup.c question


From: Felix Zielcke
Subject: Re: i386/pc/grub-setup.c question
Date: Wed, 05 Aug 2009 11:00:00 +0200

Am Mittwoch, den 05.08.2009, 01:41 -0700 schrieb Seth Goldberg:
> Hi,
> 
> 
>    I've been looking at grub-setup.c and am perplexed by the following code:
> 
> 
>    /* Make sure that GRUB reads the identical image as the OS.  */
>    tmp_img = xmalloc (core_size);
>    core_path_dev = grub_util_get_path (dir, core_file);
> 
>    /* It is a Good Thing to sync two times.  */
>    sync ();
>    sync ();
> 
> #define MAX_TRIES       5
> 
>    for (i = 0; i < MAX_TRIES; i++)
>      {
>        grub_util_info ("attempting to read the core image `%s' from GRUB%s",
>                        core_path_dev, (i == 0) ? "" : " again");
> 
>        grub_disk_cache_invalidate_all ();
> 
>        file = grub_file_open (core_path_dev);
>        if (file)
>          {
>            if (grub_file_size (file) != core_size)
> 
>    ....
> 
> 
> 
>    Has the blocklist (--force) code path been tested? Since grub_file_open 
> fails if there's no device specified in the string, and since core_path_dev 
> cannot include a device spec (since it's a concatenation of the grub 
> directory 
> + the core filename), I can't see how this loop could work, but I may be 
> missing something :).
> 

main () sets the root device if it's not given.
grub_file_open doestn't need a device if a root device is set.
Else things like `set root=(hd0,1);linux /vmlnuz' wouldn't work either
in real grub.
It works as long as the path is relative to the root.
I.e. grub-install --root-directory=/mnt /dev/sda1 is currenctly broken
but without --root-directory= it works.


-- 
Felix Zielcke
Proud Debian Maintainer





reply via email to

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