LUKS 2 support

2019-05-27 Thread StevenDoesStuffs
I was just wondering would y'all be open to taking patches for luks2 support 
(and maybe a few other crypto enhancements), or if someone else was already 
working on those things.

Sent with [ProtonMail](https://protonmail.com) Secure Email.___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] f2fs: Fix gcc9 error -Werror=maybe-uninitialized

2019-05-27 Thread John Paul Adrian Glaubitz
On 5/27/19 12:02 PM, Daniel Kiper wrote:
>> http://lists.gnu.org/archive/html/grub-devel/2019-05/msg00099.html
> 
> John, ping? Could you send us the patch soon? IMO this is the last thing
> which blocks the release.

Just a second, I will send the patch today. Sorry for the delay.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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


Re: [PATCH] f2fs: Fix gcc9 error -Werror=maybe-uninitialized

2019-05-27 Thread Daniel Kiper
On Thu, May 23, 2019 at 03:40:28PM +0800, Michael Chang wrote:
> On Wed, May 22, 2019 at 05:35:34PM +0100, Neil MacLeod wrote:
> > > Thanks! I allowed myself to add your Tested-by. I hope this is not a 
> > > problem for you
> >
> > Not at all!
> >
> > > This and other fixes posted earlier are now in the tree.
> >
> > Latest grub HEAD (53e70d30cf0d18e6c28bab0ab8d223a90d3e1b46) continues
> > to fail when building f2fs.c with gcc-9.1 due to a packed member issue
> > - Adrian (John? - sorry!) proposed a fix[1] and Michael confirmed it
> > is correct, but that fix doesn't yet appear to be in the master tree,
> > any ideas?
> >
> > Thanks
> > Neil
> >
> > 1. http://lists.gnu.org/archive/html/grub-devel/2019-05/msg00096.html
>
> Yes, we need the patch from John to solve reported gcc-9 build issue
> entirely. From the latest update he will do soon. :)
>
> http://lists.gnu.org/archive/html/grub-devel/2019-05/msg00099.html

John, ping? Could you send us the patch soon? IMO this is the last thing
which blocks the release.

Daniel

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


[PATCH] grub2: add read_hook to blocklists

2019-05-27 Thread Michael Grzeschik
This is needed to make grubenv be stored in
raw disk images. We now can run

save_env -f (ata0)1024+2 VARIABLE

Signed-off-by: Michael Grzeschik 
---
 grub-core/kern/fs.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
index 2b85f4950..d50d519d2 100644
--- a/grub-core/kern/fs.c
+++ b/grub-core/kern/fs.c
@@ -208,6 +208,11 @@ grub_fs_blocklist_read (grub_file_t file, char *buf, 
grub_size_t len)
   grub_off_t offset;
   grub_ssize_t ret = 0;
 
+  if (file->read_hook)
+ file->device->disk->read_hook = file->read_hook;
+  if (file->read_hook_data)
+ file->device->disk->read_hook_data = file->read_hook_data;
+
   if (len > file->size - file->offset)
 len = file->size - file->offset;
 
@@ -236,6 +241,7 @@ grub_fs_blocklist_read (grub_file_t file, char *buf, 
grub_size_t len)
   else
sector -= p->length;
 }
+  file->device->disk->read_hook = 0;
 
   return ret;
 }
-- 
2.20.1


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


[PATCH] grub2: setup root in grub-setup and grub-install

2019-05-27 Thread Michael Grzeschik
With this feature it is now possible to set the root
device in userspace preperation like grub-mkimage.

Signed-off-by: Michael Grzeschik 
---
 include/grub/util/install.h |  4 ++--
 util/grub-install.c |  4 ++--
 util/grub-setup.c   | 12 +++-
 util/setup.c| 11 +++
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/include/grub/util/install.h b/include/grub/util/install.h
index 2631b1074..ff02c365c 100644
--- a/include/grub/util/install.h
+++ b/include/grub/util/install.h
@@ -191,13 +191,13 @@ grub_install_get_image_target (const char *arg);
 void
 grub_util_bios_setup (const char *dir,
  const char *boot_file, const char *core_file,
- const char *dest, int force,
+ const char *root, const char *dest, int force,
  int fs_probe, int allow_floppy,
  int add_rs_codes);
 void
 grub_util_sparc_setup (const char *dir,
   const char *boot_file, const char *core_file,
-  const char *dest, int force,
+  const char *root, const char *dest, int force,
   int fs_probe, int allow_floppy,
   int add_rs_codes);
 
