Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Mar 2009 12:10:39 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-stable@freebsd.org
Cc:        David Adam <zanchey@ucc.gu.uwa.edu.au>
Subject:   Re: 7.1 new install halts on BTX error
Message-ID:  <200903021210.39757.jhb@freebsd.org>
In-Reply-To: <alpine.DEB.1.10.0901142326370.12175@martello.ucc.gu.uwa.edu.au>
References:  <alpine.DEB.1.10.0901142326370.12175@martello.ucc.gu.uwa.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 28 January 2009 10:13:46 pm David Adam wrote:
> I upgraded my 7.0 system to 7.1-RELEASE with freebsd-update only to find 
> that it no longer boots correctly, instead crashing with a BTX backtrace. 
> If I break to the loader prompt and use 'ls /boot', I also get a 
> backtrace.
> 
> A new install of 7.1 on this hardware using a separate SCSI card and drive 
> array also leads to a BTX backtrace. I have copied this below as the first 
> (most repeatable) error and also included the other problems.
> 
> A fresh install of 7.0 works fine. FreeSBIE 1.0, based on FreeBSD 5.3, 
> also boots fine and will happily list the contents of the original drive's 
> /boot in the loader, although refuses to load the kernel. The FreeBSD 7.1 
> install CD also boots and allows me to install over FTP.
> 
> I have run into BTX problems on this machine before under -CURRENT (see 
> http://lists.freebsd.org/pipermail/freebsd-current/2008-October/089460.html
> ). Dmesg from 7.0 in 
> http://www.freebsd.org/cgi/query-pr.cgi?prp=125769-1-txt&n=/patch.txt
> 
> A new install of 7.1-RELEASE on separate disks leads to this backtrace:
> int=0000000d  err=00001840  efl=00010207  eip=00000511
> eax=04551364  ebx=00000000  ecx=00495cae  edx=00495cae
> esi=00000009  edi=00000001  ebp=00000000  esp=00495cae
> cs=002b  ds=0033  es=0033    fs=0033  gs=0033  ss=0033
> cs:eip=17 00 00 00 00 00 00 0c-00 00 00 00 00 00 00 b9
>        ae 5c 49 00 00 00 00 b9-ae 5c 49 00 00 00 00 c8
> ss:esp=43 18 3c 01 74 08 3c 04-0f 85 e4 00 00 00 0f b6
>        43 19 88 86 94 00 00 00-c7 46 30 00 00 00 00 3c
> 
> BTX error on boot with the 7.0 partition that has been upgraded to 7.1:
> 
> int=0000000d  err=00000000  efl=00010a92  eip=00000430
> eax=ffffff4c  ebx=00006c94  ecx=00000001  edx=00000080
> esi=00000001  edi=ffff9416  ebp=00000000  esp=0008f8b4
> cs=002b  ds=0033  es=002b    fs=0033  gs=0033  ss=0033
> cs:eip=6c 7f 94 48 00 00 00 00-0f af c1 47 00 00 00 00
>        00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
> ss:eip=2b 00 00 00 33 00 00 00-00 0c 04 00 5f ad 08 04
>        00 00 00 00 0f 00 00 00-00 00 00 00 24 1c 06 00
> BTX halted
> 
> If I break to the loader prompt and try 'ls /boot', I get this backtrace:
> 
> int=00000006  err=00000000  efl=00010203  eip=00040c08
> eax=000000c6  ebx=00000008  ecx=eb000000  edx=000000c6
> esi=00000004  edi=000000c2  ebp=00000000  esp=0008f8b4
> cs=002b  ds=0033  es=002b    fs=0033  gs=0033  ss=0033
> cs:eip=8f 49 40 00 94 49 00 cb-00 00 04 00 00 00 fc 07
>        80 00 00 00 04 00 00 00-94 49 00 00 00 00 00 00
> ss:eip=00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
>        00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
> BTX halted
> 
> Any thoughts or suggestions? I will stay on 7.0 for now but have a fairly 
> large supply of spare drives so I can test new installs if required.

I wonder if your stack is growing into the heap (the GPT stuff made the
loader a bit bigger).  You can try something like this:

--- //depot/vendor/freebsd/src/sys/boot/i386/libi386/Makefile	2007/10/12 17:12:19
+++ //depot/user/jhb/boot/sys/boot/i386/libi386/Makefile	2009/03/02 17:08:30
@@ -33,6 +33,10 @@
 CFLAGS+= -DSMBIOS_SERIAL_NUMBERS
 .endif
 
