Skip to content

Commit

Permalink
Add Friendlyarm U-boot
Browse files Browse the repository at this point in the history
  • Loading branch information
denismosolov committed Sep 14, 2019
1 parent 1df9d31 commit 967b30c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 21 deletions.
4 changes: 4 additions & 0 deletions bootstrap/14-boot-partition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions essentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions helpers/fs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pieman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 42 additions & 17 deletions toolset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 967b30c

Please sign in to comment.