summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2005-09-20 09:07:18 +0000
committerphk <phk@FreeBSD.org>2005-09-20 09:07:18 +0000
commited5e4faa718f647c195f6a0ea15572d5d8941b1f (patch)
tree18077ca09ced8b597e82110f827e8b2b7e0356f1 /tools
parent6b94e4815764cb49d62cf7a248ada6d8291e6d8c (diff)
downloadFreeBSD-src-ed5e4faa718f647c195f6a0ea15572d5d8941b1f.zip
FreeBSD-src-ed5e4faa718f647c195f6a0ea15572d5d8941b1f.tar.gz
Add a convenience function to set NANO_MEDIASIZE, NANO_HEADS and NANO_SECTS
for commonly used flash devices by FlashDevice Sandisk 256MB in the config file.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/nanobsd/FlashDevice.sub117
-rw-r--r--tools/tools/nanobsd/nanobsd.sh10
2 files changed, 127 insertions, 0 deletions
diff --git a/tools/tools/nanobsd/FlashDevice.sub b/tools/tools/nanobsd/FlashDevice.sub
new file mode 100644
index 0000000..3948a4c
--- /dev/null
+++ b/tools/tools/nanobsd/FlashDevice.sub
@@ -0,0 +1,117 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Poul-Henning Kamp.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+# Convenience function for commonly used Flash devices.
+#
+# There is a hook over in nanobsd.sh which allows you to call into
+# this function simply with a line like:
+#
+# FlashDevice Sandisk 256
+#
+# This file will then set NANO_MEDIASIZE, NANO_HEADS and NANO_SECTS for you.
+#
+
+sub_FlashDevice () {
+ case $1 in
+ [Ss][Aa][Nn][Dd][Ii][Ss][Kk])
+ # Source:
+ # SanDisk CompactFlash Memory Card
+ # Product Manual
+ # Version 10.9
+ # Document No. 20-10-00038
+ # April 2005
+ # Table 2-7
+ # NB: notice math error in SDCFJ-4096-388 line.
+ #
+ case $2 in
+ 32|32MB)
+ NANO_MEDIASIZE=`expr 32112640 / 512`
+ NANO_HEADS=4
+ NANO_SECTS=32
+ ;;
+ 64|64MB)
+ NANO_MEDIASIZE=`expr 64225280 / 512`
+ NANO_HEADS=8
+ NANO_SECTS=32
+ ;;
+ 128|128MB)
+ NANO_MEDIASIZE=`expr 128450560 / 512`
+ NANO_HEADS=8
+ NANO_SECTS=32
+ ;;
+ 256|256MB)
+ NANO_MEDIASIZE=`expr 256901120 / 512`
+ NANO_HEADS=16
+ NANO_SECTS=32
+ ;;
+ 512|512MB)
+ NANO_MEDIASIZE=`expr 512483328 / 512`
+ NANO_HEADS=16
+ NANO_SECTS=63
+ ;;
+ 1024|1024MB|1G)
+ NANO_MEDIASIZE=`expr 1024966656 / 512`
+ NANO_HEADS=16
+ NANO_SECTS=63
+ ;;
+ 2048|2048MB|2G)
+ NANO_MEDIASIZE=`expr 2048901120 / 512`
+ NANO_HEADS=16
+ NANO_SECTS=63
+ ;;
+ 4096|4096MB|4G)
+ NANO_MEDIASIZE=`expr 4097802240 / 512`
+ NANO_HEADS=16
+ NANO_SECTS=63
+ ;;
+ *)
+ echo "Unknown Sandisk Flash capacity"
+ exit 2
+ ;;
+ esac
+ ;;
+ [Ss][Oo][Ee][Kk][Rr][Ii][Ss])
+ case $2 in
+ [Nn][Ee][Tt]4526 | 4526 | [Nn][Ee][Tt]4826 | 4826 | 64 | 64MB)
+ NANO_MEDIASIZE=125056
+ NANO_HEADS=4
+ NANO_SECTS=32
+ ;;
+ *)
+ echo "Unknown Soekris Flash capacity"
+ exit 2
+ ;;
+ esac
+ ;;
+ *)
+ echo "Unknown Flash manufacturer"
+ exit 2
+ ;;
+ esac
+}
+
diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh
index ecccd74..f2734e7 100644
--- a/tools/tools/nanobsd/nanobsd.sh
+++ b/tools/tools/nanobsd/nanobsd.sh
@@ -384,6 +384,16 @@ create_i386_diskimage ( ) (
#######################################################################
#######################################################################
+# Common Flash device geometries
+#
+
+FlashDevice () {
+ . ${NANO_SRC}/${NANO_TOOLS}/FlashDevice.sub
+ sub_FlashDevice $1 $2
+}
+
+
+#######################################################################
# Setup serial console
cust_comconsole () (
OpenPOWER on IntegriCloud