Re: Keyfile Support for GRUBs LUKS

2013-11-21 Thread Vladimir 'phcoder' Serbinenko
Why do you need offset and size options? keyfile option should be
repeteable. The whole array would be passed down and file would be opened
instead before reading password and concatebated with it unless
--no-password was specified as well. If you have remaining questions feel
free to ask here or on IRC.
On Nov 20, 2013 12:43 AM, "Ralf Ramsauer" 
wrote:

> Hi,
>
> yesterday I realised, that GRUB is already supporting LUKS and even
> simple DSA signature checking.
>
> I was thinking about the following setup:
>   - fully encrypted harddisk (LUKS) (incl. rootfs).
>   - no bootloader on harddisk
>   - kernel + initrd inside encrypted partition
>   - optionally: signatures of the kernel + initrd
>
> For "trusted" booting, I thought about an USB stick, that just includes
> GRUB, a public key for verification and a keyfile for LUKS.
> Using that setup, no password input would be required during boot. The
> USB stick can be considered as "trusted environment".
>
> Unfortunately, GRUB doesn't support keyfile for Luks up to now. As I'm
> quite familiar with dm-crypt and LUKS I tried to implement the keyfile
> feature to GRUB.
> After spending several hours trying to get a deeper insight into the
> GRUB internas I finally resigned, as I was missing documentation on
> several things...
>
> I was very confused about the way how GRUB2 is handling its modules and
> about the strategies how functions are exactly called.
> The aim is to implement three additional options to cryptodisk.c resp.
> luks.c:
>  -k keyfile [e.g. (hd2,msdos3)/mysecretkey]
>  -o keyfile offset [optional, default: 0]
>  -s keyfile size [optional, default: keyfilesize]
>
> Using LUKS, a keyfile can simply be treated like a passphrase, which
> basically is already implemented.
>
> I would appreciate, if perhaps someone of you could help me with this
> issue.
>
> Thanks in advance!
>   Ralf
>
> --
> Ralf Ramsauer
>
> PGP: 0x8F10049B
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] Add a --locale-directory option to grub-install and related tools.

2013-11-21 Thread Colin Watson
* include/grub/util/install.h (GRUB_INSTALL_OPTIONS): Add
--locale-directory option.
(enum grub_install_options): Add
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
* util/grub-install-common.c (grub_install_help_filter): Handle
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
(grub_install_parse): Likewise.
(get_localedir): New function to check for a user-provided option
before trying grub_util_get_localedir.
(copy_locales): Use get_localedir rather than
grub_util_get_localedir.
(grub_install_copy_files): Likewise.
---
 ChangeLog   | 17 +
 include/grub/util/install.h |  4 
 util/grub-install-common.c  | 20 ++--
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d4b5b2..62a4d48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2013-11-21  Colin Watson  
 
+   Add a --locale-directory option to grub-install and related tools.
+
+   * include/grub/util/install.h (GRUB_INSTALL_OPTIONS): Add
+   --locale-directory option.
+   (enum grub_install_options): Add
+   GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
+   * util/grub-install-common.c (grub_install_help_filter): Handle
+   GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
+   (grub_install_parse): Likewise.
+   (get_localedir): New function to check for a user-provided option
+   before trying grub_util_get_localedir.
+   (copy_locales): Use get_localedir rather than
+   grub_util_get_localedir.
+   (grub_install_copy_files): Likewise.
+
+2013-11-21  Colin Watson  
+
* util/grub-mkrescue.c (main): If a source directory is not
specified, read platform-specific files from subdirectories of
pkglibdir, not pkgdatadir.
diff --git a/include/grub/util/install.h b/include/grub/util/install.h
index c1cd6b3..6b0bc33 100644
--- a/include/grub/util/install.h
+++ b/include/grub/util/install.h
@@ -47,6 +47,9 @@
   { "override-directory", GRUB_INSTALL_OPTIONS_DIRECTORY2, \
   N_("DIR"), OPTION_HIDDEN,
\
 N_("use images and modules under DIR [default=%s/]"), 1 },  \
