Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-20  1:40 [PATCH 0/2 v3] grub-efi: change to generate EFI image in target package jackie.huang
@ 2013-11-20  1:40 ` jackie.huang
  2013-11-22  2:49   ` Darren Hart
  0 siblings, 1 reply; 15+ messages in thread
From: jackie.huang @ 2013-11-20  1:40 UTC (permalink / raw)
  To: openembedded-core

From: Jackie Huang <jackie.huang@windriver.com>

-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.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++
 meta/recipes-bsp/grub/grub-efi_2.00.bb             |  1 +
 2 files changed, 70 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 0000000..b2be74a
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
@@ -0,0 +1,69 @@
+From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+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
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ 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 <= 0xffffffff
+ #endif
+ 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
+@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+ 	      desc->physical_start = 0x100000;
+ 	    }
+
+-#if 1
++#if defined (MCMODEL_SMALL)
+ 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ 	      + filtered_desc->num_pages
+ 	      > BYTES_TO_PAGES (0x100000000LL))
+--
+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"
-- 
1.8.3



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-20  1:40 ` [PATCH 2/2] grub-efi: allow compilation without large model support jackie.huang
@ 2013-11-22  2:49   ` Darren Hart
  2013-11-22  3:37     ` jhuang0
  0 siblings, 1 reply; 15+ messages in thread
From: Darren Hart @ 2013-11-22  2:49 UTC (permalink / raw)
  To: jackie.huang; +Cc: openembedded-core

On Wed, 2013-11-20 at 09:40 +0800, jackie.huang@windriver.com wrote:
> From: Jackie Huang <jackie.huang@windriver.com>
> 
> -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.
> 
> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
> ---
>  ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++
>  meta/recipes-bsp/grub/grub-efi_2.00.bb             |  1 +
>  2 files changed, 70 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 0000000..b2be74a
> --- /dev/null
> +++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
> @@ -0,0 +1,69 @@
> +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001
> +From: Jackie Huang <jackie.huang@windriver.com>
> +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
> +
> +Upstream-Status: Inappropriate [configuration]

Nice try ;-) This is compatibility, not configuration. If grub-efi
maintainers refuse to accept the patch that's up to them, but we need to
work upstream first. Please prepare a patch for upstream and submit it
for review.

--
Darren

> +
> +Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
> +---
> + 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 <= 0xffffffff
> + #endif
> + 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
> +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
> + 	      desc->physical_start = 0x100000;
> + 	    }
> +
> +-#if 1
> ++#if defined (MCMODEL_SMALL)
> + 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
> + 	      + filtered_desc->num_pages
> + 	      > BYTES_TO_PAGES (0x100000000LL))
> +--
> +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"

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-22  2:49   ` Darren Hart
@ 2013-11-22  3:37     ` jhuang0
  2013-11-22  5:04       ` Darren Hart
  0 siblings, 1 reply; 15+ messages in thread
From: jhuang0 @ 2013-11-22  3:37 UTC (permalink / raw)
  To: Darren Hart; +Cc: openembedded-core



On 11/22/2013 10:49 AM, Darren Hart wrote:
> On Wed, 2013-11-20 at 09:40 +0800, jackie.huang@windriver.com wrote:
>> From: Jackie Huang <jackie.huang@windriver.com>
>>
>> -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.
>>
>> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>> ---
>>   ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++
>>   meta/recipes-bsp/grub/grub-efi_2.00.bb             |  1 +
>>   2 files changed, 70 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 0000000..b2be74a
>> --- /dev/null
>> +++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
>> @@ -0,0 +1,69 @@
>> +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001
>> +From: Jackie Huang <jackie.huang@windriver.com>
>> +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
>> +
>> +Upstream-Status: Inappropriate [configuration]
>
> Nice try ;-) This is compatibility, not configuration. If grub-efi
> maintainers refuse to accept the patch that's up to them, but we need to

Actually it's ported from old version of grub which means that they 
allowed the comilation without large model support before, but not now. 
 From the Changelog, it was added in 2009:

2009-06-04  Vladimir Serbinenko  <phcoder@gmail.com>

         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: fail gracefully and add -DMCMODEL_SMALL=1 to
         TARGET_CFLAGS when -mcmodel=large isn't supported

but it was removed in 2010:
2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>

         * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
         is not supported.

So I think they may not accept this patch again.

Thanks,
Jackie

> work upstream first. Please prepare a patch for upstream and submit it
> for review.
>
> --
> Darren
>
>> +
>> +Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>> +---
>> + 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 <= 0xffffffff
>> + #endif
>> + 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
>> +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
>> + 	      desc->physical_start = 0x100000;
>> + 	    }
>> +
>> +-#if 1
>> ++#if defined (MCMODEL_SMALL)
>> + 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
>> + 	      + filtered_desc->num_pages
>> + 	      > BYTES_TO_PAGES (0x100000000LL))
>> +--
>> +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"
>

