Deleted Added
sdiff udiff text old ( 183635 ) new ( 183636 )
full compact
1/*-
2 * Copyright (c) 1998 Robert Nordier
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are freely
6 * permitted provided that the above copyright notice and this
7 * paragraph and the following disclaimer are duplicated in all
8 * such forms.
9 *
10 * This software is provided "AS IS" and without any express or
11 * implied warranties, including, without limitation, the implied
12 * warranties of merchantability and fitness for a particular
13 * purpose.
14 */
15
16#include <sys/cdefs.h>
17__FBSDID("$FreeBSD: head/sys/boot/arm/at91/boot2/boot2.c 183635 2008-10-05 23:39:28Z imp $");
18
19#include <sys/param.h>
20#include <sys/disklabel.h>
21#include <sys/diskmbr.h>
22#include <sys/dirent.h>
23#include <sys/reboot.h>
24
25#include <machine/elf.h>

--- 20 unchanged lines hidden (view full) ---

46/* 0xe is reserved for log2(RB_POWEROFF). */
47#define RBX_GDB 0xf /* -g */
48/* #define RBX_MUTE 0x10 -m */
49/* 0x11 is reserved for log2(RB_SELFTEST). */
50/* 0x12 is reserved for boot programs. */
51/* 0x13 is reserved for boot programs. */
52/* #define RBX_PAUSE 0x14 -p */
53/* #define RBX_QUIET 0x15 -q */
54/* #define RBX_NOINTR 0x1c -n */
55/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
56/* #define RBX_DUAL 0x1d -D */
57/* 0x1f is reserved for log2(RB_BOOTINFO). */
58
59/* pass: -a, -s, -r, -v, -g */
60#define RBX_MASK (OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \
61 OPT_SET(RBX_DFLTROOT) | \
62 OPT_SET(RBX_VERBOSE) | \
63 OPT_SET(RBX_GDB))
64
65#define PATH_CONFIG "/boot.config"
66//#define PATH_KERNEL "/boot/kernel/kernel"
67#define PATH_KERNEL "/boot/kernel/kernel.gz.tramp"
68
69#define NOPT 5
70
71#define OPT_SET(opt) (1 << (opt))
72#define OPT_CHECK(opt) ((opts) & OPT_SET(opt))
73
74extern uint32_t _end;
75
76static const char optstr[NOPT] = "agrsv";
77static const unsigned char flags[NOPT] = {
78 RBX_ASKNAME,
79 RBX_GDB,
80 RBX_DFLTROOT,
81 RBX_SINGLE,
82 RBX_VERBOSE
83};
84
85unsigned dsk_start;
86static char cmd[512];
87static char kname[1024];
88static uint32_t opts;
89static int dsk_meta;
90
91static void load(void);
92static int parse(void);
93static int xfsread(ino_t, void *, size_t);
94static int dskread(void *, unsigned, unsigned);
95
96#define UFS_SMALL_CGBASE
97#include "ufsread.c"
98
99static inline int
100xfsread(ino_t inode, void *buf, size_t nbyte)
101{
102 if ((size_t)fsread(inode, buf, nbyte) != nbyte)
103 return -1;
104 return 0;
105}
106

--- 30 unchanged lines hidden (view full) ---

137}
138
139int
140main(void)
141{
142 int autoboot, c = 0;
143 ino_t ino;
144
145 board_init();
146
147 dmadat = (void *)(0x20000000 + (16 << 20));
148 /* Process configuration file */
149
150 autoboot = 1;
151
152 if ((ino = lookup(PATH_CONFIG)))
153 fsread(ino, cmd, sizeof(cmd));
154
155 if (*cmd) {
156 if (parse())
157 autoboot = 0;
158 printf("%s: %s", PATH_CONFIG, cmd);
159 /* Do not process this command twice */
160 *cmd = 0;
161 }
162
163 /* Present the user with the boot2 prompt. */
164
165 if (*kname == '\0')
166 strcpy(kname, PATH_KERNEL);
167 for (;;) {
168 printf("\nDefault: %s\nboot: ", kname);
169 if (!autoboot || (c = getc(2)) != -1)
170 getstr(c);
171 xputchar('\n');
172 autoboot = 0;
173 c = 0;
174 if (parse())
175 xputchar('\a');
176 else
177 load();

--- 120 unchanged lines hidden ---