From owner-svn-src-all@FreeBSD.ORG Thu Feb 10 23:36:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 311DF106564A; Thu, 10 Feb 2011 23:36:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06C2E8FC13; Thu, 10 Feb 2011 23:36:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1ANadfu038310; Thu, 10 Feb 2011 23:36:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1ANad4k038308; Thu, 10 Feb 2011 23:36:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201102102336.p1ANad4k038308@svn.freebsd.org> From: Warner Losh Date: Thu, 10 Feb 2011 23:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218528 - head/tools/tools/nanobsd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Feb 2011 23:36:40 -0000 Author: imp Date: Thu Feb 10 23:36:39 2011 New Revision: 218528 URL: http://svn.freebsd.org/changeset/base/218528 Log: Add 'generic' flash images. This is for projects producing generic images that are of a certain size. The geometery is bogus, but that doesn't matter since the new packet mode onviates the need to get the geometry right. Modified: head/tools/tools/nanobsd/FlashDevice.sub Modified: head/tools/tools/nanobsd/FlashDevice.sub ============================================================================== --- head/tools/tools/nanobsd/FlashDevice.sub Thu Feb 10 22:36:23 2011 (r218527) +++ head/tools/tools/nanobsd/FlashDevice.sub Thu Feb 10 23:36:39 2011 (r218528) @@ -203,10 +203,52 @@ sub_FlashDevice () { ;; esac ;; + # Generic flash media. It assumes that we're booting using packet + # mode so the HEADS and SECTS don't matter. The truncation of the + # size to a slightly lower number is intentional to be conservative + # (eg, 1 sector smaller than N GB is always smaller than any flash + # claiming to be N GB, but wastes a little space sometimes when 1GB + # really means 1GiB). This is intended to be used when producing + # generic images for anybody to boot. Media sizes are specified 'Xg' + # for X GB (10^9 bytes) flash or Xm for X MB (10^6 bytes) flash. + # Power of 2 variants can be specified with gi or mi for GiB and MiB + # sizeed flash and don't try to be conservative (use with caution). + generic) + case $a2 in + *.*) # Catch unsupported 1.5g case, since expr can't + # cope with floats. + echo "Unsupported generic size $a2" + exit 2 + ;; + *m) + NANO_HEADS=16 + NANO_SECTS=63 + NANO_MEDIASIZE=`expr -e ${a2%m} \* 1000000 / 512` + ;; + *g) + NANO_HEADS=16 + NANO_SECTS=63 + NANO_MEDIASIZE=`expr -e ${a2%g} \* 1000000000 / 512` + ;; + *mi) + NANO_HEADS=16 + NANO_SECTS=63 + NANO_MEDIASIZE=`expr -e ${a2%mi} \* 1024 \* 1024 / 512` + ;; + *gi) + NANO_HEADS=16 + NANO_SECTS=63 + NANO_MEDIASIZE=`expr -e ${a2%gi} \* 1024 \* 1024 \* 1024 / 512` + ;; + *) + echo "Unsupported generic size $a2" + exit 2 + ;; + esac + ;; *) echo "Unknown Flash manufacturer" exit 2 ;; esac } -