DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: zhoumin <zhoumin@loongson.cn>
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
	anatoly.burakov@intel.com, qiming.yang@intel.com,
	Yuying.Zhang@intel.com, jgrajcia@cisco.com,
	 konstantin.v.ananyev@yandex.ru, dev@dpdk.org,
	maobibo@loongson.cn,  Aaron Conole <aconole@redhat.com>,
	Ali Alnubani <alialnu@nvidia.com>, dpdklab <dpdklab@iol.unh.edu>,
	ci@dpdk.org
Subject: Re: [PATCH v7 0/7] Introduce support for LoongArch architecture
Date: Mon, 3 Oct 2022 18:30:24 +0200	[thread overview]
Message-ID: <CAJFAV8wpB-tJfFdagZH7Kd5gxhQUsBVSN1L4R+LCg_fS=mZ88g@mail.gmail.com> (raw)
In-Reply-To: <50bd37d8-1741-eee8-0b1c-fec9b415bc66@loongson.cn>

Hello Min,

On Sat, Oct 1, 2022 at 4:26 PM zhoumin <zhoumin@loongson.cn> wrote:
> I'm Sorry, I misunderstood the 'instructions' you said. The process of
> making the toolchain is a little complicated. So I made a script used to
> generate the toolchain from source codes. The content of the script is
> as follows:
>

I successfully generated a cross compilation toolchain with this script.

I ran this script in a UBI8 image (iow RHEL8), with the
codeready-builder-for-rhel-8-x86_64-rpms repo enabled and the
following packages installed:
# subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
# dnf install bison diffutils file flex gcc gcc-c++ git gmp-devel
libtool make python3 rsync texinfo wget xz zlib-devel

The script below works, but it is really better to run it with -e.

# bash -e $script


