All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 4/6] arch: add support for RISC-V 64-bit (riscv64) architecture
Date: Tue, 25 Sep 2018 22:06:32 +0200	[thread overview]
Message-ID: <20180925220632.337de029@windsurf> (raw)
In-Reply-To: <20180912102256.3164-5-mark.corbin@embecosm.com>

Hello,

On Wed, 12 Sep 2018 11:22:54 +0100, 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@embecosm.com>

I have applied this commit, after doing a few changes, see below.


> +ifeq ($(BR2_riscv),y)
> +
> +ifeq ($(BR2_ARCH_IS_64),y)
> +RISCV_GCC_ARCH = rv64i
> +endif
> +
> +ifeq ($(BR2_RISCV_ISA_RVM),y)
> +RISCV_GCC_ARCH := $(RISCV_GCC_ARCH)m
> +endif
> +ifeq ($(BR2_RISCV_ISA_RVA),y)
> +RISCV_GCC_ARCH := $(RISCV_GCC_ARCH)a
> +endif
> +ifeq ($(BR2_RISCV_ISA_RVF),y)
> +RISCV_GCC_ARCH := $(RISCV_GCC_ARCH)f
> +endif
> +ifeq ($(BR2_RISCV_ISA_RVD),y)
> +RISCV_GCC_ARCH := $(RISCV_GCC_ARCH)d
> +endif
> +ifeq ($(BR2_RISCV_ISA_RVC),y)
> +RISCV_GCC_ARCH := $(RISCV_GCC_ARCH)c
> +endif
> +
> +GCC_TARGET_ARCH := $(RISCV_GCC_ARCH)

In this file, I didn't see the point of the intermediate
RISCV_GCC_ARCH variable. So I've changed to use GCC_TARGET_ARCH
directly.

> +GLIBC_CONF_OPTS = \
> +		--with-pkgversion="Buildroot" \
> +		--without-cvs \
> +		--disable-profile \
> +		--without-gd \
> +		--enable-obsolete-rpc \
> +		--enable-kernel=$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)) \
> +		--with-headers=$(STAGING_DIR)/usr/include
> +
> +ifeq ($(BR2_x86_64),y)
> +GLIBC_CONF_OPTS += --enable-lock-elision
> +endif
> +
> +# Override the default library locations of /lib64/<abi> and
> +# /usr/lib64/<abi>/ for RISC-V.
> +ifeq ($(BR2_riscv),y)
> +GLIBC_CONF_OPTS += libc_cv_slibdir=/lib64 libc_cv_rtlddir=/lib
> +endif
> +
>  define GLIBC_CONFIGURE_CMDS
>  	mkdir -p $(@D)/build
>  	# Do the configuration
> @@ -98,14 +118,8 @@ define GLIBC_CONFIGURE_CMDS
>  		--build=$(GNU_HOST_NAME) \
>  		--prefix=/usr \
>  		--enable-shared \
> -		$(if $(BR2_x86_64),--enable-lock-elision) \
> -		--with-pkgversion="Buildroot" \
> -		--without-cvs \
> -		--disable-profile \
> -		--without-gd \
> -		--enable-obsolete-rpc \
> -		--enable-kernel=$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)) \
> -		--with-headers=$(STAGING_DIR)/usr/include)
> +		$(GLIBC_CONF_OPTS) \
> +	)

As I commented in an earlier review, libc_cv_* should be passed in the
environment, like other autoconf cache variables. So I did a
preliminary commit that creates a GLIBC_CONF_ENV variable, passed in
the glibc ./configure script environment, and that contains the
existing autoconf cache variables we were passing.

Then I adjusted your commit to simply add those libc_cv_* variables to
GLIBC_CONF_ENV:

+# Override the default library locations of /lib64/<abi> and
+# /usr/lib64/<abi>/ for RISC-V.
+ifeq ($(BR2_riscv),y)
+GLIBC_CONF_ENV += libc_cv_slibdir=/lib64 libc_cv_rtlddir=/lib
+endif

Thanks a lot for this contribution!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2018-09-25 20:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 10:22 [Buildroot] [PATCH v2 0/6] Add RISC-V 64-bit architecture support Mark Corbin
2018-09-12 10:22 ` [Buildroot] [PATCH v2 1/6] linux: add hash file Mark Corbin
2018-09-23 19:21   ` Thomas Petazzoni
2018-09-23 19:39     ` Fabio Estevam
2018-09-12 10:22 ` [Buildroot] [PATCH v2 2/6] package/linux-headers: add support for custom headers Mark Corbin
2018-09-12 15:23   ` Thomas Petazzoni
2018-09-23 20:12   ` Thomas Petazzoni
2018-09-12 10:22 ` [Buildroot] [PATCH v2 3/6] arch: allow GCC target options to be optionally overwritten Mark Corbin
2018-09-23 20:33   ` Thomas Petazzoni
2018-09-12 10:22 ` [Buildroot] [PATCH v2 4/6] arch: add support for RISC-V 64-bit (riscv64) architecture Mark Corbin
2018-09-12 15:21   ` Thomas Petazzoni
2018-09-25 20:06   ` Thomas Petazzoni [this message]
2018-09-12 10:22 ` [Buildroot] [PATCH v2 5/6] boot/riscv-pk: add bootloader for RISC-V architecture Mark Corbin
2018-09-25 20:08   ` Thomas Petazzoni
2018-09-12 10:22 ` [Buildroot] [PATCH v2 6/6] configs/qemu: add qemu_riscv64_virt_defconfig Mark Corbin
2018-09-25 20:10   ` Thomas Petazzoni
2018-09-12 15:18 ` [Buildroot] [PATCH v2 0/6] Add RISC-V 64-bit architecture support Thomas Petazzoni
2018-09-12 16:14   ` Mark Corbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180925220632.337de029@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.