-- 
Jackie Huang
WIND RIVER | China Development Center
MSN:jackielily@hotmail.com
Tel: +86 8477 8594
Mobile: +86 138 1027 4745


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-22  3:37     ` jhuang0
@ 2013-11-22  5:04       ` Darren Hart
  2013-11-22  6:18         ` jhuang0
  0 siblings, 1 reply; 15+ messages in thread
From: Darren Hart @ 2013-11-22  5:04 UTC (permalink / raw)
  To: jhuang0; +Cc: openembedded-core

On Fri, 2013-11-22 at 11:37 +0800, jhuang0 wrote:
> 
> On 11/22/2013 10:49 AM, Darren Hart wrote:
> > On Wed, 2013-11-20 at 09:40 +0800, jackie.huang@windriver.com wrote:
> >> From: Jackie Huang <jackie.huang@windriver.com>
> >>
> >> -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.
> >>
> >> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
> >> ---
> >>   ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++
> >>   meta/recipes-bsp/grub/grub-efi_2.00.bb             |  1 +
> >>   2 files changed, 70 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 0000000..b2be74a
> >> --- /dev/null
> >> +++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
> >> @@ -0,0 +1,69 @@
> >> +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001
> >> +From: Jackie Huang <jackie.huang@windriver.com>
> >> +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
> >> +
> >> +Upstream-Status: Inappropriate [configuration]
> >
> > Nice try ;-) This is compatibility, not configuration. If grub-efi
> > maintainers refuse to accept the patch that's up to them, but we need to
> 
> Actually it's ported from old version of grub which means that they 
> allowed the comilation without large model support before, but not now. 
>  From the Changelog, it was added in 2009:
> 
> 2009-06-04  Vladimir Serbinenko  <phcoder@gmail.com>
> 
>          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: fail gracefully and add -DMCMODEL_SMALL=1 to
>          TARGET_CFLAGS when -mcmodel=large isn't supported
> 
> but it was removed in 2010:
> 2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>
> 
>          * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
>          is not supported.
> 
> So I think they may not accept this patch again.

It does appear to be a deliverate removale, fortunatley, you know
exactly who to Cc on the list now :-) It's worth shooting it off to the
list to see what they say. Either way, it is definitely not a
configuration patch.

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-22  5:04       ` Darren Hart
@ 2013-11-22  6:18         ` jhuang0
  0 siblings, 0 replies; 15+ messages in thread
From: jhuang0 @ 2013-11-22  6:18 UTC (permalink / raw)
  To: Darren Hart; +Cc: openembedded-core



On 11/22/2013 1:04 PM, Darren Hart wrote:
> On Fri, 2013-11-22 at 11:37 +0800, jhuang0 wrote:
>>
>> On 11/22/2013 10:49 AM, Darren Hart wrote:
>>> On Wed, 2013-11-20 at 09:40 +0800, jackie.huang@windriver.com wrote:
>>>> From: Jackie Huang <jackie.huang@windriver.com>
>>>>
>>>> -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.
>>>>
>>>> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>>>> ---
>>>>    ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++
>>>>    meta/recipes-bsp/grub/grub-efi_2.00.bb             |  1 +
>>>>    2 files changed, 70 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 0000000..b2be74a
>>>> --- /dev/null
>>>> +++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
>>>> @@ -0,0 +1,69 @@
>>>> +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001
>>>> +From: Jackie Huang <jackie.huang@windriver.com>
>>>> +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
>>>> +
>>>> +Upstream-Status: Inappropriate [configuration]
>>>
>>> Nice try ;-) This is compatibility, not configuration. If grub-efi
>>> maintainers refuse to accept the patch that's up to them, but we need to
>>
>> Actually it's ported from old version of grub which means that they
>> allowed the comilation without large model support before, but not now.
>>   From the Changelog, it was added in 2009:
>>
>> 2009-06-04  Vladimir Serbinenko  <phcoder@gmail.com>
>>
>>           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: fail gracefully and add -DMCMODEL_SMALL=1 to
>>           TARGET_CFLAGS when -mcmodel=large isn't supported
>>
>> but it was removed in 2010:
>> 2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>
>>
>>           * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
>>           is not supported.
>>
>> So I think they may not accept this patch again.
>
> It does appear to be a deliverate removale, fortunatley, you know
> exactly who to Cc on the list now :-) It's worth shooting it off to the
> list to see what they say. Either way, it is definitely not a
> configuration patch.

Yes, I will change to compatibility in v4 and add Vladimir in cc list.

Thanks,
Jackie

>
> --
> Darren Hart
> Intel Open Source Technology Center
> Yocto Project - Linux Kernel
>
>
>
>

-- 
Jackie Huang
WIND RIVER | China Development Center
MSN:jackielily@hotmail.com
Tel: +86 8477 8594
Mobile: +86 138 1027 4745


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-22  7:23 [PATCH 0/2 v4] " jackie.huang
@ 2013-11-22  7:23 ` jackie.huang
       [not found]   ` <528F0F06.3010405@gmail.com>
  0 siblings, 1 reply; 15+ messages in thread
From: jackie.huang @ 2013-11-22  7:23 UTC (permalink / raw)
  To: openembedded-core; +Cc: phcoder, dvhart

From: Jackie Huang <jackie.huang@windriver.com>

-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.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 ...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 0000000..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 <jackie.huang@windriver.com>
+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  <phcoder@gmail.com>
+
+         Allow a compilation without -mcmodel=large
+
+2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>
+
+   * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
+     is not supported.
+
+Upstream-Status: Inappropriate [compatibility]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ 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 <= 0xffffffff
+ #endif
+ 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
+@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+ 	      desc->physical_start = 0x100000;
+ 	    }
+
+-#if 1
++#if defined (MCMODEL_SMALL)
+ 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ 	      + filtered_desc->num_pages
+ 	      > BYTES_TO_PAGES (0x100000000LL))
+--
+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"
-- 
1.8.3



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
       [not found]   ` <528F0F06.3010405@gmail.com>
