Re: stat for FreeBSD

2009-04-10 Thread Felix Zielcke
Am Donnerstag, den 09.04.2009, 20:51 -0700 schrieb Andrey Shuvikov:
> 
>  What's involved in creating an account?

Just like always only accountname + password + email address
See https://savannah.gnu.org/account/register.php

-- 
Felix Zielcke



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


Re: no commit allowed under discussion

2009-04-10 Thread Bean
On Fri, Apr 10, 2009 at 7:26 AM, Yoshinori K. Okuji  wrote:
> On Tuesday 07 April 2009 14:25:53 Bean wrote:
>> On Tue, Apr 7, 2009 at 8:37 AM, Yoshinori K. Okuji  wrote:
>> > On Tuesday 07 April 2009 01:43:17 Bean wrote:
>> >> On Sat, Apr 4, 2009 at 8:53 PM, Bean  wrote:
>> >> > On Sat, Apr 4, 2009 at 5:30 PM, Yoshinori K. Okuji 
>> >
>> > wrote:
>> >> >> I've undone r2063, since we're still discussing how to / not to split
>> >> >> modules. Bean, you must respect teamwork. If you are unable to follow
>> >> >> such a fundamental rule, I will have to disable your permission.
>> >> >
>> >> > Hi,
>> >> >
>> >> > I thought the previous mail is about replacing grub_printf with
>> >> > grub_dprint, I'm ok with that. This patch has been in mail list for
>> >> > sometime, it is essential to get a working display in intel macs.
>> >>
>> >> Hi,
>> >>
>> >> How about this patch ? The split is necessary as it introduces new
>> >> command loadbios and fakebios that uses the fake_bios_data function,
>> >> and it would be ugly to put them all inside linux.c.
>> >
>> > Do you have any strong reason to make loadbios and fakebios separate? I
>> > think the overhead is negligible.
>>
>> Hi,
>>
>> loadbios and fakebios are sort of like hacks for the efi platform, I
>> think they shouldn't be placed in the linux loader. Also, by moving
>> the platform dependent code out, we can merge it with i386 generic
>> loader loader/i386/linux.c.
>
> I reviewed your patch again, and I confirmed that it was good. Thanks.

Hi,

Thanks, commit it now.

-- 
Bean


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


Re: UFS fixes

2009-04-10 Thread phcoder

Commited
Yoshinori K. Okuji wrote:

On Monday 06 April 2009 22:29:58 phcoder wrote:

Here are the fixes for UFS. Basically it's a resubmit of my previous
patch. It works fine with both solaris UFS and recent BSD UFS2. Does it
break anything for anyone with ufs?


I don't have UFS, but the patch looks good to me.

Regards,
Okuji


2009-04-06  Vladimir Serbinenko  

 UFS improvements

 * fs/ufs.c (INODE_NBLOCKS): new definition
 (struct grub_ufs_dirent): added fields for non-BSD dirents
 (grub_ufs_get_file_block): fixed double indirect handling
(grub_ufs_lookup_symlink): use more robust way to determine whether
symlink is inline
 (grub_ufs_find_file): support for non-BSD dirents
 (grub_ufs_dir): support for non-BSD dirents





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



--

Regards
Vladimir 'phcoder' Serbinenko


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


Re: GRUB2 - Please add support for 64-bit FreeBSD

2009-04-10 Thread Daniel Nebdal
Bean wrote:
> Hi,
>
> Please try the btx loader in /boot/loader, which I believe to be
> 32-bit even in amd64 freebsd. The btx loader is an a.out executable,
> grurb2 has supported for it already.

Ah, just noticed I replied to this before subscribing, so the copy to
the list bounced.
Let's try again.

The BTX loader starts, yes - but the reason I'm using GRUB2 in the
first place is to skip it,
since it doesn't seem to support logical partitions.

-- 
Daniel Nebdal


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


Re: [PATCH] Test command

