Add missing RPI FDT build goop, from nick.

This commit is contained in:
jmcneill 2017-12-11 11:38:14 +00:00
parent 526dc93d6b
commit 4d9106a6a2
4 changed files with 51 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.27 2015/05/15 06:50:41 matt Exp $
# $NetBSD: Makefile,v 1.28 2017/12/11 11:38:14 jmcneill Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@ -13,7 +13,8 @@ SSHRAMDISK= ${SSHRAMDISKDIR}/sshramdisk.fs
MDSETTARGETS=
.for i in ${BUILD_KERNELS:M*_INSTALL}
.if ${i} == "RPI_INSTALL" || ${i} == "RPI2_INSTALL"
MDSETTARGETS+= ${i} ${SSHRAMDISK} -
MDSETTARGETS+= ${i} ${SSHRAMDISK} netbsd-${i}
MDSET_SUFFIXES.${i}= bin create-bin img create-img
.else
MDSETTARGETS+= ${i} ${RAMDISK} -
.endif
@ -24,6 +25,9 @@ MDSET_RELEASEDIR= installation/instkernel
MDSET_SUFFIXES.-= srec create-srec bin create-bin
create-srec= ${OBJCOPY} -O srec ${.TARGET:R} ${.TARGET}
create-bin= ${OBJCOPY} -O binary ${.TARGET:R} ${.TARGET}
create-img= \
${HOST_SH} ${NETBSDSRCDIR}/sys/arch/evbarm/compile/rpi-mkknlimg.sh \
${.TARGET:R}.bin ${.TARGET}
.include "${DISTRIBDIR}/common/Makefile.mdset"

View File

@ -1,4 +1,4 @@
# $NetBSD: armv7.conf,v 1.22 2017/12/03 13:31:45 jmcneill Exp $
# $NetBSD: armv7.conf,v 1.23 2017/12/11 11:38:14 jmcneill Exp $
# ARMv7 customization script used by mkimage
#
board=armv7
@ -45,9 +45,9 @@ populate_rpi() {
firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
# RPI2 kernel needs to be installed as kernel7.img
if [ -f "${mnt}/boot/netbsd-RPI2.bin" ]; then
echo "${bar} renaming netbsd-RPI2.bin to kernel7.img ${bar}"
mv "${mnt}/boot/netbsd-RPI2.bin" "${mnt}/boot/kernel7.img"
if [ -f "${mnt}/boot/netbsd-RPI2.img" ]; then
echo "${bar} renaming netbsd-RPI2.img to kernel7.img ${bar}"
mv "${mnt}/boot/netbsd-RPI2.img" "${mnt}/boot/kernel7.img"
cat > "${mnt}/boot/cmdline.txt" << EOF
root=ld0a console=${console}
@ -120,13 +120,13 @@ populate() {
f="${kernel}/netbsd-${k}.ub.gz"
test -f "${f}" && kernels="${kernels} ${f}"
done
# .bin kernels
# .img kernels
for k in $kernels_rpi; do
f="${kernel}/netbsd-${k}.bin.gz"
f="${kernel}/netbsd-${k}.img.gz"
test -f "${f}" && kernels="${kernels} ${f}"
done
# .dtb files
for k in $kernels_sunxi $kernels_tegra; do
for k in $kernels_rpi $kernels_sunxi $kernels_tegra; do
test -d "${KERNOBJDIR}/${k}" && \
dtbs="$(${MAKE} -C ${KERNOBJDIR}/${k} -v DTB)" || \
dtbs=

View File

@ -1,9 +1,11 @@
# $NetBSD: rpi.conf,v 1.32 2017/11/28 02:56:44 kre Exp $
# $NetBSD: rpi.conf,v 1.33 2017/12/11 11:38:14 jmcneill Exp $
# Raspberry Pi customization script used by mkimage
#
board=rpi
kernel=$src/sys/arch/evbarm/compile/RPI/netbsd-RPI.bin
kerneldir=$src/sys/arch/evbarm/compile/RPI/
kernel=$kerneldir/netbsd-RPI.img
kernels_rpi="RPI RPI2"
resize=true
. ${DIR}/conf/evbarm.conf
@ -59,11 +61,14 @@ enable_uart=1
force_turbo=0
EOF
echo "${bar} kernel ${kernel} ${bar}"
if [ ! -f ${kernel} ]; then
echo ${PROG}: Missing ${kernel} 1>&2
exit 1
fi
# .img files
echo "${bar} installing RPI kernel ${bar}"
case ${kernel} in
*.gz)
@ -84,6 +89,32 @@ EOF
;;
esac || fail "Copy of ${rpi2_kernel} to ${mnt}/boot/kernel7.img failed"
# dtb files
for k in $kernels_rpi; do
test -d "${KERNOBJDIR}/${k}" && \
dtbs="$(${MAKE} -C ${KERNOBJDIR}/${k} -v DTB)" || \
dtbs=
for dtb in $dtbs; do
f="${KERNOBJDIR}/${k}/${dtb}"
test -f "${f}" && kernels="${kernels} ${f}"
done
done
echo "${bar} installing kernel files ${bar}"
# install kernels to /boot partition
for k in ${kernels}; do
tgt="$(basename ${k} | sed 's/\.gz$//')"
echo "${bar} installing ${k} to /boot/${tgt} ${bar}"
case "${k}" in
*.gz)
${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}"
;;
*)
cp "${k}" "${mnt}/boot/${tgt}"
;;
esac
done
echo "${bar} installing firmware files ${bar}"
(cd ${mnt}/boot &&
for f in ${firmwarefiles}; do

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.91 2017/11/30 19:54:50 jmcneill Exp $
# $NetBSD: Makefile.inc,v 1.92 2017/12/11 11:38:14 jmcneill Exp $
#
# etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
#
@ -175,19 +175,19 @@ SNAP_MD_POST_DEPS+= smp_armv7
.if !empty(KERNEL_SETS:MRPI)
smp_rpi: __mkimage
.if empty(ALL_KERNELS) || !empty(ALL_KERNELS:MRPI)
MKI_OPTS.smp_rpi= -K ${IMAGE.kern}/netbsd-RPI.bin.gz
MKI_OPTS.smp_rpi= -K ${IMAGE.kern}/netbsd-RPI.img.gz
SNAP_MD_POST_DEPS+= smp_rpi
.endif
smp_rpi_inst: ${IMAGE.instk}/netbsd-RPI_INSTALL.bin.gz __mkimage
smp_rpi_inst: ${IMAGE.instk}/netbsd-RPI_INSTALL.img.gz __mkimage
.if empty(ALL_KERNELS) || !empty(ALL_KERNELS:MRPI_INSTALL)
MKI_OPTS.smp_rpi_inst= -b -K ${IMAGE.instk}/netbsd-RPI_INSTALL.bin.gz
MKI_OPTS.smp_rpi_inst= -b -K ${IMAGE.instk}/netbsd-RPI_INSTALL.img.gz
SNAP_MD_POST_DEPS+= smp_rpi_inst
.endif
.endif
snap_md_post: check_DESTDIR check_RELEASEDIR snap_post .WAIT ${SNAP_MD_POST_DEPS}
KERNEL_SUFFIXES= bin srec ub
KERNEL_SUFFIXES= bin img srec ub
INSTALLATION_DIRS+= binary/gzimg \
installation/instkernel