Subject: Re: recent boot.fs for 1.4?
To: Chris G. Demetriou <cgd@netbsd.org>
From: Matthias Drochner <drochner@zel459.zel.kfa-juelich.de>
List: netbsd-help
Date: 07/09/1999 14:29:56
cgd@netbsd.org said:
> The problem that causes sysinst to croak when upgrading old
> installations (1.3.2 and earlier, i dunno about 1.3.3) to 1.4.x has
> _NOT_ been fixed. 

I'm not an insider wrt "sysinst", but I believe that I marginally
understand what happens...
Below are some patches which reflect what I think should be changed:
-in mbr.c, the variable dosptyp_nbsd seems meaningless
 (no functional change)
-don't call md_upgrade_mbrtype() from md_pre_disklabel() - as I see
 this is only called after edit_mbr() which already deals with the
 mbr type
-call md_bios_info() in md_upgrade_mbrtype() to get the geometry
 information and check whether it succeeeded
-ask before the mbr type is really updated - this also provides a
 workaround if something goes wrong

Imho, the code shouldn't care about the geometry at all when
upgrading, but this would be a more serious change.

I haven't tested the patches - don't have a disk installation.

best regards
Matthias



Index: mbr.c
===================================================================
RCS file: /cvsroot/basesrc/distrib/utils/sysinst/mbr.c,v
retrieving revision 1.17
diff -c -2 -r1.17 mbr.c
*** mbr.c	1999/07/04 08:01:39	1.17
--- mbr.c	1999/07/09 10:28:01
***************
*** 99,104 ****
  };
  
- int dosptyp_nbsd = MBR_PTYPE_NETBSD;
- 
  static int get_mapping __P((struct mbr_partition *, int, int *, int *, int *,
  			    long *absolute));
--- 99,102 ----
***************
*** 216,220 ****
  		part[2].mbrp_typ = part[0].mbrp_flag = 0;
  		part[2].mbrp_start = part[0].mbrp_size = 0;
! 		part[3].mbrp_typ = dosptyp_nbsd;
  		part[3].mbrp_size = bsize - bsec;
  		part[3].mbrp_start = bsec;
--- 214,218 ----
  		part[2].mbrp_typ = part[0].mbrp_flag = 0;
  		part[2].mbrp_start = part[0].mbrp_size = 0;
! 		part[3].mbrp_typ = MBR_PTYPE_NETBSD;
  		part[3].mbrp_size = bsize - bsec;
  		part[3].mbrp_start = bsec;
***************
*** 302,306 ****
  			process_menu(MENU_yesno);
  			if (yesno)
! 				part[bsdpart].mbrp_typ = dosptyp_nbsd;
  		}
  			
--- 300,304 ----
  			process_menu(MENU_yesno);
  			if (yesno)
! 				part[bsdpart].mbrp_typ = MBR_PTYPE_NETBSD;
  		}
  			
Index: arch/i386/md.c
===================================================================
RCS file: /cvsroot/basesrc/distrib/utils/sysinst/arch/i386/md.c,v
retrieving revision 1.30
diff -c -2 -r1.30 md.c
*** md.c	1999/07/04 08:01:40	1.30
--- md.c	1999/07/09 10:28:01
***************
*** 169,173 ****
  		return 1;
  	}
- 	md_upgrade_mbrtype();
  	return 0;
  }
--- 169,172 ----
***************
*** 447,450 ****
--- 446,453 ----
  		return;
  
+ 	md_bios_info(diskdev);
+ 	if (!check_geom())
+ 		return; /* XXX error message? */
+ 
  	mbrp = (struct mbr_partition *)&mbr[MBR_PARTOFF];
  
***************
*** 458,463 ****
  
  	if (netbsdpart == -1 && oldbsdcount == 1) {
! 		mbrp[oldbsdpart].mbrp_typ = MBR_PTYPE_NETBSD;
! 		write_mbr(diskdev, mbr, sizeof mbr);
  	}
  }
--- 461,470 ----
  
  	if (netbsdpart == -1 && oldbsdcount == 1) {
! 		msg_display(MSG_upgradeparttype);
! 		process_menu(MENU_yesno);
! 		if (yesno) {
! 			mbrp[oldbsdpart].mbrp_typ = MBR_PTYPE_NETBSD;
! 			write_mbr(diskdev, mbr, sizeof mbr);
! 		}
  	}
  }