Subject: Re: restorecd, fdisk problems on cobalt
To: None <port-cobalt@netbsd.org>
From: Eric Auge <eau@phear.org>
List: port-cobalt
Date: 12/30/2007 09:36:15
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig2D62F3B029AE4FDCE5BA6BC8
Content-Type: multipart/mixed;
 boundary="------------030605060700090207040902"

This is a multi-part message in MIME format.
--------------030605060700090207040902
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Izumi Tsutsui wrote:
> eau@phear.org wrote:
>=20
>> Well for now the cd boot i've changed install.sh to do ${SH} -i
>> in order to have a shell prompt, so they are executing correctly
>> at boot.. if I made errors, I will be able to correct easily.
>=20
> Diff of install-core.sh might help.

Attached with this mail a diff of the scripts directory
as I changed install.sh, install-core.sh and install-env.sh,
I also changed etc files (fstab) in order for my changes to be taken
into account when rebooting.

also as disklabel provided me with the values of the disk I temporarily
hardcoded DLSIZE, DLHEAD, DLCYL, DLSEC in install-env.sh in order to see
if it would works, fdisk Trace/BPT trap  but is able to partition the
disk, as the partition are now done according to disklabel :

# disklabel wd0
# /dev/rwd0d:
type: ESDI
disk: ST3200822A
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 387621
total sectors: 390721968
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

9 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   2097648   1201536     4.2BSD   1024  8192    64  # (Cyl.   1192 -
  3272)
 b:   1180368     21168       swap                     # (Cyl.     21 -
  1191)
 c: 389520432   1201536     unused      0     0        # (Cyl.   1192 -
387620)
 d: 390721968         0     unused      0     0        # (Cyl.      0 -
387620)
 e:     21105        63 Linux Ext2      0     0        # (Cyl.      0*-
    20)
 f:  33555312   3299184     4.2BSD   1024  8192    64  # (Cyl.   3273 -
 36561)
 g:   8389584  36854496     4.2BSD   1024  8192    64  # (Cyl.  36562 -
 44884)
 h:   1024128  45244080     4.2BSD   1024  8192    64  # (Cyl.  44885 -
 45900)
 i: 344453760  46268208     4.2BSD   1024  8192    64  # (Cyl.  45901 -
387620)

but now i encounter another issue... while rebooting :

Cobalt: bfd
BOOTLOADER ramcode: selected partition /dev/hda1
Decompressing done
Executing bootloader kernel...
Jump_to_Real_Kernel: disk error, trying BFD again
BOOTLOADER ramcode: selected partition /dev/hdc1
Decompressing - done
Executing bootloader kernel...
Jump_to_Real_Kernel: disk error, trying BFD again
get_root_dev: nr_boot_failures 0x00000002 exceeds maxtries 0x00000002
for boot_index 0x00000000


 *** halting ***

and I don't have any idea where that could come from, I think i will try
some already made restorecd to see if it segfault like mine.

>=20
>> # dd if=3D/dev/zero of=3D/dev/rwd0d count=3D1
>> 1+0 records in
>> 1+0 records out
>> 512 bytes transferred in 0.003 secs (170666 bytes/sec)
>> # fdisk -S /dev/wd0
>> [1]   Trace/BPT trap          fdisk -S /dev/wd0
>> #
>>
>> Still not good, MBR cleaned, but still crashing..
>>
>> what else could it be?
>=20
> Hmm, You could try
> - fdisk wd0  (not /dev/wd0)
> - fdisk -S wd0  (not /dev/wd0)
> - fdisk -S -b 1024/255/63 wd0
> - fdisk -0 -u -f -b 1024/255/63 -s 0/0/0 wd0
> - fdisk -v -0 -u -f -b 1024/255/63 -s 0/0/0 wd0
> etc?

# fdisk wd0
[1]   Trace/BPT trap          fdisk wd0
# fdisk -S wd0
[1]   Trace/BPT trap          fdisk -S wd0
# fdisk -S -b 1024/255/63 wd0
[1]   Trace/BPT trap          fdisk -S -b 1024/255/63 wd0
# fdisk -0 -u -f -b 1024/255/63 -s 0/0/0 wd0
[1]   Trace/BPT trap          fdisk -0 -u -f -b 1024/255/63 -s 0/0/0 wd0
# fdisk -v -0 -u -f -b 1024/255/63 -s 0/0/0 wd0
[1]   Trace/BPT trap          fdisk -v -0 -u -f -b 1024/255/63 -s 0/0/0 w=
d0
#

