From 1e785c32c4fe071ddfa01d7f5ae7669879adcb68 Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 25 Nov 1997 20:34:59 +0000 Subject: [PATCH] Reworked partitioning issues for i386, closes PRs 4520, 4534, 4536. Other tweeks to make install better. --- distrib/utils/sysinst/TODO | 6 -- distrib/utils/sysinst/arch/i386/fdisk.c | 26 ++++- distrib/utils/sysinst/arch/i386/md.c | 103 +++++++++---------- distrib/utils/sysinst/arch/i386/md.h | 10 +- distrib/utils/sysinst/arch/i386/menus.md.eng | 9 +- distrib/utils/sysinst/arch/i386/msg.md.eng | 27 ++--- distrib/utils/sysinst/fdisk.c | 26 ++++- distrib/utils/sysinst/mbr.c | 26 ++++- distrib/utils/sysinst/menus.mi.eng | 4 +- distrib/utils/sysinst/target.c | 5 +- 10 files changed, 139 insertions(+), 103 deletions(-) diff --git a/distrib/utils/sysinst/TODO b/distrib/utils/sysinst/TODO index 3026677f5391..300993ca25aa 100644 --- a/distrib/utils/sysinst/TODO +++ b/distrib/utils/sysinst/TODO @@ -7,8 +7,6 @@ Things we should try and do before 1.3 release.... jump back to disklabel edit if any overlaps found. needs to skip getrawpartition() (and c on i386). - -- Allow ^L to redraw the screen to get rid of error messages. - -- Also on error messages, do something to allow the user to see any errors from anything run by run_prog(). Ideas are: @@ -46,8 +44,6 @@ Things we should try and do before 1.3 release.... distribution set from. Maybe just allowing the user to shell out and look around is good enough (this needs more thought). - -- Trap SIGINT and restore tty setting on exit. - -- check for already-mouned fileystems before install newfs. Abort with message. @@ -106,7 +102,6 @@ Things to do .... -- check for disklabel edits changing active root partition. reject. - -- remove any possibly-stale ld.so.cache files from the target /etc after unpacking sets. Maybe just don't copy ld.so.cache from /etc.old? @@ -118,7 +113,6 @@ Things to do .... on the disk, maybe use that intsead of the compiled-in default label? - -- symlinks for /tmp (/tmp -> /var/tmp or some such) Or configure tmp on mfs. diff --git a/distrib/utils/sysinst/arch/i386/fdisk.c b/distrib/utils/sysinst/arch/i386/fdisk.c index f014b21c7d17..b490c9eb11b9 100644 --- a/distrib/utils/sysinst/arch/i386/fdisk.c +++ b/distrib/utils/sysinst/arch/i386/fdisk.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdisk.c,v 1.2 1997/10/17 21:10:56 phil Exp $ */ +/* $NetBSD: fdisk.c,v 1.3 1997/11/25 20:35:05 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -55,19 +55,19 @@ struct lookfor fdiskbuf[] = { {"PART0ID", "PART0ID=%d", "a $0", &part[0][ID], NULL}, {"PART0SIZE", "PART0SIZE=%d", "a $0", &part[0][SIZE], NULL}, {"PART0START", "PART0START=%d", "a $0", &part[0][START], NULL}, - {"PART0FLAG", "PART0FLAG=%d", "a $0", &part[0][FLAG], NULL}, + {"PART0FLAG", "PART0FLAG=0x%d", "a $0", &part[0][FLAG], NULL}, {"PART1ID", "PART1ID=%d", "a $0", &part[1][ID], NULL}, {"PART1SIZE", "PART1SIZE=%d", "a $0", &part[1][SIZE], NULL}, {"PART1START", "PART1START=%d", "a $0", &part[1][START], NULL}, - {"PART1FLAG", "PART1FLAG=%d", "a $0", &part[1][FLAG], NULL}, + {"PART1FLAG", "PART1FLAG=0x%d", "a $0", &part[1][FLAG], NULL}, {"PART2ID", "PART2ID=%d", "a $0", &part[2][ID], NULL}, {"PART2SIZE", "PART2SIZE=%d", "a $0", &part[2][SIZE], NULL}, {"PART2START", "PART2START=%d", "a $0", &part[2][START], NULL}, - {"PART2FLAG", "PART2FLAG=%d", "a $0", &part[2][FLAG], NULL}, + {"PART2FLAG", "PART2FLAG=0x%d", "a $0", &part[2][FLAG], NULL}, {"PART3ID", "PART3ID=%d", "a $0", &part[3][ID], NULL}, {"PART3SIZE", "PART3SIZE=%d", "a $0", &part[3][SIZE], NULL}, {"PART3START", "PART3START=%d", "a $0", &part[3][START], NULL}, - {"PART3FLAG", "PART3FLAG=%d", "a $0", &part[3][FLAG], NULL} + {"PART3FLAG", "PART3FLAG=0x%d", "a $0", &part[3][FLAG], NULL} }; int numfdiskbuf = sizeof(fdiskbuf) / sizeof(struct lookfor); @@ -158,6 +158,7 @@ void get_fdisk_info (void) { char *textbuf; int textsize; + int t1, t2; /* Get Fdisk information */ textsize = collect (T_OUTPUT, &textbuf, @@ -169,5 +170,20 @@ void get_fdisk_info (void) } walk (textbuf, textsize, fdiskbuf, numfdiskbuf); free (textbuf); + + /* A common failure of fdisk is to get the number of cylinders + wrong and the number of sectors and heads right. This makes + a disk look very big. In this case, we can just recompute + the number of cylinders and things should work just fine. */ + + if (bcyl > 1023 && bsec < 64) { + t1 = disk->geom[0] * disk->geom[1] * disk->geom[2]; + t2 = bhead * bsec; + if (bcyl * t2 > t1) { + t2 = t1 / t2; + if (t2 < 1024) + bcyl = t2; + } + } } diff --git a/distrib/utils/sysinst/arch/i386/md.c b/distrib/utils/sysinst/arch/i386/md.c index 77ed13988533..4e9068a763c2 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.6 1997/11/09 16:07:56 phil Exp $ */ +/* $NetBSD: md.c,v 1.7 1997/11/25 20:35:07 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -51,10 +51,18 @@ int md_get_info() int i, j; get_fdisk_info (); + /* Check fdisk information */ + if (bsec <= 0 || bcyl <= 0 || bsec <= 0 || bcyl > 1024 || bsec > 63) + process_menu (MENU_biosgeom); + /* Ask about disk type ... */ if (strncmp(disk->name, "wd", 2) == 0) { process_menu (MENU_wdtype); disktype = "ST506"; + /* Check against disk geometry. */ + if (disk->geom[0] != dlcyl || disk->geom[1] != dlhead + || disk->geom[2] != dlsec) + process_menu (MENU_dlgeom); } else { disktype = "SCSI"; if (disk->geom[0]*disk->geom[1]*disk->geom[2] != disk->geom[4]) @@ -65,14 +73,6 @@ int md_get_info() process_menu (MENU_scsigeom2); } - /* Check against disk geometry. */ - if (disk->geom[0] != dlcyl || disk->geom[1] != dlhead - || disk->geom[2] != dlsec) - process_menu (MENU_dlgeom); - - /* Check fdisk information */ - if (bsec <= 0 || bcyl <= 0 || bsec <= 0 || bcyl > 1024 || bsec > 63) - process_menu (MENU_biosgeom); /* Compute the full sizes ... */ dlcylsize = dlhead*dlsec; @@ -87,10 +87,10 @@ int md_get_info() /* DOS fdisk label checking and value setting. */ if (usefull) { /* Ask if we really want to blow away non-BSD stuff */ - if (!(part[0][ID] == 0 || part[0][ID] == 165 || - part[1][ID] == 0 || part[1][ID] == 165 || - part[2][ID] == 0 || part[2][ID] == 165 || - part[3][ID] == 0 || part[3][ID] == 165)) { + if ((part[0][ID] != 0 && part[0][ID] != 165) || + (part[1][ID] != 0 && part[1][ID] != 165) || + (part[2][ID] != 0 && part[2][ID] != 165) || + (part[3][ID] != 0 && part[3][ID] != 165)) { msg_display (MSG_ovrwrite); process_menu (MENU_noyes); if (!yesno) { @@ -100,12 +100,16 @@ int md_get_info() } /* Set the partition information for full disk usage. */ part[0][ID] = part[0][SIZE] = 0; + part[0][SET] = 1; part[1][ID] = part[1][SIZE] = 0; + part[1][SET] = 1; part[2][ID] = part[2][SIZE] = 0; + part[2][SET] = 1; part[3][ID] = 165; part[3][SIZE] = bsize - bsec; part[3][START] = bsec; part[3][FLAG] = 0x80; + part[3][SET] = 1; ptstart = bsec; ptsize = bsize - bsec; @@ -158,7 +162,7 @@ int md_get_info() ptsize = part[bsdpart][SIZE]; fsdsize = dlsize; if (ptstart + ptsize < bsize) - fsptsize = part[bsdpart][SIZE]; + fsptsize = ptsize; else fsptsize = dlsize - ptstart; fsdmb = fsdsize / MEG; @@ -186,12 +190,14 @@ void md_pre_disklabel() bcyl, bhead, bsec, diskdev); for (i=0; i<4; i++) - run_prog ("/sbin/fdisk -u -f -%d -s %d/%d/%d /dev/r%sd", - i, part[i][ID], part[i][START], part[i][SIZE], - diskdev); + if (part[i][SET]) + run_prog("/sbin/fdisk -u -f -%d -s %d/%d/%d /dev/r%sd", + i, part[i][ID], part[i][START], + part[i][SIZE], diskdev); if (activepart >= 0) - run_prog ("/sbin/fdisk -a -%d -f", activepart); + run_prog ("/sbin/fdisk -a -%d -f /dev/r%s", + activepart, diskdev); } @@ -258,7 +264,7 @@ void md_make_bsd_partitions (void) /* Standard fstypes */ bsdlabel[A][D_FSTYPE] = T_42BSD; bsdlabel[B][D_FSTYPE] = T_SWAP; - bsdlabel[E][D_FSTYPE] = T_42BSD; + bsdlabel[E][D_FSTYPE] = T_UNUSED; bsdlabel[F][D_FSTYPE] = T_UNUSED; bsdlabel[G][D_FSTYPE] = T_UNUSED; bsdlabel[H][D_FSTYPE] = T_UNUSED; @@ -289,7 +295,7 @@ void md_make_bsd_partitions (void) partstart += partsize; /* /usr */ - partsize = fsdsize - partstart; + partsize = fsptsize - (partstart - ptstart); bsdlabel[E][D_OFFSET] = partstart; bsdlabel[E][D_SIZE] = partsize; bsdlabel[E][D_BSIZE] = 8192; @@ -303,9 +309,10 @@ void md_make_bsd_partitions (void) case 3: /* custom: ask user for all sizes */ ask_sizemult(); - /* root */ partstart = ptstart; - remain = fsdsize - partstart; + remain = fsptsize; + + /* root */ i = NUMSEC(20+2*rammb, MEG/sectorsize, dlcylsize) + partstart; partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize, dlcylsize) - partstart; @@ -319,9 +326,9 @@ void md_make_bsd_partitions (void) bsdlabel[A][D_FSIZE] = 1024; strcpy (fsmount[A], "/"); partstart += partsize; + remain -= partsize; /* swap */ - remain = fsdsize - partstart; i = NUMSEC( 2 * (rammb < 16 ? 16 : rammb), MEG/sectorsize, dlcylsize) + partstart; partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize, @@ -333,46 +340,34 @@ void md_make_bsd_partitions (void) bsdlabel[B][D_OFFSET] = partstart; bsdlabel[B][D_SIZE] = partsize; partstart += partsize; + remain -= partsize; - /* /usr */ - remain = fsdsize - partstart; - partsize = fsdsize - partstart; - snprintf (isize, 20, "%d", partsize/sizemult); - msg_prompt_add (MSG_askfsusr, isize, isize, 20, - remain/sizemult, multname); - partsize = NUMSEC(atoi(isize),sizemult, dlcylsize); - if (remain - partsize < sizemult) - partsize = remain; - bsdlabel[E][D_OFFSET] = partstart; - bsdlabel[E][D_SIZE] = partsize; - bsdlabel[E][D_BSIZE] = 8192; - bsdlabel[E][D_FSIZE] = 1024; - strcpy (fsmount[E], "/usr"); - partstart += partsize; - - /* Others ... */ - remain = fsdsize - partstart; - part = F; + /* Others E, F, G, H */ + part = E; if (remain > 0) msg_display (MSG_otherparts); while (remain > 0 && part <= H) { - partsize = fsdsize - partstart; + partsize = remain; snprintf (isize, 20, "%d", partsize/sizemult); msg_prompt_add (MSG_askfspart, isize, isize, 20, diskdev, partname[part], remain/sizemult, multname); partsize = NUMSEC(atoi(isize),sizemult, dlcylsize); - if (remain - partsize < sizemult) - partsize = remain; - bsdlabel[part][D_FSTYPE] = T_42BSD; - bsdlabel[part][D_OFFSET] = partstart; - bsdlabel[part][D_SIZE] = partsize; - bsdlabel[part][D_BSIZE] = 8192; - bsdlabel[part][D_FSIZE] = 1024; - msg_prompt_add (MSG_mountpoint, NULL, - fsmount[part], 20); - partstart += partsize; - remain = fsdsize - partstart; + if (partsize > 0) { + if (remain - partsize < sizemult) + partsize = remain; + bsdlabel[part][D_FSTYPE] = T_42BSD; + bsdlabel[part][D_OFFSET] = partstart; + bsdlabel[part][D_SIZE] = partsize; + bsdlabel[part][D_BSIZE] = 8192; + bsdlabel[part][D_FSIZE] = 1024; + if (part == E) + strcpy (fsmount[E], "/usr"); + msg_prompt_add (MSG_mountpoint, fsmount[part], + fsmount[part], 20); + partstart += partsize; + remain -= partsize; + } part++; } diff --git a/distrib/utils/sysinst/arch/i386/md.h b/distrib/utils/sysinst/arch/i386/md.h index 65471be1a8c2..94d4966b2575 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.7 1997/11/25 06:53:19 thorpej Exp $ */ +/* $NetBSD: md.h,v 1.8 1997/11/25 20:35:08 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -47,8 +47,8 @@ EXTERN int bcyl, bhead, bsec, bsize, bcylsize; EXTERN int bstuffset INIT(0); -enum info {ID,SIZE,START,FLAG}; -EXTERN int part[4][4] INIT({{0}}); +enum info {ID,SIZE,START,FLAG,SET}; +EXTERN int part[4][5] INIT({{0}}); EXTERN int activepart; EXTERN int bsdpart; EXTERN int usefull; @@ -61,6 +61,9 @@ EXTERN int usefull; * * i386 has the MD set kern first, because generic kernels are too * big to fit on install floppies. i386 does not yet include the x sets. + * + * Third entry is the last extension name in the split sets for loading + * from floppy. */ EXTERN distinfo dist_list[] #ifdef MAIN @@ -121,7 +124,6 @@ EXTERN char *fdtype INIT("msdos"); - /* * prototypes for MD code. */ diff --git a/distrib/utils/sysinst/arch/i386/menus.md.eng b/distrib/utils/sysinst/arch/i386/menus.md.eng index 67a507441df5..bb7a9dd2da69 100644 --- a/distrib/utils/sysinst/arch/i386/menus.md.eng +++ b/distrib/utils/sysinst/arch/i386/menus.md.eng @@ -1,4 +1,4 @@ -/* $NetBSD: menus.md.eng,v 1.7 1997/11/13 04:23:41 simonb Exp $ */ +/* $NetBSD: menus.md.eng,v 1.8 1997/11/25 20:35:10 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -79,8 +79,8 @@ menu biosgeom, title " Choose an option", y=16; display action { msg_display (MSG_biosgeom, diskdev); disp_cur_geom (); }; - option "Abort install, halt machine", - action (endwin) { system ("/sbin/halt"); exit(1); }; + option "Abort install", + action (endwin) { exit(1); }; option "Enter geometry", action { msg_clear(); set_fdisk_geom(); }, next menu confirmbios; @@ -112,6 +112,8 @@ menu editparttable, title " Choose your partition", exit; action { editpart = 2; }; option "Edit partition 3", sub menu editpart, action { editpart = 3; }; + option "Reselect size specification", + action { reask_sizemult(); }; menu editpart, title " Select to change"; display action { msg_display (MSG_editpart, editpart); @@ -137,6 +139,7 @@ menu editpart, title " Select to change"; } part[editpart][START] = start; part[editpart][SIZE] = size; + part[editpart][SET] = 1; }; option "Set active", action { activepart = editpart; }; option "Partition OK", exit; diff --git a/distrib/utils/sysinst/arch/i386/msg.md.eng b/distrib/utils/sysinst/arch/i386/msg.md.eng index cc2f42d6cf7e..5e95a4d7c3b1 100644 --- a/distrib/utils/sysinst/arch/i386/msg.md.eng +++ b/distrib/utils/sysinst/arch/i386/msg.md.eng @@ -1,4 +1,4 @@ -/* $NetBSD: msg.md.eng,v 1.2 1997/10/17 21:11:02 phil Exp $ */ +/* $NetBSD: msg.md.eng,v 1.3 1997/11/25 20:35:11 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -60,16 +60,16 @@ real geom: %d cylinders, %d heads, %d sectors } message biosgeom -{It appears that your disk, %s, did not have a FDISK label on the disk. -NetBSD is using the true geometry which is incompatible with the -BIOS. This install program gets the BIOS fake geometry of your disk -by reading the FDISK label. Your options are: - -- Abort the install, have DOS/Windows/? put on a FDISK label - -- Choose your own gemoetry and then tell the BIOS about it - -- Find out what the BIOS uses and set it +{It appears that your disk, %s, did not have a valid Master Boot +Record (MBR). That is, NetBSD is using a geometry which is +incompatible with the BIOS. This "sysinst" program gets the BIOS +fake geometry of your disk by reading the MBR. Your options are: + -- Abort the install and initialize the MBR from some other OS + -- Enter the BIOS fake geometry and sysinst will initialize the MBR -Note: Entering new geometry will cause this program to initialize your -master boot record. +WARNING: Entering new geometry will cause this program to initialize +your master boot record (MBR) and destroy any boot program you may +have installed. } @@ -143,7 +143,7 @@ message dobootblks } message askfsroot -{I will be asking for partition sizes and on some, mount points. +{I will be asking for partition information. First the root partition. You have %d %s left on your disk. Root partition size? } @@ -153,11 +153,6 @@ message askfsswap Next the swap partition. You have %d %s left on your disk. Swap partition size? } -message askfsusr -{ -Next the /usr partition. You have %d %s left on your disk. -/usr partition size? } - message otherparts {You still have some space remaining unallocated on your disk. Please give sizes and mount points for the following partitions. diff --git a/distrib/utils/sysinst/fdisk.c b/distrib/utils/sysinst/fdisk.c index f014b21c7d17..b490c9eb11b9 100644 --- a/distrib/utils/sysinst/fdisk.c +++ b/distrib/utils/sysinst/fdisk.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdisk.c,v 1.2 1997/10/17 21:10:56 phil Exp $ */ +/* $NetBSD: fdisk.c,v 1.3 1997/11/25 20:35:05 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -55,19 +55,19 @@ struct lookfor fdiskbuf[] = { {"PART0ID", "PART0ID=%d", "a $0", &part[0][ID], NULL}, {"PART0SIZE", "PART0SIZE=%d", "a $0", &part[0][SIZE], NULL}, {"PART0START", "PART0START=%d", "a $0", &part[0][START], NULL}, - {"PART0FLAG", "PART0FLAG=%d", "a $0", &part[0][FLAG], NULL}, + {"PART0FLAG", "PART0FLAG=0x%d", "a $0", &part[0][FLAG], NULL}, {"PART1ID", "PART1ID=%d", "a $0", &part[1][ID], NULL}, {"PART1SIZE", "PART1SIZE=%d", "a $0", &part[1][SIZE], NULL}, {"PART1START", "PART1START=%d", "a $0", &part[1][START], NULL}, - {"PART1FLAG", "PART1FLAG=%d", "a $0", &part[1][FLAG], NULL}, + {"PART1FLAG", "PART1FLAG=0x%d", "a $0", &part[1][FLAG], NULL}, {"PART2ID", "PART2ID=%d", "a $0", &part[2][ID], NULL}, {"PART2SIZE", "PART2SIZE=%d", "a $0", &part[2][SIZE], NULL}, {"PART2START", "PART2START=%d", "a $0", &part[2][START], NULL}, - {"PART2FLAG", "PART2FLAG=%d", "a $0", &part[2][FLAG], NULL}, + {"PART2FLAG", "PART2FLAG=0x%d", "a $0", &part[2][FLAG], NULL}, {"PART3ID", "PART3ID=%d", "a $0", &part[3][ID], NULL}, {"PART3SIZE", "PART3SIZE=%d", "a $0", &part[3][SIZE], NULL}, {"PART3START", "PART3START=%d", "a $0", &part[3][START], NULL}, - {"PART3FLAG", "PART3FLAG=%d", "a $0", &part[3][FLAG], NULL} + {"PART3FLAG", "PART3FLAG=0x%d", "a $0", &part[3][FLAG], NULL} }; int numfdiskbuf = sizeof(fdiskbuf) / sizeof(struct lookfor); @@ -158,6 +158,7 @@ void get_fdisk_info (void) { char *textbuf; int textsize; + int t1, t2; /* Get Fdisk information */ textsize = collect (T_OUTPUT, &textbuf, @@ -169,5 +170,20 @@ void get_fdisk_info (void) } walk (textbuf, textsize, fdiskbuf, numfdiskbuf); free (textbuf); + + /* A common failure of fdisk is to get the number of cylinders + wrong and the number of sectors and heads right. This makes + a disk look very big. In this case, we can just recompute + the number of cylinders and things should work just fine. */ + + if (bcyl > 1023 && bsec < 64) { + t1 = disk->geom[0] * disk->geom[1] * disk->geom[2]; + t2 = bhead * bsec; + if (bcyl * t2 > t1) { + t2 = t1 / t2; + if (t2 < 1024) + bcyl = t2; + } + } } diff --git a/distrib/utils/sysinst/mbr.c b/distrib/utils/sysinst/mbr.c index b036528a84c0..5ff8e6330e5b 100644 --- a/distrib/utils/sysinst/mbr.c +++ b/distrib/utils/sysinst/mbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.c,v 1.2 1997/10/17 21:10:56 phil Exp $ */ +/* $NetBSD: mbr.c,v 1.3 1997/11/25 20:35:05 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -55,19 +55,19 @@ struct lookfor fdiskbuf[] = { {"PART0ID", "PART0ID=%d", "a $0", &part[0][ID], NULL}, {"PART0SIZE", "PART0SIZE=%d", "a $0", &part[0][SIZE], NULL}, {"PART0START", "PART0START=%d", "a $0", &part[0][START], NULL}, - {"PART0FLAG", "PART0FLAG=%d", "a $0", &part[0][FLAG], NULL}, + {"PART0FLAG", "PART0FLAG=0x%d", "a $0", &part[0][FLAG], NULL}, {"PART1ID", "PART1ID=%d", "a $0", &part[1][ID], NULL}, {"PART1SIZE", "PART1SIZE=%d", "a $0", &part[1][SIZE], NULL}, {"PART1START", "PART1START=%d", "a $0", &part[1][START], NULL}, - {"PART1FLAG", "PART1FLAG=%d", "a $0", &part[1][FLAG], NULL}, + {"PART1FLAG", "PART1FLAG=0x%d", "a $0", &part[1][FLAG], NULL}, {"PART2ID", "PART2ID=%d", "a $0", &part[2][ID], NULL}, {"PART2SIZE", "PART2SIZE=%d", "a $0", &part[2][SIZE], NULL}, {"PART2START", "PART2START=%d", "a $0", &part[2][START], NULL}, - {"PART2FLAG", "PART2FLAG=%d", "a $0", &part[2][FLAG], NULL}, + {"PART2FLAG", "PART2FLAG=0x%d", "a $0", &part[2][FLAG], NULL}, {"PART3ID", "PART3ID=%d", "a $0", &part[3][ID], NULL}, {"PART3SIZE", "PART3SIZE=%d", "a $0", &part[3][SIZE], NULL}, {"PART3START", "PART3START=%d", "a $0", &part[3][START], NULL}, - {"PART3FLAG", "PART3FLAG=%d", "a $0", &part[3][FLAG], NULL} + {"PART3FLAG", "PART3FLAG=0x%d", "a $0", &part[3][FLAG], NULL} }; int numfdiskbuf = sizeof(fdiskbuf) / sizeof(struct lookfor); @@ -158,6 +158,7 @@ void get_fdisk_info (void) { char *textbuf; int textsize; + int t1, t2; /* Get Fdisk information */ textsize = collect (T_OUTPUT, &textbuf, @@ -169,5 +170,20 @@ void get_fdisk_info (void) } walk (textbuf, textsize, fdiskbuf, numfdiskbuf); free (textbuf); + + /* A common failure of fdisk is to get the number of cylinders + wrong and the number of sectors and heads right. This makes + a disk look very big. In this case, we can just recompute + the number of cylinders and things should work just fine. */ + + if (bcyl > 1023 && bsec < 64) { + t1 = disk->geom[0] * disk->geom[1] * disk->geom[2]; + t2 = bhead * bsec; + if (bcyl * t2 > t1) { + t2 = t1 / t2; + if (t2 < 1024) + bcyl = t2; + } + } } diff --git a/distrib/utils/sysinst/menus.mi.eng b/distrib/utils/sysinst/menus.mi.eng index 0bbabe3a8c6a..851a646c032a 100644 --- a/distrib/utils/sysinst/menus.mi.eng +++ b/distrib/utils/sysinst/menus.mi.eng @@ -1,4 +1,4 @@ -/* $NetBSD: menus.mi.eng,v 1.13 1997/11/05 22:45:59 mhitch Exp $ */ +/* $NetBSD: menus.mi.eng,v 1.14 1997/11/25 20:35:02 phil Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -70,7 +70,7 @@ menu netbsd, title " NetBSD-@@VERSION@@ Install System"; menu utility, title " NetBSD-@@VERSION@@ Utility", exit; option "Run /bin/sh", - action (endwin) { system("/bin/sh"); puts(CL); }; + action (endwin) { system("/bin/sh"); }; option "Configure network", action { config_network(); }; /* option "Partition a disk"; XXX add later. */ diff --git a/distrib/utils/sysinst/target.c b/distrib/utils/sysinst/target.c index 0b415a2fb239..90d55df5dfba 100644 --- a/distrib/utils/sysinst/target.c +++ b/distrib/utils/sysinst/target.c @@ -1,4 +1,4 @@ -/* $NetBSD: target.c,v 1.10 1997/11/13 17:26:25 phil Exp $ */ +/* $NetBSD: target.c,v 1.11 1997/11/25 20:35:02 phil Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -37,7 +37,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: target.c,v 1.10 1997/11/13 17:26:25 phil Exp $"); +__RCSID("$NetBSD: target.c,v 1.11 1997/11/25 20:35:02 phil Exp $"); #endif @@ -96,7 +96,6 @@ void backtowin(void) getchar(); /* wait for user to press return */ - puts (CL); wrefresh(stdscr); }