[Buildroot] [PATCH 1/1] arch: add support for RISC-V 64-bit (riscv64) architecture

Arnout Vandecappelle arnout at mind.be
Fri Sep 7 19:26:27 UTC 2018



On 05/09/2018 12:09, Mark Corbin wrote:
> Hello Arnout
> 
> On 04/09/18 22:03, Arnout Vandecappelle wrote:
>>
>> On 04/09/2018 15:10, Mark Corbin wrote:
>>> Hello Arnout
>>>
>>> On 04/09/18 00:00, Arnout Vandecappelle wrote:
>>>> On 31/08/2018 11:11, Mark Corbin wrote:
>>>>> This enables a riscv64 system to be built with a Buildroot generated
>>>>> toolchain (gcc >= 7.x, binutils >= 2.30, glibc only).
>>>>>
>>>>> This configuration has been used to successfully build a qemu-bootable
>>>>> riscv-linux-4.15 kernel (https://github.com/riscv/riscv-linux.git).
>>>>>
>>>>> Signed-off-by: Mark Corbin <mark.corbin at embecosm.com>
>>>>> ---
>>>>>  Makefile                                |   1 +
>>>>>  arch/Config.in                          |  15 ++++
>>>>>  arch/Config.in.riscv                    | 104 ++++++++++++++++++++++++
>>>>>  arch/arch.mk.riscv                      |  24 ++++++
>>>>>  package/binutils/Config.in.host         |   3 +
>>>>>  toolchain/toolchain-buildroot/Config.in |  12 ++-
>>>>  One more thing that is missing: in package/linux-headers/Config.in.host, you
>>>> have to exclude all the linux versions that don't support riscv yet (i.e.
>>>> everything before 4.15).
>>> Is it worth doing this when you actually have to select a custom version of
>>> headers anyway?
>>  In that case, you have to disable *all* choices except for _AS_KERNEL and _VERSION.
>>
>>  I didn't realise that upstream riscv support was broken. I saw that Linus added
>> riscv in v4.15 so I assumed that it could be used.
>>
>>  So I pulled a diff, the differences between upstream and riscv in uapi are
>> really minor. And there are no longer any differences between v4.18.5 and the
>> riscv-linux-4.18 branch. So I would tend to say that the upstream v4.15 should
>> work as well. Of course, I haven't tried...
> 
> I couldn't get the upstream 4.15 and 4.17 kernels to boot under qemu, so
> I asked about the status of kernel support on the riscv sw-dev mailing
> list. Apparently the existing upstream kernels do not support qemu
> (which is the first target that I am adding). The developers are
> expecting the necessary changes to make it into the 4.19 kernel release.

 Yes, you do not want to use the upstream 4.15 *kernel*. But that doesn't mean
you should exclude the upstream 4.15 *headers*.

> In this case I think it makes sense for me to disable all choices except
> _AS_KERNEL, _CUSTOM_TARBALL and CUSTOM_GIT.
> 
>>
>>> This makes more sense to me when the necessary riscv support
>>> makes it upstream. I think that it would be a bit messy at the moment as I
>>> should add a restriction to stop you choosing *any* mainline kernel version...
>>>
>>> config BR2_KERNEL_HEADERS_4_1
>>>         bool "Linux 4.1.x kernel headers"
>>>         select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_1
>>>         depends !BR2_riscv
>>> .
>>> .
>>> etc.
>>>
>>> ...and also restrict your choice of versions for custom headers pre-4.15...
>>>
>>> config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_14
>>>         bool "4.14.x"
>>>         select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_14
>>>         depends on !BR2_riscv
>>  If you look at the existing code, you'll see that we do add the exclusions for
>> the upstream headers choice, but not for the custom headers. That's because the
>> custom headers is supposed to be used for a vendor fork which *does* support
>> that arch already. Case in point: you'd exclude the upstream 4.15 choice, but
>> you'd still want to be able to build with the riscv-linux-4.15 tree.
> 
> So should I allow any version of custom headers to be selected even
> though only 4.15 is relevant for riscv?

 Yes. In other words, don't add dependencies at all for the custom choices. We
don't do it for any of the other architectures either.

 Regards,
 Arnout

> 
> Regards
> 
> Mark
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF


More information about the buildroot mailing list