Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/etc.evbarm Create a separate Arm64 image that uses MBR p...



details:   https://anonhg.NetBSD.org/src/rev/47dd8e514d37
branches:  trunk
changeset: 933589:47dd8e514d37
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu May 28 10:22:49 2020 +0000

description:
Create a separate Arm64 image that uses MBR partitioning. Amlogic SoCs
require the bootloader to be installed on SD cards at LBA1 which makes
them incompatible with GPT images.

diffstat:

 distrib/utils/embedded/conf/arm64mbr.conf |  110 ++++++++++++++++++++++++++++++
 etc/etc.evbarm/Makefile.inc               |    5 +-
 2 files changed, 114 insertions(+), 1 deletions(-)

diffs (133 lines):

diff -r 046eece5f8fb -r 47dd8e514d37 distrib/utils/embedded/conf/arm64mbr.conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/utils/embedded/conf/arm64mbr.conf Thu May 28 10:22:49 2020 +0000
@@ -0,0 +1,110 @@
+# $NetBSD: arm64mbr.conf,v 1.1 2020/05/28 10:22:49 jmcneill Exp $
+# ARM64 (MBR partitioning) customization script used by mkimage
+#
+board=arm64mbr
+hostname=arm64
+console=fb
+resize=true
+
+. ${DIR}/conf/evbarm.conf
+
+kernel_GENERIC64="GENERIC64"
+
+make_label() {
+       make_label_evbarm
+}
+
+make_fstab() {
+       make_fstab_evbarm
+}
+
+customize() {
+       customize_evbarm
+       cat >> "${mnt}/etc/rc.conf" << EOF
+mdnsd=YES
+devpubd=YES
+wscons=\$(dev_exists wsdisplay0)
+ec2_init=\$(dev_exists ena0)
+EOF
+}
+
+populate_common() {
+       # Add EC2 init script
+       cp ${DIR}/files/ec2_init ${mnt}/etc/rc.d/ec2_init
+       echo "./etc/rc.d/ec2_init type=file uname=root gname=wheel mode=0555" \
+           >> "$tmp/selected_sets"
+
+       # Rename kernel to netbsd.img
+       mv "${mnt}/boot/netbsd-${kernel_GENERIC64}.img" "${mnt}/boot/netbsd.img"
+
+       # Install EFI bootloader
+       mkdir -p "${mnt}/boot/EFI/BOOT"
+       cp "${release}/usr/mdec/bootaa64.efi" "${mnt}/boot/EFI/BOOT/bootaa64.efi"
+
+       # Install kernel to root of the FFS partition
+       ${GZIP_CMD} -dc ${kernel}/netbsd-${kernel_GENERIC64}.gz > "${mnt}/netbsd"
+       echo "./netbsd type=file uname=root gname=wheel mode=0755" \
+           >> "$tmp/selected_sets"
+}
+
+
+populate_rpi() {
+       firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
+       firmwarefiles="LICENCE.broadcom bootcode.bin fixup4cd.dat fixup4.dat fixup_cd.dat fixup.dat start4cd.elf start4.elf start_cd.elf start.elf"
+
+       cat > "${mnt}/boot/cmdline.txt" << EOF
+root=ld0a console=${console}
+EOF
+
+       cat > "${mnt}/boot/config.txt" << EOF
+#
+upstream_kernel=1
+#
+arm_64bit=1
+os_prefix=dtb/broadcom/
+cmdline=../../cmdline.txt
+kernel=/netbsd.img
+kernel_address=0x200000
+enable_uart=1
+force_turbo=0
+EOF
+
+       echo "${bar} installing firmware files ${bar}"
+       (cd "${mnt}/boot" &&
+               for f in ${firmwarefiles}; do
+                       echo " $f"
+                       cp "${firmwaredir}/${f}" .
+               done
+       )
+}
+
+populate() {
+       echo "${bar} looking for kernel in ${kernel} ${bar}"
+       kernels=""
+       k="$kernel_GENERIC64"
+
+       # .img kernel
+       f="${kernel}/netbsd-${k}.img.gz"
+       test -f "${f}" && kernels="${kernels} ${f}"
+
+       # install files 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 ||
+                       fail "Copy of ${k} to ${mnt}/boot/${tgt} failed"
+       done
+
+       # Board specific configuration
+       populate_rpi
+
+       # common configuration
+       populate_common
+}
diff -r 046eece5f8fb -r 47dd8e514d37 etc/etc.evbarm/Makefile.inc
--- a/etc/etc.evbarm/Makefile.inc       Thu May 28 10:19:02 2020 +0000
+++ b/etc/etc.evbarm/Makefile.inc       Thu May 28 10:22:49 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.119 2020/05/24 14:44:11 jmcneill Exp $
+#      $NetBSD: Makefile.inc,v 1.120 2020/05/28 10:22:49 jmcneill Exp $
 #
 #      etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -146,6 +146,9 @@
 smp_arm64: __mkimage
 MKI_OPTS.smp_arm64=    -K ${IMAGE.kern}
 SNAP_MD_POST_DEPS+=    smp_arm64
+smp_arm64mbr: __mkimage
+MKI_OPTS.smp_arm64mbr= -K ${IMAGE.kern}
+SNAP_MD_POST_DEPS+=    smp_arm64mbr
 .endif
 
 .if !empty(KERNEL_SETS:MRPI)



Home | Main Index | Thread Index | Old Index