summaryrefslogtreecommitdiffstats
path: root/sys/boot/pc98
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2012-03-10 15:08:37 +0000
committernyan <nyan@FreeBSD.org>2012-03-10 15:08:37 +0000
commiteaf47d1cd79c4fde9aba9adc9444cb7f78cbc044 (patch)
treea6e97b2481eec0de3f7be17f2f88a4875d63f8af /sys/boot/pc98
parent1324baa4ebfff886fe68bbe354f9d6b82bfd7d82 (diff)
downloadFreeBSD-src-eaf47d1cd79c4fde9aba9adc9444cb7f78cbc044.zip
FreeBSD-src-eaf47d1cd79c4fde9aba9adc9444cb7f78cbc044.tar.gz
MFi386: revisions 232570 and 232754
Fix boot2 to handle boot config files that only contain a custom path to a loader or kernel.
Diffstat (limited to 'sys/boot/pc98')
-rw-r--r--sys/boot/pc98/boot2/boot2.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sys/boot/pc98/boot2/boot2.c b/sys/boot/pc98/boot2/boot2.c
index 2ef4da6..393a460 100644
--- a/sys/boot/pc98/boot2/boot2.c
+++ b/sys/boot/pc98/boot2/boot2.c
@@ -130,9 +130,9 @@ static struct dsk {
unsigned part;
unsigned start;
} dsk;
-static char cmd[512], cmddup[512];
+static char cmd[512], cmddup[512], knamebuf[1024];
static const char *kname = NULL;
-static uint32_t opts;
+static uint32_t opts = 0;
static int comspeed = SIOSPD;
static struct bootinfo bootinfo;
static uint8_t ioctrl = IO_KEYBOARD;
@@ -352,6 +352,7 @@ main(void)
#endif
uint8_t autoboot;
ino_t ino;
+ size_t nbyte;
dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
v86.ctl = V86_FLAGS;
@@ -378,8 +379,10 @@ main(void)
autoboot = 1;
if ((ino = lookup(PATH_CONFIG)) ||
- (ino = lookup(PATH_DOTCONFIG)))
- fsread(ino, cmd, sizeof(cmd));
+ (ino = lookup(PATH_DOTCONFIG))) {
+ nbyte = fsread(ino, cmd, sizeof(cmd) - 1);
+ cmd[nbyte] = '\0';
+ }
if (*cmd) {
memcpy(cmddup, cmd, sizeof(cmd));
@@ -396,9 +399,9 @@ main(void)
* or in case of failure, try to load a kernel directly instead.
*/
- if (autoboot && !kname) {
+ if (!kname) {
kname = PATH_BOOT3;
- if (!keyhit(3*SECOND)) {
+ if (autoboot && !keyhit(3*SECOND)) {
load();
kname = PATH_KERNEL;
}
@@ -595,7 +598,12 @@ parse()
dsk.daua = dsk.disk | dsk.unit;
dsk_meta = 0;
}
- kname = arg;
+ if ((i = ep - arg)) {
+ if ((size_t)i >= sizeof(knamebuf))
+ return -1;
+ memcpy(knamebuf, arg, i + 1);
+ kname = knamebuf;
+ }
}
arg = p;
}
OpenPOWER on IntegriCloud