From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VjsAO-00025W-IN for mharc-grub-devel@gnu.org; Fri, 22 Nov 2013 09:57:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vjlrv-0005Ix-Vw for grub-devel@gnu.org; Fri, 22 Nov 2013 03:13:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vjlrq-0001eN-Na for grub-devel@gnu.org; Fri, 22 Nov 2013 03:13:39 -0500 Received: from mail1.windriver.com ([147.11.146.13]:54360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vjlrq-0001eJ-F5 for grub-devel@gnu.org; Fri, 22 Nov 2013 03:13:34 -0500 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.14.5/8.14.5) with ESMTP id rAM8DVh4012780 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 22 Nov 2013 00:13:31 -0800 (PST) Received: from [128.224.162.200] (128.224.162.200) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server id 14.2.347.0; Fri, 22 Nov 2013 00:13:30 -0800 Message-ID: <528F1228.4020108@windriver.com> Date: Fri, 22 Nov 2013 16:13:28 +0800 From: jhuang0 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= Subject: Re: [PATCH 2/2] grub-efi: allow compilation without large model support References: <528F0F06.3010405@gmail.com> In-Reply-To: <528F0F06.3010405@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mail1.windriver.com id rAM8DVh4012780 X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 147.11.146.13 X-Mailman-Approved-At: Fri, 22 Nov 2013 09:57:05 -0500 Cc: The development of GRUB 2 , dvhart@linux.intel.com, openembedded-core@lists.openembedded.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2013 08:13:45 -0000 On 11/22/2013 4:00 PM, Vladimir '=CF=86-coder/phcoder' Serbinenko wrote: > On 22.11.2013 08:23, jackie.huang@windriver.com wrote: >> From: Jackie Huang >> >> -mcmodel=3Dlarge 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 >> --- >> ...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-comp= ilation-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 200= 1 >> +From: Jackie Huang >> +Date: Tue, 5 Nov 2013 07:23:32 -0500 >> +Subject: [PATCH] Allow a compilation without -mcmodel=3Dlarge >> + >> +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB >> + when compiled without -mcmodel=3Dlarge >> + (filter_memory_map): remove memory post 4 GiB when compiled >> + without -mcmodel=3Dlarge >> +* configure.ac: add -DMCMODEL_SMALL=3D1 to TARGET_CFLAGS when >> + -mcmodel=3Dlarge isn't supported >> + >> +It's ported from old version of grub which was deliberately >> +removed in current and newer version: >> + >> +2009-06-04 Vladimir Serbinenko >> + >> + Allow a compilation without -mcmodel=3Dlarge >> + >> +2010-04-21 Vladimir Serbinenko >> + >> + * configure.ac: Refuse to compile for x86_64-efi is mcmodel=3Dlarg= e >> + is not supported. >> + >> +Upstream-Status: Inappropriate [compatibility] >> + >> +Signed-off-by: Jackie Huang >> +--- >> + configure.ac | 4 +++- >> + grub-core/kern/efi/mm.c | 6 +++--- >> + 2 files changed, 6 insertions(+), 4 deletions(-) >> + >> +diff --git a/configure.ac b/configure.ac >> +index 319d063..ee72fee 100644 >> +--- a/configure.ac >> ++++ b/configure.ac >> +@@ -567,7 +567,9 @@ if test "$target_cpu"-"$platform" =3D x86_64-efi;= then >> + [grub_cv_cc_mcmodel=3Dno]) >> + ]) >> + if test "x$grub_cv_cc_mcmodel" =3D xno; then >> +- AC_MSG_ERROR([-mcmodel=3Dlarge not supported. Upgrade your gcc.]= ) >> ++ CFLAGS=3D"$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=3D1" >> ++ TARGET_CFLAGS=3D"$TARGET_CFLAGS -DMCMODEL_SMALL=3D1" >> ++ AC_MSG_WARN([-mcmodel=3Dlarge not supported. You won't be able t= o use the memory over 4GiB. Upgrade your gcc.]) >> + else >> + TARGET_CFLAGS=3D"$TARGET_CFLAGS -mcmodel=3Dlarge" >> + 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 =3D=3D 0) >> + { >> + type =3D GRUB_EFI_ALLOCATE_MAX_ADDRESS; >> +@@ -305,7 +305,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *= memory_map, >> + desc =3D NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) >> + { >> + if (desc->type =3D=3D GRUB_EFI_CONVENTIONAL_MEMORY >> +-#if 1 >> ++#if defined (MCMODEL_SMALL) >> + && desc->physical_start <=3D 0xffffffff >> + #endif >> + && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x10= 0000 >> +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *= memory_map, >> + desc->physical_start =3D 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 =3D "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.t= ar.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] =3D "e927540b6eda8b024fb0391eeaa4091c" >> SRC_URI[sha256sum] =3D "65b39a0558f8c802209c574f4d02ca263a804e8a564b= c6caf1cd0fd3b3cc11e3" >> > --=20 Jackie Huang WIND RIVER | China Development Center MSN:jackielily@hotmail.com Tel: +86 8477 8594 Mobile: +86 138 1027 4745