2009-04-10 Thread phcoder

Rediffed. New changelog
2009-04-11  Vladimir Serbinenko  

Test command

* commands/test.c: rewritten to use bash-like test

phcoder wrote:

Sorry forgot to attach the file
phcoder wrote:
Hello. Here is an implementation of bash-like "test" command. Many 
file tests are omitted because they are useless in grub (e.g. -c 
test). I also added 3 extension: lexicographical comparing, prefixed 
-gt and -lt (it skips common prefix. Useful for comparing versions. 
e.g. [ vmlinuz-3 -plt vmlinuz-11 ] is true) and biased -nt/-ot which 
adds s specified amount of seconds to mtime.

Regards
Vladimir 'phcoder' Serbinenko





--

Regards
Vladimir 'phcoder' Serbinenko
diff --git a/commands/test.c b/commands/test.c
index a9c8281..2d8dedd 100644
--- a/commands/test.c
+++ b/commands/test.c
@@ -21,33 +21,385 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 
+/* A simple implementation for signed numbers*/
+static int
+grub_strtosl (char *arg, char **end, int base)
+{
+  if (arg[0] == '-')
+return -grub_strtoul (arg + 1, end, base);
+  return grub_strtoul (arg, end, base);
+}
+
+/* Parse a test expression startion from *argn*/
+static int
+test_parse (char **args, int *argn, int argc)
+{
+  int ret = 0, discard = 0, invert = 0;
+  int file_exists;
+  struct grub_dirhook_info file_info;
+
+  auto void update_val (int val);
+  auto void get_fileinfo (char *pathname);
+
+  /*Take care of discarding and inverting*/
+  void update_val (int val)
+  {
+if (!discard)
+  ret = invert ? !val : val;
+invert = discard = 0;
+  }
+
+  /* Check if file exists and fetch its information */
+  void get_fileinfo (char *pathname)
+  {
+char *filename, *path;
+char *device_name;
+grub_fs_t fs;
+grub_device_t dev;
+
+/* A hook for iterating directories */
+auto int find_file (const char *cur_filename, 
+			struct grub_dirhook_info info);
+int find_file (const char *cur_filename, struct grub_dirhook_info info)
+{
+  if (info.case_insensitive ? !grub_strcasecmp (cur_filename, filename)
+	  :!grub_strcmp (cur_filename, filename))
+	{
+	  file_info = info;
+	  file_exists = 1;
+	  return 1;
+	}
+  return 0;
+}
+
+
+file_exists = 0;
+device_name = grub_file_get_device_name (pathname);
+dev = grub_device_open (device_name);
+if (! dev)
+  {
+	grub_free (device_name);
+	return;
+  }
+
+fs = grub_fs_probe (dev);
+path = grub_strchr (pathname, ')');
+if (! path)
+  path = pathname;
+else
+  path++;
+
+/* Remove trailing / */
+while (*pathname && pathname[grub_strlen (pathname) - 1] == '/')
+  pathname[grub_strlen (pathname) - 1] = 0;
+
+/* Split into path and filename*/
+filename = grub_strrchr (pathname, '/');
+if (!filename)
+  {
+	path = grub_strdup ("/");
+	filename = pathname;
+  }
+else
+  {
+	filename++;
+	path = grub_strdup (pathname);
+	path[filename - pathname] = 0;
+  }
+
+/* It's the whole device*/
+if (!*pathname)
+  {
+	file_exists = 1;
+	grub_memset (&file_info, 0, sizeof (file_info));
+	/* Root is always a directory */
+	file_info.dir = 1;
+
+	/* Fetch writing time */
+	file_info.mtimeset = 0;
+	if (fs->mtime)
+	  {
+	if (! fs->mtime (dev, &file_info.mtime))
+	  file_info.mtimeset = 1;
+	grub_errno = GRUB_ERR_NONE;
+	  }
+  }
+else
+  (fs->dir) (dev, path, find_file);
+
+grub_device_close (dev); 
+grub_free (path);
+grub_free (device_name);
+  }
+
+  /* Here we have the real parsing */
+  while (*argn < argc)
+{
+  /* First try 3 argument tests */
+  /* String tests */
+  if (*argn + 2 < argc && (!grub_strcmp (args[*argn + 1], "=")
+			   || !grub_strcmp (args[*argn + 1], "==")))
+	{
+	  update_val (grub_strcmp (args[*argn], args[*argn + 2]) == 0);
+	  (*argn) += 3;
+	  continue;
+	}
+
+  if (*argn + 2 < argc && !grub_strcmp (args[*argn + 1], "!="))
+	{
+	  update_val (grub_strcmp (args[*argn], args[*argn + 2]) != 0);
+	  (*argn) += 3;
+	  continue;
+	}
+
+  /* GRUB extension: lexicographical sorting */
+  if (*argn + 2 < argc && !grub_strcmp (args[*argn + 1], "<"))
+	{
+	  update_val (grub_strcmp (args[*argn], args[*argn + 2]) < 0);
+	  (*argn) += 3;
+	  continue;
+	}
+
+  if (*argn + 2 < argc && !grub_strcmp (args[*argn + 1], "<="))
+	{
+	  update_val (grub_strcmp (args[*argn], args[*argn + 2]) <= 0);
+	  (*argn) += 3;
+	  continue;
+	}
+
+  if (*argn + 2 < argc && !grub_strcmp (args[*argn + 1], ">"))
+	{
+	  update_val (grub_strcmp (args[*argn], args[*argn + 2]) > 0);
+	  (*argn) += 3;
+	  continue;
+	}
+
+  if (*argn + 2 < argc && !grub_strcmp (args[*argn + 1], ">="))
+	{
+	  update_val (grub_strcmp (args[*argn], args[*argn + 2]) >= 0);
+	  (*argn) += 3;
+	  continue;
+	}
+
+  /* Number tests */
+  if (*argn + 2 < argc && !grub_strcmp (args[*argn + 1], "-eq"))
+	{
+	  update_val (grub_strtosl (args[*argn], 0, 0) 
+		  == grub_str

Re: gettext patch (beta)

2009-04-10 Thread phcoder
Hello, thanks for your work. It's a nice stuff, however it has some 
minor problems

Carles Pina i Estany wrote:

-Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo
Languages files should go to a subdir of $PREFIX. E.g. to 
$PREFIX/langs/$LANG.mo

linux directories may be inaccessible

CALL FOR HELP:
I need to write the Makefile.in (see po/TODO :-( ). I'm not used or
familiar to write Makefiles :-( if someone wants to help it would 
speed up the process quite much. It needs only to merge the files with

the new .pot, compile (msgfmt), and install to the correct directory.

Use common.rmk, don't write directly to Makefile.


I exactly know what has to do, so if someone knows about
installation/Makefiles and doesn't know about gettext it's not a
problem, contact me. Else I will try to implement soon.

I can help you, I'm not a makefile expert but can be useful


I would even invite to a couple of beers in Fosdem if someone does
this part :-)

TODO:
-the Makefile.in
-and more testing about 00_header with gettext detection.
-Add _("") for mainly all strings (I would do in a separate patch)
-I have seen that Grub2 is not printing correctly the accents,
could be a problem in gettext or in some other layer
Did you load unifont as your font? Are you in gfxterm mode? Plain pc 
console can't output unicode characters because it uses fixed-width 
8-bit font. Perhaps loading the characters most useful for current 
languages to the upper 128 characters would be an option. OR we can just 
tell everyone to use gfxterm

Index: conf/common.mk
===
--- conf/common.mk  (revision 1952)
+++ conf/common.mk  (working copy)

Don't include auto-generated files in your patch

Index: gettext/gettext.c
===
--- gettext/gettext.c   (revision 0)
+++ gettext/gettext.c   (revision 0)
+static int
+grub_gettext_get_info (int offset)
+{
+  int buf;

Use grub_uint32_t here. Also be aware of endianness. It should be
static grub_uint32_t
grub_gettext_get_info (int offset)
{
  grub_uint32_t buf;

  grub_file_seek (fd_mo, offset);
  grub_file_read (fd_mo, (char*) &buf, sizeof (buf));
  buf = grub_cpu_to_le32 (buf);
  return buf;
}
Same applies multiple times in different places.
grub_gettext_translation_number is a bit a misnomer because this name 
would suggest transforming translation into number

+  offsettranslation = grub_gettext_get_info (GETTEXT_OFFSET_TRANSLATION);
+
+  position=offsettranslation+i*8;

Please respect GCS. This should be position = offsettranslation + i * 8;

+  ret = grub_malloc(grub_strlen(orig) + 1);
+  grub_strcpy(ret,orig);
+  return ret;

This would fail if the string isn't present at all in .mo

+  if (magic != 0x950412de)

A define instead of hardcoded number is suggested

+  locale_prefix = grub_env_get ("locale_prefix");
You need to treat the case when no locale_prefix is defined. I suggest 
to put a default $prefix/locale

+  grub_sprintf (mo_file, "%s/%s/LC_MESSAGES/grub.mo", locale_prefix, lang);
+  /* XXX: lang is written by the user, need to sanitaze the input?  */

I suggest
grub_sprintf (mo_file, "%s/%s.mo", locale_prefix, lang);
because .mo need to reside together with grub so all LC_MESSAGE is just 
unnecessary



--

Regards
Vladimir 'phcoder' Serbinenko


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


Re: [PATCH] Support up to 256 SCSI disks on Linux

2009-04-10 Thread phcoder

Robert Millan wrote:

On Wed, Mar 04, 2009 at 10:16:29PM +0100, Robert Millan wrote:

   else if (major == SCSI_DISK0_MAJOR)
-sprintf (name, "/dev/sd%c", 'a' + minor / 16);
+grub_util_getdiskname_scsi (name, 0, minor / 16);
+  else if (major == SCSI_DISK1_MAJOR)
+grub_util_getdiskname_scsi (name, 1, minor / 16);
[...]

Can this be factorized somehow?  Space in raid.mod is quite critical; when
used it usually ends up in core.img, which needs to fit in the embed area.


Oh, I'm sorry.  I thought you were editting disk/raid.c.  util/raid.c has no
size issues.  A macro would still be nice though.


What about making an array of SCSI_DISK?_MAJOR and then just go through it?

--

Regards
Vladimir 'phcoder' Serbinenko


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


Re: [PATCH] framework for building modules externally

2009-04-10 Thread phcoder

Robert Millan wrote:

On Wed, Nov 05, 2008 at 07:57:38AM +0100, Christian Franke wrote:
Alternative: Export a symbol describing the ABI version in kernel 
("grub_abi_3_14").


That requires more bytes than a 32-bit integer.
You export grub_abi anyway. _3_14 is 4 bytes instead of 4 but saves. 
grub_abi_* can be a fictive variable by adding something like

  {"grub_abi_<..>", 0},
to gensymlist.sh.in



Access this symbol in each module (this can be hidden 
in GRUB_MOD_INIT).


And this adds code in every module, but for non-external modules we already
have reassurance that their abi is consistent (users should never bypass
grub-install;  if they do, it's likely going to break for them anyway).

I understand there's a minor benefit for programmers of external modules,
but both things are at the expense of extra size to kernel and core.img
modules.  External modules will only provide non-essential functionality, so
it's not a problem they have to check the ABI IMHO.




--

Regards
Vladimir 'phcoder' Serbinenko


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


Re: [PATCH] Build system improvement

2009-04-10 Thread phcoder

I don't see any stoppers to merge this patch
Javier Martín wrote:

This patch modifies several files in the build system (mainly common.rmk
and genmk.rb) to reduce the general verbosity of the build process to a
manageable, semi-informative level. Thus, what currently appears as
"gcc" calls, several lines long each is turned into lines like:

[M xfs.mod] COMPILE ../src/fs/xfs.c ->
xfs_mod-fs_xfs.o  
[M xfs.mod] LINK xfs_mod-fs_xfs.o ->
pre-xfs.o   
[M xfs.mod] Looking for EXPORTED SYMBOL definitions: pre-xfs.o


And so on. The change also makes warning-hunting marginally easier,
though not by much since the patch intentionally shows a line for nearly
every process that did so previously. This behavior could be simplified
further if needed - this post is more of an RFC than anything else.
Also, it is by no means thorough or complete - only the most common
processes have been addressed - as I'm a bit busy with exams.

The patch makes the new behavior the default one, so a new make-time
option is added: V (for "verbose"), which must have the value 1 in order
to get the behavior, as in "make V=1"




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



--

Regards
Vladimir 'phcoder' Serbinenko


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


Re: [PATCH] Long linux kernel command lines

2009-04-10 Thread phcoder

Grüüzzi
This part (now named linux16) is kept for backward compatibility only. 
And it looks like current implementation of linux command doesn't suffer 
this limitation. Can you confirm?

BTW I'm at ETH too
Jan Alsenz wrote:

Robert Millan wrote:

On Tue, Feb 10, 2009 at 07:02:56PM +0100, Jan Alsenz wrote:

Hello!

I just noticed, that the pc linux loader (loader/i386/pc/linux.c) always
truncates the kernel command line to less than 256 characters.
Well since I needed a longer command line, I fixed this problem.

Hi,

Thanks for your effort, but note that this can't be changed carelessly.  It's
possible we have this limit for backward compatibility.

If newer versions of Linux allow a longer cmdline, our code should check for
that instead.


If you look at the patch I send on Feb 11, I think it does all the necessary 
checks.


Also, would be cool if you can check whether loader/i386/linux.c also has
this problem.


Well, it uses a fixed 4k command-line area. But I don't know, if this is a
problem there.

Greets,

Jan





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



--

Regards
Vladimir 'phcoder' Serbinenko


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


Re: [PATCH] Faster text rendering by optimizing font glyph lookup

2009-04-10 Thread phcoder

Any reason not to merge this patch?
Colin D Bennett wrote:

This patch greatly—*tremendously*, even, if higher-numbered Unicode
characters are used—speeds up retrieving a glyph for a particular
Unicode character.  This makes text rendering in general much faster.

My text benchmark shows the new text rendering speed is somewhere from
2.6x to 31x of the previous speed.  Basically, PFF2 font files are now
required to have the character index ordered in ascending order of code
point.

Fonts created by 'grub-mkfont' already satisfy this requirement.  Fonts
created by my old Java 'fonttool' do not, and cannot be used any longer.

The font loader verifies that fonts fulfill the character ordering
requirement, refusing to load invalid fonts, but the primary change is
in the 'find_glyph()' function, which now uses a binary search rather
than a linear search to find the glyph.

Regards,
Colin




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



--

Regards
Vladimir 'phcoder' Serbinenko


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


[PATCH] Preboot support

2009-04-10 Thread phcoder
Hello, here is the preboot hooks support. Apply on top of my bootmove 
patch. They are very useful for patches like sendkey (my old patch that 
I'll rediff), badram, acpi (2 patches in separate threads) or drivemap

--

Regards
Vladimir 'phcoder' Serbinenko
diff --git a/ChangeLog b/ChangeLog
index a69e381..2b37e04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-04-06  Vladimir Serbinenko 
+
+	Preboot hooks support
+
+	* commands/boot.c (struct grub_preboot_t): new declaration
+	(preboots_head): new variable
+	(preboots_tail): likewise
+	(grub_loader_add_preboot): new function
+	(grub_loader_remove_preboot): likewise
+	(grub_loader_set): launch preboot hooks
+	* include/grub/loader.h (grub_loader_add_preboot): new declaration
+	(grub_loader_remove_preboot): likewise
+
 2009-03-22  Vladimir Serbinenko 
 
 	Move loader out of the kernel
diff --git a/commands/boot.c b/commands/boot.c
index 9a08fea..3eaf111 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -22,12 +22,25 @@
 #include 
 #include 
 #include 
+#include 
 
 static grub_err_t (*grub_loader_boot_func) (void);
 static grub_err_t (*grub_loader_unload_func) (void);
 static int grub_loader_noreturn;
 
+struct grub_preboot_t
+{
+  grub_err_t (*preboot_func) (int);
+  grub_err_t (*preboot_rest_func) (void);
+  int prio;
+  struct grub_preboot_t *next;
+  struct grub_preboot_t *prev;
+};
+
 static int grub_loader_loaded;
+static struct grub_preboot_t *preboots_head = 0, 
+  *preboots_tail = 0;
+
 
 int
 grub_loader_is_loaded (void)
@@ -35,6 +48,69 @@ grub_loader_is_loaded (void)
   return grub_loader_loaded;
 }
 
+/*Add a preboot function*/
+void *
+grub_loader_add_preboot (grub_err_t (*preboot_func) (int noreturn),
+			 grub_err_t (*preboot_rest_func) (void),
+			 int prio)
+{
+  struct grub_preboot_t *cur, *new_preboot;
+
+  if (! preboot_func && ! preboot_rest_func)
+return 0;
+
+  new_preboot = (struct grub_preboot_t *) 
+grub_malloc (sizeof (struct grub_preboot_t));
+  if (! new_preboot)
+{
+  grub_error (GRUB_ERR_OUT_OF_MEMORY, "hook not added");
+  return 0;
+}
+
+  new_preboot->preboot_func = preboot_func;
+  new_preboot->preboot_rest_func = preboot_rest_func;
+  new_preboot->prio = prio;
+
+  for (cur = preboots_head; cur && cur->prio > prio; cur = cur->next);
+
+  if (cur)
+{
+  new_preboot->next = cur;
+  new_preboot->prev = cur->prev;
+  cur->prev = new_preboot;
+}
+  else
+{
+  new_preboot->next = 0;
+  new_preboot->prev = preboots_tail;
+  preboots_tail = new_preboot;
+}
+  if (new_preboot->prev)
+new_preboot->prev->next = new_preboot;
+  else
+preboots_head = new_preboot;
+
+
+  return new_preboot;
+}
+
+void 
+grub_loader_remove_preboot (void *hnd)
+{
+  struct grub_preboot_t *preb = hnd;
+
+  if (preb->next)
+preb->next->prev = preb->prev;
+  else
+preboots_tail = preb->prev;
+  if (preb->prev)
+preb->prev->next = preb->next;
+  else
+preboots_head = preb->next;
+
+  grub_free (preb);  
+}
+
 void
 grub_loader_set (grub_err_t (*boot) (void),
 		 grub_err_t (*unload) (void),
@@ -65,13 +141,32 @@ grub_loader_unset(void)
 grub_err_t
 grub_loader_boot (void)
 {
+  grub_err_t err = GRUB_ERR_NONE;
+  struct grub_preboot_t *cur;
+
   if (! grub_loader_loaded)
 return grub_error (GRUB_ERR_NO_KERNEL, "no loaded kernel");
 
   if (grub_loader_noreturn)
 grub_machine_fini ();
+
+  for (cur = preboots_head; cur; cur = cur->next)
+if (err = cur->preboot_func (grub_loader_noreturn))
+  {
+	for (cur = cur->prev; cur; cur = cur->prev)
+	  cur->preboot_rest_func ();
+	return err;
+  }
   
-  return (grub_loader_boot_func) ();
+  err = (grub_loader_boot_func) ();
+
+  for (cur = preboots_tail; cur; cur = cur->prev)
+if (! err) 
+  err = cur->preboot_rest_func ();
+else
+  cur->preboot_rest_func ();
+
+  return err;
 }
 
 
diff --git a/include/grub/loader.h b/include/grub/loader.h
index 185d297..f701569 100644
--- a/include/grub/loader.h
+++ b/include/grub/loader.h
@@ -41,4 +41,12 @@ void grub_loader_unset (void);
depending on the setting by grub_loader_set.  */
 grub_err_t grub_loader_boot (void);
 
+/* Add a preboot function */
+void *grub_loader_add_preboot (grub_err_t (*preboot_func) (int noreturn),
+			   grub_err_t (*preboot_rest_func) (void),
+			   int prio);
+
+/* Remove given preboot function */
+void grub_loader_remove_preboot (void *hnd);
+
 #endif /* ! GRUB_LOADER_HEADER */
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH]: grub: Fix type of 'actual' size arguments to ieee1275 interfaces.

2009-04-10 Thread David Miller
From: Manoel Rebelo Abranches 
Date: Thu, 09 Apr 2009 20:00:43 -0300

> This patch is ok. it shouldn't be int.

Committed, thanks.


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


[PATCH] Fix target tool check logic

2009-04-10 Thread Pavel Roskin

Hello!

I promised this patch long ago, but didn't have a chance to implement  
and test it.  This patch would help users test GRUB using  
cross-compilers.  Many users would prefer to compile native GRUB  
utilities (grub-mkimage etc) but create the bootloader for another  
platform.  This is currently impossible.  To compile the bootloader  
for a foreign architecture, you have to cross-compile the GRUB  
utilities.


The current logic is broken.  The check for the target compiler is  
made if the canonical name for the build and the host are identical,  
that is if we are cross-compiling the GRUB utilities.  The matches the  
incorrect comment, but doesn't match the intention of the code.


The intention is to check for the target compiler and other tools  
after we have already found the tools for compiling for the host.


If the target has not been specified on the command line, there is no  
need to look for the target tools.  It is assumed that the host and  
the target are the same, whether we are cross-compiling or not.  The  
host tools can be used.  The target specified on the command line is  
stored in $target_alias.  Thus, if $target_alias is empty, we don't  
check for the target tools.


Further, if somebody specified the host and the target in the same  
way, there is no need to check for the target tools.  They will be the  
same.  Some package build system like to specify all possible  
switches, so they will be happy.


However, if the host and the target are specified in different ways on  
the command line, we need to check for the target tools.  That  
includes the case when the host has not been specified at all.


Even if the canonical names are the same, we should check for the  
target tools.  If $host_alias and $target_alias are different,  
configure can find different compilers.  For example, if somebody runs


./configure --host=powerpc-linux --target=powerpc-linux-uclibc

and both powerpc-linux-gcc and powerpc-linux-uclibc-gcc are present in  
$PATH, the former would be used for the host and the later for the  
target.  Generally, if the user took care to specify different values,  
we should take care not to ignore that.


ChangeLog:
* configure.ac: Change the logic when we check for target tools.
Do it when the target is specified and it's different from the
specified value of the host.

--- configure.ac
+++ configure.ac
@@ -231,8 +231,8 @@
 AC_SUBST(TARGET_OBJ2ELF)
 AC_MSG_RESULT([$TARGET_OBJ2ELF])

-# For cross-compiling.
-if test "x$build" != "x$host"; then
+# Find tools for the target.
+if test -n "$target_alias" && test "x$host_alias" != "x$target_alias"; then
   # XXX this depends on the implementation of autoconf!
   tmp_ac_tool_prefix="$ac_tool_prefix"
   ac_tool_prefix=$target_alias-

--
Regards,
Pavel Roskin


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