Add a new hook, md_pre_mount(), that is called after preparation of

the target filesystem, but before mounting it. Use this on sparc64
to install the primary boot block, but install the secondary boot
(/ofwboot) later.
This allows sysinst to run at securelevel 1 (as long as we don't do an
upgrade install on the hard disk we booted from).
This commit is contained in:
martin 2011-11-04 11:27:00 +00:00
parent 380d04da8a
commit 7a8c1b579b
46 changed files with 319 additions and 49 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.28 2011/09/14 12:35:19 christos Exp $ */
/* $NetBSD: md.c,v 1.29 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -348,3 +348,9 @@ filecore_checksum(u_char *bootblock)
return (sum - ((sum - 1) / 255) * 255);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.50 2011/04/04 08:30:16 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.51 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -195,3 +195,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.24 2011/04/04 08:30:18 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.25 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -139,3 +139,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.35 2011/04/04 08:30:19 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.36 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -393,3 +393,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
bootsize = part[0].mbrp_size;
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.26 2011/04/04 08:30:19 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.27 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -180,3 +180,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.56 2011/08/25 15:42:33 kiyohara Exp $ */
/* $NetBSD: md.c,v 1.57 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -155,3 +155,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
{
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.23 2011/04/04 08:30:20 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.24 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -200,3 +200,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.8 2011/04/04 08:30:21 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.9 2011/11/04 11:27:01 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -412,3 +412,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
bootsize = part[0].mbrp_size;
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.3 2011/04/04 08:30:22 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.4 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -200,3 +200,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.24 2011/04/04 08:30:22 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.25 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -181,3 +181,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.8 2011/04/04 08:30:25 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.9 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997,2002 Piermont Information Systems Inc.
@ -158,3 +158,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
{
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.31 2011/04/04 08:30:26 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.32 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997,2002 Piermont Information Systems Inc.
@ -162,3 +162,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
{
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.3 2011/04/04 08:30:27 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.4 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -186,3 +186,9 @@ md_post_extract(void)
{
return 0;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.9 2011/04/04 08:30:27 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.10 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -225,3 +225,9 @@ ews4800mips_sysvbfs_size(void)
{
return (8 * 1024 * 1024) / 512; /* 8MB */
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.30 2011/04/04 08:30:28 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.31 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -245,3 +245,9 @@ hp300_boot_size(void)
return i;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.11 2011/04/04 08:30:28 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.12 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -200,3 +200,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.11 2011/06/11 11:43:23 nonaka Exp $ */
/* $NetBSD: md.c,v 1.12 2011/11/04 11:27:02 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -222,3 +222,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
{
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.47 2011/04/04 08:30:30 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.48 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -164,3 +164,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
{
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.3 2011/04/04 08:30:31 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.4 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -171,3 +171,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.128 2011/04/04 08:30:32 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.129 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -631,3 +631,9 @@ get_bootmodel(void)
return SET_KERNEL_GENERIC;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.9 2011/04/04 08:30:33 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.10 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997,2002 Piermont Information Systems Inc.
@ -181,3 +181,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2011/07/16 15:52:21 tsutsui Exp $ */
/* $NetBSD: md.c,v 1.2 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -196,3 +196,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.59 2011/04/04 08:30:34 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.60 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -1193,3 +1193,9 @@ md_debug_dump(title)
return(yesno);
}
#endif /* MD_DEBUG_SORT_MERGE */
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.44 2011/04/04 08:30:34 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.45 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -210,3 +210,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.18 2011/04/04 08:30:35 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.19 2011/11/04 11:27:03 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -196,3 +196,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.25 2011/04/04 08:30:36 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.26 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -231,3 +231,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.33 2011/07/16 23:49:10 tsutsui Exp $ */
/* $NetBSD: md.c,v 1.34 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -194,3 +194,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.20 2011/04/04 08:30:38 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.21 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -185,3 +185,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.9 2011/08/21 13:40:08 phx Exp $ */
/* $NetBSD: md.c,v 1.10 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -542,3 +542,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.65 2011/04/04 08:30:40 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.66 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -205,3 +205,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.33 2011/04/04 08:30:40 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.34 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -283,3 +283,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.36 2011/04/04 08:30:41 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.37 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -219,3 +219,9 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
{
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.27 2011/04/04 08:30:42 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.28 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -217,3 +217,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.26 2011/04/04 08:30:42 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.27 2011/11/04 11:27:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -226,3 +226,9 @@ clear_mbr(const char *disk, char *diskpath, size_t diskpathlen)
return 0;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.50 2011/04/04 08:30:43 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.51 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -193,3 +193,9 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.27 2011/04/04 08:30:44 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.28 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -53,6 +53,7 @@
#include "menu_defs.h"
static void install_bootblocks(void);
static void install_ofwboot(void);
void
md_init(void)
@ -145,6 +146,7 @@ md_pre_disklabel(void)
int
md_post_disklabel(void)
{
install_bootblocks();
return 0;
}
@ -156,7 +158,7 @@ md_post_disklabel(void)
int
md_post_newfs(void)
{
install_bootblocks();
install_ofwboot();
return 0;
}
@ -192,8 +194,26 @@ md_update(void)
static void
install_bootblocks(void)
{
/* Install boot blocks now that we have a full system ... */
/* Install boot blocks before mounting the target disk */
msg_display(MSG_dobootblks, diskdev);
run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev);
run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s", targetroot_mnt);
run_program(RUN_DISPLAY, "/usr/sbin/installboot /dev/r%sc"
" /usr/mdec/bootblk", diskdev);
}
/* install/update secondary bootstrap */
static void
install_ofwboot(void)
{
/* copy secondary bootstrap now that the target is mounted */
msg_display(MSG_doofwboot, targetroot_mnt);
run_program(RUN_DISPLAY, "/bin/cp -p /usr/mdec/ofwboot %s",
targetroot_mnt);
}
int
md_pre_mount()
{
install_bootblocks();
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.de,v 1.8 2011/04/04 08:30:44 mbalmer Exp $ */
/* $NetBSD: msg.md.de,v 1.9 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -49,6 +49,10 @@ message dobootblks
{Installiere die Bootblöcke auf %s ...
}
message doofwboot
{Installiere /ofwboot auf %s ...
}
message set_kernel_1
{Kernel (GENERIC)}
message set_kernel_2

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.en,v 1.10 2011/04/04 08:30:44 mbalmer Exp $ */
/* $NetBSD: msg.md.en,v 1.11 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -48,6 +48,10 @@ message dobootblks
{Installing boot blocks on %s....
}
message doofwboot
{Installing /ofwboot on %s....
}
message set_kernel_1
{Kernel (GENERIC)}
message set_kernel_2

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.es,v 1.8 2011/04/04 08:30:44 mbalmer Exp $ */
/* $NetBSD: msg.md.es,v 1.9 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -48,6 +48,10 @@ message dobootblks
{Instalando bloques de arranque en %s....
}
message doofwboot
{Instalando /ofwboot en %s....
}
message set_kernel_1
{Núcleo (GENERIC)}
message set_kernel_2

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.fr,v 1.11 2011/04/04 08:30:44 mbalmer Exp $ */
/* $NetBSD: msg.md.fr,v 1.12 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -48,6 +48,10 @@ message dobootblks
{Installation des blocs de démarrage sur %s ...
}
message doofwboot
{Installation des /ofwboot sur %s ...
}
message set_kernel_1
{Kernel (GENERIC)}
message set_kernel_2

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.pl,v 1.9 2011/04/04 08:30:44 mbalmer Exp $ */
/* $NetBSD: msg.md.pl,v 1.10 2011/11/04 11:27:05 martin Exp $ */
/* Based on english version: */
/* NetBSD: msg.md.en,v 1.2 2002/12/03 01:54:49 minoura Exp */
@ -50,6 +50,10 @@ message dobootblks
{Instalowanie bootblokow na %s....
}
message doofwboot
{Instalowanie /ofwboot na %s....
}
message set_kernel_1
{Kernel (GENERIC)}
message set_kernel_2

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.36 2011/04/04 08:30:44 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.37 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -189,3 +189,8 @@ md_update(void)
md_post_newfs();
return 1;
}
int
md_pre_mount()
{
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.40 2011/04/04 08:30:45 mbalmer Exp $ */
/* $NetBSD: md.c,v 1.41 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -327,3 +327,8 @@ md_newdisk(void)
"/usr/mdec/newdisk -v %s", diskdev);
}
int
md_pre_mount()
{
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.8 2011/06/11 11:43:23 nonaka Exp $ */
/* $NetBSD: md.c,v 1.9 2011/11/04 11:27:05 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -189,3 +189,8 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
return mbr_use_wholedisk(mbri);
}
int
md_pre_mount()
{
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.154 2011/06/30 20:09:15 wiz Exp $ */
/* $NetBSD: defs.h,v 1.155 2011/11/04 11:27:00 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -326,6 +326,7 @@ int md_make_bsd_partitions(void);
int md_check_partitions(void);
int md_pre_disklabel(void);
int md_post_disklabel(void);
int md_pre_mount(void);
int md_post_newfs(void);
int md_post_extract(void);
void md_cleanup_install(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.116 2011/08/21 15:06:41 phx Exp $ */
/* $NetBSD: disks.c,v 1.117 2011/11/04 11:27:00 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -628,6 +628,8 @@ make_filesystems(void)
if (error != 0)
return error;
md_pre_mount();
if (lbl->pi_flags & PIF_MOUNT && mnt_opts != NULL) {
make_target_dir(lbl->pi_mount);
error = target_mount(mnt_opts, diskdev, ptn,
@ -919,6 +921,8 @@ mount_root(void)
if (error != 0)
return error;
md_pre_mount();
/* Mount /dev/<diskdev>a on target's "".
* If we pass "" as mount-on, Prefixing will DTRT.
* for now, use no options.