Add annoyingly verbose comments to pmax md.c and md.h, to serve as

documentation for porting to more hosts.

Define DISKLABEL_CMD in MD code.
CAVS: ----------------------------------------------------------------------
This commit is contained in:
jonathan 1997-11-07 08:43:46 +00:00
parent 27ccca6ffd
commit cb086002a9
2 changed files with 119 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.7 1997/11/02 08:16:39 jonathan Exp $ */
/* $NetBSD: md.c,v 1.8 1997/11/07 08:43:46 jonathan Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -100,27 +100,27 @@ int md_get_info (void)
return 1;
}
/*
* hook called before editing new disklabel.
*/
void md_pre_disklabel (void)
{
}
/*
* hook called after writing disklabel to new target disk.
*/
void md_post_disklabel (void)
{
}
void md_post_newfs (void)
{
/* XXX boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev);
run_prog_or_continue("/sbin/disklabel -B %s /dev/r%sc",
"-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev);
}
void md_copy_filesystem (void)
{
}
void md_make_bsd_partitions (void)
/*
* md back-end code for menu-driven BSD disklabel editor.
*/
void md_make_bsd_partitions (void)
{
FILE *f;
int i, part;
@ -335,16 +335,71 @@ void md_make_bsd_partitions (void)
}
/*
* md_copy_filesystem() -- MD hook called after the target
* disk's filesystems are newfs'ed (install) or /fsck'ed (upgrade)
* and mounted.
* Gives MD code an opportunity to copy data from the install-tools
* boot disk to the target disk. (e.g., on i386, put a copy of the
* complete install ramdisk onto the hard disk, so it's at least
* minimally bootable.)
*
* On pmax, we're probably running off a release diskimage.
* Copy the diskimage to the target disk, since it's probably
* the same as the install sets and it makes the target bootable
* to standalone. But don't do anything if the target is
* already the current root: we'd clobber the files we're trying to copy.
*/
void md_copy_filesystem (void)
{
if (target_already_root()) {
return;
}
/* Copy the instbin(s) to the disk. */
printf ("%s", msg_string(MSG_dotar));
run_prog ("tar --one-file-system -cf - / |"
"(cd /mnt ; tar --unlink -xpf - )");
#if 0
/* pmax diskimage does not yet have a .hdprofile. */
run_prog ("/bin/cp /tmp/.hdprofile /mnt/.profile");
#endif
}
/*
* MD hook called after upgrade() or install() hasve finished the
* setting up the target disk but immediately before the user is
* given thte ``disks are now set up'' message, that if power fails,
* they can continue installation by booting the target disk and
* doing an `upgrade'.
*
* On pmax, this is a convenient place to write up-to-date bootblocks
* to the target root filesystem.
*/
void md_post_newfs (void)
{
/* XXX boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev);
run_prog_or_continue("/sbin/disklabel -B %s /dev/r%sc",
"-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev);
}
/* Upgrade support */
int
md_update(void)
{
#ifdef notyet /* stolen from i386 -- untested */
/* stolen from i386 -- untested */
endwin();
md_copy_filesystem ();
md_post_newfs();
puts (CL);
wrefresh(stdscr);
#endif
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.5 1997/11/02 08:15:02 jonathan Exp $ */
/* $NetBSD: md.h,v 1.6 1997/11/07 08:43:49 jonathan Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -40,20 +40,55 @@
/* Constants and defines */
/* Megs required for a full X installation. */
/*
* Megabytes of disk required for a full X installation.
* XXX is this swap space or additional space in /usr required
* to hold X binaries?
* For now, we set it to 100 on the pmax.
*/
#define XNEEDMB 100
/* Disk names. */
/*
* Disk names accepted as valid targets for a from-scratch installation.
*
* On the pmax, we accept the current 'rz' driver and also accept
* 'sd' in case this release of sysinst gets used after we switch to
* the MI scsi code.
*/
EXTERN char *disk_names[]
#ifdef MAIN
= {"rz", "sd", NULL}
#endif
;
/* Legal start character for a disk for checking input. */
/*
* Legal start character for a disk for checking input.
* this must return 1 for a character that matches the first
* characters of each member of disk_names.
*/
#define ISDISKSTART(dn) (dn == 'r' || dn == 's')
/* Definition of files to retreive from ftp. */
/*
* Machine-specific command to write a new label to a disk.
* For example, i386 uses "/sbin/disklabel -w -r", just like i386
* miniroot scripts, though this may leave a bogus incore label.
* Sun ports should probably use DISKLABEL_CMD "/sbin/disklabel -w"
* to get incore to ondisk inode translation for the Sun proms.
* If not defined, we assume the port does not support disklabels and
* hand-edited disklabel will NOT be written by MI code.
*
* On pmax, we just use do the same as the i386 until we find
* a reason to switch to disklabel -w -r.
*/
#define DISKLABEL_CMD "disklabel -w -r"
/*
* Default filesets to fetch and install during installation
* or upgrade. The standard sets are:
* base, etc, comp, games, man, misc, text,
* xbase, xfont, xserver, xcontrib, xcomp.
*/
EXTERN char ftp_prefix[STRSIZE] INIT("/binary/Tarfiles");
EXTERN char dist_postfix[STRSIZE] INIT(".tar.gz");
EXTERN distinfo dist_list[]
@ -68,7 +103,7 @@ EXTERN distinfo dist_list[]
{"text%s%s", 1, NULL, "Text tools : "},
{"xbase%s%s", 1, NULL, "X11 clients : "},
{"xfont%s%s", 1, NULL, "X11 fonts : "},
{"xfont%s%s", 1, NULL, "X11 servers : "},
{"xserver%s%s", 1, NULL, "X11 servers : "},
{"xcontrib%s%s",1, NULL, "X11 contrib : "},
{"xcomp%s%s", 1, NULL, "X programming: "},
@ -77,4 +112,11 @@ EXTERN distinfo dist_list[]
#endif
;
/*
* Default fileystem type for floppy disks.
*
* On pmax, we don't support a dedicated floppy-disk driver, only
* SCSI floppy drives, so we can't recognize floppies by name.
*/
EXTERN char *fdtype INIT("");