From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 029C0A0543; Tue, 4 Oct 2022 10:50:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4AD7427FF; Tue, 4 Oct 2022 10:50:14 +0200 (CEST) Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by mails.dpdk.org (Postfix) with ESMTP id B1F8B40DFB; Tue, 4 Oct 2022 10:50:10 +0200 (CEST) Received: from [192.168.0.101] (unknown [114.241.48.130]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxTWuv8ztjPMclAA--.12246S3; Tue, 04 Oct 2022 16:49:52 +0800 (CST) Message-ID: <97b7320c-c359-23ba-89d8-00cf9eba9470@loongson.cn> Date: Tue, 4 Oct 2022 16:49:51 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v7 0/7] Introduce support for LoongArch architecture To: David Marchand 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 , Ali Alnubani , dpdklab , ci@dpdk.org References: <20220930080228.864681-1-zhoumin@loongson.cn> <3219c10e-79fa-39df-30f5-c2287fd1872b@loongson.cn> <50bd37d8-1741-eee8-0b1c-fec9b415bc66@loongson.cn> From: zhoumin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf8AxTWuv8ztjPMclAA--.12246S3 X-Coremail-Antispam: 1UD129KBjvJXoWxuw4Dur1DZr4xuF18Xry5Arb_yoW3KryDp3 W3uw40kF93Xr9Ykr1DA3y8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.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, David, Thanks for your kind reply. On Tue, Oct 4, 2022 at 00:30, David Marchand wrote: > Hello Min, > > On Sat, Oct 1, 2022 at 4:26 PM zhoumin 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 I'm sorry. I forgot to give the dependencies for build the cross compilation toolchain. These dependencies can be added into the documentation for LoongArch. Thanks a lot. > The script below works, but it is really better to run it with -e. > > # bash -e $script Yes, thanks. The script will run for a long time. It is better to run it with -e in order to exit quickly when an error has occured. > >> #!/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 >> Thanks, -- Min Zhou >