diff --git a/README.en.md b/README.en.md index 82359d3fff39b3e07c9107700f6bea39eba48134..57964a5639c4f9f0ad06684b1f8418a362a848e5 100644 --- a/README.en.md +++ b/README.en.md @@ -1,7 +1,7 @@ # gcc-cross #### Description -GCC cross compilation tool chain currently supports x86->arm32/arm64, will continue to expand in the future. +GCC cross compilation tool chain currently supports x86->arm32/arm64/riscv64, will continue to expand in the future. #### Software Architecture Software architecture description diff --git a/build.sh b/build.sh index 6661e15d7ab10ac44732e3817ce75f04314e0239..bb2525d7379a1a74c8281a0fdc0924466accdbda 100755 --- a/build.sh +++ b/build.sh @@ -48,7 +48,7 @@ miss_tool_error bison --version miss_tool_error flex --version miss_tool_error makeinfo --version -if [ "$1"x = "openeuler_gcc_arm64le"x ] || [ "$1"x = "openeuler_gcc_arm32le"x ]; then +if [ "$1"x = "openeuler_gcc_arm64le"x ] || [ "$1"x = "openeuler_gcc_arm32le"x ] || [ "$1"x = "openeuler_gcc_riscv64"x ]; then cd $1 elif [ "$1"x = "clean"x ] ; then clean diff --git a/gcc-cross.spec b/gcc-cross.spec index 378f524fe2cad486e371d85df59b6ccb39ac49a2..544f7627255a8e1d26ca79fc8292488073e23b2c 100644 --- a/gcc-cross.spec +++ b/gcc-cross.spec @@ -1,6 +1,6 @@ Summary: C/C++ Cross Compiler Toolchain Name: gcc-cross -Version: 1.0 +Version: 1.1 Release: 0 # libgcc, libgfortran, libmudflap, libgomp, libstdc++ and crtstuff have # GCC Runtime Exception. @@ -30,17 +30,26 @@ fi bash download.sh bash build.sh openeuler_gcc_arm64le bash build.sh openeuler_gcc_arm32le +bash build.sh openeuler_gcc_riscv64 %install mkdir -p %{buildroot}/tmp cp %{_builddir}/output/openeuler_gcc_arm64le/openeuler_gcc_arm64le.tar.gz %{buildroot}/tmp cp %{_builddir}/output/openeuler_gcc_arm32le/openeuler_gcc_arm32le.tar.gz %{buildroot}/tmp +cp %{_builddir}/output/openeuler_gcc_riscv64/openeuler_gcc_riscv64.tar.gz %{buildroot}/tmp %files %attr(755, root, root) /tmp/openeuler_gcc_arm64le.tar.gz %attr(755, root, root) /tmp/openeuler_gcc_arm32le.tar.gz +%attr(755, root, root) /tmp/openeuler_gcc_riscv64.tar.gz %changelog +* Tue May 24 2022 fanglinxu - 1.1-0 +- Type:RISC-V +- ID:NA +- SUG:NA +- DESC: add riscv64 support + * Wed Mar 23 2022 dingguangya - Type:Init - ID:NA diff --git a/openeuler_gcc_riscv64/build.sh b/openeuler_gcc_riscv64/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..7e401c09aa01d5e666450eaadbd6d6712fef2e4a --- /dev/null +++ b/openeuler_gcc_riscv64/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e +set -x + +readonly LOG_PATH="$PWD/../logs" + +source $PWD/../config.xml + +[ -e "$LOG_PATH/openeuler_gcc_riscv64_patch.log" ] && rm $LOG_PATH/openeuler_gcc_riscv64_patch.log +[ -e "$LOG_PATH/openeuler_gcc_riscv64_build.log" ] && rm $LOG_PATH/openeuler_gcc_riscv64_build.log +mkdir -p $LOG_PATH + +source pre_construction.sh &>> $LOG_PATH/openeuler_gcc_riscv64_patch.log + +echo "------------------------------------------" +echo "Now building the "openeuler_gcc_riscv64" toolchain ..." +echo "The entire build process takes about 45 minutes (build time is related to machine preformance), you can view the detailed build log in the ${LOG_PATH} file" +source openeuler_gcc_update_sourcecode.sh +source openeuler_gcc_riscv64_linux_release.sh &>> $LOG_PATH/openeuler_gcc_riscv64_build.log +echo "Build openeuler_gcc_riscv64 toolchain completed!" diff --git a/openeuler_gcc_riscv64/openeuler_gcc_riscv64_linux_release.sh b/openeuler_gcc_riscv64/openeuler_gcc_riscv64_linux_release.sh new file mode 100755 index 0000000000000000000000000000000000000000..760869d7f3a90a1d754e79f164ab47910f601e73 --- /dev/null +++ b/openeuler_gcc_riscv64/openeuler_gcc_riscv64_linux_release.sh @@ -0,0 +1,107 @@ +#!/bin/bash + +set -e + +# Target root directory,should be adapted according to your environment +readonly ROOT_TAR_DIR="$PWD/riscv64_build_dir" +readonly ROOT_TAR_SRC="$PWD/../../open_source" +readonly INSTALL="openeuler_gcc_riscv64" +readonly PREFIX="$PWD/riscv64_build_dir/$INSTALL" +readonly OUTPUT="$PWD/../../output/$INSTALL" + +readonly SECURE_LDFLAGS="-z relro -z now -z noexecstack" +readonly SECURE_CFLAGS="-fPIC -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fPIE" +readonly SECURE_CXXFLAGS="-fPIC -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fPIE" +readonly SECURE_CFLAGS_FOR_TARGET="-fPIC -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -march=rv64g" +readonly SECURE_CXXFLAGS_FOR_TARGET="-fPIC -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -march=rv64g" + +readonly HOST="$(gcc -dumpmachine)" +readonly BUILD="$(gcc -dumpmachine)" + +readonly SYSROOT="$PREFIX/sysroot" + +#OTHER CONFIG +readonly ARCH="rv64g" +readonly TARGET="riscv64-openeuler-linux-gnu" + +source $PWD/../config.xml + +declare -x CFLAGS_FOR_TARGET="-fPIC -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -march=rv64g" +declare -x CXXFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET" + +#Create an empty file +create_new_file(){ +while [ $# != 0 ] ; do +[ -n "$1" ] && rm -rf $1 ; mkdir -p $1; shift; done } + +create_new_file $ROOT_TAR_DIR/obj $PREFIX $OUTPUT $ROOT_TAR_DIR/obj/build-gmp $ROOT_TAR_DIR/obj/build-mpfr $ROOT_TAR_DIR/obj/build-isl $ROOT_TAR_DIR/obj/build-mpc $ROOT_TAR_DIR/obj/build-binutils $ROOT_TAR_DIR/obj/build-gcc-first $ROOT_TAR_DIR/obj/glibc-headers-lp64 $ROOT_TAR_DIR/obj/build-gcc-second $ROOT_TAR_DIR/obj/build-eglibc-lp64 $ROOT_TAR_DIR/obj/build-gcc-final + +# Change GLIBC_DYNAMIC_LINKER to lib64 +sed -i "s#^\#define GLIBC_DYNAMIC_LINKER.*#\#define GLIBC_DYNAMIC_LINKER \"/lib64/ld-linux-riscv\" XLEN_SPEC \"-\" ABI_SPEC \".so.1\"#g" $ROOT_TAR_SRC/$GCC/$GCC_DIR/gcc/config/riscv/linux.h + +# Change libstdc++.so option +sed -i "s#^\\t\$(OPT_LDFLAGS).*#\\t\$(OPT_LDFLAGS) \$(SECTION_LDFLAGS) \$(AM_CXXFLAGS) \$(LTLDFLAGS) -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -o \$\@#g" $ROOT_TAR_SRC/$GCC/$GCC_DIR/libstdc++-v3/src/Makefile.in + +echo "Building gmp..." && pushd $ROOT_TAR_DIR/obj/build-gmp +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$GMP/$GMP_DIR/configure --build=$BUILD --prefix=$PREFIX --disable-shared --host=$HOST --enable-cxx +make -j 32 && make install && popd + +echo "Building mpfr..." && pushd $ROOT_TAR_DIR/obj/build-mpfr +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$MPFR/$MPFR_DIR/configure --build=$BUILD --target=$TARGET --prefix=$PREFIX --disable-shared --host=$HOST --with-gmp=$PREFIX +make -j 32 && make install && popd + +echo "Building isl..." && pushd $ROOT_TAR_DIR/obj/build-isl +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$ISL/$ISL_DIR/configure --build=$BUILD --host=$HOST --prefix=$PREFIX --with-gmp-prefix=$PREFIX --disable-shared +make -j 32 && make install && popd + +echo "Building mpc..." && pushd $ROOT_TAR_DIR/obj/build-mpc +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$MPC/$MPC_DIR/configure --build=$BUILD --target=$TARGET --prefix=$PREFIX --disable-shared --host=$HOST --with-gmp=$PREFIX +make -j 32 && make install && popd + +echo "Building binutils..." && pushd $ROOT_TAR_DIR/obj/build-binutils +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$BINUTILS/$BINUTILS_DIR/configure --build=$BUILD --target=$TARGET --prefix=$PREFIX --host=$HOST --with-pkgversion="${COMPILER_INFO}" --with-sysroot=$SYSROOT --enable-plugins --enable-ld=yes --disable-gdb --libdir=$PREFIX/lib64 +make -j 32 && make install prefix=$PREFIX exec_prefix=$PREFIX libdir=$PREFIX/lib64 && popd + +echo "Installing kernel headers..." && pushd $ROOT_TAR_SRC/$KERNEL_HEADERS/ +mkdir -p $SYSROOT/usr/ && cp -r include $SYSROOT/usr/ +mkdir -p $SYSROOT/usr/include/bits $SYSROOT/usr/include/gnu && popd + +echo "Building GCC first..." && pushd $ROOT_TAR_DIR/obj/build-gcc-first +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$GCC/$GCC_DIR/configure --build=$BUILD --host=$HOST --target=$TARGET --prefix=$PREFIX --disable-multilib --with-abi=lp64d --disable-libmudflap --without-headers --with-newlib --enable-threads=no --disable-shared --disable-nls --with-arch=$ARCH --with-gnu-as --with-gnu-ld --enable-poison-system-directories --disable-libssp --enable-symvers=gnu --enable-__cxa_atexit --disable-libgomp --disable-libstdcxx-pch --disable-libquadmath --disable-lto --enable-languages=c --with-pkgversion="${COMPILER_INFO}" --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --with-isl=$PREFIX --with-sysroot=$SYSROOT --with-build-sysroot=$SYSROOT --with-build-time-tools=$PREFIX/$TARGET/bin --libdir=$PREFIX/lib64 --disable-bootstrap --disable-libatomic --disable-libcilkrts --disable-libstdcxx-dual-abi --with-system-zlib +echo $PATH +echo $LD_LIBRARY_PATH +make -j 32 CPPFLAGS_FOR_TARGET=--sysroot=$SYSROOT && make install prefix=$PREFIX exec_prefix=$PREFIX libdir=$PREFIX/lib64 && popd + +echo "Installing eglibc headers for lp64..." && mkdir -p $SYSROOT/lib64/ $SYSROOT/usr/lib64/ && pushd "$ROOT_TAR_DIR/obj/glibc-headers-lp64" +cp -af $ROOT_TAR_SRC/$GLIBC/$GLIBC_DIR/include/gnu/stubs.h $SYSROOT/usr/include/gnu +CC="$PREFIX/bin/$TARGET-gcc $CFLAGS_FOR_TARGET" $ROOT_TAR_SRC/$GLIBC/$GLIBC_DIR/configure --prefix=/usr --with-headers=$SYSROOT/usr/include --build=$BUILD --host=$TARGET --enable-obsolete-rpc --disable-profile --without-gd --without-cvs --disable-multi-arch --enable-add-ons libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes --enable-stack-protector=strong libc_cv_ssp=yes +make install-bootstrap-headers=yes install-headers install_root=$SYSROOT && make -j 32 csu/subdir_lib +cp csu/crt1.o csu/crti.o csu/crtn.o $SYSROOT/usr/lib64/ +# RISC-V ABI wants to install everything in /lib64/lp64d or /usr/lib64/lp64d. +# Make these be symlinks to /lib64 or /usr/lib64 respectively. See: +# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DRHT5YTPK4WWVGL3GIN5BF2IKX2ODHZ3/ +pushd $SYSROOT/usr/lib64/ && ln -sf . lp64d && popd +pushd $SYSROOT/lib64/ && ln -sf . lp64d && popd +$PREFIX/bin/$TARGET-gcc $CFLAGS_FOR_TARGET -o "$SYSROOT/usr/lib64/libc.so" -nostdlib -nostartfiles -shared -x c /dev/null && popd + +echo "Building GCC second..." && pushd $ROOT_TAR_DIR/obj/build-gcc-second +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$GCC/$GCC_DIR/configure --build=$BUILD --host=$HOST --target=$TARGET --prefix=$PREFIX --disable-multilib --with-abi=lp64d --disable-libmudflap --enable-shared --with-arch=$ARCH --enable-__cxa_atexit --with-gnu-as --with-gnu-ld --disable-nls --disable-libssp --disable-libgomp --enable-lto --disable-libquadmath --enable-poison-system-directories --enable-symvers=gnu --enable-languages=c --with-pkgversion="${COMPILER_INFO}" --with-sysroot=$SYSROOT --with-build-sysroot=$SYSROOT --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --with-isl=$PREFIX --with-build-time-tools=$PREFIX/$TARGET/bin --libdir=$PREFIX/lib64 --disable-bootstrap --disable-libatomic --disable-libcilkrts --disable-libstdcxx-dual-abi --with-system-zlib +make -j 32 CPPFLAGS_FOR_TARGET=--sysroot=$SYSROOT build_tooldir=$PREFIX/$TARGET && make install-gcc install-target-libgcc prefix=$PREFIX exec_prefix=$PREFIX libdir=$PREFIX/lib64 && popd + +echo "Building eglibc for lp64..." && mkdir -p $SYSROOT/lib64/ $SYSROOT/usr/lib64/ && pushd $ROOT_TAR_DIR/obj/build-eglibc-lp64 +CC="$PREFIX/bin/$TARGET-gcc $CFLAGS_FOR_TARGET" CXX="$PREFIX/bin/$TARGET-g++ $CXXFLAGS_FOR_TARGET" LDFLAGS="${SECURE_LDFLAGS}" $ROOT_TAR_SRC/$GLIBC/$GLIBC_DIR/configure --prefix=/usr --with-headers=$SYSROOT/usr/include --build=$BUILD --host=$TARGET --disable-profile --without-gd --enable-obsolete-rpc --without-cvs --with-__thread --with-tls --disable-multi-arch --enable-shared --with-fp --enable-add-ons libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes --libdir=/usr/lib64 --enable-stack-protector=strong libc_cv_ssp=yes +make -j 32 && make install_root=$SYSROOT slibdir=/lib64 rtlddir=/lib64 install && popd + +echo "Building GCC final..." && pushd $ROOT_TAR_DIR/obj/build-gcc-final +LDFLAGS="${SECURE_LDFLAGS}" CFLAGS="${SECURE_CFLAGS}" CXXFLAGS="${SECURE_CXXFLAGS}" CFLAGS_FOR_TARGET="${SECURE_CFLAGS_FOR_TARGET}" CXXFLAGS_FOR_TARGET="${SECURE_CXXFLAGS_FOR_TARGET}" $ROOT_TAR_SRC/$GCC/$GCC_DIR/configure --build=$BUILD --host=$HOST --target=$TARGET --with-arch=$ARCH --prefix=$PREFIX --disable-multilib --with-abi=lp64d --enable-__cxa_atexit --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-libgomp --enable-threads --enable-plugin --enable-c99 --enable-long-long --disable-nls --enable-shared --disable-libquadmath --enable-poison-system-directories --enable-symvers=gnu --with-pkgversion="${COMPILER_INFO}" --enable-languages=c,c++,fortran --with-headers=$SYSROOT/usr/include --with-sysroot=$SYSROOT --with-build-sysroot=$SYSROOT --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --with-isl=$PREFIX --with-build-time-tools=$PREFIX/$TARGET/bin --libdir=$PREFIX/lib64 --disable-bootstrap --disable-libsanitizer --disable-libcilkrts --disable-libstdcxx-dual-abi --enable-default-pie --with-system-zlib +make -j 32 CPPFLAGS_FOR_TARGET=--sysroot=$SYSROOT && make install prefix=$PREFIX exec_prefix=$PREFIX libdir=$PREFIX/lib64 && popd + +# handle rpath +for file in $(find "$PREFIX" -name "lib*so*.0") ; do + chrpath --delete $file +done + +pushd $PREFIX/.. && chmod 750 $INSTALL -R +tar --format=gnu -czf $OUTPUT/$INSTALL.tar.gz $INSTALL && popd + +echo "Build Complete!" && echo "To use this newly-built $INSTALL cross toolchain, add $PREFIX/bin to your PATH!" diff --git a/openeuler_gcc_riscv64/openeuler_gcc_update_sourcecode.sh b/openeuler_gcc_riscv64/openeuler_gcc_update_sourcecode.sh new file mode 100755 index 0000000000000000000000000000000000000000..0c32fab77d0501ae873302572006676e748cdbe4 --- /dev/null +++ b/openeuler_gcc_riscv64/openeuler_gcc_update_sourcecode.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e +set -x + +readonly ROOT_TOUCH_SRC="$PWD/../../open_source" + +source $PWD/../config.xml + +#[task 002/007] touch .info files in source code for binutils +find $ROOT_TOUCH_SRC/$BINUTILS/$BINUTILS_DIR -name "*.info"|xargs -i bash -c "touch {}" + +touch $ROOT_TOUCH_SRC/$BINUTILS/$BINUTILS_DIR/binutils/doc/binutils.texi + +find $ROOT_TOUCH_SRC/$BINUTILS/$BINUTILS_DIR -name "*.1"|xargs -i bash -c "touch {}" + +touch $ROOT_TOUCH_SRC/$GCC/$GCC_DIR/gcc/config/riscv/riscv.md + +find $ROOT_TOUCH_SRC/$GCC/$GCC_DIR -name "*.1"|xargs -i bash -c "touch {}" + +find $ROOT_TOUCH_SRC/$GCC/$GCC_DIR -name "*.info"|xargs -i bash -c "touch {}" + +touch $ROOT_TOUCH_SRC/$GLIBC/$GLIBC_DIR/locale/programs/*-kw.h + +touch $ROOT_TOUCH_SRC/$MPFR/$MPFR_DIR/*.m4 +touch $ROOT_TOUCH_SRC/$MPFR/$MPFR_DIR/configure +touch $ROOT_TOUCH_SRC/$MPFR/$MPFR_DIR/Makefile.* +touch $ROOT_TOUCH_SRC/$MPFR/$MPFR_DIR/doc/* +touch $ROOT_TOUCH_SRC/$GMP/$GMP_DIR/*.m4 +touch $ROOT_TOUCH_SRC/$GMP/$GMP_DIR/configure +touch $ROOT_TOUCH_SRC/$GMP/$GMP_DIR/Makefile.* +touch $ROOT_TOUCH_SRC/$GMP/$GMP_DIR/doc/* +touch $ROOT_TOUCH_SRC/$MPC/$MPC_DIR/*.m4 +touch $ROOT_TOUCH_SRC/$MPC/$MPC_DIR/configure +touch $ROOT_TOUCH_SRC/$MPC/$MPC_DIR/Makefile.* +touch $ROOT_TOUCH_SRC/$MPC/$MPC_DIR/doc/* +touch $ROOT_TOUCH_SRC/$ISL/$ISL_DIR/*.m4 +touch $ROOT_TOUCH_SRC/$ISL/$ISL_DIR/configure +touch $ROOT_TOUCH_SRC/$ISL/$ISL_DIR/Makefile.* diff --git a/openeuler_gcc_riscv64/pre_construction.sh b/openeuler_gcc_riscv64/pre_construction.sh new file mode 100755 index 0000000000000000000000000000000000000000..059e46a835c0ac5adf67caeb775e792634d06957 --- /dev/null +++ b/openeuler_gcc_riscv64/pre_construction.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e +set -x + +readonly ROOT_BUILD_SRC="$PWD/../../open_source" +readonly OUTPUT_INSTALL="$PWD/../../output/openeuler_gcc_riscv64" + +source $PWD/../config.xml + +#clear history build legacy files +clean(){ + [ -n "$OUTPUT_INSTALL" ] && rm -rf $OUTPUT_INSTALL + mkdir -p $OUTPUT_INSTALL +} + +#clean the build direcoty +clean + +chmod 777 $ROOT_BUILD_SRC -R + +# Extract kernel header files +cd $ROOT_BUILD_SRC/$LINUX_KERNEL +make headers_install ARCH=riscv INSTALL_HDR_PATH=$ROOT_BUILD_SRC/$KERNEL_HEADERS +cd -