Subject: misc/3142: Make install.sh smarter about disk geometry
To: None <gnats-bugs@gnats.netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: netbsd-bugs
Date: 01/26/1997 14:33:56
>Number:         3142
>Category:       misc
>Synopsis:       Make install.sh smarter about disk geometry
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 26 08:05:00 1997
>Last-Modified:
>Originator:     Hubert Feyrer
>Organization:
=============== Hubert Feyrer ============================================
      Weekdays: Rennerstr. 19, D-93053 Regensburg,  Tel. 0941/943-1333
      Weekends: Bachstr. 40,   D-84066 Mallersdorf, Tel. 08772/6084
      Internet: hubert.feyrer@rz.uni-regensburg.de == IRC: hubertf
==========================================================================
>Release:        1.2
>Environment:
	
System: NetBSD miyu 1.2 NetBSD 1.2 (MIYU) #1: Fri Dec 27 04:11:05 GMT 1996 feyrer@miyu:/disk1/src12/sys/arch/i386/compile/MIYU i386


>Description:
	When installing NetBSD, the system asks for the disk's 
	gemometry as given during system startup. Use those
	values as defaults.

>How-To-Repeat:
	Install NetBSD(/i386 V1.2). :)

>Fix:

* The patch below makes /usr/src/distrib/i386/floppies/inst/install.sh
  a bit smarter.
* As /kern/msgbuf is referenced earlier in install.sh, i give 
  it is mounted during installtion.
* Having no "head" command on the install disk, i use sed. (2nd -e)
* I haven't tried this out with an actual installation, but it
  did figure out the values for the disks i use.


*** install.sh-1.2	Sun Jan 26 13:35:37 1997
--- install.sh	Sun Jan 26 14:23:20 1997
***************
*** 180,199 ****
  echo	"You will now enter the disk geometry information"
  echo	""
  
! echo -n	"Number of bytes per disk sector? [512] "
! getresp 512
  bytes_per_sect="$resp"
  
! echo -n "Number of disk cylinders? "
! getresp
  cyls_per_disk="$resp"
  
! echo -n	"Number of disk tracks (heads) per disk cylinder? "
! getresp
  tracks_per_cyl="$resp"
  
! echo -n	"Number of disk sectors per disk track? "
! getresp
  sects_per_track="$resp"
  
  cylindersize=`expr $sects_per_track \* $tracks_per_cyl`
--- 180,211 ----
  echo	"You will now enter the disk geometry information"
  echo	""
  
! bytes_per_sect=`cat /kern/msgbuf \
! 	         | sed -n -e /^${drivename}:/p -e /^${drivename}:/q \
! 	         | awk '{ print $9 }'`
! echo -n	"Number of bytes per disk sector? [$bytes_per_sect] "
! getresp $bytes_per_sect
  bytes_per_sect="$resp"
  
! cyls_per_disk=`cat /kern/msgbuf \
! 	       | sed -n -e /^${drivename}:/p -e /^${drivename}:/q \
! 	       | awk '{ print $3 }'`
! echo -n "Number of disk cylinders? [$cyls_per_disk]"
! getresp $cyls_per_disk
  cyls_per_disk="$resp"
  
! tracks_per_cyl=`cat /kern/msgbuf \
! 	        | sed -n -e /^${drivename}:/p -e /^${drivename}:/q \
! 	        | awk '{ print $5 }'`
! echo -n	"Number of disk tracks (heads) per disk cylinder? [$tracks_per_cyl]"
! getresp $tracks_per_cyl
  tracks_per_cyl="$resp"
  
! sects_per_track=`cat /kern/msgbuf \
! 	         | sed -n -e /^${drivename}:/p -e /^${drivename}:/q \
! 	         | awk '{ print $7 }'`
! echo -n	"Number of disk sectors per disk track? [$sects_per_track]"
! getresp $sects_per_track
  sects_per_track="$resp"
  
  cylindersize=`expr $sects_per_track \* $tracks_per_cyl`
>Audit-Trail:
>Unformatted: