Subject: Re: restorecd, fdisk problems on cobalt
To: Eric Auge <eau@phear.org>
From: Erik Berls <cyber@netbsd.org>
List: port-cobalt
Date: 12/30/2007 12:16:13
To answer the first question, if the firmware can't find the proper
file it will kick off a message like that. The file lives in /boot of
a linux filesystem, which the firmware finds by looking at the fdisk
partition map.
-=erik.
On 12/30/07, Eric Auge <eau@phear.org> wrote:
> Izumi Tsutsui wrote:
> > eau@phear.org wrote:
> >
> >> 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.
> >
> > 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.
>
> >
> >> # dd if=/dev/zero of=/dev/rwd0d count=1
> >> 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?
> >
> > 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 wd0
> #
>
> >
> > (fdisk(8) man page description for -b, -f and -u seems inconsistent..)
> >
> >>> fdisk(8) seems problematic on non-x86 ports (which don't have BIOS values),
> >>> but I have not tracked what triggers it.
> >> I try to look at fdisk srcs ... any starting point is welcome anyway.
> >
> > 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.
>
>
> 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:31:28.000000000 +0100
> +++ restorecd-almost/cddir/restorecd/nfsroot/install/scripts/install-core.sh 2007-12-30 09:23:57.000000000 +0100
> @@ -7,7 +7,10 @@
> # 10Mb
> e2fs_size=10485760
>
> +one_gigs=1073741824
> two_gigs=2147483648
> +four_gigs=4294967296
> +sixteen_gigs=17179869184
> ten_gigs=10737418240
> five_megs=524288000
>
> @@ -95,7 +98,7 @@
> printmsg "Disk Setup" "Enable swap"
>
> req_size=`$SYSCTL -n hw.physmem`
> - req_size=`expr $req_size \* 2`
> + req_size=`expr $req_size \* 4`
>
> get_slice_size $req_size
> $FDISK -1 -f -u -b $DLCYL/$DLHEAD/$DLSEC -s $LINUX_SWAP/$part_start/$size $DISK
> @@ -119,29 +122,44 @@
> export bsd_size
> }
>
> +create_usr_slice()
> +{
> + get_slice_size $sixteen_gigs
> + usrsz=$size
> +
> + align_size $usrsz
> + usrsz=$align
> +
> + 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=10
> - else
> - div=5
> - fi
> -
> - varsz=`expr $bsd_size / $div`
> +# get_slice_size $two_gigs
> +# if [ $DLSIZE -le $size ]; then
> +# div=10
> +# else
> +# div=5
> +# fi
> +#
> +# varsz=`expr $bsd_size / $div`
>
> # if it's more than 2G, stick to 2G
> - get_slice_size $two_gigs
> - if [ $varsz -gt $size ]; then
> - varsz=$size
> - fi
> + get_slice_size $four_gigs
> +# if [ $varsz -gt $size ]; then
> +# varsz=$size
> +# fi
> + varsz=$size
>
> align_size $varsz
> varsz=$align
>
> - echo " f: $varsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
> + echo " g: $varsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
>
> update_avail $varsz
> }
> @@ -150,19 +168,20 @@
> create_tmp_slice()
> {
> # try to take 5% of the available disk space
> - tmpsz=`expr $bsd_size / 10`
> +# tmpsz=`expr $bsd_size / 10`
>
> # if it's more than 500m, stick to 500m
> get_slice_size $five_megs
>
> - if [ $tmpsz -gt $size ]; then
> - tmpsz=$size
> - fi
> +# if [ $tmpsz -gt $size ]; then
> +# tmpsz=$size
> +# fi
>
> + tmpsz=$size
> align_size $tmpsz
> tmpsz=$align
>
> - echo " g: $tmpsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
> + echo " h: $tmpsz $part_start 4.2BSD 1024 8192 64" >> $PTAB
>
> update_avail $tmpsz
> }
> @@ -170,8 +189,20 @@
> # create / slice
> create_root_slice()
> {
> + get_slice_size $one_gigs
> + rootsz=$size
> + align_size $rootsz
> + rootsz=$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
> }
>
> # remove all partition tables
> @@ -198,9 +229,15 @@
> printmsg "Disk Setup" "Format boot"
> $MKE2FS -r 0 -O none -m 0 $ALTROOT_DEV
>
> + printmsg "Disk Setup" "Format /usr"
> + $NEWFS $USR_DEV
> +
> printmsg "Disk Setup" "Format /var"
> $NEWFS $VAR_DEV
>
> + printmsg "Disk Setup" "Format /home"
> + $NEWFS $HOME_DEV
> +
> printmsg "Disk Setup" "Format /tmp"
> $NEWFS $TMP_DEV
>
> @@ -234,12 +271,18 @@
>
> $MOUNT $MOUNT_FFS_OPT $ROOT_DEV /mnt
>
> + $MKDIR /mnt/usr
> + $MOUNT $MOUNT_FFS_OPT $USR_DEV /mnt/usr
> +
> $MKDIR /mnt/var
> $MOUNT $MOUNT_FFS_OPT $VAR_DEV /mnt/var
>
> $MKDIR /mnt/tmp
> $MOUNT $MOUNT_FFS_OPT $TMP_DEV /mnt/tmp
>
> + $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
>
> # 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
>
> # 3. Install the disklabel and initialize filesystems.
> install_disklabel
> diff -ru restorecd/data/cobalt/install/scripts/install-env.sh restorecd-almost/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="base.tgz comp.tgz etc.tgz man.tgz misc.tgz text.tgz"
>
> DISK=/dev/wd0
> +DLSIZE=390721968
> +DLCYL=387621
> +DLHEAD=16
> +DLSEC=63
>
> ALTROOT_DEV=/dev/wd0e
> ROOT_DEV=/dev/wd0a
> SWAP_DEV=/dev/wd0b
> -VAR_DEV=/dev/wd0f
> -TMP_DEV=/dev/wd0g
> +USR_DEV=/dev/wd0f
> +VAR_DEV=/dev/wd0g
> +TMP_DEV=/dev/wd0h
> +HOME_DEV=/dev/wd0i
>
> MOUNT_FFS_OPT="-o async"
>
> diff -ru restorecd/data/cobalt/install/scripts/install.sh restorecd-almost/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 2007-12-29 22:51:09.000000000 +0100
> @@ -9,7 +9,9 @@
> echo >> $INSTALL_SH
>
> # 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
>
> $SH $INSTALL_SH
>
>
>
--
"Too bad $VOLUNTEERS don't get their act together and provide
$SOLUTION_TO_VERY_DIFFICULT_PROBLEM in a decent fashion" -- from IRC,
#netbsd, EFNet