Module Name: src
Committed By: thorpej
Date: Sun Jun 21 17:17:02 UTC 2020
Modified Files:
src/tools/installboot: Makefile
src/usr.sbin/installboot: Makefile installboot.h machines.c
Added Files:
src/usr.sbin/installboot/arch: evbmips.c
Log Message:
Add evbmips support for u-boot handling.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tools/installboot/Makefile
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/installboot/Makefile
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/installboot/installboot.h
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/installboot/machines.c
cvs rdiff -u -r0 -r1.1 src/usr.sbin/installboot/arch/evbmips.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tools/installboot/Makefile
diff -u src/tools/installboot/Makefile:1.12 src/tools/installboot/Makefile:1.13
--- src/tools/installboot/Makefile:1.12 Tue May 7 05:02:42 2019
+++ src/tools/installboot/Makefile Sun Jun 21 17:17:01 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2019/05/07 05:02:42 thorpej Exp $
+# $NetBSD: Makefile,v 1.13 2020/06/21 17:17:01 thorpej Exp $
.include <bsd.hostinit.mk>
@@ -22,7 +22,7 @@ HOST_SHAREDIR= ${TOOLDIR}/share
BOARDDB_SRCDIR= ${SHARE_SRCDIR}/installboot
BOARDDB_DSTDIR= ${HOST_SHAREDIR}/installboot
-BOARDDBS= evbarm
+BOARDDBS= evbarm evbmips
.for _d in ${BOARDDBS}
install: .PHONY install.${_d}.boards.plist
Index: src/usr.sbin/installboot/Makefile
diff -u src/usr.sbin/installboot/Makefile:1.54 src/usr.sbin/installboot/Makefile:1.55
--- src/usr.sbin/installboot/Makefile:1.54 Thu Aug 15 19:53:01 2019
+++ src/usr.sbin/installboot/Makefile Sun Jun 21 17:17:02 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.54 2019/08/15 19:53:01 martin Exp $
+# $NetBSD: Makefile,v 1.55 2020/06/21 17:17:02 thorpej Exp $
#
.include <bsd.own.mk>
@@ -12,7 +12,7 @@ ARCH_XLAT+= sun2-sun68k.c sun3-sun68k.c
.if !defined(SMALLPROG) && !defined(ARCH_FILES)
ARCH_FILES= alpha.c amiga.c
-ARCH_FILES+= emips.c evbarm.c ews4800mips.c
+ARCH_FILES+= emips.c evbarm.c evbmips.c ews4800mips.c
ARCH_FILES+= hp300.c hppa.c
ARCH_FILES+= i386.c
ARCH_FILES+= landisk.c
@@ -32,11 +32,11 @@ COPTS.machines.c+= -DSINGLE_ARCH=ib_mach
SRCS+=${ARCH_FILES}
-.if !empty(ARCH_FILES:C/(evbarm)/evboard/:Mevboard.c)
+.if !empty(ARCH_FILES:C/(evbarm|evbmips)/evboard/:Mevboard.c)
SRCS+=evboards.c
.endif
-.if !empty(ARCH_FILES:C/(evbarm)/fdt/:Mfdt.c)
+.if !empty(ARCH_FILES:C/(evbarm|evbmips)/fdt/:Mfdt.c)
FDTDIR= ${.CURDIR}/../../sys/external/bsd/libfdt/dist
.PATH: ${FDTDIR}
CPPFLAGS+= -DSUPPORT_FDT -I${FDTDIR}
@@ -49,7 +49,7 @@ COPTS.fdt_strerror.c+= -Wno-error=sign-c
.if !defined(HOSTPROGNAME)
-.if !empty(ARCH_FILES:C/(evbarm)/ofw/:Mofw.c)
+.if !empty(ARCH_FILES:C/(evbarm|evbmips)/ofw/:Mofw.c)
CPPFLAGS+= -DSUPPORT_OPENFIRMWARE
.endif
.endif
Index: src/usr.sbin/installboot/installboot.h
diff -u src/usr.sbin/installboot/installboot.h:1.41 src/usr.sbin/installboot/installboot.h:1.42
--- src/usr.sbin/installboot/installboot.h:1.41 Thu Aug 15 08:36:09 2019
+++ src/usr.sbin/installboot/installboot.h Sun Jun 21 17:17:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: installboot.h,v 1.41 2019/08/15 08:36:09 kamil Exp $ */
+/* $NetBSD: installboot.h,v 1.42 2020/06/21 17:17:02 thorpej Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -186,6 +186,7 @@ extern struct ib_mach ib_mach_amd64;
extern struct ib_mach ib_mach_amiga;
extern struct ib_mach ib_mach_emips;
extern struct ib_mach ib_mach_evbarm;
+extern struct ib_mach ib_mach_evbmips;
extern struct ib_mach ib_mach_ews4800mips;
extern struct ib_mach ib_mach_hp300;
extern struct ib_mach ib_mach_hppa;
Index: src/usr.sbin/installboot/machines.c
diff -u src/usr.sbin/installboot/machines.c:1.42 src/usr.sbin/installboot/machines.c:1.43
--- src/usr.sbin/installboot/machines.c:1.42 Thu Aug 15 19:53:01 2019
+++ src/usr.sbin/installboot/machines.c Sun Jun 21 17:17:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: machines.c,v 1.42 2019/08/15 19:53:01 martin Exp $ */
+/* $NetBSD: machines.c,v 1.43 2020/06/21 17:17:02 thorpej Exp $ */
/*-
* Copyright (c) 2002-2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if !defined(__lint)
-__RCSID("$NetBSD: machines.c,v 1.42 2019/08/15 19:53:01 martin Exp $");
+__RCSID("$NetBSD: machines.c,v 1.43 2020/06/21 17:17:02 thorpej Exp $");
#endif /* !__lint */
#include <sys/types.h>
@@ -50,6 +50,7 @@ struct ib_mach * const machines[] = {
&ib_mach_amiga,
&ib_mach_emips,
&ib_mach_evbarm,
+ &ib_mach_evbmips,
&ib_mach_ews4800mips,
&ib_mach_hp300,
&ib_mach_hppa,
Added files:
Index: src/usr.sbin/installboot/arch/evbmips.c
diff -u /dev/null src/usr.sbin/installboot/arch/evbmips.c:1.1
--- /dev/null Sun Jun 21 17:17:02 2020
+++ src/usr.sbin/installboot/arch/evbmips.c Sun Jun 21 17:17:02 2020
@@ -0,0 +1,119 @@
+/* $NetBSD: evbmips.c,v 1.1 2020/06/21 17:17:02 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2019 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 FOUNDATION 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.
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+#if !defined(__lint)
+__RCSID("$NetBSD: evbmips.c,v 1.1 2020/06/21 17:17:02 thorpej Exp $");
+#endif /* !__lint */
+
+#include <err.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+
+#include "installboot.h"
+#include "evboards.h"
+
+static int evbmips_setboot(ib_params *);
+static int evbmips_clearboot(ib_params *);
+static int evbmips_editboot(ib_params *);
+static void evbmips_usage(ib_params *);
+
+struct ib_mach ib_mach_evbmips = {
+ .name = "evbmips",
+ .setboot = evbmips_setboot,
+ .clearboot = evbmips_clearboot,
+ .editboot = evbmips_editboot,
+ .usage = evbmips_usage,
+ .valid_flags = IB_BOARD | IB_DTB | IB_MEDIA,
+ .mach_flags = MF_UBOOT,
+};
+
+static int
+evbmips_setboot(ib_params *params)
+{
+ evb_board board;
+ int rv = 0;
+
+ if (!evb_db_load(params)) {
+ warnx("Unable to load board db.");
+ return 0;
+ }
+
+ board = evb_db_get_board(params);
+ if (board == NULL)
+ goto out;
+
+ rv = evb_uboot_setboot(params, board);
+
+ out:
+ if (params->mach_data) {
+ prop_object_release(params->mach_data);
+ params->mach_data = NULL;
+ }
+ return rv;
+}
+
+static int
+evbmips_clearboot(ib_params *params)
+{
+
+ return no_clearboot(params);
+}
+
+static int
+evbmips_editboot(ib_params *params)
+{
+
+ return no_editboot(params);
+}
+
+static void
+evbmips_usage(ib_params *params)
+{
+
+ if (!evb_db_load(params)) {
+ warnx("Unable to load board db.");
+ return;
+ }
+
+ fprintf(stderr, "Known boards (for -o board=...) are:\n");
+ evb_db_list_boards(params, stderr);
+
+ if (params->mach_data) {
+ prop_object_release(params->mach_data);
+ params->mach_data = NULL;
+ }
+}