>=20
> (fdisk(8) man page description for -b, -f and -u seems inconsistent..)
>=20
>>> fdisk(8) seems problematic on non-x86 ports (which don't have BIOS va=
lues),
>>> but I have not tracked what triggers it.
>> I try to look at fdisk srcs ... any starting point is welcome anyway.
>=20
> I guess the problem is in intuit_translated_geometry()
> and get_mapping() in src/sbin/fdisk/fdisk.c.
> Maybe we should add some sanity checks if each parameter
> read from disk isn't zero, but sprinkling printf()s there
> might help to track the problem.
> ---
> Izumi Tsutsui

hmm..


Thanks,
Regards,
Eric.


--------------030605060700090207040902
Content-Type: text/plain;
 name="install-scripts.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="install-scripts.patch"

diff -ru restorecd/data/cobalt/install/scripts/install-core.sh restorecd-=
almost/cddir/restorecd/nfsroot/install/scripts/install-core.sh
--- restorecd/data/cobalt/install/scripts/install-core.sh	2007-11-06 17:3=
1:28.000000000 +0100
+++ restorecd-almost/cddir/restorecd/nfsroot/install/scripts/install-core=
=2Esh	2007-12-30 09:23:57.000000000 +0100
@@ -7,7 +7,10 @@
 # 10Mb
 e2fs_size=3D10485760
=20
+one_gigs=3D1073741824
 two_gigs=3D2147483648
+four_gigs=3D4294967296
+sixteen_gigs=3D17179869184
 ten_gigs=3D10737418240
 five_megs=3D524288000
=20
@@ -95,7 +98,7 @@
 	printmsg "Disk Setup" "Enable swap"
=20
 	req_size=3D`$SYSCTL -n hw.physmem`
-	req_size=3D`expr $req_size \* 2`
+	req_size=3D`expr $req_size \* 4`
=20
 	get_slice_size $req_size
 	$FDISK -1 -f -u -b $DLCYL/$DLHEAD/$DLSEC -s $LINUX_SWAP/$part_start/$si=
ze $DISK
@@ -119,29 +122,44 @@
 	export bsd_size
 }
=20
+create_usr_slice()
+{
+	get_slice_size $sixteen_gigs
+	usrsz=3D$size
+
+	align_size $usrsz
+	usrsz=3D$align
+=09
+	echo " f: $usrsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
+
+	update_avail $usrsz
+}
+
+
 # create /var slice
 create_var_slice()
 {
 	# try to take 20% of the available disk space (10% if disk size < 2G)
-	get_slice_size $two_gigs
-	if [ $DLSIZE -le $size ]; then
-		div=3D10
-	else
-		div=3D5
-	fi
-
-	varsz=3D`expr $bsd_size / $div`
+#	get_slice_size $two_gigs
+#	if [ $DLSIZE -le $size ]; then
+#		div=3D10
+#	else
+#		div=3D5
+#	fi
+#
+#	varsz=3D`expr $bsd_size / $div`
=20
 	# if it's more than 2G, stick to 2G
-	get_slice_size $two_gigs
-	if [ $varsz -gt $size ]; then
-		varsz=3D$size
-	fi
+	get_slice_size $four_gigs
+#	if [ $varsz -gt $size ]; then
+#		varsz=3D$size
+#	fi
+	varsz=3D$size
=20
 	align_size $varsz
 	varsz=3D$align
=20
-	echo " f: $varsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
+	echo " g: $varsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
=20
 	update_avail $varsz
 }
@@ -150,19 +168,20 @@
 create_tmp_slice()
 {
 	# try to take 5% of the available disk space
-	tmpsz=3D`expr $bsd_size / 10`
+#	tmpsz=3D`expr $bsd_size / 10`
=20
 	# if it's more than 500m, stick to 500m
 	get_slice_size $five_megs
=20
-	if [ $tmpsz -gt $size ]; then
-		tmpsz=3D$size
-	fi
+#	if [ $tmpsz -gt $size ]; then
+#		tmpsz=3D$size
+#	fi
=20
+	tmpsz=3D$size
 	align_size $tmpsz
 	tmpsz=3D$align
=20
-	echo " g: $tmpsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
+	echo " h: $tmpsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
=20
 	update_avail $tmpsz
 }
@@ -170,8 +189,20 @@
 # create / slice
 create_root_slice()
 {
+	get_slice_size $one_gigs
+	rootsz=3D$size
+	align_size $rootsz
+	rootsz=3D$align
+	# the rest is for the installation
+	echo " a: $rootsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
+	update_avail $rootsz
+}
+
+# /home
+create_home_slice()
+{
 	# the rest is for the installation
-	echo " a: $disk_avail $part_start 4.2BSD 1024 8192 64" >> $PTAB
+	echo " i: $disk_avail $part_start 4.2BSD 1024 8192 64" >> $PTAB
 }
