Re: [PATH] grub-mkrelpath

2009-08-29 Thread Felix Zielcke
Am Samstag, den 29.08.2009, 01:55 +0200 schrieb Robert Millan:
> On Fri, Aug 28, 2009 at 07:58:39PM +0200, Felix Zielcke wrote:
> > +#else /* ! HAVE_REALPATH */
> > +  grub_util_warn ("grub-mkrelpath might not work on your OS correctly.");
> > +  /* make relative path absolute.  */
> > +  if (*path != '/')
> > +{
> > +  len = 1024;
> > +  buf2 = xmalloc (len);
> > +  do
> > +   {
> > + buf2 = getcwd (buf2, len);
> > + if (buf2 == NULL)
> > +   {
> > + if (errno != ERANGE)
> > +   grub_util_error ("can not get current working directory");
> > + else
> > +   len *= 2;
> > + buf2 = xrealloc (buf2, len);
> > +   }
> > +   } while (buf2 == NULL);
> > +  buf = xmalloc (strlen (path) + strlen (buf2) + 1);
> > +  strcpy (buf, buf2);
> > +  strcat (buf, "/");
> > +  strcat (buf, path);
> > +}
> > +  else
> > +  buf = strdup (path);
> > +#endif /* ! HAVE_REALPATH */
> 
> Please can you leave this part out?  realpath() is POSIX, so it should be
> present in all systems we support, and if it isn't, we should be using a
> complete implementation from Gnulib instead, but we don't need to worry
> about this untill/unless someone reports it as a problem.

Ok, but should I then check in configure.ac that realpath is required or
something else?
Or should I just assume that realpath is always avaible?

> > +  p = strrchr (buf, '/');
> > +  if (p == NULL)
> > +   grub_util_error ("FIXME: no / in buf. 
> > (make_system_path_relative_to_its_root)");
> 
> Does this ever happen?

As Vladimir said, it shouldn't ever happen, but I thought it would be
better to check for this explicitly instead of core dumping in that
case.


-- 
Felix Zielcke
Proud Debian Maintainer



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] bless command

2009-08-29 Thread Bean
On Sat, Aug 29, 2009 at 2:27 PM, Vladimir 'phcoder'
Serbinenko wrote:
>> Actually, I think the correct handling is to first bless a boot
>> directory (storing the directory id in header), then bless a boot file
>> (add +tbxi attribute), that's why the bless command in OSX needs needs
>> both --folder and --file option.
> AFAIK --file has no effect for intel macs.

Hi,

After more testing, I believe the booting process works like this:

One important difference between openfirmware and efi is that
openfirmware stores file path in nvram, while efi stores device path.
The default boot file for openfirmware is like this:

device:\\+tbxi

Which means the files which +tbxi attribute in the blessed directory.

But efi only store the boot device (uuid), so it needs to use the
blessed file to boot.

So to distinguish these two situation, we can have too options for bless:

bless [--bootinfo PATH_TO_BOOTX] [[--bootefi PATH_TO_BOOTEFI]

--bootinfo set the blessed directory plus +tbxi, while --bootefi set
the blessed file, this way we could specify different boot files for
openfirmware and efi, something like this:

bless --bootinfo /grub.elf --bootefi grub.efi

-- 
Bean

gitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] bless command

2009-08-29 Thread Michal Suchanek
2009/8/29 Bean :
> On Sat, Aug 29, 2009 at 2:27 PM, Vladimir 'phcoder'
> Serbinenko wrote:
>>> Actually, I think the correct handling is to first bless a boot
>>> directory (storing the directory id in header), then bless a boot file
>>> (add +tbxi attribute), that's why the bless command in OSX needs needs
>>> both --folder and --file option.
>> AFAIK --file has no effect for intel macs.
>
> Hi,
>
> After more testing, I believe the booting process works like this:
>
> One important difference between openfirmware and efi is that
> openfirmware stores file path in nvram, while efi stores device path.
> The default boot file for openfirmware is like this:
>
> device:\\+tbxi
>
> Which means the files which +tbxi attribute in the blessed directory.
>
> But efi only store the boot device (uuid), so it needs to use the
> blessed file to boot.
>
> So to distinguish these two situation, we can have too options for bless:
>
> bless [--bootinfo PATH_TO_BOOTX] [[--bootefi PATH_TO_BOOTEFI]
>
> --bootinfo set the blessed directory plus +tbxi, while --bootefi set
> the blessed file, this way we could specify different boot files for
> openfirmware and efi, something like this:
>
> bless --bootinfo /grub.elf --bootefi grub.efi
>

Wouldn't it be possible to do a check in bless that determines if the
file is for openfirmware of efi?

Thanks

Michal


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] bless command

