-# $OpenBSD: Makefile,v 1.34 2022/10/10 11:06:14 kn Exp $
+# $OpenBSD: Makefile,v 1.35 2022/11/08 12:08:53 kn Exp $
INSTALLBOOT ?= /usr/sbin/installboot
DRY_RUN = ${INSTALLBOOT} -n
prepare:
${SUDO} ${REAL_RUN} -p -- "$$(<${ROOTDEVFILE})"
-.if ${USE_SOFTRAID:L} == "yes"
- # XXX -p is not yet softraid(4) aware, need to prepare chunks manually
-. for devfile in ${DISKDEVFILES}
- ${SUDO} ${REAL_RUN} -p -- "$$(<${devfile})"
-. endfor
-.endif
REGRESS_TARGETS += dry-prepare \
dry-default \
-/* $OpenBSD: installboot.c,v 1.15 2022/08/19 08:27:48 kn Exp $ */
+/* $OpenBSD: installboot.c,v 1.16 2022/11/08 12:08:53 kn Exp $ */
/*
* Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org>
err(1, "open: %s", realdev);
if (prepare) {
+#if SOFTRAID
+ sr_prepareboot(devfd, dev);
+#else
md_prepareboot(devfd, realdev);
+#endif
return 0;
}
-/* $OpenBSD: installboot.h,v 1.15 2022/11/07 15:56:09 kn Exp $ */
+/* $OpenBSD: installboot.h,v 1.16 2022/11/08 12:08:53 kn Exp $ */
/*
* Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org>
*
#ifdef SOFTRAID
int sr_open_chunk(int, int, int, struct bioc_disk *, char **, char *);
+void sr_prepareboot(int, char *);
void sr_installboot(int, char *);
void sr_install_bootblk(int, int, int);
void sr_install_bootldr(int, char *);
-/* $OpenBSD: softraid.c,v 1.6 2022/11/07 15:56:09 kn Exp $ */
+/* $OpenBSD: softraid.c,v 1.7 2022/11/08 12:08:53 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
*
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <util.h>
#include "installboot.h"
static int sr_volume(int, char *, int *, int *);
+static void
+sr_prepare_chunk(int devfd, int vol, int disk)
+{
+ struct bioc_disk bd;
+ char *realdev;
+ char part;
+ int diskfd;
+
+ diskfd = sr_open_chunk(devfd, vol, disk, &bd, &realdev, &part);
+ if (diskfd == -1)
+ return;
+
+ /* Prepare file system on device. */
+ md_prepareboot(diskfd, realdev);
+
+ close(diskfd);
+}
+
+void
+sr_prepareboot(int devfd, char *dev)
+{
+ int vol = -1, ndisks = 0, disk;
+
+ /* Use the normal process if this is not a softraid volume. */
+ if (!sr_volume(devfd, dev, &vol, &ndisks)) {
+ md_prepareboot(devfd, dev);
+ return;
+ }
+
+ /* Prepare file system on each disk that is part of this volume. */
+ for (disk = 0; disk < ndisks; disk++)
+ sr_prepare_chunk(devfd, vol, disk);
+}
+
void
sr_installboot(int devfd, char *dev)
{
-/* $OpenBSD: sparc64_softraid.c,v 1.8 2022/11/07 15:56:09 kn Exp $ */
+/* $OpenBSD: sparc64_softraid.c,v 1.9 2022/11/08 12:08:53 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
-#include <sys/disklabel.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <dev/biovar.h>
-#include <dev/softraidvar.h>
#include <err.h>
-#include <fcntl.h>
#include <stdio.h>
#include <string.h>
-#include <util.h>
#include <unistd.h>
#include "installboot.h"