> #!/bin/bash
>
> # Prepare the working directories
> export SYSDIR=/tmp/la_cross_tools
> mkdir -pv ${SYSDIR}
> mkdir -pv ${SYSDIR}/downloads
> mkdir -pv ${SYSDIR}/build
> install -dv ${SYSDIR}/cross-tools
> install -dv ${SYSDIR}/sysroot
>
> set +h
> umask 022
> # Set the environment variables to be used next
> export BUILDDIR="${SYSDIR}/build"
> export DOWNLOADDIR="${SYSDIR}/downloads"
> export LC_ALL=POSIX
> export CROSS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
> export CROSS_TARGET="loongarch64-unknown-linux-gnu"
> export MABI="lp64d"
> export BUILD64="-mabi=lp64d"
> export PATH=${SYSDIR}/cross-tools/bin:/bin:/usr/bin
> export JOBS=-j8
> unset CFLAGS
> unset CXXFLAGS
>
> # Download the source code archives
> pushd $DOWNLOADDIR
> wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.19.tar.gz
> wget https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz
> wget https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz
> wget https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
> wget https://ftp.gnu.org/gnu/libc/glibc-2.36.tar.xz
> popd
>
> # Make and install the linux header files
> tar xvf ${DOWNLOADDIR}/linux-5.19.tar.gz -C ${BUILDDIR}
> pushd ${BUILDDIR}/linux-5.19
>     make mrproper
>     make ARCH=loongarch INSTALL_HDR_PATH=dest headers_install
>     find dest/include -name '.*' -delete
>     mkdir -pv ${SYSDIR}/sysroot/usr/include
>     cp -rv dest/include/* ${SYSDIR}/sysroot/usr/include
> popd
>
> # Prepare the binutils source code
> git clone git://sourceware.org/git/binutils-gdb.git --depth 1
> pushd binutils-gdb
>     git archive --format=tar.gz --prefix=binutils-2.38/ --output ../binutils-2.38.tar.gz "master"
> popd
> mv binutils-2.38.tar.gz ${DOWNLOADDIR}
>
> # Make and install the binutils files
> tar xvf ${DOWNLOADDIR}/binutils-2.38.tar.gz -C ${BUILDDIR}
> pushd ${BUILDDIR}/binutils-2.38
>     rm -rf gdb* libdecnumber readline sim
>     mkdir tools-build
>     pushd tools-build
>         CC=gcc AR=ar AS=as \
>         ../configure --prefix=${SYSDIR}/cross-tools --build=${CROSS_HOST} --host=${CROSS_HOST} \
>                      --target=${CROSS_TARGET} --with-sysroot=${SYSDIR}/sysroot --disable-nls \
>                      --disable-static --disable-werror --enable-64-bit-bfd
>         make configure-host ${JOBS}
>         make ${JOBS}
>         make install-strip
>         cp -v ../include/libiberty.h ${SYSDIR}/sysroot/usr/include
>     popd
> popd
>
> # Make and install the gmp files used by GCC
> tar xvf ${DOWNLOADDIR}/gmp-6.2.1.tar.xz -C ${BUILDDIR}
> pushd ${BUILDDIR}/gmp-6.2.1
>     ./configure --prefix=${SYSDIR}/cross-tools --enable-cxx --disable-static
>     make ${JOBS}
>     make install
> popd
>
> # Make and install the mpfr files used by GCC
> tar xvf ${DOWNLOADDIR}/mpfr-4.1.0.tar.xz -C ${BUILDDIR}
> pushd ${BUILDDIR}/mpfr-4.1.0
>     ./configure --prefix=${SYSDIR}/cross-tools --disable-static --with-gmp=${SYSDIR}/cross-tools
>     make ${JOBS}
>     make install
> popd
>
> # Make and install the mpc files used by GCC
> tar xvf ${DOWNLOADDIR}/mpc-1.2.1.tar.gz -C ${BUILDDIR}
> pushd ${BUILDDIR}/mpc-1.2.1
>     ./configure --prefix=${SYSDIR}/cross-tools --disable-static --with-gmp=${SYSDIR}/cross-tools
>     make ${JOBS}
>     make install
> popd
>
> # Prepare the gcc source code
> git clone git://sourceware.org/git/gcc.git --depth 1
> pushd gcc
>     git archive --format=tar.gz --prefix=gcc-13.0.0/ --output ../gcc-13.0.0.tar.gz "master"
> popd
> mv gcc-13.0.0.tar.gz ${DOWNLOADDIR}
>
> # Make and install the simplified GCC files
> tar xvf ${DOWNLOADDIR}/gcc-13.0.0.tar.gz -C ${BUILDDIR}
> pushd ${BUILDDIR}/gcc-13.0.0
>     mkdir tools-build
>     pushd tools-build
>         AR=ar LDFLAGS="-Wl,-rpath,${SYSDIR}/cross-tools/lib" \
>         ../configure --prefix=${SYSDIR}/cross-tools --build=${CROSS_HOST} --host=${CROSS_HOST} \
>                      --target=${CROSS_TARGET} --disable-nls \
>                      --with-mpfr=${SYSDIR}/cross-tools --with-gmp=${SYSDIR}/cross-tools \
>                      --with-mpc=${SYSDIR}/cross-tools \
>                      --with-newlib --disable-shared --with-sysroot=${SYSDIR}/sysroot \
>                      --disable-decimal-float --disable-libgomp --disable-libitm \
>                      --disable-libsanitizer --disable-libquadmath --disable-threads \
>                      --disable-target-zlib --with-system-zlib --enable-checking=release \
>                      --enable-default-pie \
>                      --enable-languages=c
>         make all-gcc all-target-libgcc ${JOBS}
>         make install-strip-gcc install-strip-target-libgcc
>     popd
> popd
>
> # Make and install the glibc files
> tar xvf ${DOWNLOADDIR}/glibc-2.36.tar.xz -C ${BUILDDIR}
> pushd ${BUILDDIR}/glibc-2.36
>     sed -i "s@5.15.0@4.15.0@g" sysdeps/unix/sysv/linux/loongarch/configure{,.ac}
>     mkdir -v build-64
>     pushd build-64
>         BUILD_CC="gcc" CC="${CROSS_TARGET}-gcc ${BUILD64}" \
>         CXX="${CROSS_TARGET}-gcc ${BUILD64}" \
>         AR="${CROSS_TARGET}-ar" RANLIB="${CROSS_TARGET}-ranlib" \
>         ../configure --prefix=/usr --host=${CROSS_TARGET} --build=${CROSS_HOST} \
>                      --libdir=/usr/lib64 --libexecdir=/usr/lib64/glibc \
>                      --with-binutils=${SYSDIR}/cross-tools/bin \
>                      --with-headers=${SYSDIR}/sysroot/usr/include \
>                      --enable-stack-protector=strong --enable-add-ons \
>                      --disable-werror libc_cv_slibdir=/usr/lib64 \
>                      --enable-kernel=4.15
>         make ${JOBS}
>         make DESTDIR=${SYSDIR}/sysroot install
>         cp -v ../nscd/nscd.conf ${SYSDIR}/sysroot/etc/nscd.conf
>         mkdir -pv ${SYSDIR}/sysroot/var/cache/nscd
>         install -v -Dm644 ../nscd/nscd.tmpfiles \
>                           ${SYSDIR}/sysroot/usr/lib/tmpfiles.d/nscd.conf
>         install -v -Dm644 ../nscd/nscd.service \
>                           ${SYSDIR}/sysroot/usr/lib/systemd/system/nscd.service
>     popd
>     mkdir -v build-locale
>     pushd build-locale
>         ../configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/lib64/glibc \
>                      --enable-stack-protector=strong --enable-add-ons \
>                      --disable-werror libc_cv_slibdir=/usr/lib64
>         make ${JOBS}
>         make DESTDIR=${SYSDIR}/sysroot localedata/install-locales
>     popd
> popd
>
> # Make and install the complete GCC files
> tar xvf ${DOWNLOADDIR}/gcc-13.0.0.tar.gz -C ${BUILDDIR}
> pushd ${BUILDDIR}/gcc-13.0.0
>     mkdir tools-build-all
>     pushd tools-build-all
>         AR=ar LDFLAGS="-Wl,-rpath,${SYSDIR}/cross-tools/lib" \
>         ../configure --prefix=${SYSDIR}/cross-tools --build=${CROSS_HOST} \
>                      --host=${CROSS_HOST} --target=${CROSS_TARGET} \
>                      --with-sysroot=${SYSDIR}/sysroot --with-mpfr=${SYSDIR}/cross-tools \
>                      --with-gmp=${SYSDIR}/cross-tools --with-mpc=${SYSDIR}/cross-tools \
>                      --enable-__cxa_atexit --enable-threads=posix --with-system-zlib \
>                      --enable-libstdcxx-time --enable-checking=release \
>                      --enable-default-pie \
>                      --enable-languages=c,c++,fortran,objc,obj-c++,lto
>         make ${JOBS}
>         make install-strip
>     popd
> popd
>


-- 
David Marchand


  reply	other threads:[~2022-10-03 16:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30  8:02 Min Zhou
2022-09-30  8:02 ` [PATCH v7 1/7] eal/loongarch: support " Min Zhou
2022-10-03 17:15   ` David Marchand
2022-10-04  8:49     ` zhoumin
2022-09-30  8:02 ` [PATCH v7 2/7] net/ixgbe: add vector stubs for LoongArch Min Zhou
2022-09-30  8:02 ` [PATCH v7 3/7] net/memif: set memfd syscall ID on LoongArch Min Zhou
2022-09-30  8:02 ` [PATCH v7 4/7] net/tap: set BPF syscall ID for LoongArch Min Zhou
2022-09-30  8:02 ` [PATCH v7 5/7] examples/l3fwd: enable LoongArch operation Min Zhou
2022-09-30  8:02 ` [PATCH v7 6/7] test/cpuflags: add test for LoongArch cpu flag Min Zhou
2022-09-30  8:02 ` [PATCH v7 7/7] ci: add LOONGARCH64 cross compilation job Min Zhou
2022-09-30  8:13 ` [PATCH v7 0/7] Introduce support for LoongArch architecture David Marchand
2022-09-30 10:05   ` zhoumin
2022-09-30 14:20     ` David Marchand
2022-10-01 14:25       ` zhoumin
2022-10-03 16:30         ` David Marchand [this message]
2022-10-04  8:49           ` zhoumin
2022-10-03  8:14       ` Ali Alnubani
2022-10-03 12:44         ` zhoumin
2022-10-04  6:59 ` David Marchand
2022-10-04  8:50   ` zhoumin

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='CAJFAV8wpB-tJfFdagZH7Kd5gxhQUsBVSN1L4R+LCg_fS=mZ88g@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=Yuying.Zhang@intel.com \
    --cc=aconole@redhat.com \
    --cc=alialnu@nvidia.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=ci@dpdk.org \
    --cc=dev@dpdk.org \
    --cc=dpdklab@iol.unh.edu \
    --cc=jgrajcia@cisco.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=maobibo@loongson.cn \
    --cc=qiming.yang@intel.com \
    --cc=thomas@monjalon.net \
    --cc=zhoumin@loongson.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).