Hi,
this diff provides the infrastructure to compile a ramdisk kernel for
arm64. It's been copied from armv7 and stripped from u-boots, device
trees and mkuboot.
ok?
Patrick
diff --git a/distrib/arm64/Makefile b/distrib/arm64/Makefile
new file mode 100644
index 00000000000..bb5d606b329
--- /dev/null
+++ b/distrib/arm64/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2013/09/04 20:00:21 patrick Exp $
+
+SUBDIR= ramdisk
+
+.include <bsd.subdir.mk>
diff --git a/distrib/arm64/ramdisk/Makefile b/distrib/arm64/ramdisk/Makefile
new file mode 100644
index 00000000000..178e40352aa
--- /dev/null
+++ b/distrib/arm64/ramdisk/Makefile
@@ -0,0 +1,78 @@
+# $OpenBSD: Makefile,v 1.16 2016/11/30 15:46:45 natano Exp $
+
+REV= ${OSrev}
+
+TOP= ${.CURDIR}/..
+
+BSD_RD= bsd.rd
+IMAGE= mr.fs
+CBIN?= instbin
+CRUNCHCONF?= ${CBIN}.conf
+CRUNCHCONFS?= ${.CURDIR}/../common/crunch.conf
+LISTS= ${.CURDIR}/list
+UTILS?= ${.CURDIR}/../../miniroot
+
+MTREE= ${UTILS}/mtree.conf
+
+DISKTYPE= rdroot
+MAKEFSARGS_RD= -o disklabel=${DISKTYPE},minfree=0,density=4096
+
+.ifndef DESTDIR
+all ${IMAGE}:
+ @echo setenv DESTDIR before making a ramdisk!
+ @false
+.else
+
+ALLBSD= bsd
+ALLBSDRD= ${BSD_RD}
+all: ${ALLBSDRD}
+
+bsd:
+ cd ${TOP}/../../sys/arch/arm64/compile/RAMDISK && \
+ su ${BUILDUSER} -c '${MAKE} config && ${MAKE} clean && exec ${MAKE}'
+ cp -p ${TOP}/../../sys/arch/arm64/compile/RAMDISK/obj/bsd bsd
+
+${BSD_RD}: ${IMAGE} bsd rdsetroot
+ cp bsd ${BSD_RD}
+ ${.OBJDIR}/rdsetroot ${BSD_RD} ${IMAGE}
+
+${IMAGE}: ${CBIN}
+ rm -rf [email protected]
+ install -d -o root -g wheel [email protected]
+ mtree -def ${MTREE} -p [email protected] -u
+ TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} REV=${REV} \
+ [email protected] UTILS=${UTILS} RELEASEDIR=${RELEASEDIR} \
+ sh ${UTILS}/runlist.sh ${LISTS}
+ rm [email protected]/${CBIN}
+ makefs ${MAKEFSARGS_RD} $@ [email protected]
+
+.endif
+
+rdsetroot: ${TOP}/../common/elfrdsetroot.c
+ ${HOSTCC} ${HOSTCFLAGS} -o rdsetroot \
+ ${TOP}/../common/elfrdsetroot.c ${TOP}/../common/elf32.c \
+ ${TOP}/../common/elf64.c
+
+${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
+ crunchgen -E -D ${.CURDIR}/../../.. -L ${DESTDIR}/usr/lib ${.ALLSRC}
+
+${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
+ ${MAKE} -f ${CBIN}.mk SRCLIBDIR=${.CURDIR}/../../../lib all
+
+${CRUNCHCONF}: ${LISTS}
+ awk -f ${UTILS}/makeconf.awk CBIN=${CBIN} ${LISTS} > ${CBIN}.conf
+
+clean cleandir:
+ /bin/rm -f *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache \
+ lib*.a lib*.olist ${CBIN}.map \
+ *.o *.lo *.c ${ALLBSD} ${ALLBSDRD} rdsetroot
+ rm -f instbin.conf
+ rm -rf cd-dir ${IMAGE}.d
+
+.ifdef RELEASEDIR
+install:
+ cp ${ALLBSDRD} ${RELEASEDIR}
+.endif # RELEASEDIR
+
+.include <bsd.obj.mk>
+.include <bsd.subdir.mk>
diff --git a/distrib/arm64/ramdisk/Makefile.inc
b/distrib/arm64/ramdisk/Makefile.inc
new file mode 100644
index 00000000000..4b23e5f9958
--- /dev/null
+++ b/distrib/arm64/ramdisk/Makefile.inc
@@ -0,0 +1,4 @@
+# $OpenBSD: Makefile.inc,v 1.1 2013/09/04 20:00:23 patrick Exp $
+
+CRUNCHGENOPTS= -E
+
diff --git a/distrib/arm64/ramdisk/install.md b/distrib/arm64/ramdisk/install.md
new file mode 100644
index 00000000000..b3d2d87eefb
--- /dev/null
+++ b/distrib/arm64/ramdisk/install.md
@@ -0,0 +1,130 @@
+# $OpenBSD: install.md,v 1.43 2017/01/19 06:55:58 jsg Exp $
+#
+#
+# Copyright (c) 1996 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jason R. Thorpe.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# machine dependent section of installation/upgrade script.
+#
+
+SANESETS="bsd"
+DEFAULTSETS="bsd bsd.rd"
+
+NEWFSARGS_msdos="-F 16 -L boot"
+MOUNT_ARGS_msdos="-o-l"
+
+md_installboot() {
+ local _disk=/dev/$1
+
+ # Mount MSDOS partition, extract U-Boot and copy UEFI boot program
+ mount ${MOUNT_ARGS_msdos} ${_disk}i /mnt/mnt
+ mkdir -p /mnt/mnt/efi/boot
+ cp /mnt/usr/mdec/BOOTAA64.EFI /mnt/mnt/efi/boot/bootaa64.efi
+}
+
+md_prep_fdisk() {
+ local _disk=$1 _d
+
+ local bootparttype="C"
+ local bootsectorstart="2048"
+ local bootsectorsize="32768"
+ local bootsectorend=$(($bootsectorstart + $bootsectorsize))
+ local bootfstype="msdos"
+ local newfs_args=${NEWFSARGS_msdos}
+
+ while :; do
+ _d=whole
+ if disk_has $_disk mbr; then
+ fdisk $_disk
+ else
+ echo "MBR has invalid signature; not showing it."
+ fi
+ ask "Use (W)hole disk$ or (E)dit the MBR?" "$_d"
+ case $resp in
+ [wW]*)
+ echo -n "Creating a ${bootfstype} partition and an
OpenBSD partition for rest of $_disk..."
+ fdisk -e ${_disk} <<__EOT >/dev/null
+reinit
+e 0
+${bootparttype}
+n
+${bootsectorstart}
+${bootsectorsize}
+f 0
+e 3
+A6
+n
+${bootsectorend}
+
+write
+quit
+__EOT
+ echo "done."
+ disklabel $_disk 2>/dev/null | grep -q "^ i:" ||
disklabel -w -d $_disk
+ newfs -t ${bootfstype} ${newfs_args} ${_disk}i
+ return ;;
+ [eE]*)
+ # Manually configure the MBR.
+ cat <<__EOT
+
+You will now create one MBR partition to contain your OpenBSD data
+and one MBR partition on which the OpenBSD boot program is located.
+Neither partition will overlap any other partition.
+
+The OpenBSD MBR partition will have an id of 'A6' and the boot MBR
+partition will have an id of '${bootparttype}' (${bootfstype}).
+The boot partition will be at least 16MB and be the first 'MSDOS'
+partition on the disk.
+
+$(fdisk ${_disk})
+__EOT
+ fdisk -e ${_disk}
+ disk_has $_disk mbr openbsd && return
+ echo No OpenBSD partition in MBR, try again. ;;
+ esac
+ done
+}
+
+md_prep_disklabel() {
+ local _disk=$1 _f=/tmp/i/fstab.$1
+
+ md_prep_fdisk $_disk
+
+ disklabel_autolayout $_disk $_f || return
+ [[ -s $_f ]] && return
+
+ # Edit disklabel manually.
+ # Abandon all hope, ye who enter here.
+ disklabel -F $_f -E $_disk
+}
+
+md_congrats() {
+}
+
+md_consoleinfo() {
+}
diff --git a/distrib/arm64/ramdisk/list b/distrib/arm64/ramdisk/list
new file mode 100644
index 00000000000..dc3da942a3a
--- /dev/null
+++ b/distrib/arm64/ramdisk/list
@@ -0,0 +1,119 @@
+# $OpenBSD: list,v 1.28 2016/12/31 02:06:35 deraadt Exp $
+
+SRCDIRS distrib/special
+
+# copy the crunched binary, link to it, and kill it
+COPY ${OBJDIR}/instbin instbin
+LINK instbin bin/arch
+LINK instbin bin/cat
+LINK instbin bin/chmod bin/chgrp sbin/chown
+LINK instbin bin/cp
+LINK instbin bin/date
+LINK instbin bin/dd
+LINK instbin bin/df
+LINK instbin bin/ed
+LINK instbin bin/hostname
+LINK instbin bin/ksh bin/sh
+ARGVLINK ksh -sh
+LINK instbin bin/ln
+LINK instbin bin/ls
+LINK instbin bin/md5 bin/sha256 bin/sha512
+SPECIAL rm bin/md5
+LINK instbin bin/mkdir
+LINK instbin bin/mt bin/eject
+LINK instbin bin/mv
+LINK instbin bin/pax bin/tar
+LINK instbin bin/rm
+LINK instbin bin/sleep
+LINK instbin bin/stty
+LINK instbin bin/sync
+LINK instbin sbin/bioctl
+LINK instbin sbin/dhclient
+LINK instbin sbin/disklabel
+LINK instbin sbin/dmesg
+LINK instbin sbin/fdisk
+LINK instbin sbin/fsck
+LINK instbin sbin/fsck_ext2fs
+LINK instbin sbin/fsck_ffs
+LINK instbin sbin/ifconfig
+LINK instbin sbin/init
+LINK instbin sbin/mknod
+LINK instbin sbin/mount
+LINK instbin sbin/mount_cd9660
+LINK instbin sbin/mount_ext2fs
+LINK instbin sbin/mount_ffs
+LINK instbin sbin/mount_msdos
+LINK instbin sbin/mount_nfs
+LINK instbin sbin/newfs
+LINK instbin sbin/newfs_ext2fs
+LINK instbin sbin/newfs_msdos
+LINK instbin sbin/ping sbin/ping6
+LINK instbin sbin/reboot sbin/halt
+LINK instbin sbin/route
+LINK instbin sbin/sysctl
+LINK instbin sbin/umount
+LINK instbin usr/bin/doas
+LINK instbin usr/bin/encrypt
+LINK instbin usr/bin/grep usr/bin/egrep
usr/bin/fgrep
+LINK instbin usr/bin/gzip usr/bin/gunzip
usr/bin/gzcat
+LINK instbin usr/bin/more usr/bin/less
+LINK instbin usr/bin/sed
+LINK instbin usr/bin/signify
+LINK instbin usr/sbin/chroot
+LINK instbin usr/sbin/pwd_mkdb
+
+COPY ${DESTDIR}/etc/ssl/cert.pem etc/ssl/cert.pem
+LINK instbin usr/bin/ftp-ssl usr/bin/ftp
+SPECIAL rm usr/bin/ftp-ssl
+
+# firmware we might need
+COPY ${DESTDIR}/etc/firmware/kue etc/firmware/kue
+COPY ${DESTDIR}/etc/firmware/zd1211 etc/firmware/zd1211
+COPY ${DESTDIR}/etc/firmware/zd1211b etc/firmware/zd1211b
+COPY ${DESTDIR}/etc/firmware/rum-rt2573 etc/firmware/rum-rt2573
+COPY ${DESTDIR}/etc/firmware/run-rt2870 etc/firmware/run-rt2870
+COPY ${DESTDIR}/etc/firmware/run-rt3071 etc/firmware/run-rt3071
+COPY ${DESTDIR}/etc/firmware/atu-at76c503-i3863-ext
etc/firmware/atu-at76c503-i3863-ext
+COPY ${DESTDIR}/etc/firmware/atu-at76c503-i3863-int
etc/firmware/atu-at76c503-i3863-int
+COPY ${DESTDIR}/etc/firmware/atu-at76c503-rfmd-acc-ext
etc/firmware/atu-at76c503-rfmd-acc-ext
+COPY ${DESTDIR}/etc/firmware/atu-at76c503-rfmd-acc-int
etc/firmware/atu-at76c503-rfmd-acc-int
+COPY ${DESTDIR}/etc/firmware/atu-at76c505-rfmd-ext
etc/firmware/atu-at76c505-rfmd-ext
+COPY ${DESTDIR}/etc/firmware/atu-at76c505-rfmd-int
etc/firmware/atu-at76c505-rfmd-int
+COPY ${DESTDIR}/etc/firmware/atu-intersil-ext etc/firmware/atu-intersil-ext
+COPY ${DESTDIR}/etc/firmware/atu-intersil-int etc/firmware/atu-intersil-int
+COPY ${DESTDIR}/etc/firmware/atu-rfmd-ext etc/firmware/atu-rfmd-ext
+COPY ${DESTDIR}/etc/firmware/atu-rfmd-int etc/firmware/atu-rfmd-int
+COPY ${DESTDIR}/etc/firmware/atu-rfmd2958-ext etc/firmware/atu-rfmd2958-ext
+COPY ${DESTDIR}/etc/firmware/atu-rfmd2958-int etc/firmware/atu-rfmd2958-int
+COPY ${DESTDIR}/etc/firmware/atu-rfmd2958smc-ext
etc/firmware/atu-rfmd2958smc-ext
+COPY ${DESTDIR}/etc/firmware/atu-rfmd2958smc-int
etc/firmware/atu-rfmd2958smc-int
+
+# this is the list from distrib/miniroot/makeconf.awk with -lz added.
+LIBS -lstubs -lutil -lm -lc -ltls -lssl -lcrypto -lz
+
+# copy the MAKEDEV script and make some devices
+SCRIPT ${DESTDIR}/dev/MAKEDEV dev/MAKEDEV
+SPECIAL cd dev; sh MAKEDEV ramdisk
+
+# various files that we need in /etc for the install
+COPY ${CURDIR}/../../miniroot/group etc/group
+COPY ${CURDIR}/../../miniroot/master.passwd etc/master.passwd
+SPECIAL pwd_mkdb -p -d etc master.passwd; rm etc/master.passwd
+COPY ${DESTDIR}/etc/signify/openbsd-${REV}-base.pub
etc/signify/openbsd-${REV}-base.pub
+COPY ${CURDIR}/../../miniroot/protocols etc/protocols
+COPY ${CURDIR}/../../miniroot/services etc/services
+SYMLINK /tmp/i/fstab.shadow etc/fstab
+SYMLINK /tmp/i/resolv.conf.shadow etc/resolv.conf
+SYMLINK /tmp/i/hosts etc/hosts
+TERMCAP vt100,vt220,dumb usr/share/misc/termcap
+
+# and the installation tools
+SCRIPT ${CURDIR}/../../miniroot/dot.profile .profile
+SCRIPT ${CURDIR}/install.md install.md
+SCRIPT ${CURDIR}/../../miniroot/install.sub install.sub
+SPECIAL chmod 755 install.sub
+SYMLINK install.sub autoinstall
+SYMLINK install.sub install
+SYMLINK install.sub upgrade
+
+TZ