+.if !defined(LOADER_NO_GPT_SUPPORT)
+CFLAGS+=	-DLOADER_GPT_SUPPORT
+.endif
+
 # Include simple terminal emulation (cons25-compatible)
 CFLAGS+= -DTERM_EMU
 
--- //depot/vendor/freebsd/src/sys/boot/i386/libi386/biosdisk.c	2008/11/19 16:05:14
+++ //depot/user/jhb/boot/sys/boot/i386/libi386/biosdisk.c	2009/03/02 17:08:30
@@ -68,12 +68,14 @@
 # define DEBUG(fmt, args...)
 #endif
 
+#ifdef LOADER_GPT_SUPPORT
 struct gpt_part {
     int		gp_index;
     uuid_t	gp_type;
     uint64_t	gp_start;
     uint64_t	gp_end;
 };
+#endif
 
 struct open_disk {
     int			od_dkunit;		/* disk unit number */
@@ -90,25 +92,31 @@
 #define BD_FLOPPY		0x0004
 #define BD_LABELOK		0x0008
 #define BD_PARTTABOK		0x0010
+#ifdef LOADER_GPT_SUPPORT
 #define	BD_GPTOK		0x0020
+#endif
     union {
 	struct {
 	    struct disklabel		mbr_disklabel;
 	    int				mbr_nslices;	/* slice count */
 	    struct dos_partition	mbr_slicetab[NEXTDOSPART];
 	} _mbr;
+#ifdef LOADER_GPT_SUPPORT
 	struct {
 	    int				gpt_nparts;		
 	    struct gpt_part		*gpt_partitions;
 	} _gpt;
+#endif
     } _data;
 };
 
 #define	od_disklabel		_data._mbr.mbr_disklabel
 #define	od_nslices		_data._mbr.mbr_nslices
 #define	od_slicetab		_data._mbr.mbr_slicetab
+#ifdef LOADER_GPT_SUPPORT
 #define	od_nparts		_data._gpt.gpt_nparts
 #define	od_partitions		_data._gpt.gpt_partitions
+#endif
 
 /*
  * List of BIOS devices, translation from disk unit number to
@@ -130,8 +138,10 @@
 
 static int	bd_int13probe(struct bdinfo *bd);
 
+#ifdef LOADER_GPT_SUPPORT
 static void	bd_printgptpart(struct open_disk *od, struct gpt_part *gp,
 		    char *prefix, int verbose);
+#endif
 static void	bd_printslice(struct open_disk *od, struct dos_partition *dp,
 		    char *prefix, int verbose);
 static void	bd_printbsdslice(struct open_disk *od, daddr_t offset,
@@ -163,8 +173,10 @@
 static int	bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev);
 static int	bd_bestslice(struct open_disk *od);
 static void	bd_checkextended(struct open_disk *od, int slicenum);
+#ifdef LOADER_GPT_SUPPORT
 static int	bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev);
 static struct gpt_part *bd_best_gptpart(struct open_disk *od);
+#endif
 
 /*
  * Translate between BIOS device numbers and our private unit numbers.
@@ -286,6 +298,7 @@
 	
 	if (!bd_opendisk(&od, &dev)) {
 
+#ifdef LOADER_GPT_SUPPORT
 	    /* Do we have a GPT table? */
 	    if (od->od_flags & BD_GPTOK) {
 		for (j = 0; j < od->od_nparts; j++) {
@@ -293,9 +306,10 @@
 			od->od_partitions[j].gp_index);
 		    bd_printgptpart(od, &od->od_partitions[j], line, verbose);
 		}
-
+	    } else
+#endif
 	    /* Do we have a partition table? */
-	    } else if (od->od_flags & BD_PARTTABOK) {
+	    if (od->od_flags & BD_PARTTABOK) {
 		dptr = &od->od_slicetab[0];
 
 		/* Check for a "dedicated" disk */
@@ -339,6 +353,7 @@
     return (buf);
 }
 
+#ifdef LOADER_GPT_SUPPORT
 static uuid_t efi = GPT_ENT_TYPE_EFI;
 static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
 static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
@@ -380,6 +395,7 @@
 	    stats);
     pager_output(line);
 }
+#endif
 
 /*
  * Print information about slices on a disk.  For the size calculations we
@@ -561,8 +577,10 @@
     }
 
     /* Determine disk layout. */
+#ifdef LOADER_GPT_SUPPORT
     error = bd_open_gpt(od, dev);
     if (error)
