#!/bin/sh # Build SD card image IMAGE="${1}" # For example "boot-bananapi.bin" DEFCONFIG="${2}" # For example "Bananapi_defconfig" TUPLE="${3}" # For example "arm-linux-gnueabihf" PLAT="${4}" # For example "sun50i_a64" set -e # Create fresh empty directory TMP=$(mktemp -d tmp.XXXXXX) cd "${TMP}" if [ "${TUPLE}" = "aarch64-linux-gnu" ] then build-atf "${PLAT}" "${TUPLE}" export BL31="$(pwd)/arm-trusted-firmware/build/${PLAT}/debug/bl31.bin" fi build-image tmp.img build-u_boot "${DEFCONFIG}" "${TUPLE}" # Copy U-Boot to 8192 bytes from start dd if=u-boot/u-boot-sunxi-with-spl.bin of=tmp.img bs=1K seek=8 truncate -s 32M tmp.img gzip tmp.img cp tmp.img.gz "${IMAGE}.bin.gz"