Fix 'boot -z' bogons.

This commit is contained in:
ad 2009-03-21 15:01:56 +00:00
parent 418272808a
commit 3c11640e0d
10 changed files with 82 additions and 43 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot2.c,v 1.43 2009/02/16 22:39:30 jmcneill Exp $ */
/* $NetBSD: boot2.c,v 1.44 2009/03/21 15:01:56 ad Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -220,6 +220,14 @@ sprint_bootsel(const char *filename)
return "(invalid)";
}
static void
clearit(void)
{
if (bootconf.clear)
clear_pc_screen();
}
void
bootit(const char *filename, int howto, int tell)
{
@ -231,7 +239,7 @@ bootit(const char *filename, int howto, int tell)
printf("\n");
}
if (exec_netbsd(filename, 0, howto, boot_biosdev < 0x80) < 0)
if (exec_netbsd(filename, 0, howto, boot_biosdev < 0x80, clearit) < 0)
printf("boot: %s: %s\n", sprint_bootsel(filename),
strerror(errno));
else
@ -241,9 +249,8 @@ bootit(const char *filename, int howto, int tell)
void
print_banner(void)
{
if (bootconf.clear)
clear_pc_screen();
clearit();
#ifndef SMALL
int n;
if (bootconf.banner[0]) {
@ -402,7 +409,7 @@ command_boot(char *arg)
int howto;
if (parseboot(arg, &filename, &howto))
bootit(filename, howto, 1);
bootit(filename, howto, (howto & AB_VERBOSE) != 0);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.28 2009/03/18 10:22:30 cegger Exp $ */
/* $NetBSD: main.c,v 1.29 2009/03/21 15:01:56 ad Exp $ */
/*
* Copyright (c) 1996, 1997
@ -185,7 +185,7 @@ bootit(const char *filename, int howto, int tell)
printf("\n");
}
#ifdef SUPPORT_LYNX
if(exec_netbsd(filename, 0, howto, floppy) < 0)
if(exec_netbsd(filename, 0, howto, floppy, NULL) < 0)
printf("boot netbsd: %s: %s\n", sprint_bootsel(filename),
strerror(errno));
else {
@ -198,7 +198,7 @@ bootit(const char *filename, int howto, int tell)
else
printf("boot lynx returned\n");
#else
if (exec_netbsd(filename, 0, howto, floppy) < 0)
if (exec_netbsd(filename, 0, howto, floppy, NULL) < 0)
printf("boot: %s: %s\n", sprint_bootsel(filename),
strerror(errno));
else

View File

@ -1,7 +1,7 @@
/* $NetBSD: exec.c,v 1.39 2009/02/16 22:39:30 jmcneill Exp $ */
/* $NetBSD: exec.c,v 1.40 2009/03/21 15:01:56 ad Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -102,8 +102,10 @@
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/reboot.h>
#include <machine/multiboot.h>
#include <machine/stdarg.h>
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
@ -134,6 +136,7 @@ static struct btinfo_modulelist *btinfo_modulelist;
static size_t btinfo_modulelist_size;
static uint32_t image_end;
static char module_base[64] = "/";
static int howto;
static void module_init(void);
@ -267,7 +270,8 @@ common_load_kernel(const char *file, u_long *basemem, u_long *extmem,
}
int
exec_netbsd(const char *file, physaddr_t loadaddr, int boothowto, int floppy)
exec_netbsd(const char *file, physaddr_t loadaddr, int boothowto, int floppy,
void (*callback)(void))
{
u_long boot_argv[BOOT_NARGS];
u_long marks[MARK_MAX];
@ -286,6 +290,8 @@ exec_netbsd(const char *file, physaddr_t loadaddr, int boothowto, int floppy)
BI_ADD(&btinfo_framebuffer, BTINFO_FRAMEBUFFER,
sizeof(struct btinfo_framebuffer));
howto = boothowto;
if (common_load_kernel(file, &basemem, &extmem, loadaddr, floppy, marks))
goto out;
@ -315,6 +321,8 @@ exec_netbsd(const char *file, physaddr_t loadaddr, int boothowto, int floppy)
btinfo_symtab.esym = marks[MARK_END];
BI_ADD(&btinfo_symtab, BTINFO_SYMTAB, sizeof(struct btinfo_symtab));
if (callback != NULL)
(*callback)();
startprog(marks[MARK_ENTRY], BOOT_NARGS, boot_argv,
x86_trunc_page(basemem*1024));
panic("exec returned");
@ -445,7 +453,8 @@ module_init(void)
for (bm = boot_modules; bm; bm = bm->bm_next) {
if (bm->bm_len == -1)
continue;
printf("Loading %s ", bm->bm_path);
if ((howto & AB_SILENT) == 0)
printf("Loading %s ", bm->bm_path);
fd = module_open(bm, 0);
if (fd == -1) {
printf("ERROR: couldn't open %s\n", bm->bm_path);
@ -454,6 +463,8 @@ module_init(void)
image_end = (image_end + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
len = pread(fd, (void *)image_end, SSIZE_MAX);
if (len < bm->bm_len) {
if ((howto & AB_SILENT) != 0)
printf("Loading %s ", bm->bm_path);
printf(" FAILED\n");
} else {
btinfo_modulelist->num++;
@ -463,7 +474,8 @@ module_init(void)
bi->base = image_end;
bi->len = len;
bi->type = BI_MODULE_ELF;
printf(" \n");
if ((howto & AB_SILENT) == 0)
printf(" \n");
}
if (len > 0)
image_end += len;
@ -547,3 +559,15 @@ out:
dealloc(mbi, 0);
return -1;
}
void
x86_progress(const char *fmt, ...)
{
va_list ap;
if ((howto & AB_SILENT) != 0)
return;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: libi386.h,v 1.30 2009/02/16 22:39:30 jmcneill Exp $ */
/* $NetBSD: libi386.h,v 1.31 2009/03/21 15:01:56 ad Exp $ */
/*
* Copyright (c) 1996
@ -38,7 +38,7 @@ ssize_t pread(int, void *, size_t);
void startprog(physaddr_t, int, unsigned long *, physaddr_t);
void multiboot(physaddr_t, physaddr_t, physaddr_t);
int exec_netbsd(const char *, physaddr_t, int, int);
int exec_netbsd(const char *, physaddr_t, int, int, void (*)(void));
int exec_multiboot(const char *, char *);
void delay(int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.16 2009/03/18 10:22:30 cegger Exp $ */
/* $NetBSD: main.c,v 1.17 2009/03/21 15:01:56 ad Exp $ */
/*
* Copyright (c) 1996
@ -64,7 +64,7 @@ const struct bootblk_command commands[] = {
int
bootit(const char *filename, int howto)
{
if (exec_netbsd(filename, 0, howto, 0) < 0)
if (exec_netbsd(filename, 0, howto, 0, clear_pc_screen) < 0)
printf("boot: %s\n", strerror(errno));
else
printf("boot returned\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.19 2009/03/14 14:46:00 dsl Exp $ */
/* $NetBSD: main.c,v 1.20 2009/03/21 15:01:56 ad Exp $ */
/*
* Copyright (c) 1996
@ -75,10 +75,18 @@ const struct bootblk_command commands[] = {
{ NULL, NULL },
};
static void
clearit(void)
{
if (bootconf.clear)
clear_pc_screen();
}
static int
bootit(const char *filename, int howto)
{
if (exec_netbsd(filename, 0, howto, 0) < 0)
if (exec_netbsd(filename, 0, howto, 0, clearit) < 0)
printf("boot: %s\n", strerror(errno));
else
printf("boot returned\n");
@ -91,9 +99,7 @@ print_banner(void)
int base = getbasemem();
int ext = getextmem();
if (bootconf.clear)
clear_pc_screen();
clearit();
printf("\n"
">> NetBSD/x86 PXE boot, Revision %s (from NetBSD %s)\n"
">> Memory: %d/%d k\n",

View File

@ -1,7 +1,7 @@
/* $NetBSD: loadfile_machdep.h,v 1.3 2008/09/25 21:03:22 christos Exp $ */
/* $NetBSD: loadfile_machdep.h,v 1.4 2009/03/21 15:01:56 ad Exp $ */
/*-
* Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -45,11 +45,12 @@
#define WARN(a) (void)(printf a, \
printf((errno ? ": %s\n" : "\n"), \
strerror(errno)))
#define PROGRESS(a) (void) printf a
#define PROGRESS(a) x86_progress a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
#define OKMAGIC(a) ((a) == ZMAGIC)
void x86_progress(const char *, ...);
void vpbcopy(const void *, void *, size_t);
void pbzero(void *, size_t);
ssize_t pread(int, void *, size_t);

View File

@ -1,7 +1,7 @@
/* $NetBSD: pci_intr_machdep.c,v 1.12 2008/07/03 14:02:25 drochner Exp $ */
/* $NetBSD: pci_intr_machdep.c,v 1.13 2009/03/21 15:01:56 ad Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.12 2008/07/03 14:02:25 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.13 2009/03/21 15:01:56 ad Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -129,7 +129,7 @@ pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
*ihp = 0;
if (pin > PCI_INTERRUPT_PIN_MAX) {
printf("pci_intr_map: bad interrupt pin %d\n", pin);
aprint_normal("pci_intr_map: bad interrupt pin %d\n", pin);
goto bad;
}
@ -163,16 +163,16 @@ pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
* the BIOS has not configured the device.
*/
if (line == 0 || line == X86_PCI_INTERRUPT_LINE_NO_CONNECTION) {
printf("pci_intr_map: no mapping for pin %c (line=%02x)\n",
aprint_normal("pci_intr_map: no mapping for pin %c (line=%02x)\n",
'@' + pin, line);
goto bad;
} else {
if (line >= NUM_LEGACY_IRQS) {
printf("pci_intr_map: bad interrupt line %d\n", line);
aprint_normal("pci_intr_map: bad interrupt line %d\n", line);
goto bad;
}
if (line == 2) {
printf("pci_intr_map: changed line 2 to line 9\n");
aprint_normal("pci_intr_map: changed line 2 to line 9\n");
line = 9;
}
}
@ -190,9 +190,9 @@ pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
return 0;
}
#endif
printf("pci_intr_map: bus %d dev %d func %d pin %d; line %d\n",
aprint_normal("pci_intr_map: bus %d dev %d func %d pin %d; line %d\n",
bus, dev, func, pin, line);
printf("pci_intr_map: no MP mapping found\n");
aprint_normal("pci_intr_map: no MP mapping found\n");
}
#endif
@ -257,7 +257,7 @@ pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih,
if (ih & APIC_INT_VIA_APIC) {
ioapic = ioapic_find(APIC_IRQ_APIC(ih));
if (ioapic == NULL) {
printf("pci_intr_establish: bad ioapic %d\n",
aprint_normal("pci_intr_establish: bad ioapic %d\n",
APIC_IRQ_APIC(ih));
return NULL;
}

View File

@ -1,8 +1,8 @@
/* $NetBSD: x86_machdep.c,v 1.30 2009/02/13 22:41:03 apb Exp $ */
/* $NetBSD: x86_machdep.c,v 1.31 2009/03/21 15:01:57 ad Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
* Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
* Copyright (c) 2005, 2008, 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.30 2009/02/13 22:41:03 apb Exp $");
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.31 2009/03/21 15:01:57 ad Exp $");
#include "opt_modular.h"
@ -379,7 +379,7 @@ add_mem_cluster(phys_ram_seg_t *seg_clusters, int seg_cluster_cnt,
#endif
if (seg_end > TOPLIMIT) {
printf("WARNING: skipping large memory map entry: "
aprint_verbose("WARNING: skipping large memory map entry: "
"0x%"PRIx64"/0x%"PRIx64"/0x%x\n",
seg_start,
(seg_end - seg_start),

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_todr.c,v 1.28 2009/02/14 20:45:29 christos Exp $ */
/* $NetBSD: kern_todr.c,v 1.29 2009/03/21 15:01:57 ad Exp $ */
/*
* Copyright (c) 1992, 1993
@ -76,7 +76,7 @@
* @(#)clock.c 8.1 (Berkeley) 6/10/93
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.28 2009/02/14 20:45:29 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.29 2009/03/21 15:01:57 ad Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -170,8 +170,9 @@ inittodr(time_t base)
deltat / SECDAY);
badrtc = 1;
} else {
printf("WARNING: clock gained %d days\n",
deltat / SECDAY);
aprint_verbose("WARNING: clock gained %d "
"days\n", deltat / SECDAY);
goodtime = 1;
}
} else {
goodtime = 1;