diff --git a/util/grub-install.c b/util/grub-install.c
index 8a55ad4b8..f90cf2cf7 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1712,7 +1712,7 @@ main (int argc, char *argv[])
/*  Now perform the installation.  */
if (install_bootsector)
  grub_util_bios_setup (platdir, "boot.img", "core.img",
-   install_drive, force,
+   NULL, install_drive, force,
fs_probe, allow_floppy, add_rs_codes);
break;
   }
@@ -1738,7 +1738,7 @@ main (int argc, char *argv[])
/*  Now perform the installation.  */
if (install_bootsector)
  grub_util_sparc_setup (platdir, "boot.img", "core.img",
-install_drive, force,
+NULL, install_device, force,
 fs_probe, allow_floppy,
 0 /* unused */ );
break;
diff --git a/util/grub-setup.c b/util/grub-setup.c
index 42b98ad3c..ae1f98f75 100644
--- a/util/grub-setup.c
+++ b/util/grub-setup.c
@@ -87,6 +87,8 @@ static struct argp_option options[] = {
N_("install even if problems are detected"), 0},
   {"skip-fs-probe",'s',0,  0,
N_("do not probe for filesystems in DEVICE"), 0},
+  {"root-device", 'r', N_("DEVICE"), 0,
+   N_("use DEVICE as the root device"), 0},
   {"verbose", 'v', 0,  0, N_("print verbose messages."), 0},
   {"allow-floppy", 'a', 0,  0,
/* TRANSLATORS: The potential breakage isn't limited to floppies but it's
@@ -130,6 +132,7 @@ struct arguments
   char *core_file;
   char *dir;
   char *dev_map;
+  char *root_dev;
   int  force;
   int  fs_probe;
   int allow_floppy;
@@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct argp_state *state)
 arguments->dev_map = xstrdup (arg);
 break;
 
+  case 'r':
+if (arguments->root_dev)
+  free (arguments->root_dev);
+
+arguments->root_dev = xstrdup (arg);
+break;
+
   case 'f':
 arguments->force = 1;
 break;
@@ -313,7 +323,7 @@ main (int argc, char *argv[])
   GRUB_SETUP_FUNC (arguments.dir ? : DEFAULT_DIRECTORY,
   arguments.boot_file ? : DEFAULT_BOOT_FILE,
   arguments.core_file ? : DEFAULT_CORE_FILE,
-  dest_dev, arguments.force,
+  arguments.root_dev, dest_dev, arguments.force,
   arguments.fs_probe, arguments.allow_floppy,
   arguments.add_rs_codes);
 
diff --git a/util/setup.c b/util/setup.c
index 6f88f3cc4..9bef0a8a1 100644
--- a/util/setup.c
+++ b/util/setup.c
@@ -252,13 +252,12 @@ identify_partmap (grub_disk_t disk __attribute__ 
((unused)),
 void
 SETUP (const char *dir,
const char *boot_file, const char *core_file,
-   const char *dest, int force,
+   const char *root, const char *dest, int force,
int fs_probe, int allow_floppy,
int add_rs_codes __attribute__ ((unused))) /* unused on sparc64 */
 {
   char *core_path;
   char *boot_img, *core_img, *boot_path;
-  char *root = 0;
   size_t boot_size, core_size;
   grub_uint16_t core_sectors;
   grub_device_t root_dev = 0, dest_dev, core_dev;
@@ -307,7 +306,10 @@ SETUP (const char *dir,
 
   core_dev = dest_dev;
 
-  {
+  if (root)
+root_dev = grub_device_open(root);
+
+  if (!root_dev) {
 char **root_devices = grub_guess_root_devices (dir);
 char **cur;
 int found = 0;
@@ -320,6 +322,8 @@ SETUP (const char *dir,
char *drive;
grub_device_t try_dev;
 
+   if (root_dev)
+ break;
drive = grub_util_get_grub_dev (*cur);
if (!drive)
  continue;
@@ 

[PATCH] grub2: add support to search for partuuid

2019-05-27 Thread Michael Grzeschik
With this feature the grub-shell is able to search for partuuid strings.
This reduces the complexity to find the correct boot partition on
systems with unspecified device connectivity.

Signed-off-by: Michael Grzeschik 
---
 grub-core/Makefile.core.def  |  5 +
 grub-core/commands/search.c  | 25 -
 grub-core/commands/search_partuuid.c |  5 +
 grub-core/commands/search_wrap.c |  8 +++-
 grub-core/partmap/msdos.c|  9 +
 include/grub/disk.h  |  2 ++
 6 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 grub-core/commands/search_partuuid.c

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 474a63e68..208feb934 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1070,6 +1070,11 @@ module = {
   common = commands/search_file.c;
 };
 
+module = {
+  name = search_partuuid;
+  common = commands/search_partuuid.c;
+};
+
 module = {
   name = search_fs_uuid;
   common = commands/search_uuid.c;
diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c
index ed090b3af..3ac93943b 100644
--- a/grub-core/commands/search.c
+++ b/grub-core/commands/search.c
@@ -72,7 +72,26 @@ iterate_device (const char *name, void *data)
 #define compare_fn grub_strcmp
 #endif
 
-#ifdef DO_SEARCH_FILE
+#ifdef (DO_SEARCH_PARTUUID)
+{
+  grub_disk_t disk;
+  char *part_uuid;
+  char *uuid;
+
+  disk = grub_disk_open (name);
+  if (disk && disk->partition)
+   {
+  part_uuid = grub_xasprintf ("%08x-%02x", disk->nt_disk_sig,
+  disk->partition->index + 1);
+  if (compare_fn (part_uuid, ctx->key) == 0)
+   found = 1;
+  if (part_uuid)
+grub_free (part_uuid);
+}
+  if (disk)
+grub_disk_close (disk);
+}
+#elif defined (DO_SEARCH_FILE)
 {
   char *buf;
   grub_file_t file;
@@ -313,6 +332,8 @@ static grub_command_t cmd;
 
 #ifdef DO_SEARCH_FILE
 GRUB_MOD_INIT(search_fs_file)
+#elif defined (DO_SEARCH_PARTUUID)
+GRUB_MOD_INIT(search_partuuid)
 #elif defined (DO_SEARCH_FS_UUID)
 GRUB_MOD_INIT(search_fs_uuid)
 #else
@@ -327,6 +348,8 @@ GRUB_MOD_INIT(search_label)
 
 #ifdef DO_SEARCH_FILE
 GRUB_MOD_FINI(search_fs_file)
+#elif defined (DO_SEARCH_PARTUUID)
+GRUB_MOD_FINI(search_partuuid)
 #elif defined (DO_SEARCH_FS_UUID)
 GRUB_MOD_FINI(search_fs_uuid)
 #else
diff --git a/grub-core/commands/search_partuuid.c 
b/grub-core/commands/search_partuuid.c
new file mode 100644
index 0..e4aa20b5f
--- /dev/null
+++ b/grub-core/commands/search_partuuid.c
@@ -0,0 +1,5 @@
+#define DO_SEARCH_PARTUUID 1
+#define FUNC_NAME grub_search_partuuid
+#define COMMAND_NAME "search.partuuid"
+#define HELP_MESSAGE N_("Search devices by PARTUUID. If VARIABLE is specified, 
the first device found is set to a variable.")
+#include "search.c"
diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c
index d7fd26b94..ba36dbac2 100644
--- a/grub-core/commands/search_wrap.c
+++ b/grub-core/commands/search_wrap.c
@@ -36,6 +36,8 @@ static const struct grub_arg_option options[] =
  0, 0},
 {"fs-uuid",'u', 0, N_("Search devices by a filesystem 
UUID."),
  0, 0},
+{"partuuid",   'p', 0, N_("Search devices by a PARTUUID."),
+ 0, 0},
 {"set",'s', GRUB_ARG_OPTION_OPTIONAL,
  N_("Set a variable to the first device found."), N_("VARNAME"),
  ARG_TYPE_STRING},
@@ -71,6 +73,7 @@ enum options
 SEARCH_FILE,
 SEARCH_LABEL,
 SEARCH_FS_UUID,
+SEARCH_PARTUUID,
 SEARCH_SET,
 SEARCH_NO_FLOPPY,
 SEARCH_HINT,
@@ -186,6 +189,9 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char 
**args)
   else if (state[SEARCH_FS_UUID].set)
 grub_search_fs_uuid (id, var, state[SEARCH_NO_FLOPPY].set,
 hints, nhints);
+  else if (state[SEARCH_PARTUUID].set)
+grub_search_partuuid (id, var, state[SEARCH_NO_FLOPPY].set,
+hints, nhints);
   else if (state[SEARCH_FILE].set)
 grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set, 
 hints, nhints);
@@ -207,7 +213,7 @@ GRUB_MOD_INIT(search)
  N_("[-f|-l|-u|-s|-n] [--hint HINT [--hint HINT] ...]"
 " NAME"),
  N_("Search devices by file, filesystem label"
-" or filesystem UUID."
+" PARTUUID or filesystem UUID."
 " If --set is specified, the first device found is"
 " set to a variable. If no variable name is"
 " specified, `root' is used."),
diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c
index 7b8e45076..8a4af5931 100644
--- a/grub-core/partmap/msdos.c
+++ b/grub-core/partmap/msdos.c
@@ -19,6 +19,7 @@
 
 #include