2017-06-23 00:08:36 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
2018-03-21 14:36:16 +00:00
|
|
|
DTB_DIR="/usr/local/share/rpi-firmware"
|
2017-11-17 17:34:52 +00:00
|
|
|
DTB="bcm2710-rpi-3-b.dtb"
|
2017-06-23 00:08:36 +00:00
|
|
|
EMBEDDED_TARGET_ARCH="aarch64"
|
2017-11-17 17:34:52 +00:00
|
|
|
EMBEDDED_TARGET="arm64"
|
|
|
|
EMBEDDEDBUILD=1
|
2018-03-21 14:36:16 +00:00
|
|
|
EMBEDDEDPORTS="sysutils/u-boot-rpi3 sysutils/rpi-firmware"
|
2017-06-23 00:08:36 +00:00
|
|
|
FAT_SIZE="50m -b 1m"
|
|
|
|
FAT_TYPE="16"
|
2017-11-17 17:34:52 +00:00
|
|
|
IMAGE_SIZE="2560M"
|
|
|
|
KERNEL="GENERIC"
|
2017-06-23 00:08:36 +00:00
|
|
|
MD_ARGS="-x 63 -y 255"
|
|
|
|
NODOC=1
|
2018-03-21 14:36:16 +00:00
|
|
|
OL_DIR="${DTB_DIR}/overlays"
|
2018-05-17 19:10:13 +00:00
|
|
|
OVERLAYS="mmc.dtbo pwm.dtbo pi3-disable-bt.dtbo"
|
2017-11-17 17:34:52 +00:00
|
|
|
PART_SCHEME="MBR"
|
2017-06-23 00:08:36 +00:00
|
|
|
export BOARDNAME="RPI3"
|
|
|
|
|
|
|
|
arm_install_uboot() {
|
|
|
|
UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi3"
|
2018-04-10 17:40:44 +00:00
|
|
|
UBOOT_FILES="README u-boot.bin"
|
2018-05-17 19:10:13 +00:00
|
|
|
DTB_FILES="armstub8.bin bootcode.bin fixup_cd.dat \
|
2018-04-10 17:40:44 +00:00
|
|
|
fixup_db.dat fixup_x.dat fixup.dat LICENCE.broadcom \
|
|
|
|
start_cd.elf start_db.elf start_x.elf start.elf ${DTB}"
|
2017-06-23 00:08:36 +00:00
|
|
|
FATMOUNT="${DESTDIR%${KERNEL}}fat"
|
|
|
|
UFSMOUNT="${DESTDIR%${KERNEL}}ufs"
|
|
|
|
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
|
|
|
|
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
|
|
|
|
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
|
|
|
|
for _UF in ${UBOOT_FILES}; do
|
|
|
|
chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \
|
|
|
|
${FATMOUNT}/${_UF}
|
|
|
|
done
|
2018-04-10 17:40:44 +00:00
|
|
|
for _DF in ${DTB_FILES}; do
|
|
|
|
chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${_DF} \
|
|
|
|
${FATMOUNT}/${_DF}
|
|
|
|
done
|
2018-05-17 19:10:13 +00:00
|
|
|
chroot ${CHROOTDIR} cp -p ${DTB_DIR}/config_rpi3.txt \
|
|
|
|
${FATMOUNT}/config.txt
|
2017-06-23 00:08:36 +00:00
|
|
|
chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays
|
|
|
|
for _OL in ${OVERLAYS}; do
|
2018-03-21 14:36:16 +00:00
|
|
|
chroot ${CHROOTDIR} cp -p ${OL_DIR}/${_OL} \
|
|
|
|
${FATMOUNT}/overlays/${_OL}
|
2017-06-23 00:08:36 +00:00
|
|
|
done
|
|
|
|
|
2017-11-01 21:22:05 +00:00
|
|
|
BOOTFILES="$(chroot ${CHROOTDIR} \
|
2017-11-17 17:40:53 +00:00
|
|
|
env TARGET=${EMBEDDED_TARGET} TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
|
|
|
|
WITH_UNIFIED_OBJDIR=yes \
|
|
|
|
make -C ${WORLDDIR}/stand -V .OBJDIR)"
|
2017-11-20 15:03:03 +00:00
|
|
|
BOOTFILES="$(chroot ${CHROOTDIR} realpath ${BOOTFILES})"
|
2017-06-23 00:08:36 +00:00
|
|
|
|
|
|
|
chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/EFI/BOOT
|
2018-05-21 11:58:02 +00:00
|
|
|
chroot ${CHROOTDIR} cp -p ${BOOTFILES}/efi/loader/loader.efi \
|
2017-06-23 00:08:36 +00:00
|
|
|
${FATMOUNT}/EFI/BOOT/bootaa64.efi
|
|
|
|
chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot
|
|
|
|
sync
|
|
|
|
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
|
|
|
umount_loop ${CHROOTDIR}/${UFSMOUNT}
|
|
|
|
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
|
|
|
chroot ${CHROOTDIR} rmdir ${UFSMOUNT}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|