@ 2013-11-22  8:13     ` jhuang0
  2013-11-22  9:59       ` jhuang0
  0 siblings, 1 reply; 15+ messages in thread
From: jhuang0 @ 2013-11-22  8:13 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko
  Cc: The development of GRUB 2, dvhart, openembedded-core



On 11/22/2013 4:00 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 22.11.2013 08:23, jackie.huang@windriver.com wrote:
>> From: Jackie Huang <jackie.huang@windriver.com>
>>
>> -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.
>>
> Please try attached patch instead

Thanks, I'm going to try with your patch.

Thanks,
Jackie

>> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>> ---
>>   ...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 0000000..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 <jackie.huang@windriver.com>
>> +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  <phcoder@gmail.com>
>> +
>> +         Allow a compilation without -mcmodel=large
>> +
>> +2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>
>> +
>> +   * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
>> +     is not supported.
>> +
>> +Upstream-Status: Inappropriate [compatibility]
>> +
>> +Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>> +---
>> + 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 <= 0xffffffff
>> + #endif
>> + 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
>> +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
>> + 	      desc->physical_start = 0x100000;
>> + 	    }
>> +
>> +-#if 1
>> ++#if defined (MCMODEL_SMALL)
>> + 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
>> + 	      + filtered_desc->num_pages
>> + 	      > BYTES_TO_PAGES (0x100000000LL))
>> +--
>> +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"
>>
>

-- 
Jackie Huang
WIND RIVER | China Development Center
MSN:jackielily@hotmail.com
Tel: +86 8477 8594
Mobile: +86 138 1027 4745


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-22  8:13     ` jhuang0
@ 2013-11-22  9:59       ` jhuang0
  0 siblings, 0 replies; 15+ messages in thread
From: jhuang0 @ 2013-11-22  9:59 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko,
	openembedded-core
  Cc: The development of GRUB 2, dvhart



On 11/22/2013 4:13 PM, jhuang0 wrote:
>
>
> On 11/22/2013 4:00 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>> On 22.11.2013 08:23, jackie.huang@windriver.com wrote:
>>> From: Jackie Huang <jackie.huang@windriver.com>
>>>
>>> -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.
>>>
>> Please try attached patch instead
>
> Thanks, I'm going to try with your patch.

Tested with Vladimir's patch, it works fine. I'm going send v5 for this.

Thanks,
Jackie

>
> Thanks,
> Jackie
>
>>> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>>> ---
>>>   ...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 0000000..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 <jackie.huang@windriver.com>
>>> +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  <phcoder@gmail.com>
>>> +
>>> +         Allow a compilation without -mcmodel=large
>>> +
>>> +2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>
>>> +
>>> +   * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
>>> +     is not supported.
>>> +
>>> +Upstream-Status: Inappropriate [compatibility]
>>> +
>>> +Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>>> +---
>>> + 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 <= 0xffffffff
>>> + #endif
>>> +       && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) >
>>> 0x100000
>>> +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t
>>> *memory_map,
>>> +           desc->physical_start = 0x100000;
>>> +         }
>>> +
>>> +-#if 1
>>> ++#if defined (MCMODEL_SMALL)
>>> +       if (BYTES_TO_PAGES (filtered_desc->physical_start)
>>> +           + filtered_desc->num_pages
>>> +           > BYTES_TO_PAGES (0x100000000LL))
>>> +--
>>> +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"
>>>
>>
>

