All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub: Add support for RISC-V
@ 2020-11-25 17:22 Norbert Kaminski
  2020-11-25 18:54 ` [OE-core] " Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Norbert Kaminski @ 2020-11-25 17:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: maciej.pijanowski, Norbert Kaminski

This patch adds RISC-V to the COMPATIBLE_HOST. Since GRUB 2.04,
the source code supports the RISC-V, thanks to Alexander Graf.

Adding the GRUBPLATFORM for RISC-V prevents autoconf problems.
Also, the patch appends the __anonymous method with RISC-V architecture.

Signed-off-by: Norbert Kaminski <norbert.kaminski@3mdeb.com>
---
 meta/recipes-bsp/grub/grub-efi_2.04.bb | 4 ++++
 meta/recipes-bsp/grub/grub2.inc        | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-bsp/grub/grub-efi_2.04.bb b/meta/recipes-bsp/grub/grub-efi_2.04.bb
index 30d95f95e0..f80afd95cb 100644
--- a/meta/recipes-bsp/grub/grub-efi_2.04.bb
+++ b/meta/recipes-bsp/grub/grub-efi_2.04.bb
@@ -26,6 +26,10 @@ python __anonymous () {
         grubtarget = 'arm64'
     elif re.match('arm', target):
         grubtarget = 'arm'
+    elif re.match('riscv64', target):
+        grubtarget = 'riscv64'
+    elif re.match('riscv32', target):
+        grubtarget = 'riscv32'
     else:
         raise bb.parse.SkipRecipe("grub-efi is incompatible with target %s" % target)
     grubimage = prefix + d.getVar("EFI_BOOT_IMAGE")
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index ff17dbe8b7..d020103605 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -33,7 +33,7 @@ SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e503165
 
 DEPENDS = "flex-native bison-native gettext-native"
 
-COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
+COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'
 COMPATIBLE_HOST_armv7a = 'null'
 COMPATIBLE_HOST_armv7ve = 'null'
 
@@ -42,6 +42,8 @@ COMPATIBLE_HOST_armv7ve = 'null'
 
 GRUBPLATFORM_arm = "efi"
 GRUBPLATFORM_aarch64 = "efi"
+GRUBPLATFORM_riscv32 = "efi"
+GRUBPLATFORM_riscv64 = "efi"
 GRUBPLATFORM ??= "pc"
 
 inherit autotools gettext texinfo pkgconfig
-- 
2.25.1


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

* Re: [OE-core] [PATCH] grub: Add support for RISC-V
  2020-11-25 17:22 [PATCH] grub: Add support for RISC-V Norbert Kaminski
@ 2020-11-25 18:54 ` Khem Raj
  2020-11-26 15:17   ` Norbert Kaminski
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2020-11-25 18:54 UTC (permalink / raw)
  To: Norbert Kaminski
  Cc: Patches and discussions about the oe-core layer, Maciej Pijanowski

Thanks for your contribution.

On Wed, Nov 25, 2020 at 9:23 AM Norbert Kaminski
<norbert.kaminski@3mdeb.com> wrote:
>
> This patch adds RISC-V to the COMPATIBLE_HOST. Since GRUB 2.04,
> the source code supports the RISC-V, thanks to Alexander Graf.
>
> Adding the GRUBPLATFORM for RISC-V prevents autoconf problems.
> Also, the patch appends the __anonymous method with RISC-V architecture.
>
> Signed-off-by: Norbert Kaminski <norbert.kaminski@3mdeb.com>
> ---
>  meta/recipes-bsp/grub/grub-efi_2.04.bb | 4 ++++
>  meta/recipes-bsp/grub/grub2.inc        | 4 +++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-bsp/grub/grub-efi_2.04.bb b/meta/recipes-bsp/grub/grub-efi_2.04.bb
> index 30d95f95e0..f80afd95cb 100644
> --- a/meta/recipes-bsp/grub/grub-efi_2.04.bb
> +++ b/meta/recipes-bsp/grub/grub-efi_2.04.bb
> @@ -26,6 +26,10 @@ python __anonymous () {
>          grubtarget = 'arm64'
>      elif re.match('arm', target):
>          grubtarget = 'arm'
> +    elif re.match('riscv64', target):
> +        grubtarget = 'riscv64'
> +    elif re.match('riscv32', target):
> +        grubtarget = 'riscv32'

RV64 is file but does it also support RV32 ?

>      else:
>          raise bb.parse.SkipRecipe("grub-efi is incompatible with target %s" % target)
>      grubimage = prefix + d.getVar("EFI_BOOT_IMAGE")
> diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
> index ff17dbe8b7..d020103605 100644
> --- a/meta/recipes-bsp/grub/grub2.inc
> +++ b/meta/recipes-bsp/grub/grub2.inc
> @@ -33,7 +33,7 @@ SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e503165
>
>  DEPENDS = "flex-native bison-native gettext-native"
>
> -COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
> +COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'
>  COMPATIBLE_HOST_armv7a = 'null'
>  COMPATIBLE_HOST_armv7ve = 'null'
>
> @@ -42,6 +42,8 @@ COMPATIBLE_HOST_armv7ve = 'null'
>
>  GRUBPLATFORM_arm = "efi"
>  GRUBPLATFORM_aarch64 = "efi"
> +GRUBPLATFORM_riscv32 = "efi"
> +GRUBPLATFORM_riscv64 = "efi"
>  GRUBPLATFORM ??= "pc"
>
>  inherit autotools gettext texinfo pkgconfig
> --
> 2.25.1
>
>
> 
>

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

* Re: [OE-core] [PATCH] grub: Add support for RISC-V
  2020-11-25 18:54 ` [OE-core] " Khem Raj
