diff --git a/distrib/utils/sysinst/arch/shark/md.c b/distrib/utils/sysinst/arch/shark/md.c index 00d92471f393..d1a248d207b3 100644 --- a/distrib/utils/sysinst/arch/shark/md.c +++ b/distrib/utils/sysinst/arch/shark/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.19 2006/04/05 16:55:07 garbled Exp $ */ +/* $NetBSD: md.c,v 1.20 2007/03/12 11:19:37 jmmv Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -53,6 +53,31 @@ #include "msg_defs.h" #include "menu_defs.h" +/* + * Clears the disk's first sector by writing all zeros over it. + * Returns 0 on success, -1 on failure. Leaves the disk's path in + * the output diskpath buffer for further usage in error messages. + */ +static int +clear_mbr(const char *disk, char *diskpath, size_t diskpathlen) +{ + int fd; + char sector[512]; + + fd = opendisk(disk, O_WRONLY, diskpath, diskpathlen, 0); + if (fd < 0) + return -1; + + memset(sector, 0, sizeof(sector)); + if (pwrite(fd, §or, sizeof(sector), 0) < 0) { + close(fd); + return -1; + } + + close(fd); + return 0; +} + int md_get_info(void) { @@ -103,6 +128,13 @@ md_get_info(void) int md_pre_disklabel(void) { + char diskpath[MAXPATHLEN]; + + if (clear_mbr(diskdev, diskpath, sizeof(diskpath)) == -1) { + msg_display(MSG_badclearmbr, diskpath); + process_menu(MENU_ok, NULL); + } + return 0; } @@ -178,5 +210,9 @@ md_init(void) int md_post_extract(void) { + + msg_display(MSG_setbootdevice); + process_menu(MENU_ok, NULL); + return 0; } diff --git a/distrib/utils/sysinst/arch/shark/msg.md.de b/distrib/utils/sysinst/arch/shark/msg.md.de index dac50098b314..489fe1756f00 100644 --- a/distrib/utils/sysinst/arch/shark/msg.md.de +++ b/distrib/utils/sysinst/arch/shark/msg.md.de @@ -1,4 +1,4 @@ -/* $NetBSD: msg.md.de,v 1.4 2004/10/21 12:14:22 martin Exp $ */ +/* $NetBSD: msg.md.de,v 1.5 2007/03/12 11:19:37 jmmv Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -81,3 +81,27 @@ message arm32fspart message set_kernel_1 {Kernel (GENERIC)} + +message setbootdevice +{In order to make your system boot automatically from the on-disk file +system, you need to manually configure OpenFirmware to tell it where to +load the kernel from. + +OpenFirmware can load a NetBSD a.out kernel (sorry, ELF is not supported) +straight from a FFS partition on the local hard disk. So, to configure it +to boot the just-installed kernel, run the following command from +OpenFirmware's shell: + +setenv boot-device disk:\\netbsd.aout + +You only need to run this once and only if the 'boot-device' property did +not already contain the value shown above. +} + +message badclearmbr +{Failed to clear the disk's first sector. If OpenFirmware cannot see the +disk, try to run the following command manually from the installer's shell +utility: + +dd if=/dev/zero of=%s bs=512 count=1 +} diff --git a/distrib/utils/sysinst/arch/shark/msg.md.en b/distrib/utils/sysinst/arch/shark/msg.md.en index 50ba650fc885..84a20dde63c5 100644 --- a/distrib/utils/sysinst/arch/shark/msg.md.en +++ b/distrib/utils/sysinst/arch/shark/msg.md.en @@ -1,4 +1,4 @@ -/* $NetBSD: msg.md.en,v 1.6 2003/06/12 11:20:13 dsl Exp $ */ +/* $NetBSD: msg.md.en,v 1.7 2007/03/12 11:19:37 jmmv Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -77,3 +77,27 @@ message arm32fspart message set_kernel_1 {Kernel (GENERIC)} + +message setbootdevice +{In order to make your system boot automatically from the on-disk file +system, you need to manually configure OpenFirmware to tell it where to +load the kernel from. + +OpenFirmware can load a NetBSD a.out kernel (sorry, ELF is not supported) +straight from a FFS partition on the local hard disk. So, to configure it +to boot the just-installed kernel, run the following command from +OpenFirmware's shell: + +setenv boot-device disk:\\netbsd.aout + +You only need to run this once and only if the 'boot-device' property did +not already contain the value shown above. +} + +message badclearmbr +{Failed to clear the disk's first sector. If OpenFirmware cannot see the +disk, try to run the following command manually from the installer's shell +utility: + +dd if=/dev/zero of=%s bs=512 count=1 +} diff --git a/distrib/utils/sysinst/arch/shark/msg.md.es b/distrib/utils/sysinst/arch/shark/msg.md.es index 7f35b303e995..c676efc65ece 100644 --- a/distrib/utils/sysinst/arch/shark/msg.md.es +++ b/distrib/utils/sysinst/arch/shark/msg.md.es @@ -1,4 +1,4 @@ -/* $NetBSD: msg.md.es,v 1.2 2005/08/26 16:32:33 xtraeme Exp $ */ +/* $NetBSD: msg.md.es,v 1.3 2007/03/12 11:19:37 jmmv Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -80,3 +80,26 @@ Compensaci message set_kernel_1 {Núcleo (GENERIC)} + +message setbootdevice +{Para conseguir que el sistema arranque automaticamente desde el sistema +de ficheros del disco, necesita configura manualmente OpenFirmware para +indicarle desde dónde debe cargar el núcleo del sistema. + +OpenFirmware puede cargar un núcleo a.out de NetBSD (perdone, pero ELF no está soportado) directamente desde una partición FFS del disco local. Así que, para +configurarlo para que arranque desde disco deberá ejecutar manualmente el +siguiente comando desde la interfaz de OpenFirmware: + +setenv boot-device disk:\\netbsd.aout + +Sólo tiene que ejecutar esto una vez y sólamente si la propiedad +'boot-device' no contenía el valor mostrado arriba. +} + +message badclearmbr +{Ha ocurrido un error al intentar borrar el primer sector del disco. Si el +firmware no puede verlo, pruebe a ejecutar el siguiente comando manualmente +desde la linea de comandos de la utilidad de instalación: + +dd if=/dev/zero of=%s bs=512 count=1 +} diff --git a/distrib/utils/sysinst/arch/shark/msg.md.fr b/distrib/utils/sysinst/arch/shark/msg.md.fr index acffafb8a00e..d7a11807d553 100644 --- a/distrib/utils/sysinst/arch/shark/msg.md.fr +++ b/distrib/utils/sysinst/arch/shark/msg.md.fr @@ -1,4 +1,4 @@ -/* $NetBSD: msg.md.fr,v 1.6 2003/06/12 11:20:13 dsl Exp $ */ +/* $NetBSD: msg.md.fr,v 1.7 2007/03/12 11:19:37 jmmv Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -82,3 +82,26 @@ message arm32fspart message set_kernel_1 {Kernel (GENERIC)} +message setbootdevice +{In order to make your system boot automatically from the on-disk file +system, you need to manually configure OpenFirmware to tell it where to +load the kernel from. + +OpenFirmware can load a NetBSD a.out kernel (sorry, ELF is not supported) +straight from a FFS partition on the local hard disk. So, to configure it +to boot the just-installed kernel, run the following command from +OpenFirmware's shell: + +setenv boot-device disk:\\netbsd.aout + +You only need to run this once and only if the 'boot-device' property did +not already contain the value shown above. +} + +message badclearmbr +{Failed to clear the disk's first sector. If OpenFirmware cannot see the +disk, try to run the following command manually from the installer's shell +utility: + +dd if=/dev/zero of=%s bs=512 count=1 +} diff --git a/distrib/utils/sysinst/arch/shark/msg.md.pl b/distrib/utils/sysinst/arch/shark/msg.md.pl index 09497e2aa00c..fca5e14d8caa 100644 --- a/distrib/utils/sysinst/arch/shark/msg.md.pl +++ b/distrib/utils/sysinst/arch/shark/msg.md.pl @@ -1,4 +1,4 @@ -/* $NetBSD: msg.md.pl,v 1.5 2003/06/12 11:20:13 dsl Exp $ */ +/* $NetBSD: msg.md.pl,v 1.6 2007/03/12 11:19:38 jmmv Exp $ */ /* Based on english version: */ /* NetBSD: msg.md.en,v 1.2 2002/04/02 17:02:54 thorpej Exp */ @@ -80,3 +80,26 @@ message arm32fspart message set_kernel_1 {Kernel (GENERIC)} +message setbootdevice +{In order to make your system boot automatically from the on-disk file +system, you need to manually configure OpenFirmware to tell it where to +load the kernel from. + +OpenFirmware can load a NetBSD a.out kernel (sorry, ELF is not supported) +straight from a FFS partition on the local hard disk. So, to configure it +to boot the just-installed kernel, run the following command from +OpenFirmware's shell: + +setenv boot-device disk:\\netbsd.aout + +You only need to run this once and only if the 'boot-device' property did +not already contain the value shown above. +} + +message badclearmbr +{Failed to clear the disk's first sector. If OpenFirmware cannot see the +disk, try to run the following command manually from the installer's shell +utility: + +dd if=/dev/zero of=%s bs=512 count=1 +}