-- 
Jackie Huang
WIND RIVER | China Development Center
MSN:jackielily@hotmail.com
Tel: +86 8477 8594
Mobile: +86 138 1027 4745


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package
@ 2013-11-22 10:00 jackie.huang
  2013-11-22 10:00 ` [PATCH 1/2] " jackie.huang
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: jackie.huang @ 2013-11-22 10:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: phcoder, dvhart

From: Jackie Huang <jackie.huang@windriver.com>

v5 comments:
Replace the patch "allow a compilation without mcmodel=large" with the one
provided by Vladimir Serbinenko <phcoder@gmail.com>.

--
The following changes since commit ee3e2e5ce15a3bf78c7e9d76d7bf68131f2d3ef7:

  librsvg: upgrade to 2.40.0 (2013-11-20 14:03:06 +0000)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib jhuang0/d_grub-efi_v5_1122_1
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/d_grub-efi_v5_1122_1

Jackie Huang (2):
  grub-efi: change to generate EFI image in target package
  grub-efi: allow compilation without large model support

 meta/classes/grub-efi.bbclass                      |   4 +-
 ...allow-a-compilation-without-mcmodel-large.patch | 141 +++++++++++++++++++++
 .../{grub-efi-native_2.00.bb => grub-efi_2.00.bb}  |  44 ++++---
 3 files changed, 168 insertions(+), 21 deletions(-)
 create mode 100644 meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
 rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)

-- 
1.8.3



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/2] grub-efi: change to generate EFI image in target package
  2013-11-22 10:00 [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package jackie.huang
@ 2013-11-22 10:00 ` jackie.huang
  2013-11-22 18:52   ` Darren Hart
  2013-11-22 10:00 ` [PATCH 2/2] grub-efi: allow compilation without large model support jackie.huang
  2013-11-22 10:31 ` [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package jhuang0
  2 siblings, 1 reply; 15+ messages in thread
From: jackie.huang @ 2013-11-22 10:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: phcoder, dvhart

From: Jackie Huang <jackie.huang@windriver.com>

To generate the target EFI image in a native package, it requires
the host gcc have the ability to do -m32/-m64 compiling, but gcc
doesn't have that support on the 32bit version of some distributions
(e.g. rehl, suse), it would fail when build a 64bit target on these
32bit hosts.

In fact, all we need from grub-efi-native is the grub-mkimage binary,
so change the solution to:
 * grub-efi-native only install grub-mkimage
 * grub-efi compiles target modules, generates EFI image
   with grub-mkimage and deploy, but install nothing.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 meta/classes/grub-efi.bbclass                      |  4 +-
 .../{grub-efi-native_2.00.bb => grub-efi_2.00.bb}  | 43 ++++++++++++----------
 2 files changed, 26 insertions(+), 21 deletions(-)
 rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)

diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 2f00901..71bd00f 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -15,8 +15,8 @@
 # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
 # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
 
-do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy"
-do_bootdirectdisk[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy"
+do_bootimg[depends] += "grub-efi:do_deploy"
+do_bootdirectdisk[depends] += "grub-efi:do_deploy"
 
 GRUB_SERIAL ?= "console=ttyS0,115200"
 GRUBCFG = "${S}/grub.cfg"
diff --git a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb b/meta/recipes-bsp/grub/grub-efi_2.00.bb
similarity index 77%
rename from meta/recipes-bsp/grub/grub-efi-native_2.00.bb
rename to meta/recipes-bsp/grub/grub-efi_2.00.bb
index 04973b5..2fe688c 100644
--- a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
+++ b/meta/recipes-bsp/grub/grub-efi_2.00.bb
@@ -14,14 +14,10 @@ LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 # FIXME: We should be able to optionally drop freetype as a dependency
-DEPENDS = "autogen-native"
-RDEPENDS_${PN} = "diffutils freetype"
+DEPENDS = "autogen-native flex-native bison-native"
+DEPENDS_class-target = "grub-efi-native"
 PR = "r2"
 
-# Native packages do not normally rebuild when the target changes.
-# Ensure this is built once per HOST-TARGET pair.
-PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native"
-
 SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
            file://cfg \
            file://grub-2.00-fpmath-sse-387-fix.patch \
@@ -39,12 +35,10 @@ COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
 
 S = "${WORKDIR}/grub-${PV}"
 
-# Determine the target arch for the grub modules before the native class
-# clobbers TARGET_ARCH.
-ORIG_TARGET_ARCH := "${TARGET_ARCH}"
+# Determine the target arch for the grub modules
 python __anonymous () {
     import re
-    target = d.getVar('ORIG_TARGET_ARCH', True)
+    target = d.getVar('TARGET_ARCH', True)
     if target == "x86_64":
         grubtarget = 'x86_64'
         grubimage = "bootx64.efi"
@@ -59,26 +53,37 @@ python __anonymous () {
 
 inherit autotools
 inherit gettext
-inherit native
 inherit deploy
 
 EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
-                --target=${GRUB_TARGET} --enable-efiemu=no --program-prefix='' \
+                --enable-efiemu=no --program-prefix='' \
                 --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
 
-do_mkimage() {
+do_install_class-target() {
+	:
+}
+
+do_install_class-native() {
+	install -d ${D}${bindir}
+	install -m 755 grub-mkimage ${D}${bindir}
+}
+
+do_deploy() {
 	# Search for the grub.cfg on the local boot media by using the
 	# built in cfg file provided via this recipe
-	./grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
+	grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
 	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
 	               boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search
+	install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
 }
-addtask mkimage after do_compile before do_install
 
-do_deploy() {
-	install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
+do_deploy_class-native() {
+	:
 }
+
 addtask deploy after do_install before do_build
 
-do_install[noexec] = "1"
-do_populate_sysroot[noexec] = "1"
+FILES_${PN}-dbg += "${libdir}/${BPN}/${GRUB_TARGET}-efi/.debug"
+
+BBCLASSEXTEND = "native"
+ALLOW_EMPTY_${PN} = "1"
-- 
1.8.3



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-22 10:00 [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package jackie.huang
  2013-11-22 10:00 ` [PATCH 1/2] " jackie.huang
@ 2013-11-22 10:00 ` jackie.huang
       [not found]   ` <528F2CA2.6000908@gmail.com>
  2013-11-22 18:52   ` Darren Hart
  2013-11-22 10:31 ` [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package jhuang0
  2 siblings, 2 replies; 15+ messages in thread
From: jackie.huang @ 2013-11-22 10:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: phcoder, dvhart

From: Jackie Huang <jackie.huang@windriver.com>

-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.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 ...allow-a-compilation-without-mcmodel-large.patch | 141 +++++++++++++++++++++
 meta/recipes-bsp/grub/grub-efi_2.00.bb             |   1 +
 2 files changed, 142 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 0000000..b4b948f
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
@@ -0,0 +1,141 @@
+Allow a compilation without -mcmodel=large
+
+It's provided by Vladimir Serbinenko, and it's not going to
+upstream since this was deliberately removed in current
+and newer version:
+
+2009-06-04  Vladimir Serbinenko  <phcoder@gmail.com>
+
+         Allow a compilation without -mcmodel=large
+
+2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>
+
+   * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
+     is not supported.
+
+Upstream-Status: Inappropriate [compatibility]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+--
+diff --git a/configure.ac b/configure.ac
+index 9f8fb8a..2c5e6ed 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -723,9 +723,7 @@ if test "$target_cpu" = x86_64; then
+ 		      [grub_cv_cc_mcmodel=yes],
+ 		      [grub_cv_cc_mcmodel=no])
+   ])
+-  if test "x$grub_cv_cc_mcmodel" = xno; then
+-    AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
+-  else
++  if test "x$grub_cv_cc_mcmodel" = xyes; then
+     TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
+   fi
+ fi
+diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
+index 1409b5d..6e9dace 100644
+--- a/grub-core/kern/efi/mm.c
++++ b/grub-core/kern/efi/mm.c
+@@ -32,6 +32,12 @@
+ #define BYTES_TO_PAGES(bytes)	(((bytes) + 0xfff) >> 12)
+ #define PAGES_TO_BYTES(pages)	((pages) << 12)
+
++#if defined (__code_model_large__) || !defined (__x86_64__)
++#define MAX_USABLE_ADDRESS 0xffffffff
++#else
++#define MAX_USABLE_ADDRESS 0x7fffffff
++#endif
++
+ /* The size of a memory map obtained from the firmware. This must be
+    a multiplier of 4KB.  */
+ #define MEMORY_MAP_SIZE	0x3000
+@@ -58,7 +64,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+
+ #if 1
+   /* Limit the memory access to less than 4GB for 32-bit platforms.  */
+-  if (address > 0xffffffff)
++  if (address > MAX_USABLE_ADDRESS)
+     return 0;
+ #endif
+
+@@ -66,7 +72,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+   if (address == 0)
+     {
+       type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
+-      address = 0xffffffff;
++      address = MAX_USABLE_ADDRESS;
+     }
+   else
+     type = GRUB_EFI_ALLOCATE_ADDRESS;
+@@ -86,7 +92,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+     {
+       /* Uggh, the address 0 was allocated... This is too annoying,
+ 	 so reallocate another one.  */
+-      address = 0xffffffff;
++      address = MAX_USABLE_ADDRESS;
+       status = efi_call_4 (b->allocate_pages, type, GRUB_EFI_LOADER_DATA, pages, &address);
+       grub_efi_free_pages (0, pages);
+       if (status != GRUB_EFI_SUCCESS)
+@@ -319,7 +325,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+     {
+       if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
+ #if 1
+-	  && desc->physical_start <= 0xffffffff
++	  && desc->physical_start <= MAX_USABLE_ADDRESS
+ #endif
+ 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
+ 	  && desc->num_pages != 0)
+@@ -337,9 +343,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+ #if 1
+ 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ 	      + filtered_desc->num_pages
+-	      > BYTES_TO_PAGES (0x100000000LL))
++	      > BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL))
+ 	    filtered_desc->num_pages
+-	      = (BYTES_TO_PAGES (0x100000000LL)
++	      = (BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL)
+ 		 - BYTES_TO_PAGES (filtered_desc->physical_start));
+ #endif
+
+diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
+index 65f09ef..17c1215 100644
+--- a/grub-core/kern/x86_64/dl.c
++++ b/grub-core/kern/x86_64/dl.c
+@@ -100,14 +100,32 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
+ 		    break;
+
+ 		  case R_X86_64_PC32:
+-		    *addr32 += rel->r_addend + sym->st_value -
+-		              (Elf64_Xword) seg->addr - rel->r_offset;
++		    {
++		      grub_int64_t value;
++		      value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
++			(Elf64_Xword) seg->addr - rel->r_offset;
++		      if (value != (grub_int32_t) value)
++			return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++		      *addr32 = value;
++		    }
+ 		    break;
+
+                   case R_X86_64_32:
++		    {
++		      grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;
++		      if (value != (grub_uint32_t) value)
++			return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++		      *addr32 = value;
++		    }
++		    break;
+                   case R_X86_64_32S:
+-                    *addr32 += rel->r_addend + sym->st_value;
+-                    break;
++		    {
++		      grub_int64_t value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value;
++		      if (value != (grub_int32_t) value)
++			return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++		      *addr32 = value;
++		    }
++		    break;
+
+ 		  default:
+ 		    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
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"
-- 
1.8.3



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
       [not found]   ` <528F2CA2.6000908@gmail.com>
@ 2013-11-22 10:24     ` jhuang0
  0 siblings, 0 replies; 15+ messages in thread
From: jhuang0 @ 2013-11-22 10:24 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko
  Cc: The development of GRUB 2, dvhart, openembedded-core



On 11/22/2013 6:06 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 22.11.2013 11:00, jackie.huang@windriver.com wrote:
>> +Upstream-Status: Inappropriate [compatibility]
> Should be backport as I'm about to commit my patch upstream once I've
> finished xen part and some documentation pertaining to introduced limits
> (2GiB)

Ok, thanks, changed to backport.

Thanks,
Jackie

>

