summaryrefslogtreecommitdiffstats
path: root/sys/boot/arm
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2008-10-05 23:59:52 +0000
committerimp <imp@FreeBSD.org>2008-10-05 23:59:52 +0000
commit9d1fbd5bcd6214ba3ec3f05c27c5094796fe3231 (patch)
treee0c53ad69f30dc6ea2713b1833ae728eb43c1a0b /sys/boot/arm
parent1bfe387f1b74b44a34501ccff6c8f94f97db87ee (diff)
downloadFreeBSD-src-9d1fbd5bcd6214ba3ec3f05c27c5094796fe3231.zip
FreeBSD-src-9d1fbd5bcd6214ba3ec3f05c27c5094796fe3231.tar.gz
Bring in the trivial differences between this code and John Hay's new
code. Added a copyright for the work I did to this file a couple of years ago. Add John's copyright too, since I'm sure I'll be pulling more into this code. This also implements a new -n option to not allow breaking into the boot sequence which was original in the patch John posted (not in the original i386 code I based this boot2.c on, only the name is the same). I haven't checked to see if he did that, or if it was one of Sam's improvements. Submitted by: jhay@
Diffstat (limited to 'sys/boot/arm')
-rw-r--r--sys/boot/arm/at91/boot2/boot2.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/sys/boot/arm/at91/boot2/boot2.c b/sys/boot/arm/at91/boot2/boot2.c
index 67ec5d0..f5f04e4 100644
--- a/sys/boot/arm/at91/boot2/boot2.c
+++ b/sys/boot/arm/at91/boot2/boot2.c
@@ -1,4 +1,6 @@
/*-
+ * Copyright (c) 2008 John Hay
+ * Copyright (c) 2006 Warner Losh
* Copyright (c) 1998 Robert Nordier
* All rights reserved.
*
@@ -51,7 +53,7 @@ __FBSDID("$FreeBSD$");
/* 0x13 is reserved for boot programs. */
/* #define RBX_PAUSE 0x14 -p */
/* #define RBX_QUIET 0x15 -q */
-/* #define RBX_NOINTR 0x1c -n */
+#define RBX_NOINTR 0x1c /* -n */
/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
/* #define RBX_DUAL 0x1d -D */
/* 0x1f is reserved for log2(RB_BOOTINFO). */
@@ -66,20 +68,21 @@ __FBSDID("$FreeBSD$");
//#define PATH_KERNEL "/boot/kernel/kernel"
#define PATH_KERNEL "/boot/kernel/kernel.gz.tramp"
-#define NOPT 5
+extern uint32_t _end;
+
+#define NOPT 6
#define OPT_SET(opt) (1 << (opt))
#define OPT_CHECK(opt) ((opts) & OPT_SET(opt))
-extern uint32_t _end;
-
-static const char optstr[NOPT] = "agrsv";
+static const char optstr[NOPT] = "agnrsv";
static const unsigned char flags[NOPT] = {
- RBX_ASKNAME,
- RBX_GDB,
- RBX_DFLTROOT,
- RBX_SINGLE,
- RBX_VERBOSE
+ RBX_ASKNAME,
+ RBX_GDB,
+ RBX_NOINTR,
+ RBX_DFLTROOT,
+ RBX_SINGLE,
+ RBX_VERBOSE
};
unsigned dsk_start;
@@ -96,6 +99,12 @@ static int dskread(void *, unsigned, unsigned);
#define UFS_SMALL_CGBASE
#include "ufsread.c"
+#ifdef DEBUG
+#define DPRINTF(fmt, ...) printf(fmt, __VA_ARGS__)
+#else
+#define DPRINTF(fmt, ...)
+#endif
+
static inline int
xfsread(ino_t inode, void *buf, size_t nbyte)
{
@@ -142,31 +151,31 @@ main(void)
int autoboot, c = 0;
ino_t ino;
- board_init();
-
dmadat = (void *)(0x20000000 + (16 << 20));
- /* Process configuration file */
+ board_init();
autoboot = 1;
+ /* Process configuration file */
if ((ino = lookup(PATH_CONFIG)))
fsread(ino, cmd, sizeof(cmd));
if (*cmd) {
if (parse())
autoboot = 0;
- printf("%s: %s", PATH_CONFIG, cmd);
+ printf("%s: %s\n", PATH_CONFIG, cmd);
/* Do not process this command twice */
*cmd = 0;
}
- /* Present the user with the boot2 prompt. */
-
if (*kname == '\0')
strcpy(kname, PATH_KERNEL);
+
+ /* Present the user with the boot2 prompt. */
for (;;) {
printf("\nDefault: %s\nboot: ", kname);
- if (!autoboot || (c = getc(2)) != -1)
+ if (!autoboot ||
+ (OPT_CHECK(RBX_NOINTR) == 0 && (c = getc(2)) != 0))
getstr(c);
xputchar('\n');
autoboot = 0;
OpenPOWER on IntegriCloud