Default boot blocks to those used to install the system.

Add 19200 baud and serial ports com1, com2 and com3.
Fixes PR install/21418
This commit is contained in:
dsl 2003-07-27 20:25:07 +00:00
parent a2d0517af5
commit d0bba60fad
6 changed files with 122 additions and 42 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.93 2003/07/25 08:26:27 dsl Exp $ */ /* $NetBSD: md.c,v 1.94 2003/07/27 20:25:07 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -54,7 +54,6 @@
#include "endian.h" #include "endian.h"
#include "msg_defs.h" #include "msg_defs.h"
#include "menu_defs.h" #include "menu_defs.h"
#include <sys/bootblock.h>
#ifdef NO_LBA_READS /* for testing */ #ifdef NO_LBA_READS /* for testing */
#undef BIFLAG_EXTINT13 #undef BIFLAG_EXTINT13
@ -283,16 +282,39 @@ md_post_newfs(void)
int len; int len;
int td, sd; int td, sd;
char bootxx[8192 + 4]; char bootxx[8192 + 4];
static struct i386_boot_params boottype =
{sizeof boottype, 0, 10, 0, 9600, ""};
static int conmib[] = {CTL_MACHDEP, CPU_CONSDEV};
struct termios t;
dev_t condev;
#define bp (*(struct i386_boot_params *)(bootxx + 512 * 2 + 8)) #define bp (*(struct i386_boot_params *)(bootxx + 512 * 2 + 8))
/*
* Get console device, should either be ttyE0 or tty0n.
* Too hard to double check, so just 'know' the device numbers.
*/
len = sizeof condev;
if (sysctl(conmib, nelem(conmib), &condev, &len, NULL, 0) != -1
&& (condev & ~3) == 0x800) {
/* Motherboard serial port */
boottype.bp_consdev = (condev & 3) + 1;
td = open("/dev/console", O_RDONLY, 0);
if (td != -1) {
if (tcgetattr(td, &t) != -1)
boottype.bp_conspeed = t.c_ispeed;
close(td);
}
}
process_menu(MENU_getboottype, &boottype);
msg_display(MSG_dobootblks, diskdev);
if (bp.bp_consdev == ~0)
return 0;
ret = cp_to_target("/usr/mdec/biosboot", "/boot"); ret = cp_to_target("/usr/mdec/biosboot", "/boot");
if (ret) if (ret)
return ret; return ret;
msg_display(MSG_getboottype);
process_menu(MENU_getboottype, NULL);
msg_display(MSG_dobootblks, diskdev);
/* Copy bootstrap in by hand - /sbin/installboot explodes ramdisks */ /* Copy bootstrap in by hand - /sbin/installboot explodes ramdisks */
ret = 1; ret = 1;
@ -308,10 +330,8 @@ md_post_newfs(void)
if (*(uint32_t *)(bootxx + 512 * 2 + 4) != X86_BOOT_MAGIC_1) if (*(uint32_t *)(bootxx + 512 * 2 + 4) != X86_BOOT_MAGIC_1)
goto bad_bootxx; goto bad_bootxx;
if (!strncmp(boottype, "serial", 6)) { boottype.bp_length = bp.bp_length;
bp.bp_consdev = 1; /* com0 */ memcpy(&bp, &boottype, min(boottype.bp_length, sizeof boottype));
bp.bp_conspeed = atoi(boottype + 6);
}
if (pwrite(td, bootxx, 512, 0) != 512) if (pwrite(td, bootxx, 512, 0) != 512)
goto bad_bootxx; goto bad_bootxx;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.46 2003/07/25 08:26:27 dsl Exp $ */ /* $NetBSD: md.h,v 1.47 2003/07/27 20:25:07 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,6 +42,7 @@
#include <machine/cpu.h> #include <machine/cpu.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/bootblock.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -84,9 +85,6 @@
*/ */
#define DISK_NAMES "wd", "sd", "ld", "ed" #define DISK_NAMES "wd", "sd", "ld", "ed"
/* Bootblock type */
EXTERN const char *boottype INIT("");
/* /*
* Machine-specific command to write a new label to a disk. * Machine-specific command to write a new label to a disk.
* For example, i386 uses "/sbin/disklabel -w -r", just like i386 * For example, i386 uses "/sbin/disklabel -w -r", just like i386

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md,v 1.6 2003/06/13 22:27:08 dsl Exp $ */ /* $NetBSD: menus.md,v 1.7 2003/07/27 20:25:07 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -38,17 +38,48 @@
/* Menu definitions for sysinst. i386 version, machine dependent. */ /* Menu definitions for sysinst. i386 version, machine dependent. */
menu getboottype, title MSG_Bootblocks_selection; menu getboottype, title MSG_Bootblocks_selection, y=10, exit;
option MSG_Use_normal_bootblocks, exit, action display action { msg_display(MSG_getboottype);
{boottype = "normal";}; if (((struct i386_boot_params *)arg)->bp_consdev == 0)
option MSG_Use_serial_9600_bootblocks, exit, action msg_display_add(MSG_console_PC);
{boottype = "serial9600";}; else
option MSG_Use_serial_38400_bootblocks, exit, action msg_display_add(MSG_console_com,
{boottype = "serial38400";}; ((struct i386_boot_params *)arg)->bp_consdev - 1,
option MSG_Use_serial_57600_bootblocks, exit, action ((struct i386_boot_params *)arg)->bp_conspeed);
{boottype = "serial57600";}; };
option MSG_Use_serial_115200_bootblocks, exit, action option MSG_Use_normal_bootblocks, action
{boottype = "serial115200";}; {((struct i386_boot_params *)arg)->bp_consdev = 0;};
option MSG_Use_serial_com0, action
{((struct i386_boot_params *)arg)->bp_consdev = 1;};
option MSG_Use_serial_com1, action
{((struct i386_boot_params *)arg)->bp_consdev = 2;};
option MSG_Use_serial_com2, action
{((struct i386_boot_params *)arg)->bp_consdev = 3;};
option MSG_Use_serial_com3, action
{((struct i386_boot_params *)arg)->bp_consdev = 4;};
option MSG_serial_baud_rate, sub menu consolebaud;
option MSG_Use_existing_bootblocks, action
{((struct i386_boot_params *)arg)->bp_consdev = ~0;};
menu consolebaud, title MSG_serial_baud_rate, x=40, y=13;
display action {
switch (((struct i386_boot_params *)arg)->bp_conspeed) {
case 9600: menu->cursel = 0; break;
case 19200: menu->cursel = 1; break;
case 38400: menu->cursel = 2; break;
case 57600: menu->cursel = 3; break;
case 115200: menu->cursel = 4; break;
}};
option "9600", exit, action
{((struct i386_boot_params *)arg)->bp_conspeed = 9600;};
option "19200", exit, action
{((struct i386_boot_params *)arg)->bp_conspeed = 19200;};
option "38400", exit, action
{((struct i386_boot_params *)arg)->bp_conspeed = 38400;};
option "57600", exit, action
{((struct i386_boot_params *)arg)->bp_conspeed = 57600;};
option "115200", exit, action
{((struct i386_boot_params *)arg)->bp_conspeed = 115200;};
menu biosonematch; menu biosonematch;
option MSG_This_is_the_correct_geometry, exit, action { }; option MSG_This_is_the_correct_geometry, exit, action { };

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.en,v 1.40 2003/07/07 21:26:34 dsl Exp $ */ /* $NetBSD: msg.md.en,v 1.41 2003/07/27 20:25:07 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -53,20 +53,21 @@ message getboottype
Normal bootblocks use the BIOS console device as the console Normal bootblocks use the BIOS console device as the console
(usually the monitor and keyboard). Serial bootblocks use the first (usually the monitor and keyboard). Serial bootblocks use the first
serial port as the console. serial port as the console.
}
Selected bootblock: }
message console_PC {BIOS console}
message console_com {Serial port com%d at %d baud}
message Bootblocks_selection message Bootblocks_selection
{Bootblocks selection} {Bootblocks selection}
message Use_normal_bootblocks message Use_normal_bootblocks {Use BIOS console}
{Use normal bootblocks} message Use_serial_com0 {Use serial port com0}
message Use_serial_9600_bootblocks message Use_serial_com1 {Use serial port com1}
{Use serial (9600) bootblocks} message Use_serial_com2 {Use serial port com2}
message Use_serial_38400_bootblocks message Use_serial_com3 {Use serial port com3}
{Use serial (38400) bootblocks} message serial_baud_rate {Serial baud rate}
message Use_serial_57600_bootblocks message Use_existing_bootblocks {Use exitisting bootblocks}
{Use serial (57600) bootblocks}
message Use_serial_115200_bootblocks
{Use serial (115200) bootblocks}
message dobootblks message dobootblks
{Installing boot blocks on %s.... {Installing boot blocks on %s....

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.fr,v 1.30 2003/07/07 21:26:34 dsl Exp $ */ /* $NetBSD: msg.md.fr,v 1.31 2003/07/27 20:25:07 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -49,8 +49,23 @@ message dobad144
message getboottype message getboottype
{Aimez-vous installer l'ensemble normal de bootblocks ou de bootblocks serial? {Aimez-vous installer l'ensemble normal de bootblocks ou de bootblocks serial?
}
Selected bootblock: }
message console_PC {BIOS console}
message console_com {Serial port com%d, baud rate %d}
message Bootblocks_selection
{Bootblocks selection}
message Use_normal_bootblocks {Use BIOS console}
message Use_serial_com0 {Use serial port com0}
message Use_serial_com1 {Use serial port com1}
message Use_serial_com2 {Use serial port com2}
message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use exitisting bootblocks}
.if 0
message Bootblocks_selection message Bootblocks_selection
{Sélection de Bootblocks} {Sélection de Bootblocks}
message Use_normal_bootblocks message Use_normal_bootblocks
@ -63,6 +78,7 @@ message Use_serial_57600_bootblocks
{Utilisez serial (57600) le bootblocks} {Utilisez serial (57600) le bootblocks}
message Use_serial_115200_bootblocks message Use_serial_115200_bootblocks
{Utilisez serial (115200) le bootblocks} {Utilisez serial (115200) le bootblocks}
.endif
message dobootblks message dobootblks
{Installation des block de démarrage sur %s ... {Installation des block de démarrage sur %s ...

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.pl,v 1.15 2003/07/07 21:26:34 dsl Exp $ */ /* $NetBSD: msg.md.pl,v 1.16 2003/07/27 20:25:07 dsl Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: msg.md.en,v 1.24 2001/01/27 07:34:39 jmc Exp */ /* NetBSD: msg.md.en,v 1.24 2001/01/27 07:34:39 jmc Exp */
@ -51,10 +51,23 @@ message dobad144
message getboottype message getboottype
{Czy chcesz zainstalowac normalne bootbloki, czy te do uzycia z zewn. konsola? {Czy chcesz zainstalowac normalne bootbloki, czy te do uzycia z zewn. konsola?
}
Selected bootblock: }
message console_PC {BIOS console}
message console_com {Serial port com%d, baud rate %d}
message Bootblocks_selection message Bootblocks_selection
{Wybor bootblokow} {Wybor bootblokow}
message Use_normal_bootblocks {Use BIOS console}
message Use_serial_com0 {Use serial port com0}
message Use_serial_com1 {Use serial port com1}
message Use_serial_com2 {Use serial port com2}
message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use exitisting bootblocks}
.if 0
message Use_normal_bootblocks message Use_normal_bootblocks
{Uzyj normalnych bootblokow} {Uzyj normalnych bootblokow}
message Use_serial_9600_bootblocks message Use_serial_9600_bootblocks
@ -65,6 +78,7 @@ message Use_serial_57600_bootblocks
{Uzyj bootblokow na zewn. konsole (57600)} {Uzyj bootblokow na zewn. konsole (57600)}
message Use_serial_115200_bootblocks message Use_serial_115200_bootblocks
{Uzyj bootblokow na zewn. konsole (115200)} {Uzyj bootblokow na zewn. konsole (115200)}
.endif
message dobootblks message dobootblks
{Instalowanie bootblokow na %s.... {Instalowanie bootblokow na %s....