diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-07-17 14:36:33 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-07-17 14:36:33 +0000 |
commit | 7d6a9688220aab82c1addcb720b5ce7233307f74 (patch) | |
tree | a30696d5351cd63f7f197bae74e8afed52e85719 /distrib/octeon | |
parent | c09161ec3dc5b7e09e301126a008ff7b9a8ee841 (diff) |
Add a bootloader for octeon.
The firmware on OCTEON machines usually does not provide an interface
for accessing devices, which has made it tricky to implement an OpenBSD
bootloader. To solve this device access problem, this new loader has
been built on top of a small kernel. The kernel provides all the
necessary devices drivers, while most of the usual bootloader logic
is in a userspace program in a ramdisk.
The loader program is accompanied by a special device, octboot(4).
The main purpose of this device is to implement a mechanism for
loading and launching kernels. The mechanism has been inspired by Linux'
kexec(2) system call.
The bootloader will be enabled later when it is ready for general use.
Discussed with deraadt@
Diffstat (limited to 'distrib/octeon')
-rw-r--r-- | distrib/octeon/boot/Makefile | 65 | ||||
-rw-r--r-- | distrib/octeon/boot/list | 9 |
2 files changed, 74 insertions, 0 deletions
diff --git a/distrib/octeon/boot/Makefile b/distrib/octeon/boot/Makefile new file mode 100644 index 00000000000..9d9e619bb65 --- /dev/null +++ b/distrib/octeon/boot/Makefile @@ -0,0 +1,65 @@ +# $OpenBSD: Makefile,v 1.1 2019/07/17 14:36:32 visa Exp $ + +FS= miniroot${OSrev}.fs +FSSIZE= 24576 +FSDISKTYPE= miniroot +MOUNT_POINT= /mnt +MTREE= ${UTILS}/mtree.conf +RAMDISK= BOOT + +LISTS= ${.CURDIR}/list +UTILS= ${.CURDIR}/../../miniroot + +MRDISKTYPE= rdroot +MRMAKEFSARGS= -o disklabel=${MRDISKTYPE},minfree=0,density=4096 + +all: bsd.rd + +bsd.rd: mr.fs bsd + cp bsd bsd.rd + rdsetroot bsd.rd mr.fs + +bsd: + cd ${.CURDIR}/../../../sys/arch/${MACHINE}/compile/${RAMDISK} && \ + su ${BUILDUSER} -c '${MAKE} config && ${MAKE} clean && exec ${MAKE}' + cp -p ${.CURDIR}/../../../sys/arch/${MACHINE}/compile/${RAMDISK}/obj/bsd bsd + +mr.fs: rdboot + rm -rf $@.d + install -d -o root -g wheel $@.d + mtree -def ${MTREE} -p $@.d -u + CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} OSrev=${OSrev} \ + TARGDIR=$@.d UTILS=${UTILS} RELEASEDIR=${RELEASEDIR} \ + sh ${UTILS}/runlist.sh ${LISTS} + makefs ${MRMAKEFSARGS} $@ $@.d + +instbin.mk instbin.cache instbin.c: instbin.conf + crunchgen -E -M -D ${.CURDIR}/../../.. -L ${DESTDIR}/usr/lib \ + -c instbin.c -e instbin -m instbin.mk instbin.conf + +instbin: instbin.mk instbin.cache instbin.c + ${MAKE} -f instbin.mk SRCLIBDIR=${.CURDIR}/../../../lib all + +instbin.conf: ${LISTS} + awk -f ${UTILS}/makeconf.awk ${LISTS} > instbin.conf + +rdboot: + cp -p ${.CURDIR}/../../../sys/arch/${MACHINE}/stand/rdboot/obj/rdboot rdboot + strip rdboot + +unconfig: + -umount -f ${MOUNT_POINT} + -[ -f vnd ] && vnconfig -u `cat vnd` && rm -f vnd + +.ifdef RELEASEDIR +install: + cp bsd.rd ${RELEASEDIR}/boot + chmod a+r ${RELEASEDIR}/boot +.endif + +clean cleandir: + rm -f *.core mr.fs instbin instbin.mk instbin.cache \ + lib*.a lib*.olist instbin.map *.o *.lo *.c bsd bsd.rd rdboot + rm -rf cd-dir mr.fs.d + +.include <bsd.obj.mk> diff --git a/distrib/octeon/boot/list b/distrib/octeon/boot/list new file mode 100644 index 00000000000..8bc8325c46e --- /dev/null +++ b/distrib/octeon/boot/list @@ -0,0 +1,9 @@ +# $OpenBSD: list,v 1.1 2019/07/17 14:36:32 visa Exp $ + +SRCDIRS distrib/special + +COPY ${OBJDIR}/rdboot sbin/init + +# copy the MAKEDEV script and make some devices +SCRIPT ${DESTDIR}/dev/MAKEDEV dev/MAKEDEV +SPECIAL cd dev; sh MAKEDEV boot |