=20
 # remove all partition tables
@@ -198,9 +229,15 @@
 	printmsg "Disk Setup" "Format boot"
 	$MKE2FS -r 0 -O none -m 0 $ALTROOT_DEV
=20
+	printmsg "Disk Setup" "Format /usr"
+	$NEWFS $USR_DEV
+
 	printmsg "Disk Setup" "Format /var"
 	$NEWFS $VAR_DEV
=20
+	printmsg "Disk Setup" "Format /home"
+	$NEWFS $HOME_DEV
+
 	printmsg "Disk Setup" "Format /tmp"
 	$NEWFS $TMP_DEV
=20
@@ -234,12 +271,18 @@
=20
 	$MOUNT $MOUNT_FFS_OPT $ROOT_DEV /mnt
=20
+	$MKDIR /mnt/usr
+	$MOUNT $MOUNT_FFS_OPT $USR_DEV /mnt/usr
+
 	$MKDIR /mnt/var
 	$MOUNT $MOUNT_FFS_OPT $VAR_DEV /mnt/var
=20
 	$MKDIR /mnt/tmp
 	$MOUNT $MOUNT_FFS_OPT $TMP_DEV /mnt/tmp
=20
+	$MKDIR /mnt/home
+	$MOUNT $MOUNT_FFS_OPT $HOME_DEV /mnt/home
+
 	cd /mnt
 	for _set in $INST_TARBALLS; do
 		printmsg "System install" "$_set"
@@ -306,9 +349,11 @@
 	create_42bsd
=20
 	# 2. Create slices within 4.2BSD partition.
+	create_root_slice
+	create_usr_slice
 	create_var_slice
 	create_tmp_slice
-	create_root_slice
+	create_home_slice
=20
 	# 3. Install the disklabel and initialize filesystems.
 	install_disklabel
diff -ru restorecd/data/cobalt/install/scripts/install-env.sh restorecd-a=
lmost/cddir/restorecd/nfsroot/install/scripts/install-env.sh
--- restorecd/data/cobalt/install/scripts/install-env.sh	2007-11-06 15:20=
:55.000000000 +0100
+++ restorecd-almost/cddir/restorecd/nfsroot/install/scripts/install-env.=
sh	2007-12-29 22:51:43.000000000 +0100
@@ -31,12 +31,18 @@
 INST_TARBALLS=3D"base.tgz comp.tgz etc.tgz man.tgz misc.tgz text.tgz"
=20
 DISK=3D/dev/wd0
+DLSIZE=3D390721968
+DLCYL=3D387621
+DLHEAD=3D16
+DLSEC=3D63
=20
 ALTROOT_DEV=3D/dev/wd0e
 ROOT_DEV=3D/dev/wd0a
 SWAP_DEV=3D/dev/wd0b
-VAR_DEV=3D/dev/wd0f
-TMP_DEV=3D/dev/wd0g
+USR_DEV=3D/dev/wd0f
+VAR_DEV=3D/dev/wd0g
+TMP_DEV=3D/dev/wd0h
+HOME_DEV=3D/dev/wd0i
=20
 MOUNT_FFS_OPT=3D"-o async"
=20
diff -ru restorecd/data/cobalt/install/scripts/install.sh restorecd-almos=
t/cddir/restorecd/nfsroot/install/scripts/install.sh
--- restorecd/data/cobalt/install/scripts/install.sh	2007-10-28 11:10:24.=
000000000 +0100
+++ restorecd-almost/cddir/restorecd/nfsroot/install/scripts/install.sh	2=
007-12-29 22:51:09.000000000 +0100
@@ -9,7 +9,9 @@
 echo >> $INSTALL_SH
=20
 # XXX
-$FDISK -S $DISK | $SED '/^Drive serial/d' >> $INSTALL_SH
+#$FDISK -S $DISK
+#$SH -i
+#$FDISK -S $DISK | $SED '/^Drive serial/d' >> $INSTALL_SH
 $CAT $INSTALL_CORE >> $INSTALL_SH
=20
 $SH $INSTALL_SH

--------------030605060700090207040902--

--------------enig2D62F3B029AE4FDCE5BA6BC8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHd1iCSdZNA80H8MYRAp/0AKCo2BKdDrcQ39yQNf2bzL+2fNq88wCgq1aB
5BIkshXNwc+TNF2sCMCuQ+o=
=b/B6
-----END PGP SIGNATURE-----

--------------enig2D62F3B029AE4FDCE5BA6BC8--