1#!/usr/bin/env bash 2 3# Quick script to build and copy the kernel to the tftp server. 4# Modify the TFTPHOST variable to match your setup. 5# Alternatively change the scp to a cp to copy the kernel to the SD card. 6 7set -e 8 9export PROJECT=bananapi-f3-test 10BUILDDIR="build-${PROJECT}" 11 12RAMDISK="${BUILDDIR}/ramdisk.img" 13OUTPUT="${BUILDDIR}/lk.img" 14 15TFTPHOST=192.168.0.4 16 17set -x 18 19./scripts/make-parallel 20 21# create a small ramdisk to satisfy the mkimage tool 22truncate -s 4 ${BUILDDIR}/ramdisk.img 23 24# build a uboot uimage containing the lk binary, the ramdisk and the device tree 25mkimage -A riscv -O linux -T multi -C none -a 0x10200000 -e 0x10200000 -n LK -d ${BUILDDIR}/lk.bin:${RAMDISK}:target/bananapi-f3/bananapi-f3.dtb ${OUTPUT} 26 27# copy to a local tftp server, replace with cp if a using a local directory 28scp ${BUILDDIR}/lk.img ${TFTPHOST}:/tftpboot 29 30set +x 31 32echo boot with 33echo dhcp\; tftpboot ${TFTPHOST}:lk.img\; bootm 34exit 1