Improve UFS2 root handling on sysinst:

- add HAVE_UFS2_BOOT define on ports which have UFS2 capable loader
- reject UFS2 for root file system on ports !HAVE_UFS2_BOOT
- add a MI function to get bootxx name from root file system type
  per MD defines and remove md_bootxx_name() from arch/i386/md.c,
  so that alpha can use bootxx_ffsv2 for UFS2 as well as x86

Tested on i386 and alpha with FFSv1 and FFSv2, and also
tested on vax (on simh) for !HAVE_UFS2_BOOT case.
de translation is provided by martin@.

No objection on tech-install, and "move forward with it" from perry@.

XXX1: not tested on all ports, more ports might/could have UFS2 root support
XXX2: no es, fr, and pl translations, even en message should be improved
XXX3: alpha has a fixed en message without MSG
This commit is contained in:
tsutsui 2009-04-07 10:45:04 +00:00
parent 5c9ab7f6c0
commit a4063088f7
24 changed files with 204 additions and 75 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.18 2008/02/04 08:42:41 chris Exp $ */
/* $NetBSD: md.h,v 1.19 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -48,6 +48,9 @@
#define PART_USR PART_E
#define PART_FIRST_FREE PART_F
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/*
* Default filesets to fetch and install during installation
* or upgrade. The standard sets are:

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.45 2008/10/07 09:58:14 abs Exp $ */
/* $NetBSD: md.c,v 1.46 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -126,12 +126,13 @@ md_post_disklabel(void)
int
md_post_newfs(void)
{
char *bootxx;
printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", "/boot");
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs",
diskdev))
bootxx = bootxx_name();
if (bootxx == NULL || run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc %s", diskdev, bootxx))
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.21 2006/02/26 10:25:52 dsl Exp $ */
/* $NetBSD: md.h,v 1.22 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -52,6 +52,15 @@
#define XNEEDMB 50 /* XXXTHORPEJ */
#define DEFROOTSIZE 128
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/* have file system specific primary boot loader */
#define HAVE_BOOTXX_xFS
#define BOOTXXDIR "/usr/mdec"
#define BOOTXX_FFSV1 "bootxx_ffs"
#define BOOTXX_FFSV2 "bootxx_ffsv2"
/*
* Default filesets to fetch and install during installation
* or upgrade.

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.24 2009/04/05 00:50:52 tsutsui Exp $ */
/* $NetBSD: md.h,v 1.25 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -53,13 +53,21 @@
#define DEFUSRSIZE 0
#define DEFSWAPSIZE (-1)
/* use UFS2 by default for ffs */
#define DEFAULT_UFS2
#define HAVE_UFS2_BOOT
/* Megs required for a full X installation. */
#define XNEEDMB 50
/* use UFS2 by default for ffs */
#define DEFAULT_UFS2
/* have support for booting form UFS2 */
#define HAVE_UFS2_BOOT
/* have file system specific primary boot loader */
#define HAVE_BOOTXX_xFS
#define BOOTXXDIR "/usr/mdec"
#define BOOTXX_FFSV1 "bootxx_ffsv1"
#define BOOTXX_FFSV2 "bootxx_ffsv2"
/*
* Default filesets to fetch and install during installation

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.14 2008/02/02 04:20:02 tsutsui Exp $ */
/* $NetBSD: md.h,v 1.15 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -75,6 +75,9 @@
/* Megs required for a full X installation. */
#define XNEEDMB 100
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/*
* Default filesets to fetch and install during installation

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.1 2008/02/02 09:14:32 tsutsui Exp $ */
/* $NetBSD: md.h,v 1.2 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -75,6 +75,9 @@
/* Megs required for a full X installation. */
#define XNEEDMB 100
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/*
* Default filesets to fetch and install during installation

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.120 2009/04/04 11:03:24 ad Exp $ */
/* $NetBSD: md.c,v 1.121 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -68,7 +68,6 @@ static int mbr_root_above_chs(void);
static void md_upgrade_mbrtype(void);
static int md_read_bootcode(const char *, struct mbr_sector *);
static unsigned int get_bootmodel(void);
static char *md_bootxx_name(void);
int
@ -342,7 +341,7 @@ md_post_newfs(void)
snprintf(bootxx, sizeof bootxx, "/dev/r%s%c", diskdev, 'a' + rootpart);
td = open(bootxx, O_RDWR, 0);
bootxx_filename = md_bootxx_name();
bootxx_filename = bootxx_name();
if (bootxx_filename != NULL) {
sd = open(bootxx_filename, O_RDONLY);
free(bootxx_filename);
@ -406,7 +405,7 @@ md_check_partitions(void)
char *bootxx;
/* check we have boot code for the root partition type */
bootxx = md_bootxx_name();
bootxx = bootxx_name();
rval = access(bootxx, R_OK);
free(bootxx);
if (rval == 0)
@ -614,32 +613,6 @@ md_init_set_status(int minimal)
set_kernel_set(get_bootmodel());
}
static char *
md_bootxx_name(void)
{
int fstype;
const char *bootfs = 0;
char *bootxx;
/* check we have boot code for the root partition type */
fstype = bsdlabel[rootpart].pi_fstype;
if (fstype == FS_BSDFFS)
if (bsdlabel[rootpart].pi_flags & PIF_FFSv2)
bootfs = "ffsv2";
else
bootfs = "ffsv1";
else if (fstype == FS_BSDLFS)
bootfs = "lfsv2";
else
bootfs = mountnames[fstype];
if (bootfs == NULL)
return NULL;
asprintf(&bootxx, "/usr/mdec/bootxx_%s", bootfs);
return bootxx;
}
int
md_post_extract(void)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.65 2009/04/05 00:50:52 tsutsui Exp $ */
/* $NetBSD: md.h,v 1.66 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -54,13 +54,21 @@
#define DEFSWAPSIZE (-1)
#define DEFROOTSIZE 32
/* use UFS2 by default for ffs */
#define DEFAULT_UFS2
#define HAVE_UFS2_BOOT
/* Megs required for a full X installation. */
#define XNEEDMB 50
/* use UFS2 by default for ffs */
#define DEFAULT_UFS2
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/* have file system specific primary boot loader */
#define HAVE_BOOTXX_xFS
#define BOOTXXDIR "/usr/mdec"
#define BOOTXX_FFSV1 "bootxx_ffsv1"
#define BOOTXX_FFSV2 "bootxx_ffsv2"
/*
* Default filesets to fetch and install during installation
* or upgrade. The standard sets are:

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.de,v 1.15 2008/04/30 15:29:11 ad Exp $ */
/* $NetBSD: msg.md.de,v 1.16 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -74,8 +74,6 @@ message Use_serial_com3 {Serieller Anschluss com3 benutzen}
message serial_baud_rate {Serielle baud Rate}
message Use_existing_bootblocks {Vorhandene Bootblöcke benutzen}
message No_Bootcode {Kein Bootcode für die Rootpartition vorhanden}
message dobootblks
{Installiere die Bootblöcke auf %s ...
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.en,v 1.57 2008/04/30 15:29:11 ad Exp $ */
/* $NetBSD: msg.md.en,v 1.58 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -73,8 +73,6 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Set serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks}
message No_Bootcode {No bootcode for root partition}
message dobootblks
{Installing boot blocks on %s....
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.es,v 1.10 2008/04/30 15:29:11 ad Exp $ */
/* $NetBSD: msg.md.es,v 1.11 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -73,8 +73,6 @@ message Use_serial_com3 {Usar puerto serie com3}
message serial_baud_rate {Baudios puerto serie}
message Use_existing_bootblocks {Usar bootblocks existente}
message No_Bootcode {No hay código de arranque para la partición root}
message dobootblks
{Instalando bloques de arranque en %s....
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.fr,v 1.47 2008/04/30 15:29:11 ad Exp $ */
/* $NetBSD: msg.md.fr,v 1.48 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -69,8 +69,6 @@ message Use_serial_com3 {port s
message serial_baud_rate {Vitesse du port série}
message Use_existing_bootblocks {Conserver le programme de démarrage existant}
message No_Bootcode {Pas de programme de démarrage pour la partition racine}
message dobootblks
{Installation programme de démarrage sur %s ...
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.pl,v 1.30 2008/04/30 15:29:11 ad Exp $ */
/* $NetBSD: msg.md.pl,v 1.31 2009/04/07 10:45:05 tsutsui Exp $ */
/* Based on english version: */
/* NetBSD: msg.md.en,v 1.24 2001/01/27 07:34:39 jmc Exp */
@ -71,8 +71,6 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks}
message No_Bootcode {No bootcode for root partition}
message dobootblks
{Instalowanie bootblokow na %s....
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.16 2006/02/26 10:25:53 dsl Exp $ */
/* $NetBSD: md.h,v 1.17 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -51,6 +51,9 @@
/* Megs required for a full X installation. */
#define XNEEDMB 35 /* XXXTHORPEJ */
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/*
* Default filesets to fetch and install during installation
* or upgrade.

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.23 2007/11/12 15:07:36 jmmv Exp $ */
/* $NetBSD: md.h,v 1.24 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -58,6 +58,9 @@
#define DEFUSRSIZE 120 /* Default /usr size, if /home */
#define XNEEDMB 100 /* Extra megs for full X installation */
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/*
* Machine-specific command to write a new label to a disk.
* If not defined, we assume the port does not support disklabels and

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.23 2006/08/11 13:35:54 hubertf Exp $ */
/* $NetBSD: md.h,v 1.24 2009/04/07 10:45:05 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -56,6 +56,9 @@
#define DEFUSRSIZE 100 /* Default /usr size, if /home */
#define XNEEDMB 35 /* Extra megs for full X installation */
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/*
* Default filesets to fetch and install during installation
* or upgrade.

View File

@ -1,4 +1,4 @@
/* $NetBSD: bsddisklabel.c,v 1.50 2009/04/05 00:50:51 tsutsui Exp $ */
/* $NetBSD: bsddisklabel.c,v 1.51 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -56,6 +56,8 @@
#include "msg_defs.h"
#include "menu_defs.h"
static int check_partitions(void);
/* For the current state of this file blame abs@NetBSD.org */
/* Even though he wasn't the last to hack it, but he did admit doing so :-) */
@ -704,7 +706,7 @@ make_bsd_partitions(void)
msg_display(MSG_abort);
return 0;
}
if (md_check_partitions() == 0)
if (check_partitions() == 0)
goto edit_check;
/* Disk name */
@ -716,3 +718,41 @@ make_bsd_partitions(void)
/* Everything looks OK. */
return (1);
}
/*
* check that there is at least a / somewhere.
*/
static int
check_partitions(void)
{
#ifdef HAVE_BOOTXX_xFS
int rv;
char *bootxx;
#endif
#ifndef HAVE_UFS2_BOOT
int fstype;
#endif
#ifdef HAVE_BOOTXX_xFS
/* check if we have boot code for the root partition type */
bootxx = bootxx_name();
if (bootxx != NULL) {
rv = access(bootxx, R_OK);
free(bootxx);
}
if (bootxx == NULL || rv != 0) {
process_menu(MENU_ok, deconst(MSG_No_Bootcode));
return 0;
}
#endif
#ifndef HAVE_UFS2_BOOT
fstype = bsdlabel[rootpart].pi_fstype;
if (fstype == FS_BSDFFS &&
(bsdlabel[rootpart].pi_flags & PIF_FFSv2) != 0) {
process_menu(MENU_ok, deconst(MSG_cannot_ufs2_root));
return 0;
}
#endif
return md_check_partitions();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.141 2009/04/05 02:18:41 tsutsui Exp $ */
/* $NetBSD: defs.h,v 1.142 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -339,6 +339,7 @@ int make_fstab(void);
int mount_disks(void);
int set_swap(const char *, partinfo *);
int check_swap(const char *, int);
char *bootxx_name(void);
/* from disks_lfs.c */
int fs_is_lfs(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.103 2009/02/23 23:12:24 ad Exp $ */
/* $NetBSD: disks.c,v 1.104 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -823,3 +823,49 @@ check_swap(const char *disk, int remove_swap)
rval = -1;
goto done;
}
#ifdef HAVE_BOOTXX_xFS
char *
bootxx_name(void)
{
int fstype;
const char *bootxxname;
char *bootxx;
/* check we have boot code for the root partition type */
fstype = bsdlabel[rootpart].pi_fstype;
switch (fstype) {
#if defined(BOOTXX_FFSV1) || defined(BOOTXX_FFSV2)
case FS_BSDFFS:
if (bsdlabel[rootpart].pi_flags & PIF_FFSv2) {
#ifdef BOOTXX_FFSV2
bootxxname = BOOTXX_FFSV2;
#else
bootxxname = NULL;
#endif
} else {
#ifdef BOOTXX_FFSV1
bootxxname = BOOTXX_FFSV1;
#else
bootxxname = NULL;
#endif
}
break;
#endif
#ifdef BOOTXX_LFS
case FS_BSDLFS:
bootxxname = BOOTXX_LFS;
break;
#endif
default:
bootxxname = NULL;
break;
}
if (bootxxname == NULL)
return NULL;
asprintf(&bootxx, "%s/%s", BOOTXXDIR, bootxxname);
return bootxx;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.de,v 1.47 2009/01/28 16:31:49 martin Exp $ */
/* $NetBSD: msg.mi.de,v 1.48 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -845,6 +845,13 @@ message must_be_one_root
message partitions_overlap
{Die Partitionen %c und %c überlappen sich.}
message No_Bootcode
{Kein Bootcode für die Rootpartition vorhanden}
message cannot_ufs2_root
{Leider existiert für diese Maschine kein Bootloader für FFSv2 Dateisysteme,
daher kann das Root-Dateisystem nicht im FFSv2 Format angelegt werden.}
message edit_partitions_again
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.en,v 1.152 2008/12/21 11:02:42 martin Exp $ */
/* $NetBSD: msg.mi.en,v 1.153 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -787,6 +787,13 @@ message must_be_one_root
message partitions_overlap
{partitions %c and %c overlap.}
message No_Bootcode
{No bootcode for root partition}
message cannot_ufs2_root
{Sorry, the root file system can't be FFSv2 due to lack of bootloader support
on this port.}
message edit_partitions_again
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.es,v 1.24 2009/01/28 16:31:49 martin Exp $ */
/* $NetBSD: msg.mi.es,v 1.25 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -812,6 +812,13 @@ message must_be_one_root
message partitions_overlap
{las particiones %c y %c se solapan.}
message No_Bootcode
{No hay código de arranque para la partición root}
message cannot_ufs2_root
{Sorry, the root file system can't be FFSv2 due to lack of bootloader support
on this port.}
message edit_partitions_again
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.fr,v 1.104 2009/01/28 16:31:49 martin Exp $ */
/* $NetBSD: msg.mi.fr,v 1.105 2009/04/07 10:45:04 tsutsui Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -865,6 +865,13 @@ Une seule partition peut
message partitions_overlap
{Les partitions %c et %c se recouvrent.}
message No_Bootcode
{Pas de programme de démarrage pour la partition racine}
message cannot_ufs2_root
{Sorry, the root file system can't be FFSv2 due to lack of bootloader support
on this port.}
message edit_partitions_again
{
Vous pouvez éditer la table de partitions à la main, ou abandonner et

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.pl,v 1.63 2009/01/28 16:31:49 martin Exp $ */
/* $NetBSD: msg.mi.pl,v 1.64 2009/04/07 10:45:04 tsutsui Exp $ */
/* Based on english version: */
/* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */
@ -785,6 +785,13 @@ message must_be_one_root
message partitions_overlap
{partycje %c i %c pokrycia.}
message No_Bootcode
{No bootcode for root partition}
message cannot_ufs2_root
{Sorry, the root file system can't be FFSv2 due to lack of bootloader support
on this port.}
message edit_partitions_again
{