2009-08-29 Thread Vladimir 'phcoder' Serbinenko
> Hi,
>
> After more testing, I believe the booting process works like this:
>
> One important difference between openfirmware and efi is that
> openfirmware stores file path in nvram, while efi stores device path.
> The default boot file for openfirmware is like this:
>
> device:\\+tbxi
>
> Which means the files which +tbxi attribute in the blessed directory.
>
> But efi only store the boot device (uuid), so it needs to use the
> blessed file to boot.
>
> So to distinguish these two situation, we can have too options for bless:
>
> bless [--bootinfo PATH_TO_BOOTX] [[--bootefi PATH_TO_BOOTEFI]
>
> --bootinfo set the blessed directory plus +tbxi, while --bootefi set
> the blessed file, this way we could specify different boot files for
> openfirmware and efi, something like this:
>
> bless --bootinfo /grub.elf --bootefi grub.efi
The --botinfo and --bootefi in this case are independent. I don't see
why it would be stuffed in the same command. What about:
blessefi - change blessed file
blessofw - change blessed directory +tbxi
blessdir - change blessed directory
>
> --
> Bean
>
> gitgrub home: http://github.com/grub/grub/
> my fork page: http://github.com/bean123/grub/
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] bless command

2009-08-29 Thread Vladimir 'phcoder' Serbinenko
On Sat, Aug 29, 2009 at 9:58 AM, Michal Suchanek wrote:
> 2009/8/29 Bean :
>> On Sat, Aug 29, 2009 at 2:27 PM, Vladimir 'phcoder'
>> Serbinenko wrote:
 Actually, I think the correct handling is to first bless a boot
 directory (storing the directory id in header), then bless a boot file
 (add +tbxi attribute), that's why the bless command in OSX needs needs
 both --folder and --file option.
>>> AFAIK --file has no effect for intel macs.
>>
>> Hi,
>>
>> After more testing, I believe the booting process works like this:
>>
>> One important difference between openfirmware and efi is that
>> openfirmware stores file path in nvram, while efi stores device path.
>> The default boot file for openfirmware is like this:
>>
>> device:\\+tbxi
>>
>> Which means the files which +tbxi attribute in the blessed directory.
>>
>> But efi only store the boot device (uuid), so it needs to use the
>> blessed file to boot.
>>
>> So to distinguish these two situation, we can have too options for bless:
>>
>> bless [--bootinfo PATH_TO_BOOTX] [[--bootefi PATH_TO_BOOTEFI]
>>
>> --bootinfo set the blessed directory plus +tbxi, while --bootefi set
>> the blessed file, this way we could specify different boot files for
>> openfirmware and efi, something like this:
>>
>> bless --bootinfo /grub.elf --bootefi grub.efi
>>
>
> Wouldn't it be possible to do a check in bless that determines if the
> file is for openfirmware of efi?
>
Actually it's even easy. EFI files are exes (Mark Zbykowsky or some
fat binaries signatures) while OFW files are ELF AFAIR
> Thanks
>
> Michal
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] bless command

2009-08-29 Thread Bean
On Sat, Aug 29, 2009 at 3:58 PM, Michal Suchanek wrote:
> 2009/8/29 Bean :
>> On Sat, Aug 29, 2009 at 2:27 PM, Vladimir 'phcoder'
>> Serbinenko wrote:
 Actually, I think the correct handling is to first bless a boot
 directory (storing the directory id in header), then bless a boot file
 (add +tbxi attribute), that's why the bless command in OSX needs needs
 both --folder and --file option.
>>> AFAIK --file has no effect for intel macs.
>>
>> Hi,
>>
>> After more testing, I believe the booting process works like this:
>>
>> One important difference between openfirmware and efi is that
>> openfirmware stores file path in nvram, while efi stores device path.
>> The default boot file for openfirmware is like this:
>>
>> device:\\+tbxi
>>
>> Which means the files which +tbxi attribute in the blessed directory.
>>
>> But efi only store the boot device (uuid), so it needs to use the
>> blessed file to boot.
>>
>> So to distinguish these two situation, we can have too options for bless:
>>
>> bless [--bootinfo PATH_TO_BOOTX] [[--bootefi PATH_TO_BOOTEFI]
>>
>> --bootinfo set the blessed directory plus +tbxi, while --bootefi set
>> the blessed file, this way we could specify different boot files for
>> openfirmware and efi, something like this:
>>
>> bless --bootinfo /grub.elf --bootefi grub.efi
>>
>
> Wouldn't it be possible to do a check in bless that determines if the
> file is for openfirmware of efi?

Hi,

I think it would be better to specify the type explicitly, as there
are multiple formats supports by both platform. OpenFirmware support
bootinfo, xcoff and elf, while efi support i386-efi, x86_64-efi and
fat binary.

-- 
Bean

gitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] bless command

2009-08-29 Thread Michal Suchanek
2009/8/29 Bean :
> On Sat, Aug 29, 2009 at 3:58 PM, Michal Suchanek wrote:
>> 2009/8/29 Bean :
>>> On Sat, Aug 29, 2009 at 2:27 PM, Vladimir 'phcoder'
>>> Serbinenko wrote:
> Actually, I think the correct handling is to first bless a boot
> directory (storing the directory id in header), then bless a boot file
> (add +tbxi attribute), that's why the bless command in OSX needs needs
> both --folder and --file option.
 AFAIK --file has no effect for intel macs.
>>>
>>> Hi,
>>>
>>> After more testing, I believe the booting process works like this:
>>>
>>> One important difference between openfirmware and efi is that
>>> openfirmware stores file path in nvram, while efi stores device path.
>>> The default boot file for openfirmware is like this:
>>>
>>> device:\\+tbxi
>>>
>>> Which means the files which +tbxi attribute in the blessed directory.
>>>
>>> But efi only store the boot device (uuid), so it needs to use the
>>> blessed file to boot.
>>>
>>> So to distinguish these two situation, we can have too options for bless:
>>>
>>> bless [--bootinfo PATH_TO_BOOTX] [[--bootefi PATH_TO_BOOTEFI]
>>>
>>> --bootinfo set the blessed directory plus +tbxi, while --bootefi set
>>> the blessed file, this way we could specify different boot files for
>>> openfirmware and efi, something like this:
>>>
>>> bless --bootinfo /grub.elf --bootefi grub.efi
>>>
>>
>> Wouldn't it be possible to do a check in bless that determines if the
>> file is for openfirmware of efi?
>
> Hi,
>
> I think it would be better to specify the type explicitly, as there
> are multiple formats supports by both platform. OpenFirmware support
> bootinfo, xcoff and elf, while efi support i386-efi, x86_64-efi and
> fat binary.
>

They are multiple but different. I guess automatic detection would be
nice to have but writing detection for multiple formats might take
some time so it would be better to get a bless command without
detection initially and possibly add detection later.

Thanks

Michal


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [Bug Report] loadenv module

2009-08-29 Thread Yves Blusseau



Hi,

i have compiled the current version of grub2 under OSX. I have an  
error when using the loadenv module:
I don't have any grub.cfg file. When i was at the prompt i do a  
save_env timeout and grub return me an "out of partition" error.


I have created a newly grubenv with grub-editenv command before the  
test.


I have check under qemu and OSX: same error. I was using a GPT drive  
and the grubenv file is in a hfsplus partition.


If i set a value with grub-editenv and try to load it from grub with  
the load_env command, all is working well and the variable is import  
in the environement.


Another usefull information, the problem came from loadenv module  
compiled on OSX because if i take only the loadenv.mod compiled on  
linux it's work.


Regards,
Yves Blusseau


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel