Patchwork grub_git: fix warning->error

login
register
mail settings
Submitter Trevor Woerner
Date May 28, 2014, 1:26 p.m.
Message ID <1401283598-9136-1-git-send-email-trevor.woerner@linaro.org>
Download mbox | patch
Permalink /patch/72903/
State New
Headers show

Comments

Trevor Woerner - May 28, 2014, 1:26 p.m.
This patch fixes a grub build error which is promoted to an error via -Werror.

Signed-off-by: Trevor Woerner <trevor.woerner@linaro.org>
Upstream-status: submitted
---
 ...l-grub-gen-asciih-fix-build-warning-error.patch | 44 ++++++++++++++++++++++
 meta/recipes-bsp/grub/grub_git.bb                  |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta/recipes-bsp/grub/grub/0001-util-grub-gen-asciih-fix-build-warning-error.patch
Khem Raj - May 28, 2014, 7:57 p.m.
On Wed, May 28, 2014 at 6:26 AM, Trevor Woerner
<trevor.woerner@linaro.org> wrote:
> This patch fixes a grub build error which is promoted to an error via -Werror.
>
> Signed-off-by: Trevor Woerner <trevor.woerner@linaro.org>
> Upstream-status: submitted
> -

Upstream-status should appear in component source patch header not
overall OE patch header.
Trevor Woerner - May 29, 2014, 3:41 a.m.
On 05/28/14 15:57, Khem Raj wrote:
> Upstream-status should appear in component source patch header not
> overall OE patch header. 

Thanks for the clarification. v2 is on its way.

Patch

diff --git a/meta/recipes-bsp/grub/grub/0001-util-grub-gen-asciih-fix-build-warning-error.patch b/meta/recipes-bsp/grub/grub/0001-util-grub-gen-asciih-fix-build-warning-error.patch
new file mode 100644
index 0000000..cb46cad
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub/0001-util-grub-gen-asciih-fix-build-warning-error.patch
@@ -0,0 +1,44 @@ 
+From 9b8a9aafae67848cadb5961e5edbb34bea8987e1 Mon Sep 17 00:00:00 2001
+From: Trevor Woerner <trevor.woerner@linaro.org>
+Date: Mon, 26 May 2014 12:58:50 -0400
+Subject: [PATCH] util/grub-gen-asciih: fix build warning->error
+
+Using a GCC 4.8.1 cross-compiler for ARM a "may be used uninitialized in this
+function" warning is generated which is converted to an error via -Werror.
+This patch eliminates the warning by initializing the structure then checking
+it has been filled in correctly after calling add_glyph().
+
+Signed-off-by: Trevor Woerner <trevor.woerner@linaro.org>
+---
+ util/grub-gen-asciih.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/util/grub-gen-asciih.c b/util/grub-gen-asciih.c
+index e01447a..c143afd 100644
+--- a/util/grub-gen-asciih.c
++++ b/util/grub-gen-asciih.c
+@@ -131,6 +131,8 @@ write_font_ascii_bitmap (FILE *file, FT_Face face)
+   struct grub_glyph_info glyph;
+   int char_code;
+ 
++  memset (&glyph, 0, sizeof(glyph));
++
+   fprintf (file, "/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n");
+   fprintf (file, "unsigned char ascii_bitmaps[] =\n");
+   fprintf (file, "{\n");
+@@ -144,6 +146,12 @@ write_font_ascii_bitmap (FILE *file, FT_Face face)
+ 	return;
+       add_glyph (glyph_idx, face, char_code, &glyph);
+ 
++      if (glyph.bitmap == 0)
++        {
++          fprintf (stderr, "grub-gen-asciih: add_glyph not successful");
++          exit (1);
++        }
++
+       if (glyph.width == 8 && glyph.height == 16
+ 	  && glyph.x_ofs == 0 && glyph.y_ofs == 0)
+ 	{
+-- 
+1.9.0
+
diff --git a/meta/recipes-bsp/grub/grub_git.bb b/meta/recipes-bsp/grub/grub_git.bb
index 1b9497c..e2e0bf0 100644
--- a/meta/recipes-bsp/grub/grub_git.bb
+++ b/meta/recipes-bsp/grub/grub_git.bb
@@ -22,6 +22,7 @@  SRC_URI = "git://git.savannah.gnu.org/grub.git \
            file://40_custom \
            file://autogen.sh-exclude-pc.patch \
            file://grub-2.00-add-oe-kernel.patch \
+           file://0001-util-grub-gen-asciih-fix-build-warning-error.patch \
           "
 
 S = "${WORKDIR}/git"