diff gsm-fw/cfgmagic/feature.pirhack-ffs @ 269:6e7410f7975c

gsm-fw feature pirhack-ffs: require explicit selection of sectors to be used
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 06 Feb 2014 03:09:39 +0000
parents 4d706a4134b0
children 042c178ebac5
line wrap: on
line diff
--- a/gsm-fw/cfgmagic/feature.pirhack-ffs	Thu Feb 06 01:55:47 2014 +0000
+++ b/gsm-fw/cfgmagic/feature.pirhack-ffs	Thu Feb 06 03:09:39 2014 +0000
@@ -5,17 +5,29 @@
 # different that trying to reuse it would be more trouble than it is worth.
 # (And Pirelli's FFS contains no IMEI or RF calibration data to boot!)
 #
-# Therefore, I (FC developer Michael Spacefalcon) have decided that when
-# targeting the Pirelli, it would be better for us to start from our own blank
-# FFS than to deal with the original.  This feature pirhack-ffs configures our
-# GSM fw to put its FFS in the last 7 256 KiB sectors of the 2nd flash chip
-# select: these sectors form an independent read/write bank, and are not used
-# for FFS by Pirelli's fw, eliminating the possibility of accidental FFS
-# cross-contamination between the two very different firmwares on the same hw.
+# Therefore, I (FC developer Space Falcon) have decided that when targeting the
+# Pirelli, it would be better for us to start from our own blank FFS than to
+# deal with the original.  However, because there is no single correct answer
+# as to which region of the flash chip we should use (other than needing to be
+# in the flash2 bank so we can use the more efficient multibank flash driver),
+# this feature pirhack-ffs takes two required arguments: the number of the
+# first flash2 sector to be used for the FFS and the total number of sectors
+# to be used.  For example, this setting:
+#
+# feature pirhack-ffs 24 7
 #
-# If you want to use some other sectors for FC FFS on the Pirelli, invoke
-# feature pirhack-ffs first, then change CONFIG_PIRHACK_FFS_START and
-# CONFIG_PIRHACK_FFS_NBLOCKS to taste.
+# will configure our GSM fw to put its FFS in the last 7 256 KiB sectors of the
+# 2nd flash chip select, which coincidentally form an independent read/write
+# bank, and are part of the flash2 region which appears to be "unused" by the
+# original firmware.  Or you can use all of this "unused" area like this:
+#
+# feature pirhack-ffs 18 13
+#
+# The sum of the two numbers must not exceed 31, i.e., the end of our FFS must
+# be at or before the end of the "large sectors" main part of flash2.
+# Specifying feature pirhack-ffs 0 18 will make our FFS use the same sectors
+# as the original, but attempting to reuse the original FFS without reformatting
+# is NOT recommended or supported.
 
 if [ $TARGET != pirelli ]
 then
@@ -24,10 +36,16 @@
 	exit 1
 fi
 
+if [ $# != 3 ]
+then
+	echo "feature pirhack-ffs: two arguments required" 1>&2
+	exit 1
+fi
+
 FFS_IN_RAM=0
 CONFIG_PIRHACK_FFS=1
-CONFIG_PIRHACK_FFS_START=24
-CONFIG_PIRHACK_FFS_NBLOCKS=7
+CONFIG_PIRHACK_FFS_START=$2
+CONFIG_PIRHACK_FFS_NBLOCKS=$3
 CONFIG_FLASH_WRITE=1
 export_to_c	CONFIG_PIRHACK_FFS
 export_to_c	CONFIG_PIRHACK_FFS_START