@ 2020-11-26 15:17   ` Norbert Kaminski
  0 siblings, 0 replies; 3+ messages in thread
From: Norbert Kaminski @ 2020-11-26 15:17 UTC (permalink / raw)
  To: Khem Raj
  Cc: Patches and discussions about the oe-core layer, Maciej Pijanowski

On 25.11.2020 19:54, Khem Raj wrote:
> Thanks for your contribution.
>
> On Wed, Nov 25, 2020 at 9:23 AM Norbert Kaminski
> <norbert.kaminski@3mdeb.com> wrote:
>> This patch adds RISC-V to the COMPATIBLE_HOST. Since GRUB 2.04,
>> the source code supports the RISC-V, thanks to Alexander Graf.
>>
>> Adding the GRUBPLATFORM for RISC-V prevents autoconf problems.
>> Also, the patch appends the __anonymous method with RISC-V architecture.
>>
>> Signed-off-by: Norbert Kaminski <norbert.kaminski@3mdeb.com>
>> ---
>>   meta/recipes-bsp/grub/grub-efi_2.04.bb | 4 ++++
>>   meta/recipes-bsp/grub/grub2.inc        | 4 +++-
>>   2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/recipes-bsp/grub/grub-efi_2.04.bb b/meta/recipes-bsp/grub/grub-efi_2.04.bb
>> index 30d95f95e0..f80afd95cb 100644
>> --- a/meta/recipes-bsp/grub/grub-efi_2.04.bb
>> +++ b/meta/recipes-bsp/grub/grub-efi_2.04.bb
>> @@ -26,6 +26,10 @@ python __anonymous () {
>>           grubtarget = 'arm64'
>>       elif re.match('arm', target):
>>           grubtarget = 'arm'
>> +    elif re.match('riscv64', target):
>> +        grubtarget = 'riscv64'
>> +    elif re.match('riscv32', target):
>> +        grubtarget = 'riscv32'
> RV64 is file but does it also support RV32 ?
I see that there are some changes for RV32:

https://git.savannah.gnu.org/cgit/grub.git/tree/configure.ac?h=grub-2.04#n186

And I'm able to build the grub and grub-native package for RV32.
There is a problem with grub-mkimage for RV32 in grub-efi,
it fails with the error:

grub-mkimage: error: target 1f46 not reachable from pc=10b6.

This points to the line:
https://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-mkimagexx.c?h=grub-2.04&id=3562536fd5e5cc3d40942f3e8ac53d4f0ee5c220#n1300

I guess for now, we should leave the support only for the RV64,
which is tested and works well.

>>       else:
>>           raise bb.parse.SkipRecipe("grub-efi is incompatible with target %s" % target)
>>       grubimage = prefix + d.getVar("EFI_BOOT_IMAGE")
>> diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
>> index ff17dbe8b7..d020103605 100644
>> --- a/meta/recipes-bsp/grub/grub2.inc
>> +++ b/meta/recipes-bsp/grub/grub2.inc
>> @@ -33,7 +33,7 @@ SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e503165
>>
>>   DEPENDS = "flex-native bison-native gettext-native"
>>
>> -COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
>> +COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'
>>   COMPATIBLE_HOST_armv7a = 'null'
>>   COMPATIBLE_HOST_armv7ve = 'null'
>>
>> @@ -42,6 +42,8 @@ COMPATIBLE_HOST_armv7ve = 'null'
>>
>>   GRUBPLATFORM_arm = "efi"
>>   GRUBPLATFORM_aarch64 = "efi"
>> +GRUBPLATFORM_riscv32 = "efi"
>> +GRUBPLATFORM_riscv64 = "efi"
>>   GRUBPLATFORM ??= "pc"
>>
>>   inherit autotools gettext texinfo pkgconfig
>> --
>> 2.25.1
>>
>>
>> 
>>

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

end of thread, other threads:[~2020-11-26 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 17:22 [PATCH] grub: Add support for RISC-V Norbert Kaminski
2020-11-25 18:54 ` [OE-core] " Khem Raj
2020-11-26 15:17   ` Norbert Kaminski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.