+  { "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, \
+  N_("DIR"), 0,\
+N_("use translations under DIR [default=%s]"), 1 },
\
   { "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, \
   "FILE", OPTION_HIDDEN, 0, 1 },   \
 /* TRANSLATORS: "embed" is a verb (command description).  "*/  \
@@ -100,6 +103,7 @@ enum grub_install_options {
   GRUB_INSTALL_OPTIONS_INSTALL_LOCALES,
   GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,
   GRUB_INSTALL_OPTIONS_DIRECTORY2,
+  GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
   GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE
 };
 
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
index 4e1d41a..c733489 100644
--- a/util/grub-install-common.c
+++ b/util/grub-install-common.c
@@ -58,6 +58,8 @@ grub_install_help_filter (int key, const char *text,
 case GRUB_INSTALL_OPTIONS_DIRECTORY:
 case GRUB_INSTALL_OPTIONS_DIRECTORY2:
   return xasprintf(text, grub_util_get_pkglibdir ());  
+case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY:
+  return xasprintf(text, grub_util_get_localedir ());
 default:
   return (char *) text;
 }
@@ -217,6 +219,7 @@ struct install_list install_locales = { 1, 0, 0, 0 };
 struct install_list install_fonts = { 1, 0, 0, 0 };
 struct install_list install_themes = { 1, 0, 0, 0 };
 char *grub_install_source_directory = NULL;
+char *grub_install_locale_directory = NULL;
 
 void
 grub_install_push_module (const char *val)
@@ -313,6 +316,10 @@ grub_install_parse (int key, char *arg)
   free (grub_install_source_directory);
   grub_install_source_directory = xstrdup (arg);
   return 1;
+case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY:
+  free (grub_install_locale_directory);
+  grub_install_locale_directory = xstrdup (arg);
+  return 1;
 case GRUB_INSTALL_OPTIONS_INSTALL_MODULES:
   handle_install_list (&install_modules, arg, 0);
   return 1;
@@ -551,12 +558,21 @@ copy_all (const char *srcd,
   grub_util_fd_closedir (d);
 }
 
+static const char *
+get_localedir (void)
+{
+  if (grub_install_locale_directory)
+return grub_install_locale_directory;
+  else
+return grub_util_get_localedir ();
+}
+
 static void
 copy_locales (const char *dstd)
 {
   grub_util_fd_dir_t d;
   grub_util_fd_dirent_t de;
-  const char *locale_dir = grub_util_get_localedir ();
+  const char *locale_dir = get_localedir ();
 
   d = grub_util_fd_opendir (locale_dir);
   if (!d)
@@ -706,7 +722,7 @@ grub_install_copy_files (const char *src,
 }
   else
 {
-  const char *locale_dir = grub_util_get_localedir ();
+  const char *locale_dir = get_localedir ();
 
   for (i = 0; i < install_locales.n_entries; i++)
{
-- 
1.8.4.3


[PATCH] Enable grub-install --no-nvram option for EFI targets

2013-11-21 Thread Keshav Padram Amburay
Hi,
 The attached patch enables --no-nvram option for EFI targets in
grub-install so that it is possible to prevent grub-install from create a
boot entry using efibootmgr in non-removable EFI installs.

With Best Regards,

Keshav
commit 307c6b4440562245d2adfcc585b4175ef9c61260
Author: Keshav Padram Amburay 
Date:   Fri Nov 22 00:26:37 2013 +0530

* util/grub-install.c (update_nvram): Support --no-nvram flag
in EFI targets to prevent grub-install from creating entry using
efibootmgr in non-removable EFI installs

diff --git a/ChangeLog b/ChangeLog
index 6d4b5b2..e54674b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-11-22  Keshav Padram Amburay 
+
+	* util/grub-install.c (update_nvram): Support --no-nvram flag
+	in EFI targets to prevent grub-install from creating entry using
+	efibootmgr in non-removable EFI installs
+
 2013-11-21  Colin Watson  
 
 	* util/grub-mkrescue.c (main): If a source directory is not
diff --git a/util/grub-install.c b/util/grub-install.c
index 78e9a04..72e8957 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -233,7 +233,7 @@ static struct argp_option options[] = {
   "This option is only available on BIOS target."), 2},
   {"no-nvram", OPTION_NO_NVRAM, 0, 0,
N_("don't update the `boot-device' NVRAM variable. "
-  "This option is only available on IEEE1275 targets."), 2},
+  "This option is only available on EFI and IEEE1275 targets."), 2},
   {"skip-fs-probe",'s',0,  0,
N_("do not probe for filesystems in DEVICE"), 0},
   {"no-bootsector", OPTION_NO_BOOTSECTOR, 0, 0,
@@ -1509,7 +1509,7 @@ main (int argc, char *argv[])
 	grub_install_copy_file (imgfile, dst, 1);
 	free (dst);
   }
-  if (!removable)
+  if (!removable && update_nvram)
 	{
 	  char * efidir_disk;
 	  int efidir_part;
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] grub-legacy: fix 256 char limitation on kernel command line length

2013-11-21 Thread Paul Gortmaker
The legacy grub only copies 0xff chars of cmdline, which means that
longer lines used with nfsroot and static network settings may get
truncated.

The code where this happens is in stage2/boot.c:

   while (dest < linux_data_tmp_addr + LINUX_CL_END_OFFSET && *src)
  *(dest++) = *(src++);

Bump everything up by 0x100 to give us 512 chars, or double what it
used to be.  Current x86 kernels support up to 2048 chars, but this
will cover 99% of currently failing use cases.

Signed-off-by: Paul Gortmaker 

---

diff --git a/stage2/shared.h b/stage2/shared.h
index 818062c..8cf24da 100644
--- a/stage2/shared.h
+++ b/stage2/shared.h
@@ -160,8 +160,8 @@ extern char *grub_scratch_mem;
 #define LINUX_VID_MODE_ASK 0xFFFD
 
 #define LINUX_CL_OFFSET0x9000
-#define LINUX_CL_END_OFFSET0x90FF
-#define LINUX_SETUP_MOVE_SIZE  0x9100
+#define LINUX_CL_END_OFFSET0x91FF
+#define LINUX_SETUP_MOVE_SIZE  0x9200
 #define LINUX_CL_MAGIC 0xA33F
 
 /*

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


Re: Keyfile Support for GRUBs LUKS

2013-11-21 Thread Ralf Ramsauer
On 11/21/13 16:31, Vladimir 'phcoder' Serbinenko wrote:
>
> Why do you need offset and size options? keyfile option should be
> repeteable. The whole array would be passed down and file would be
> opened instead before reading password and concatebated with it unless
> --no-password was specified as well. If you have remaining questions
> feel free to ask here or on IRC.
>
See man 8 cryptsetup:
 /  --keyfile-offset value//
//  Skip value bytes at the beginning of the key file. 
Works with all commands that accepts key files.//
//
//   --keyfile-size, -l value//
//  Read a maximum of value bytes from the key file. 
Default is to read the whole file up to the compiled-in maximum that can
be queried with --help. Supplying more data than the compiled-in maximum
aborts the operation.//
//
//  This option is useful to cut trailing newlines, for
example. If --keyfile-offset is also given, the size count starts after
the offset.  Works with all commands that accepts key files./


> On Nov 20, 2013 12:43 AM, "Ralf Ramsauer"
>  > wrote:
>
> Hi,
>
> yesterday I realised, that GRUB is already supporting LUKS and even
> simple DSA signature checking.
>
> I was thinking about the following setup:
>   - fully encrypted harddisk (LUKS) (incl. rootfs).
>   - no bootloader on harddisk
>   - kernel + initrd inside encrypted partition
>   - optionally: signatures of the kernel + initrd
>
> For "trusted" booting, I thought about an USB stick, that just
> includes
> GRUB, a public key for verification and a keyfile for LUKS.
> Using that setup, no password input would be required during boot. The
> USB stick can be considered as "trusted environment".
>
> Unfortunately, GRUB doesn't support keyfile for Luks up to now. As I'm
> quite familiar with dm-crypt and LUKS I tried to implement the keyfile
> feature to GRUB.
> After spending several hours trying to get a deeper insight into the
> GRUB internas I finally resigned, as I was missing documentation on
> several things...
>
> I was very confused about the way how GRUB2 is handling its
> modules and
> about the strategies how functions are exactly called.
> The aim is to implement three additional options to cryptodisk.c resp.
> luks.c:
>  -k keyfile [e.g. (hd2,msdos3)/mysecretkey]
>  -o keyfile offset [optional, default: 0]
>  -s keyfile size [optional, default: keyfilesize]
>
> Using LUKS, a keyfile can simply be treated like a passphrase, which
> basically is already implemented.
>
> I would appreciate, if perhaps someone of you could help me with
> this issue.
>
> Thanks in advance!
>   Ralf
>
> --
> Ralf Ramsauer
>
> PGP: 0x8F10049B
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org 
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Ralf Ramsauer

PGP: 0x8F10049B

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


Re: Shouldn't unicode.pf2 be installed into /boot/grub ?

2013-11-21 Thread Vladimir 'phcoder' Serbinenko
This part is only for backward compatibility. New grub loads fonts from
$prefix/fonts
On Nov 21, 2013 3:24 PM, "Rémi Mathieu"  wrote:

> Hi
>
> Here is what can be found in grub.cfg
>
> /"search --no-floppy --fs-uuid --set=root //
> //if loadfont /usr/share/grub/unicode.pf2 ; then//"
> /
> GNU/Linux file hierarchie has been defined to keep together what is needed
> for any operation. So, shouldn't all material needed by grub to be kept in
> the /grub directory and the file unicode.pf2 be installed at grub-install
> time into this very directory ?
>
> Arbiel
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: Keyfile Support for GRUBs LUKS

2013-11-21 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 21.11.2013 20:34, Ralf Ramsauer wrote:
> On 11/21/13 16:31, Vladimir 'phcoder' Serbinenko wrote:
>>
>> Why do you need offset and size options? keyfile option should be
>> repeteable. The whole array would be passed down and file would be
>> opened instead before reading password and concatebated with it unless
>> --no-password was specified as well. If you have remaining questions
>> feel free to ask here or on IRC.
>>
> See man 8 cryptsetup:
>  /  --keyfile-offset value//
> //  Skip value bytes at the beginning of the key file. 
> Works with all commands that accepts key files.//
> //
> //   --keyfile-size, -l value//
> //  Read a maximum of value bytes from the key file. 
> Default is to read the whole file up to the compiled-in maximum that can
> be queried with --help. Supplying more data than the compiled-in maximum
> aborts the operation.//
> //
> //  This option is useful to cut trailing newlines, for
> example. If --keyfile-offset is also given, the size count starts after
> the offset.  Works with all commands that accepts key files./
> 
Cutting trailing newlines throuch such options is IMHO inelegant and
would require more scripting than we currently have. Also those options
result in ambiguous syntax if you have multiple keyfiles (like geli). I
think it's better to skip those options, at least for now.




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Shouldn't unicode.pf2 be installed into /boot/grub ?

2013-11-21 Thread Rémi Mathieu

Hi

Here is what can be found in grub.cfg

/"search --no-floppy --fs-uuid --set=root //
//if loadfont /usr/share/grub/unicode.pf2 ; then//"
/
GNU/Linux file hierarchie has been defined to keep together what is 
needed for any operation. So, shouldn't all material needed by grub to 
be kept in the /grub directory and the file unicode.pf2 be installed at 
grub-install time into this very directory ?


Arbiel

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


Re: [PATCH] Add a --locale-directory option to grub-install and related tools.

2013-11-21 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 21.11.2013 19:32, Colin Watson wrote:
> * include/grub/util/install.h (GRUB_INSTALL_OPTIONS): Add
> --locale-directory option.
> (enum grub_install_options): Add
> GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
> * util/grub-install-common.c (grub_install_help_filter): Handle
> GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
> (grub_install_parse): Likewise.
> (get_localedir): New function to check for a user-provided option
> before trying grub_util_get_localedir.
> (copy_locales): Use get_localedir rather than
> grub_util_get_localedir.
> (grub_install_copy_files): Likewise.
I think you need an addition to look for all of
$localedir/$lang{.mo,.gmo} and $localedir/$lang/LC_MESSAGES/grub.mo.
Like following (not tested):

diff --git a/util/grub-install-common.c b/util/grub-install-common.c
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
index 4e1d41a..bf722da 100644
--- a/util/grub-install-common.c
+++ b/util/grub-install-common.c
@@ -570,13 +586,26 @@ copy_locales (const char *dstd)
 {
   char *srcf;
   char *dstf;
+  char *ext;
   if (strcmp (de->d_name, ".") == 0)
continue;
   if (strcmp (de->d_name, "..") == 0)
continue;
-  srcf = grub_util_path_concat_ext (4, locale_dir, de->d_name,
+  ext = grub_strrchr (de->d_name, '.');
+  if (ext && (grub_strcmp (ext, ".mo") == 0
+ || grub_strcmp (ext, ".gmo") == 0))
+   {
+ srcf = grub_util_path_concat (2, locale_dir, de->d_name);
+ dstf = grub_util_path_concat (2, dstd, de->d_name);
+ ext = grub_strrchr (dstf, '.');
+ grub_strcpy (ext, ".mo");
+   }
+  else
+   {
+ srcf = grub_util_path_concat_ext (4, locale_dir, de->d_name,
"LC_MESSAGES", PACKAGE, ".mo");
-  dstf = grub_util_path_concat_ext (2, dstd, de->d_name, ".mo");
+ dstf = grub_util_path_concat_ext (2, dstd, de->d_name, ".mo");
+   }
   grub_install_compress_file (srcf, dstf, 0);
   free (srcf);
   free (dstf);





signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 boot root-on-zfs errors

2013-11-21 Thread Beeblebrox
@ Vladimir:
>> Please attach your config.log
Enclosed as requested (for latest run)

A new problem: I updated the git repo to latest and tried to re-build.
Build was started with:
./autogen.sh USE_GCC=any --disable-werror
./configure USE_GCC=any --disable-werror
gmake USE_GCC=any
However, compile fails as below. I cannot seem to get the compiler to
use gcc46 which is on my system - it insists on using clang.

cc -DHAVE_CONFIG_H -I.  -Wall -W -I./include -DGRUB_UTIL=1
-DGRUB_FILE=\"grub-core/osdep/platform_unix.c\" -I. -I. -I. -I.
-I./include -I./include -I./grub-core/lib/libgcrypt-grub/include
-I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib
-I./grub-core/gnulib  -I/usr/local/include -Wall -W -Wshadow
-Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes
-Wchar-subscripts -Wcomment -Wdeprecated-declarations
-Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal
-Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit
-Wimplicit-function-declaration -Wimplicit-int -Winit-self
-Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces
-Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar
-Wnonnull -Woverflow -Wparentheses -Wpointer-arith
-Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow
-Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef
-Wunknown-pragmas -Wunused -Wunused-function -Wunused-label
-Wunused-parameter -Wunused-value  -Wunused-variable -Wvariadic-macros
-Wvolatile-register-var -Wwrite-strings -Wnested-externs
-Wstrict-prototypes -Wpointer-sign -Wcast-align -Wno-undef
-Wno-sign-compare -Wno-unused -Wno-unused-parameter
-Wno-redundant-decls -Wno-unreachable-code -Wno-conversion
-Wno-old-style-definition   -MT
grub-core/osdep/grub_mkrescue-platform_unix.o -MD -MP -MF
grub-core/osdep/.deps-util/grub_mkrescue-platform_unix.Tpo -c -o
grub-core/osdep/grub_mkrescue-platform_unix.o `test -f
'grub-core/osdep/platform_unix.c' || echo
'./'`grub-core/osdep/platform_unix.c
In file included from grub-core/osdep/platform_unix.c:2:
grub-core/osdep/unix/platform.c:34:28: error: use of undeclared
identifier 'PATH_MAX'
  char *ret = xmalloc (2 * PATH_MAX);
   ^
grub-core/osdep/unix/platform.c:35:25: error: use of undeclared
identifier 'PATH_MAX'
  char *end = ret + 2 * PATH_MAX - 1;
^
2 errors generated.
gmake[2]: *** [grub-core/osdep/grub_mkrescue-platform_unix.o] Error 1
gmake[2]: Leaving directory `/asp/git/grub'

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


Re: grub2 boot root-on-zfs errors

2013-11-21 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 22.11.2013 08:09, Beeblebrox wrote:
> @ Vladimir:
>>> Please attach your config.log
> Enclosed as requested (for latest run)
> 
No you didn't. No config.log is attached. Please send it.
> A new problem: I updated the git repo to latest and tried to re-build.
> Build was started with:
> ./autogen.sh USE_GCC=any --disable-werror
> ./configure USE_GCC=any --disable-werror
> gmake USE_GCC=any
> However, compile fails as below. I cannot seem to get the compiler to
> use gcc46 which is on my system - it insists on using clang.
> 
GRUB can be compiled with clang 3.2 or later like INSTALL mentions.
> cc -DHAVE_CONFIG_H -I.  -Wall -W -I./include -DGRUB_UTIL=1
> -DGRUB_FILE=\"grub-core/osdep/platform_unix.c\" -I. -I. -I. -I.
> -I./include -I./include -I./grub-core/lib/libgcrypt-grub/include
> -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib
> -I./grub-core/gnulib  -I/usr/local/include -Wall -W -Wshadow
> -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes
> -Wchar-subscripts -Wcomment -Wdeprecated-declarations
> -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal
> -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit
> -Wimplicit-function-declaration -Wimplicit-int -Winit-self
> -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces
> -Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar
> -Wnonnull -Woverflow -Wparentheses -Wpointer-arith
> -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow
> -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef
> -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label
> -Wunused-parameter -Wunused-value  -Wunused-variable -Wvariadic-macros
> -Wvolatile-register-var -Wwrite-strings -Wnested-externs
> -Wstrict-prototypes -Wpointer-sign -Wcast-align -Wno-undef
> -Wno-sign-compare -Wno-unused -Wno-unused-parameter
> -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion
> -Wno-old-style-definition   -MT
> grub-core/osdep/grub_mkrescue-platform_unix.o -MD -MP -MF
> grub-core/osdep/.deps-util/grub_mkrescue-platform_unix.Tpo -c -o
> grub-core/osdep/grub_mkrescue-platform_unix.o `test -f
> 'grub-core/osdep/platform_unix.c' || echo
> './'`grub-core/osdep/platform_unix.c
> In file included from grub-core/osdep/platform_unix.c:2:
> grub-core/osdep/unix/platform.c:34:28: error: use of undeclared
> identifier 'PATH_MAX'
>   char *ret = xmalloc (2 * PATH_MAX);
>^
> grub-core/osdep/unix/platform.c:35:25: error: use of undeclared
> identifier 'PATH_MAX'
>   char *end = ret + 2 * PATH_MAX - 1;
> ^
> 2 errors generated.
grep PATH_MAX /usr/include/*
> gmake[2]: *** [grub-core/osdep/grub_mkrescue-platform_unix.o] Error 1
> gmake[2]: Leaving directory `/asp/git/grub'
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 boot root-on-zfs errors

2013-11-21 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 22.11.2013 08:09, Beeblebrox wrote:
> grub-core/osdep/unix/platform.c:34:28: error: use of undeclared
> identifier 'PATH_MAX'
>   char *ret = xmalloc (2 * PATH_MAX);
Please try
diff --git a/grub-core/osdep/unix/platform.c
b/grub-core/osdep/unix/platform.c
index 65c93f1..a527a1c 100644
--- a/grub-core/osdep/unix/platform.c
+++ b/grub-core/osdep/unix/platform.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 

 static char *
 get_ofpathname (const char *dev)



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 2/2] grub-efi: allow compilation without large model support

2013-11-21 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 22.11.2013 08:23, jackie.hu...@windriver.com wrote:
> From: Jackie Huang 
> 
> -mcmodel=large is not supported by gcc with version lower
> than 4.4, but we don't need to use memory over 4GiB, so add
> a patch to allow compilation without large model support.
> 
This patch is wrong and would reintroduce a bug. Removing AC_MSG_ERROR
is all that's needed from this patch. But on the other hand dl.c needs
safeguards to prevent silent overflow.
> Signed-off-by: Jackie Huang 
> ---
>  ...allow-a-compilation-without-mcmodel-large.patch | 81 
> ++
>  meta/recipes-bsp/grub/grub-efi_2.00.bb |  1 +
>  2 files changed, 82 insertions(+)
>  create mode 100644 
> meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
> 
> diff --git 
> a/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
>  
> b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
> new file mode 100644
> index 000..c6a30c8
> --- /dev/null
> +++ 
> b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
> @@ -0,0 +1,81 @@
> +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001
> +From: Jackie Huang 
> +Date: Tue, 5 Nov 2013 07:23:32 -0500
> +Subject: [PATCH] Allow a compilation without -mcmodel=large
> +
> +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB
> +  when compiled without -mcmodel=large
> +  (filter_memory_map): remove memory post 4 GiB when compiled
> +  without -mcmodel=large
> +* configure.ac: add -DMCMODEL_SMALL=1 to TARGET_CFLAGS when
> +  -mcmodel=large isn't supported
> +
> +It's ported from old version of grub which was deliberately
> +removed in current and newer version:
> +
> +2009-06-04  Vladimir Serbinenko  
> +
> + Allow a compilation without -mcmodel=large
> +
> +2010-04-21  Vladimir Serbinenko  
> +
> +   * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
> + is not supported.
> +
> +Upstream-Status: Inappropriate [compatibility]
> +
> +Signed-off-by: Jackie Huang 
> +---
> + configure.ac|4 +++-
> + grub-core/kern/efi/mm.c |6 +++---
> + 2 files changed, 6 insertions(+), 4 deletions(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 319d063..ee72fee 100644
> +--- a/configure.ac
>  b/configure.ac
> +@@ -567,7 +567,9 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then
> +   [grub_cv_cc_mcmodel=no])
> +   ])
> +   if test "x$grub_cv_cc_mcmodel" = xno; then
> +-AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
> ++CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
> ++TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
> ++AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the 
> memory over 4GiB. Upgrade your gcc.])
> +   else
> + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
> +   fi
> +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
> +index a2edc84..c67dd13 100644
> +--- a/grub-core/kern/efi/mm.c
>  b/grub-core/kern/efi/mm.c
> +@@ -62,7 +62,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t 
> address,
> + return 0;
> + #endif
> +
> +-#if 1
> ++#if defined (MCMODEL_SMALL)
> +   if (address == 0)
> + {
> +   type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
> +@@ -305,7 +305,7 @@ filter_memory_map (grub_efi_memory_descriptor_t 
> *memory_map,
> +desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
> + {
> +   if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
> +-#if 1
> ++#if defined (MCMODEL_SMALL)
> +   && desc->physical_start <= 0x
> + #endif
> +   && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x10
> +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t 
> *memory_map,
> +   desc->physical_start = 0x10;
> + }
> +
> +-#if 1
> ++#if defined (MCMODEL_SMALL)
> +   if (BYTES_TO_PAGES (filtered_desc->physical_start)
> +   + filtered_desc->num_pages
> +   > BYTES_TO_PAGES (0x1LL))
> +--
> +1.7.1
> +
> diff --git a/meta/recipes-bsp/grub/grub-efi_2.00.bb 
> b/meta/recipes-bsp/grub/grub-efi_2.00.bb
> index 2fe688c..deb9514 100644
> --- a/meta/recipes-bsp/grub/grub-efi_2.00.bb
> +++ b/meta/recipes-bsp/grub/grub-efi_2.00.bb
> @@ -27,6 +27,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
> file://grub-no-unused-result.patch \
> file://grub-2.00-ignore-gnulib-gets-stupidity.patch \
> file://fix-issue-with-flex-2.5.37.patch \
> +   file://grub-efi-allow-a-compilation-without-mcmodel-large.patch \
>"
>  SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c"
>  SRC_URI[sha256sum] = 
> "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/list