diff --git a/distrib/utils/sysinst/arch/i386/md.c b/distrib/utils/sysinst/arch/i386/md.c index d59a7d7966be..372cdb29dd23 100644 --- a/distrib/utils/sysinst/arch/i386/md.c +++ b/distrib/utils/sysinst/arch/i386/md.c @@ -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. @@ -54,7 +54,6 @@ #include "endian.h" #include "msg_defs.h" #include "menu_defs.h" -#include #ifdef NO_LBA_READS /* for testing */ #undef BIFLAG_EXTINT13 @@ -283,16 +282,39 @@ md_post_newfs(void) int len; int td, sd; 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)) + /* + * 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"); if (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 */ ret = 1; @@ -308,10 +330,8 @@ md_post_newfs(void) if (*(uint32_t *)(bootxx + 512 * 2 + 4) != X86_BOOT_MAGIC_1) goto bad_bootxx; - if (!strncmp(boottype, "serial", 6)) { - bp.bp_consdev = 1; /* com0 */ - bp.bp_conspeed = atoi(boottype + 6); - } + boottype.bp_length = bp.bp_length; + memcpy(&bp, &boottype, min(boottype.bp_length, sizeof boottype)); if (pwrite(td, bootxx, 512, 0) != 512) goto bad_bootxx; diff --git a/distrib/utils/sysinst/arch/i386/md.h b/distrib/utils/sysinst/arch/i386/md.h index 4325173f6afa..de11e5f00914 100644 --- a/distrib/utils/sysinst/arch/i386/md.h +++ b/distrib/utils/sysinst/arch/i386/md.h @@ -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. @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -84,9 +85,6 @@ */ #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. * For example, i386 uses "/sbin/disklabel -w -r", just like i386 diff --git a/distrib/utils/sysinst/arch/i386/menus.md b/distrib/utils/sysinst/arch/i386/menus.md index 183519aa7a91..ad3548f053c5 100644 --- a/distrib/utils/sysinst/arch/i386/menus.md +++ b/distrib/utils/sysinst/arch/i386/menus.md @@ -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. @@ -38,17 +38,48 @@ /* Menu definitions for sysinst. i386 version, machine dependent. */ -menu getboottype, title MSG_Bootblocks_selection; - option MSG_Use_normal_bootblocks, exit, action - {boottype = "normal";}; - option MSG_Use_serial_9600_bootblocks, exit, action - {boottype = "serial9600";}; - option MSG_Use_serial_38400_bootblocks, exit, action - {boottype = "serial38400";}; - option MSG_Use_serial_57600_bootblocks, exit, action - {boottype = "serial57600";}; - option MSG_Use_serial_115200_bootblocks, exit, action - {boottype = "serial115200";}; +menu getboottype, title MSG_Bootblocks_selection, y=10, exit; + display action { msg_display(MSG_getboottype); + if (((struct i386_boot_params *)arg)->bp_consdev == 0) + msg_display_add(MSG_console_PC); + else + msg_display_add(MSG_console_com, + ((struct i386_boot_params *)arg)->bp_consdev - 1, + ((struct i386_boot_params *)arg)->bp_conspeed); + }; + option MSG_Use_normal_bootblocks, action + {((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; option MSG_This_is_the_correct_geometry, exit, action { }; diff --git a/distrib/utils/sysinst/arch/i386/msg.md.en b/distrib/utils/sysinst/arch/i386/msg.md.en index 206e74ace7ea..9103f91fad25 100644 --- a/distrib/utils/sysinst/arch/i386/msg.md.en +++ b/distrib/utils/sysinst/arch/i386/msg.md.en @@ -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. @@ -53,20 +53,21 @@ message getboottype Normal bootblocks use the BIOS console device as the console (usually the monitor and keyboard). Serial bootblocks use the first 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 {Bootblocks selection} -message Use_normal_bootblocks -{Use normal bootblocks} -message Use_serial_9600_bootblocks -{Use serial (9600) bootblocks} -message Use_serial_38400_bootblocks -{Use serial (38400) bootblocks} -message Use_serial_57600_bootblocks -{Use serial (57600) bootblocks} -message Use_serial_115200_bootblocks -{Use serial (115200) bootblocks} +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} message dobootblks {Installing boot blocks on %s.... diff --git a/distrib/utils/sysinst/arch/i386/msg.md.fr b/distrib/utils/sysinst/arch/i386/msg.md.fr index 4ecd2676f40b..c6fee57eadc9 100644 --- a/distrib/utils/sysinst/arch/i386/msg.md.fr +++ b/distrib/utils/sysinst/arch/i386/msg.md.fr @@ -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. @@ -49,8 +49,23 @@ message dobad144 message getboottype {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 {Sélection de Bootblocks} message Use_normal_bootblocks @@ -63,6 +78,7 @@ message Use_serial_57600_bootblocks {Utilisez serial (57600) le bootblocks} message Use_serial_115200_bootblocks {Utilisez serial (115200) le bootblocks} +.endif message dobootblks {Installation des block de démarrage sur %s ... diff --git a/distrib/utils/sysinst/arch/i386/msg.md.pl b/distrib/utils/sysinst/arch/i386/msg.md.pl index 03b686e69d0c..0dd1c8196265 100644 --- a/distrib/utils/sysinst/arch/i386/msg.md.pl +++ b/distrib/utils/sysinst/arch/i386/msg.md.pl @@ -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: */ /* NetBSD: msg.md.en,v 1.24 2001/01/27 07:34:39 jmc Exp */ @@ -51,10 +51,23 @@ message dobad144 message getboottype {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 {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 {Uzyj normalnych bootblokow} message Use_serial_9600_bootblocks @@ -65,6 +78,7 @@ message Use_serial_57600_bootblocks {Uzyj bootblokow na zewn. konsole (57600)} message Use_serial_115200_bootblocks {Uzyj bootblokow na zewn. konsole (115200)} +.endif message dobootblks {Instalowanie bootblokow na %s....