-- 
Jackie Huang
WIND RIVER | China Development Center
MSN:jackielily@hotmail.com
Tel: +86 8477 8594
Mobile: +86 138 1027 4745


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package
  2013-11-22 10:00 [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package jackie.huang
  2013-11-22 10:00 ` [PATCH 1/2] " jackie.huang
  2013-11-22 10:00 ` [PATCH 2/2] grub-efi: allow compilation without large model support jackie.huang
@ 2013-11-22 10:31 ` jhuang0
  2 siblings, 0 replies; 15+ messages in thread
From: jhuang0 @ 2013-11-22 10:31 UTC (permalink / raw)
  To: openembedded-core; +Cc: phcoder, dvhart

I changed the Upstream-Status of the patch to backport according to 
Vladimir's comment, but I'm not going to send a v6, just update the pull 
request here:

--
The following changes since commit ee3e2e5ce15a3bf78c7e9d76d7bf68131f2d3ef7:

   librsvg: upgrade to 2.40.0 (2013-11-20 14:03:06 +0000)

are available in the git repository at:

   git://git.pokylinux.org/poky-contrib jhuang0/d_grub-efi_v5_1122_3
 
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/d_grub-efi_v5_1122_3

Jackie Huang (2):
   grub-efi: change to generate EFI image in target package
   grub-efi: allow compilation without large model support

  meta/classes/grub-efi.bbclass                      |   4 +-
  ...allow-a-compilation-without-mcmodel-large.patch | 131 
+++++++++++++++++++++
  .../{grub-efi-native_2.00.bb => grub-efi_2.00.bb}  |  44 ++++---
  3 files changed, 158 insertions(+), 21 deletions(-)
  create mode 100644 
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
  rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => 
grub-efi_2.00.bb} (77%)

Thanks,
Jackie

On 11/22/2013 6:00 PM, jackie.huang@windriver.com wrote:
> From: Jackie Huang <jackie.huang@windriver.com>
>
> v5 comments:
> Replace the patch "allow a compilation without mcmodel=large" with the one
> provided by Vladimir Serbinenko <phcoder@gmail.com>.
>
> --
> The following changes since commit ee3e2e5ce15a3bf78c7e9d76d7bf68131f2d3ef7:
>
>    librsvg: upgrade to 2.40.0 (2013-11-20 14:03:06 +0000)
>
> are available in the git repository at:
>
>    git://git.pokylinux.org/poky-contrib jhuang0/d_grub-efi_v5_1122_1
>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/d_grub-efi_v5_1122_1
>
> Jackie Huang (2):
>    grub-efi: change to generate EFI image in target package
>    grub-efi: allow compilation without large model support
>
>   meta/classes/grub-efi.bbclass                      |   4 +-
>   ...allow-a-compilation-without-mcmodel-large.patch | 141 +++++++++++++++++++++
>   .../{grub-efi-native_2.00.bb => grub-efi_2.00.bb}  |  44 ++++---
>   3 files changed, 168 insertions(+), 21 deletions(-)
>   create mode 100644 meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
>   rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)
>

-- 
Jackie Huang
WIND RIVER | China Development Center
MSN:jackielily@hotmail.com
Tel: +86 8477 8594
Mobile: +86 138 1027 4745


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] grub-efi: change to generate EFI image in target package
  2013-11-22 10:00 ` [PATCH 1/2] " jackie.huang
@ 2013-11-22 18:52   ` Darren Hart
  0 siblings, 0 replies; 15+ messages in thread
From: Darren Hart @ 2013-11-22 18:52 UTC (permalink / raw)
  To: jackie.huang; +Cc: phcoder, openembedded-core

On Fri, 2013-11-22 at 18:00 +0800, jackie.huang@windriver.com wrote:
> From: Jackie Huang <jackie.huang@windriver.com>
> 
> To generate the target EFI image in a native package, it requires
> the host gcc have the ability to do -m32/-m64 compiling, but gcc
> doesn't have that support on the 32bit version of some distributions
> (e.g. rehl, suse), it would fail when build a 64bit target on these
> 32bit hosts.
> 
> In fact, all we need from grub-efi-native is the grub-mkimage binary,
> so change the solution to:
>  * grub-efi-native only install grub-mkimage
>  * grub-efi compiles target modules, generates EFI image
>    with grub-mkimage and deploy, but install nothing.
> 
> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>

Thanks Jackie!

Reviewed-by: Darren Hart <dvhart@linux.intel.com>

> ---
>  meta/classes/grub-efi.bbclass                      |  4 +-
>  .../{grub-efi-native_2.00.bb => grub-efi_2.00.bb}  | 43 ++++++++++++----------
>  2 files changed, 26 insertions(+), 21 deletions(-)
>  rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)
> 
> diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
> index 2f00901..71bd00f 100644
> --- a/meta/classes/grub-efi.bbclass
> +++ b/meta/classes/grub-efi.bbclass
> @@ -15,8 +15,8 @@
>  # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
>  # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
>  
> -do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy"
> -do_bootdirectdisk[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy"
> +do_bootimg[depends] += "grub-efi:do_deploy"
> +do_bootdirectdisk[depends] += "grub-efi:do_deploy"
>  
>  GRUB_SERIAL ?= "console=ttyS0,115200"
>  GRUBCFG = "${S}/grub.cfg"
> diff --git a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb b/meta/recipes-bsp/grub/grub-efi_2.00.bb
> similarity index 77%
> rename from meta/recipes-bsp/grub/grub-efi-native_2.00.bb
> rename to meta/recipes-bsp/grub/grub-efi_2.00.bb
> index 04973b5..2fe688c 100644
> --- a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
> +++ b/meta/recipes-bsp/grub/grub-efi_2.00.bb
> @@ -14,14 +14,10 @@ LICENSE = "GPLv3"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
>  
>  # FIXME: We should be able to optionally drop freetype as a dependency
> -DEPENDS = "autogen-native"
> -RDEPENDS_${PN} = "diffutils freetype"
> +DEPENDS = "autogen-native flex-native bison-native"
> +DEPENDS_class-target = "grub-efi-native"
>  PR = "r2"
>  
> -# Native packages do not normally rebuild when the target changes.
> -# Ensure this is built once per HOST-TARGET pair.
> -PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native"
> -
>  SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
>             file://cfg \
>             file://grub-2.00-fpmath-sse-387-fix.patch \
> @@ -39,12 +35,10 @@ COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
>  
>  S = "${WORKDIR}/grub-${PV}"
>  
> -# Determine the target arch for the grub modules before the native class
> -# clobbers TARGET_ARCH.
> -ORIG_TARGET_ARCH := "${TARGET_ARCH}"
> +# Determine the target arch for the grub modules
>  python __anonymous () {
>      import re
> -    target = d.getVar('ORIG_TARGET_ARCH', True)
> +    target = d.getVar('TARGET_ARCH', True)
>      if target == "x86_64":
>          grubtarget = 'x86_64'
>          grubimage = "bootx64.efi"
> @@ -59,26 +53,37 @@ python __anonymous () {
>  
>  inherit autotools
>  inherit gettext
> -inherit native
>  inherit deploy
>  
>  EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
> -                --target=${GRUB_TARGET} --enable-efiemu=no --program-prefix='' \
> +                --enable-efiemu=no --program-prefix='' \
>                  --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
>  
> -do_mkimage() {
> +do_install_class-target() {
> +	:
> +}
> +
> +do_install_class-native() {
> +	install -d ${D}${bindir}
> +	install -m 755 grub-mkimage ${D}${bindir}
> +}
> +
> +do_deploy() {
>  	# Search for the grub.cfg on the local boot media by using the
>  	# built in cfg file provided via this recipe
> -	./grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
> +	grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
>  	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
>  	               boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search
> +	install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
>  }
> -addtask mkimage after do_compile before do_install
>  
> -do_deploy() {
> -	install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
> +do_deploy_class-native() {
> +	:
>  }
> +
>  addtask deploy after do_install before do_build
>  
> -do_install[noexec] = "1"
> -do_populate_sysroot[noexec] = "1"
> +FILES_${PN}-dbg += "${libdir}/${BPN}/${GRUB_TARGET}-efi/.debug"
> +
> +BBCLASSEXTEND = "native"
> +ALLOW_EMPTY_${PN} = "1"

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] grub-efi: allow compilation without large model support
  2013-11-22 10:00 ` [PATCH 2/2] grub-efi: allow compilation without large model support jackie.huang
       [not found]   ` <528F2CA2.6000908@gmail.com>
@ 2013-11-22 18:52   ` Darren Hart
  1 sibling, 0 replies; 15+ messages in thread
From: Darren Hart @ 2013-11-22 18:52 UTC (permalink / raw)
  To: jackie.huang; +Cc: phcoder, openembedded-core

On Fri, 2013-11-22 at 18:00 +0800, jackie.huang@windriver.com wrote:
> From: Jackie Huang <jackie.huang@windriver.com>
> 
> -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.
> 
> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>

Thanks!

Reviewed-by: Darren Hart <dvhart@linux.intel.com>

> ---
>  ...allow-a-compilation-without-mcmodel-large.patch | 141 +++++++++++++++++++++
>  meta/recipes-bsp/grub/grub-efi_2.00.bb             |   1 +
>  2 files changed, 142 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 0000000..b4b948f
> --- /dev/null
> +++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
> @@ -0,0 +1,141 @@
> +Allow a compilation without -mcmodel=large
> +
> +It's provided by Vladimir Serbinenko, and it's not going to
> +upstream since this was deliberately removed in current
> +and newer version:
> +
> +2009-06-04  Vladimir Serbinenko  <phcoder@gmail.com>
> +
> +         Allow a compilation without -mcmodel=large
> +
> +2010-04-21  Vladimir Serbinenko  <phcoder@gmail.com>
> +
> +   * configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
> +     is not supported.
> +
> +Upstream-Status: Inappropriate [compatibility]
> +
> +Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
> +
> +--
> +diff --git a/configure.ac b/configure.ac
> +index 9f8fb8a..2c5e6ed 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -723,9 +723,7 @@ if test "$target_cpu" = x86_64; then
> + 		      [grub_cv_cc_mcmodel=yes],
> + 		      [grub_cv_cc_mcmodel=no])
> +   ])
> +-  if test "x$grub_cv_cc_mcmodel" = xno; then
> +-    AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
> +-  else
> ++  if test "x$grub_cv_cc_mcmodel" = xyes; then
> +     TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
> +   fi
> + fi
> +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
> +index 1409b5d..6e9dace 100644
> +--- a/grub-core/kern/efi/mm.c
> ++++ b/grub-core/kern/efi/mm.c
> +@@ -32,6 +32,12 @@
> + #define BYTES_TO_PAGES(bytes)	(((bytes) + 0xfff) >> 12)
> + #define PAGES_TO_BYTES(pages)	((pages) << 12)
> +
> ++#if defined (__code_model_large__) || !defined (__x86_64__)
> ++#define MAX_USABLE_ADDRESS 0xffffffff
> ++#else
> ++#define MAX_USABLE_ADDRESS 0x7fffffff
> ++#endif
> ++
> + /* The size of a memory map obtained from the firmware. This must be
> +    a multiplier of 4KB.  */
> + #define MEMORY_MAP_SIZE	0x3000
> +@@ -58,7 +64,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
> +
> + #if 1
> +   /* Limit the memory access to less than 4GB for 32-bit platforms.  */
> +-  if (address > 0xffffffff)
> ++  if (address > MAX_USABLE_ADDRESS)
> +     return 0;
> + #endif
> +
> +@@ -66,7 +72,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
> +   if (address == 0)
> +     {
> +       type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
> +-      address = 0xffffffff;
> ++      address = MAX_USABLE_ADDRESS;
> +     }
> +   else
> +     type = GRUB_EFI_ALLOCATE_ADDRESS;
> +@@ -86,7 +92,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
> +     {
> +       /* Uggh, the address 0 was allocated... This is too annoying,
> + 	 so reallocate another one.  */
> +-      address = 0xffffffff;
> ++      address = MAX_USABLE_ADDRESS;
> +       status = efi_call_4 (b->allocate_pages, type, GRUB_EFI_LOADER_DATA, pages, &address);
> +       grub_efi_free_pages (0, pages);
> +       if (status != GRUB_EFI_SUCCESS)
> +@@ -319,7 +325,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
> +     {
> +       if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
> + #if 1
> +-	  && desc->physical_start <= 0xffffffff
> ++	  && desc->physical_start <= MAX_USABLE_ADDRESS
> + #endif
> + 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
> + 	  && desc->num_pages != 0)
> +@@ -337,9 +343,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
> + #if 1
> + 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
> + 	      + filtered_desc->num_pages
> +-	      > BYTES_TO_PAGES (0x100000000LL))
> ++	      > BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL))
> + 	    filtered_desc->num_pages
> +-	      = (BYTES_TO_PAGES (0x100000000LL)
> ++	      = (BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL)
> + 		 - BYTES_TO_PAGES (filtered_desc->physical_start));
> + #endif
> +
> +diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
> +index 65f09ef..17c1215 100644
> +--- a/grub-core/kern/x86_64/dl.c
> ++++ b/grub-core/kern/x86_64/dl.c
> +@@ -100,14 +100,32 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
> + 		    break;
> +
> + 		  case R_X86_64_PC32:
> +-		    *addr32 += rel->r_addend + sym->st_value -
> +-		              (Elf64_Xword) seg->addr - rel->r_offset;
> ++		    {
> ++		      grub_int64_t value;
> ++		      value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
> ++			(Elf64_Xword) seg->addr - rel->r_offset;
> ++		      if (value != (grub_int32_t) value)
> ++			return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
> ++		      *addr32 = value;
> ++		    }
> + 		    break;
> +
> +                   case R_X86_64_32:
> ++		    {
> ++		      grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;
> ++		      if (value != (grub_uint32_t) value)
> ++			return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
> ++		      *addr32 = value;
> ++		    }
> ++		    break;
> +                   case R_X86_64_32S:
> +-                    *addr32 += rel->r_addend + sym->st_value;
> +-                    break;
> ++		    {
> ++		      grub_int64_t value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value;
> ++		      if (value != (grub_int32_t) value)
> ++			return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
> ++		      *addr32 = value;
> ++		    }
> ++		    break;
> +
> + 		  default:
> + 		    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> 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"

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel




^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-11-22 18:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22 10:00 [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package jackie.huang
2013-11-22 10:00 ` [PATCH 1/2] " jackie.huang
2013-11-22 18:52   ` Darren Hart
2013-11-22 10:00 ` [PATCH 2/2] grub-efi: allow compilation without large model support jackie.huang
     [not found]   ` <528F2CA2.6000908@gmail.com>
2013-11-22 10:24     ` jhuang0
2013-11-22 18:52   ` Darren Hart
2013-11-22 10:31 ` [PATCH 0/2 v5] grub-efi: change to generate EFI image in target package jhuang0
  -- strict thread matches above, loose matches on Subject: below --
2013-11-22  7:23 [PATCH 0/2 v4] " jackie.huang
2013-11-22  7:23 ` [PATCH 2/2] grub-efi: allow compilation without large model support jackie.huang
     [not found]   ` <528F0F06.3010405@gmail.com>
2013-11-22  8:13     ` jhuang0
2013-11-22  9:59       ` jhuang0
2013-11-20  1:40 [PATCH 0/2 v3] grub-efi: change to generate EFI image in target package jackie.huang
2013-11-20  1:40 ` [PATCH 2/2] grub-efi: allow compilation without large model support jackie.huang
2013-11-22  2:49   ` Darren Hart
2013-11-22  3:37     ` jhuang0
2013-11-22  5:04       ` Darren Hart
2013-11-22  6:18         ` jhuang0

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox