On Thu, Mar 25, 2021 at 12:48 PM Alistair Francis <alistai...@gmail.com> wrote:
>
> On Thu, Mar 25, 2021 at 12:15 AM Khem Raj <raj.k...@gmail.com> wrote:
> >
> > Signed-off-by: Khem Raj <raj.k...@gmail.com>
> > Cc: Alistair Francis <alistair.fran...@wdc.com>
>
> I'm not sure if this is the right thing to do here.
>
> Have you tested this does GRUB boot with this check removed?
>

I have not run it no, but inspected the generate PE file and they look
ok. however, I think we should drop
this patch and instead just disable grub on rv32 until such time when
port is available. I have send a follow up
patch for that.


> From memory I don't think the original GRUB port would have been tested on 
> RV32.
>
> Alistair
>
> > ---
> >  ...sable-offset-overflow-check-for-rv32.patch | 45 +++++++++++++++++++
> >  meta/recipes-bsp/grub/grub2.inc               |  1 +
> >  2 files changed, 46 insertions(+)
> >  create mode 100644 
> > meta/recipes-bsp/grub/files/0001-Disable-offset-overflow-check-for-rv32.patch
> >
> > diff --git 
> > a/meta/recipes-bsp/grub/files/0001-Disable-offset-overflow-check-for-rv32.patch
> >  
> > b/meta/recipes-bsp/grub/files/0001-Disable-offset-overflow-check-for-rv32.patch
> > new file mode 100644
> > index 0000000000..6547bf2261
> > --- /dev/null
> > +++ 
> > b/meta/recipes-bsp/grub/files/0001-Disable-offset-overflow-check-for-rv32.patch
> > @@ -0,0 +1,45 @@
> > +From ce1cea0563011698e4a70c9a60e7da66b57ab1d6 Mon Sep 17 00:00:00 2001
> > +From: Khem Raj <raj.k...@gmail.com>
> > +Date: Wed, 24 Mar 2021 20:55:56 -0700
> > +Subject: [PATCH] Disable offset overflow check for rv32
> > +
> > +Fixes
> > +/tmp/grub/grub-mkimage: error: target 17c6 not reachable from pc=936.
> > +
> > +Upstream-Status: Reported [https://savannah.gnu.org/bugs/index.php?60283]
> > +Signed-off-by: Khem Raj <raj.k...@gmail.com>
> > +---
> > + util/grub-mkimagexx.c | 6 ++++--
> > + 1 file changed, 4 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
> > +index 00f49ccaa..6deb66226 100644
> > +--- a/util/grub-mkimagexx.c
> > ++++ b/util/grub-mkimagexx.c
> > +@@ -1297,9 +1297,10 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct 
> > section_metadata *smd,
> > +                    {
> > +                      grub_uint32_t hi20, lo12;
> > +
> > ++#ifdef MKIMAGE_ELF64
> > +                      if (off != (grub_int32_t)off)
> > +                        grub_util_error ("target %lx not reachable from 
> > pc=%lx", (long)sym_addr, (long)((char *)target - (char *)e));
> > +-
> > ++#endif
> > +                      hi20 = (off + 0x800) & 0xfffff000;
> > +                      lo12 = (off - hi20) & 0xfff;
> > +                      t32[0] = grub_host_to_target32 
> > ((grub_target_to_host32 (t32[0]) & 0xfff) | hi20);
> > +@@ -1336,9 +1337,10 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct 
> > section_metadata *smd,
> > +                    {
> > +                      grub_int32_t hi20;
> > +
> > ++#ifdef MKIMAGE_ELF64
> > +                      if (off != (grub_int32_t)off)
> > +                        grub_util_error ("target %lx not reachable from 
> > pc=%lx", (long)sym_addr, (long)((char *)target - (char *)e));
> > +-
> > ++#endif
> > +                      hi20 = (off + 0x800) & 0xfffff000;
> > +                      *t32 = grub_host_to_target32 ((grub_target_to_host32 
> > (*t32) & 0xfff) | hi20);
> > +                    }
> > +--
> > +2.31.0
> > +
> > diff --git a/meta/recipes-bsp/grub/grub2.inc 
> > b/meta/recipes-bsp/grub/grub2.inc
> > index bcff676c26..d8a556e06c 100644
> > --- a/meta/recipes-bsp/grub/grub2.inc
> > +++ b/meta/recipes-bsp/grub/grub2.inc
> > @@ -19,6 +19,7 @@ SRC_URI = 
> > "https://alpha.gnu.org/gnu/grub/grub-${REALPV}.tar.xz \
> >             
> > file://grub-module-explicitly-keeps-symbole-.module_license.patch \
> >             file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
> >             file://determinism.patch \
> > +           file://0001-Disable-offset-overflow-check-for-rv32.patch \
> >  "
> >
> >  SRC_URI[sha256sum] = 
> > "2c87f1f21e2ab50043e6cd9163c08f1b6c3a6171556bf23ff9ed65b074145484"
> > --
> > 2.31.0
> >
> >
> > 
> >
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#149973): 
https://lists.openembedded.org/g/openembedded-core/message/149973
Mute This Topic: https://lists.openembedded.org/mt/81595170/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to