From 967b30ca3b9fcdf490019d460b71c8fe9e2cc667 Mon Sep 17 00:00:00 2001 From: Denis Mosolov Date: Sat, 31 Aug 2019 22:00:27 +0300 Subject: [PATCH] Add Friendlyarm U-boot --- bootstrap/14-boot-partition.sh | 4 +++ essentials.sh | 4 +++ helpers/fs.sh | 6 ++-- pieman.sh | 2 +- toolset.sh | 59 ++++++++++++++++++++++++---------- 5 files changed, 54 insertions(+), 21 deletions(-) diff --git a/bootstrap/14-boot-partition.sh b/bootstrap/14-boot-partition.sh index bc6ce9ba..72640b12 100644 --- a/bootstrap/14-boot-partition.sh +++ b/bootstrap/14-boot-partition.sh @@ -47,4 +47,8 @@ for f in ${boot}; do fi done +if [[ "${DEVICE}" == "npi-neo-plus2" ]]; then + cp "${TOOLSET_FULL_PATH}/friendlyarm"/sun50i-h5-nanopi-neo-plus2.dtb ${BOOT}/sun50i-h5-nanopi-neo-plus2.dtb +fi + send_request_to_bsc_server PREPARED_BOOT_PARTITION_CODE diff --git a/essentials.sh b/essentials.sh index ba2e7b37..36fe9526 100644 --- a/essentials.sh +++ b/essentials.sh @@ -41,6 +41,10 @@ UBOOT_MENDER_BRANCH="mender-rpi-2017.09" UBOOT_MENDER_COMMIT="988e0ec54" +UBOOT_FRIENDLYARM_H5_BRANCH="sunxi-v2017.x" + +UBOOT_FRIENDLYARM_H5_COMMIT="1ee53f5" + text_in_red_color=$(tput setaf 1) text_in_green_color=$(tput setaf 2) diff --git a/helpers/fs.sh b/helpers/fs.sh index 604f3b8c..bfe471dc 100644 --- a/helpers/fs.sh +++ b/helpers/fs.sh @@ -132,9 +132,9 @@ create_temporary_dirs() { remove_temporary_dirs() { local target=${BUILD_DIR}/${PROJECT_NAME} - #if ! ${CREATE_ONLY_CHROOT}; then - # rm -rf "${target}" - #fi + if ! ${CREATE_ONLY_CHROOT}; then + rm -rf "${target}" + fi } # Installs the specified file to the specified directory and changes diff --git a/pieman.sh b/pieman.sh index 69c4e326..1cbba8a5 100755 --- a/pieman.sh +++ b/pieman.sh @@ -331,7 +331,7 @@ case "${BUILD_TYPE}" in mount "${LOOP_DEV}p1" "${MOUNT_POINT}" if [[ "${DEVICE}" == "npi-neo-plus2" ]]; then - "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/mkimage -C none -A arm -T script -d "${PIEMAN_DIR}"/files/npi/boot-neo-plus2.cmd "${BOOT}"/boot.scr + "${TOOLSET_FULL_PATH}/friendlyarm"/mkimage -C none -A arm -T script -d "${PIEMAN_DIR}"/files/npi/boot-neo-plus2.cmd "${BOOT}"/boot.scr fi if [[ "${DEVICE}" == "opi-pc-plus" ]]; then diff --git a/toolset.sh b/toolset.sh index c65f500e..c1b81323 100755 --- a/toolset.sh +++ b/toolset.sh @@ -17,7 +17,7 @@ dir_with_32bit_toolchain="gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf" cross_compiler_32bit="${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}/${dir_with_32bit_toolchain}/bin/arm-linux-gnueabihf-" dir_with_64bit_toolchain="gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu" -cross_compiler_64bit="${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}/${dir_with_64bit_toolchain}/bin/aarch64-linux-gnu-" +cross_compiler_64bit="${TOOLSET_FULL_PATH}/toolchain/${dir_with_64bit_toolchain}/bin/aarch64-linux-gnu-" toolchain_for_mender_dir="gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf" cross_compiler_for_mender="${TOOLSET_FULL_PATH}/mender/${toolchain_for_mender_dir}/bin/arm-linux-gnueabihf-" @@ -87,6 +87,8 @@ else fi fi +mkdir -p "${TOOLSET_FULL_PATH}/toolchain" + if ${mender_dependencies_are_satisfied} && $(init_installation_if_needed "${TOOLSET_FULL_PATH}/mender"); then pushd "${TOOLSET_FULL_PATH}/mender" info "downloading inventory & identity scripts" @@ -168,13 +170,6 @@ if $(init_installation_if_needed "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"); the tar xJf "${dir_with_32bit_toolchain}.tar.xz" rm "${dir_with_32bit_toolchain}.tar.xz" - info "fetching 64-bit cross-toolchain for building Das U-Boot" - wget "https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/${dir_with_64bit_toolchain}.tar.xz" -O "${dir_with_64bit_toolchain}.tar.xz" - - info "unpacking archive with 64-bit toolchain for building Das U-Boot" - tar xJf "${dir_with_64bit_toolchain}.tar.xz" - rm "${dir_with_64bit_toolchain}.tar.xz" - info "fetching Das U-Boot ${UBOOT_VER} from ${UBOOT_URL}" git clone --depth=1 -b "v${UBOOT_VER}" https://github.com/u-boot/u-boot.git "u-boot-${UBOOT_VER}" popd @@ -197,25 +192,55 @@ if $(init_installation_if_needed "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"); the cp u-boot-sunxi-with-spl.bin "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/u-boot-sunxi-with-spl-for-opi-zero.bin - make distclean - ARCH=aarch64 CROSS_COMPILE="${cross_compiler_64bit}" make nanopi_neo_plus2_defconfig - ARCH=aarch64 CROSS_COMPILE="${cross_compiler_64bit}" PYTHON=python2 make -j $(number_of_cores) - - cp u-boot-sunxi-with-spl.bin "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/u-boot-sunxi-with-spl-for-npi-neo-plus2.bin - - cp "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}/u-boot-${UBOOT_VER}"/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dtb "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/sun50i-h5-nanopi-neo-plus2.dtb - cp tools/mkimage "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}" popd pushd "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}" finalise_installation "${dir_with_32bit_toolchain}" \ - "${dir_with_64bit_toolchain}" \ "u-boot-${UBOOT_VER}" \ uboot-env popd fi +if $(init_installation_if_needed "${TOOLSET_FULL_PATH}/friendlyarm"); then + pushd "${TOOLSET_FULL_PATH}/toolchain" + info "fetching 64-bit cross-toolchain for building Das U-Boot (FriendlyARM flavour)" + wget "https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/${dir_with_64bit_toolchain}.tar.xz" -O "${dir_with_64bit_toolchain}.tar.xz" + + info "unpacking archive with 64-bit toolchain for building Das U-Boot (FriendlyARM flavour)" + tar xJf "${dir_with_64bit_toolchain}.tar.xz" + rm "${dir_with_64bit_toolchain}.tar.xz" + popd + + pushd "${TOOLSET_FULL_PATH}/friendlyarm" + info "fetching Das U-Boot (FriendlyARM flavour) ${UBOOT_FRIENDLYARM_H5_BRANCH}" + git clone -b "${UBOOT_FRIENDLYARM_H5_BRANCH}" https://github.com/friendlyarm/u-boot.git "u-boot-${UBOOT_FRIENDLYARM_H5_BRANCH}" + git -C "u-boot-${UBOOT_FRIENDLYARM_H5_BRANCH}" checkout "${UBOOT_FRIENDLYARM_H5_COMMIT}" + popd + + pushd "${TOOLSET_FULL_PATH}/friendlyarm/u-boot-${UBOOT_FRIENDLYARM_H5_BRANCH}" + info "building Das U-Boot (FriendlyARM flavour) ${UBOOT_FRIENDLYARM_H5_BRANCH}" + + ARCH=arm CROSS_COMPILE="${cross_compiler_64bit}" make nanopi_h5_defconfig + ARCH=arm CROSS_COMPILE="${cross_compiler_64bit}" PYTHON=python2 make -j $(number_of_cores) + + cp spl/sunxi-spl.bin "${TOOLSET_FULL_PATH}/friendlyarm"/sunxi-spl-for-npi-core-plus2.bin + cp u-boot.itb "${TOOLSET_FULL_PATH}/friendlyarm"/u-boot-for-npi-core-plus2.itb + + cp arch/arm/dts/sun50i-h5-nanopi-neo2.dtb "${TOOLSET_FULL_PATH}/friendlyarm"/sun50i-h5-nanopi-neo-plus2.dtb + + cp tools/mkimage "${TOOLSET_FULL_PATH}/friendlyarm" + popd + + pushd "${TOOLSET_FULL_PATH}/friendlyarm" + finalise_installation "${dir_with_64bit_toolchain}" \ + "u-boot-${UBOOT_FRIENDLYARM_H5_BRANCH}" \ + uboot-env + popd +fi + +rm -rf "${TOOLSET_FULL_PATH}/toolchain" + # Correct ownership if needed pieman_dir_ownership="$(get_ownership "${PIEMAN_DIR}")" if [ "$(get_ownership "${TOOLSET_FULL_PATH}")" != "${pieman_dir_ownership}" ]; then