Re: arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’

2018-11-21 Thread Lee Jones
On Wed, 21 Nov 2018, Daniel Kiper wrote:

> On Tue, Nov 20, 2018 at 10:45:04AM +0000, Lee Jones wrote:
> > From: Lee Jones 
> >
> > arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’
> >
> > Without this fix, building xen_boot.c omits:
> >
> > loader/arm64/xen_boot.c: In function ‘xen_boot_binary_load’:
> > loader/arm64/xen_boot.c:370:7: error: too few arguments to function 
> > ‘grub_create_loader_cmdline’
> >grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
> >^~
> > In file included from loader/arm64/xen_boot.c:36:0:
> > ../include/grub/lib/cmdline.h:29:12: note: declared here
> >  grub_err_t grub_create_loader_cmdline (int argc, char *argv[], char *buf,
> >
> > Signed-off-by: Lee Jones 
> 
> Pushed despite it had malformed tabs. Next time please use "git format-patch"
> and "git send-email" to build and send the patches.

I normally do this (for my kernel work), but Leif asked me to reply
directly to this mail (since I am not set-up for Grub).

If I continue to contribute, I'll set something up more enduring.

Thank you for your help.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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


arm64/xen: Remove duplicate check for arguments

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Remove duplicate check for arguments

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 1b1dd8c65..5af15c70d 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -404,12 +404,6 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
   argc--;
 }
 
-  if (!argc)
-{
-  grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
-  goto fail;
-}
-
   if (!loaded)
 {
   grub_error (GRUB_ERR_BAD_ARGUMENT,

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


[PATCH v2] arm64/xen: Fix too few arguments to function ‘grub_file_open’

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_file_open’

Without this fix xen_boot.c omits:

loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_module’:
loader/arm64/xen_boot.c:424:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~
In file included from ../include/grub/cache.h:23:0,
 from loader/arm64/xen_boot.c:19:
../include/grub/file.h:204:25: note: declared here
 grub_file_t EXPORT_FUNC(grub_file_open) (const char *name, enum grub_file_type 
type);
 ^
../include/grub/symbol.h:68:25: note: in definition of macro ‘EXPORT_FUNC’
 # define EXPORT_FUNC(x) x
 ^
loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_hypervisor’:
loader/arm64/xen_boot.c:456:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 117293fb9..1b1dd8c65 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -427,7 +427,7 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
   if (!file)
 goto fail;
 
@@ -459,7 +459,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ 
((unused)),
   goto fail;
 }
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
   if (!file)
 goto fail;

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


[PATCH v3 (part 2)] generic/blocklist: Fix implicit declaration of function ‘grub_file_filter_disable_compression'

2018-11-20 Thread Lee Jones
From: Lee Jones 

generic/blocklist: Fix implicit declaration of function 
‘grub_file_filter_disable_compression'

grub_file_filter_disable_compression() no longer exists.

Signed-off-by: Lee Jones 

diff --git a/grub-core/osdep/generic/blocklist.c 
b/grub-core/osdep/generic/blocklist.c
index 74024fd06..43186949d 100644
--- a/grub-core/osdep/generic/blocklist.c
+++ b/grub-core/osdep/generic/blocklist.c
@@ -59,8 +59,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
 
   grub_disk_cache_invalidate_all ();
 
-  grub_file_filter_disable_compression ();
-  file = grub_file_open (core_path_dev);
+  file = grub_file_open (core_path_dev, FILE_TYPE_NO_DECOMPRESS);
   if (file)
{
  if (grub_file_size (file) != core_size)
@@ -117,8 +116,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
 
   grub_file_t file;
   /* Now read the core image to determine where the sectors are.  */
-  grub_file_filter_disable_compression ();
-  file = grub_file_open (core_path_dev);
+  file = grub_file_open (core_path_dev, FILE_TYPE_NO_DECOMPRESS);
   if (! file)
 grub_util_error ("%s", grub_errmsg);

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


Re: arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression

2018-11-20 Thread Lee Jones
On Tue, 20 Nov 2018, Julien Grall wrote:
> On 20/11/2018 10:46, Lee Jones wrote:
> > From: Lee Jones 
> > 
> > arm64/xen: Fix implicit declaration of function 
> > ‘grub_file_filter_disable_compression
> 
> This patch seems to drop support for --nounzip. Can you explain why?

It only seemed to serve the invocation of grub_file_filter_disable_compression()
which was removed in this patch.  On closer inspection, I do see that
argv/argc still needs to be shifted though.  I will fix that.

> Note that the option added on Arm64 to keep the compatibility with x86
> multiboot loading.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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


[PATCH v3 (part 1)] arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression'

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix implicit declaration of function 
‘grub_file_filter_disable_compression'

Without this fix, building xen_boot.c emits:

loader/arm64/xen_boot.c:433:5: error: implicit declaration of function 
‘grub_file_filter_disable_compression’; did you mean 
‘grub_file_filter_unregister’? [-Werror=implicit-function-declaration]
 grub_file_filter_disable_compression ();
 ^~~~
 grub_file_filter_unregister
loader/arm64/xen_boot.c:433:5: error: nested extern declaration of 
‘grub_file_filter_disable_compression’ [-Werror=nested-externs]

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 7d1adce1b..a01792a72 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -429,9 +429,9 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
 
-  if (nounzip)
-grub_file_filter_disable_compression ();
-  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL
+| (nounzip ? GRUB_FILE_TYPE_NO_DECOMPRESS
+   : GRUB_FILE_TYPE_NONE));
   if (!file)
 goto fail;

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


Re: arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression

2018-11-20 Thread Lee Jones
On Tue, 20 Nov 2018, Julien Grall wrote:

> Hi,
> 
> On 20/11/2018 11:22, Lee Jones wrote:
> > On Tue, 20 Nov 2018, Julien Grall wrote:
> > > On 20/11/2018 10:46, Lee Jones wrote:
> > > > From: Lee Jones 
> > > > 
> > > > arm64/xen: Fix implicit declaration of function 
> > > > ‘grub_file_filter_disable_compression
> > > 
> > > This patch seems to drop support for --nounzip. Can you explain why?
> > 
> > It only seemed to serve the invocation of 
> > grub_file_filter_disable_compression()
> > which was removed in this patch.
> 
> But --nounzip will not work as expected after this patch. Looking at GRUB,
> it seems the call to that function was replaced by passing
> GRUB_FILE_TYPE_NO_DECOMPRESSION to grub_file_open.

Ah yes, I see.  Please bear with me.

I need to split this patch too.

> Is there any reason to not use it for Arm?

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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


arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’

Without this fix, building xen_boot.c omits:

loader/arm64/xen_boot.c: In function ‘xen_boot_binary_load’:
loader/arm64/xen_boot.c:370:7: error: too few arguments to function 
‘grub_create_loader_cmdline’
   grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
   ^~
In file included from loader/arm64/xen_boot.c:36:0:
../include/grub/lib/cmdline.h:29:12: note: declared here
 grub_err_t grub_create_loader_cmdline (int argc, char *argv[], char *buf,

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 1003a0b99..33a855df4 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -368,7 +368,8 @@ xen_boot_binary_load (struct xen_boot_binary *binary, 
grub_file_t file,
  return;
}
   grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
- binary->cmdline_size);
+ binary->cmdline_size,
+ GRUB_VERIFY_KERNEL_CMDLINE);
   grub_dprintf ("xen_loader",
"Xen_boot cmdline @ %p %s, size: %d\n",
binary->cmdline, binary->cmdline, binary->cmdline_size);

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


Re: arm64/xen: Fix too few arguments to function ‘grub_file_open’

2018-11-20 Thread Lee Jones
On Tue, 20 Nov 2018, Julien Grall wrote:

> Hi Lee,
> 
> On 20/11/2018 10:48, Lee Jones wrote:
> > From: Lee Jones 
> > 
> > arm64/xen: Fix too few arguments to function ‘grub_file_open’
> > Without this fix xen_boot.c omits:
> > loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_module’:
> > loader/arm64/xen_boot.c:424:10: error: too few arguments to function 
> > ‘grub_file_open’
> > file = grub_file_open (argv[0]);
> >^~
> > In file included from ../include/grub/cache.h:23:0,
> >   from loader/arm64/xen_boot.c:19:
> > ../include/grub/file.h:204:25: note: declared here
> >   grub_file_t EXPORT_FUNC(grub_file_open) (const char *name, enum 
> > grub_file_type type);
> >   ^
> > ../include/grub/symbol.h:68:25: note: in definition of macro ‘EXPORT_FUNC’
> >   # define EXPORT_FUNC(x) x
> >   ^
> > loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_hypervisor’:
> > loader/arm64/xen_boot.c:456:10: error: too few arguments to function 
> > ‘grub_file_open’
> > file = grub_file_open (argv[0]);
> >^~
> > 
> > Signed-off-by: Lee Jones 
> > 
> > diff --git a/grub-core/loader/arm64/xen_boot.c 
> > b/grub-core/loader/arm64/xen_boot.c
> > index 5820412e8..1f49e3278 100644
> > --- a/grub-core/loader/arm64/xen_boot.c
> > +++ b/grub-core/loader/arm64/xen_boot.c
> > @@ -421,7 +421,7 @@ grub_cmd_xen_module (grub_command_t cmd 
> > __attribute__((unused)),
> > grub_dprintf ("xen_loader", "Init module and node info\n");
> > -  file = grub_file_open (argv[0]);
> > +  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
> > if (!file)
> >   goto fail;
> > @@ -453,7 +453,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd 
> > __attribute__ ((unused)),
> > goto fail;
> >   }
> > -  file = grub_file_open (argv[0]);
> > +  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
> 
> I would prefer if we try to keep the type similar to x86 Xen. In that case
> it would be GRUB_FILE_TYPE_LINUX_KERNEL.

Thanks Julien.  Will fix.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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


arm64/xen: Fix too few arguments to function ‘grub_file_open’

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_file_open’

Without this fix xen_boot.c omits:

loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_module’:
loader/arm64/xen_boot.c:424:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~
In file included from ../include/grub/cache.h:23:0,
 from loader/arm64/xen_boot.c:19:
../include/grub/file.h:204:25: note: declared here
 grub_file_t EXPORT_FUNC(grub_file_open) (const char *name, enum grub_file_type 
type);
 ^
../include/grub/symbol.h:68:25: note: in definition of macro ‘EXPORT_FUNC’
 # define EXPORT_FUNC(x) x
 ^
loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_hypervisor’:
loader/arm64/xen_boot.c:456:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 5820412e8..1f49e3278 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -421,7 +421,7 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
   if (!file)
 goto fail;
 
@@ -453,7 +453,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ 
((unused)),
   goto fail;
 }
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
   if (!file)
 goto fail;

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