+#endif
 	error = bd_open_mbr(od, dev);
     
  out:
@@ -826,6 +844,7 @@
 	return (prefslice);
 }
 
+#ifdef LOADER_GPT_SUPPORT
 static int
 bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev)
 {
@@ -1003,6 +1022,7 @@
     }
     return (prefpart);
 }
+#endif
 
 static int 
 bd_close(struct open_file *f)
@@ -1022,8 +1042,10 @@
     if (od->od_flags & BD_FLOPPY)
 	delay(3000000);
 #endif
+#ifdef LOADER_GPT_SUPPORT
     if (od->od_flags & BD_GPTOK)
 	free(od->od_partitions);
+#endif
     free(od);
 }
 
--- //depot/vendor/freebsd/src/sys/boot/i386/libi386/devicename.c	2008/11/17 20:55:47
+++ //depot/user/jhb/boot/sys/boot/i386/libi386/devicename.c	2009/03/02 17:08:30
@@ -120,6 +120,7 @@
 		err = EUNIT;
 		goto fail;
 	    }
+#ifdef LOADER_GPT_SUPPORT
 	    if (*cp == 'p') {		/* got a GPT partition */
 		np = cp + 1;
 		slice = strtol(np, &cp, 10);
@@ -133,6 +134,7 @@
 		}
 		partition = 0xff;
 	    } else {
+#endif
 		if (*cp == 's') {		/* got a slice number */
 		    np = cp + 1;
 		    slice = strtol(np, &cp, 10);
@@ -149,7 +151,9 @@
 		    }
 		    cp++;
 		}
+#ifdef LOADER_GPT_SUPPORT
 	    }
+#endif
 	} else {
 		cp = np;
 	}
@@ -227,14 +231,18 @@
     case DEVT_DISK:
 	cp = buf;
 	cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit);
+#ifdef LOADER_GPT_SUPPORT
 	if (dev->d_kind.biosdisk.partition == 0xff) {
 	    cp += sprintf(cp, "p%d", dev->d_kind.biosdisk.slice);
 	} else {
+#endif
 	    if (dev->d_kind.biosdisk.slice > 0)
 		cp += sprintf(cp, "s%d", dev->d_kind.biosdisk.slice);
 	    if (dev->d_kind.biosdisk.partition >= 0)
 		cp += sprintf(cp, "%c", dev->d_kind.biosdisk.partition + 'a');
+#ifdef LOADER_GPT_SUPPORT
 	}
+#endif
 	strcat(cp, ":");
 	break;
 
--- //depot/vendor/freebsd/src/sys/boot/i386/loader/Makefile	2009/02/21 15:10:32
+++ //depot/user/jhb/boot/sys/boot/i386/loader/Makefile	2009/03/02 17:08:30
@@ -51,6 +51,9 @@
 .if !defined(LOADER_NO_GZIP_SUPPORT)
 CFLAGS+=	-DLOADER_GZIP_SUPPORT
 .endif
+.if !defined(LOADER_NO_GPT_SUPPORT)
+CFLAGS+=	-DLOADER_GPT_SUPPORT
+.endif
 
 # Always add MI sources 
 .PATH:		${.CURDIR}/../../common
@@ -91,12 +94,14 @@
 loader.help: help.common help.i386
 	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
 
+.if !defined(NOFORTH)
 .PATH: ${.CURDIR}/../../forth 
 FILES=	loader loader.help loader.4th support.4th loader.conf
 FILES+= screen.4th frames.4th beastie.4th
 # XXX INSTALLFLAGS_loader= -b
 FILESMODE_loader= ${BINMODE} -b
 FILESDIR_loader.conf=	/boot/defaults
+.endif
 
 .if !exists(${DESTDIR}/boot/loader.rc)
 FILES+=	loader.rc
--- //depot/vendor/freebsd/src/sys/boot/i386/loader/main.c	2008/11/17 20:55:47
+++ //depot/user/jhb/boot/sys/boot/i386/loader/main.c	2009/03/02 17:08:30
@@ -102,7 +102,7 @@
      */
     bios_getmem();
 
-#if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_FIREWIRE_SUPPORT) || defined(LOADER_ZFS_SUPPORT)
+#if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_FIREWIRE_SUPPORT) || defined(LOADER_GPT_SUPPORT) || defined(LOADER_ZFS_SUPPORT)
     heap_top = PTOV(memtop_copyin);
     memtop_copyin -= 0x300000;
     heap_bottom = PTOV(memtop_copyin);

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903021210.39757.jhb>