From owner-svn-src-all@FreeBSD.ORG  Sat Mar  1 19:25:24 2014
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 88B4BD56;
 Sat,  1 Mar 2014 19:25:24 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 75899156D;
 Sat,  1 Mar 2014 19:25:24 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s21JPO5u027806;
 Sat, 1 Mar 2014 19:25:24 GMT (envelope-from ian@svn.freebsd.org)
Received: (from ian@localhost)
 by svn.freebsd.org (8.14.8/8.14.8/Submit) id s21JPOP4027805;
 Sat, 1 Mar 2014 19:25:24 GMT (envelope-from ian@svn.freebsd.org)
Message-Id: <201403011925.s21JPOP4027805@svn.freebsd.org>
From: Ian Lepore <ian@FreeBSD.org>
Date: Sat, 1 Mar 2014 19:25:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r262666 - head/sys/boot/uboot/common
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 01 Mar 2014 19:25:24 -0000

Author: ian
Date: Sat Mar  1 19:25:23 2014
New Revision: 262666
URL: http://svnweb.freebsd.org/changeset/base/262666

Log:
  If we can't find the u-boot api signature, exit with an error status that
  includes "badab1"; u-boot displays the status in hex, so this may help
  give some clue about why ubldr isn't working (more than -1 does anyway).

Modified:
  head/sys/boot/uboot/common/main.c

Modified: head/sys/boot/uboot/common/main.c
==============================================================================
--- head/sys/boot/uboot/common/main.c	Sat Mar  1 19:06:43 2014	(r262665)
+++ head/sys/boot/uboot/common/main.c	Sat Mar  1 19:25:23 2014	(r262666)
@@ -124,15 +124,21 @@ main(void)
 	struct open_file f;
 	const char * loaderdev;
 
+	/*
+	 * If we can't find the magic signature and related info, exit with a
+	 * unique error code that U-Boot reports as "## Application terminated,
+	 * rc = 0xnnbadab1". Hopefully 'badab1' looks enough like "bad api" to
+	 * provide a clue. It's better than 0xffffffff anyway.
+	 */
 	if (!api_search_sig(&sig))
-		return (-1);
+		return (0x01badab1);
 
 	syscall_ptr = sig->syscall;
 	if (syscall_ptr == NULL)
-		return (-2);
+		return (0x02badab1);
 
 	if (sig->version > API_SIG_VERSION)
-		return (-3);
+		return (0x03badab1);
 
         /* Clear BSS sections */
 	bzero(__sbss_start, __sbss_end - __sbss_start);