changeset 207:c70c077243dd

gsm-fw: beginning of config magic for FFS
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 25 Dec 2013 08:40:20 +0000
parents 9539929b3414
children 2abe6ade042d
files gsm-fw/cfgmagic/feature.mokoffs gsm-fw/cfgmagic/feature.pirhack-ffs gsm-fw/cfgmagic/processconf.sh gsm-fw/cfgmagic/target.gtamodem gsm-fw/cfgmagic/target.pirelli
diffstat 5 files changed, 84 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/cfgmagic/feature.mokoffs	Wed Dec 25 08:40:20 2013 +0000
@@ -0,0 +1,25 @@
+# feature mokoffs is applicable only when building gsm-fw for the Openmoko
+# GTA0x GSM modem.  This feature directs our fw to use the original FFS
+# which contains the factory IMEI + RF calibration data and which the
+# original mokoN firmware treats as writable.
+#
+# feature mokoffs	-- use MokoFFS, but treat it as read-only
+# feature mokoffs rw	-- treat MokoFFS as R/W like the original fw does
+
+if [ $TARGET != gtamodem ]
+then
+	echo "Error: feature mokoffs is applicable only to target gtamodem" 1>&2
+	exit 1
+fi
+
+FFS_IN_RAM=0
+CONFIG_MOKOFFS=1
+export_to_c	CONFIG_MOKOFFS
+
+if [ "$2" = rw ]
+then
+	CONFIG_FLASH_WRITE=1
+else
+	CONFIG_FLASH_WRITE=0
+fi
+export_to_c	CONFIG_FLASH_WRITE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/cfgmagic/feature.pirhack-ffs	Wed Dec 25 08:40:20 2013 +0000
@@ -0,0 +1,27 @@
+# Concerning the FFS, there is one fundamental difference between the gtamodem
+# and pirelli targets: whereas the content of Openmoko's modem FFS is directly
+# fit for reuse by our fw (resulting from the phylogenetic proximity of the two
+# firmwares), Pirelli's original FFS has the same format, but its content is so
+# 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.
+
+if [ $TARGET != pirelli ]
+then
+	echo \
+	"Error: feature pirhack-ffs is applicable only to target pirelli" 1>&2
+	exit 1
+fi
+
+FFS_IN_RAM=0
+CONFIG_PIRHACK_FFS=1
+CONFIG_FLASH_WRITE=1
+export_to_c	CONFIG_PIRHACK_FFS
+export_to_c	CONFIG_FLASH_WRITE
--- a/gsm-fw/cfgmagic/processconf.sh	Mon Dec 23 19:32:22 2013 +0000
+++ b/gsm-fw/cfgmagic/processconf.sh	Wed Dec 25 08:40:20 2013 +0000
@@ -4,7 +4,7 @@
 # that configuration file and to produce include/config.{h,mk,m4} files
 # corresponding to the selected configuration.
 #
-# The current directory is expected to be the top level of nuc-fw, i.e.,
+# The current directory is expected to be the top level of gsm-fw, i.e.,
 # all fragments are sourced as cfgmagic/blah.
 # Don't run this script directly - let the Makefile do it for you.
 
@@ -16,6 +16,7 @@
 m4_export_list=
 
 # some defaults
+FFS_IN_RAM=1
 RVTMUX_UART_port=IrDA
 RVTMUX_UART_baud=115200
 
@@ -36,7 +37,7 @@
 		export_to_c CONFIG_RVTMUX_ON_MODEM
 		;;
 	*)
-		echo "Error: unknown RTVMUX_UART_port=$RTVMUX_UART_port" 1>&2
+		echo "Error: unknown RVTMUX_UART_port=$RVTMUX_UART_port" 1>&2
 		exit 1
 		;;
 esac
@@ -44,6 +45,23 @@
 TR_BAUD_CONFIG=TR_BAUD_$RVTMUX_UART_baud
 export_to_c TR_BAUD_CONFIG
 
+# FFS in RAM
+export_to_c	FFS_IN_RAM
+export_to_m4	FFS_IN_RAM
+if [ $FFS_IN_RAM = 1 ]
+then
+	if [ -z "$RAMFFS_BLKSIZE_LOG2" -o -z "$RAMFFS_NBLOCKS" ]
+	then
+		echo \
+	"Error: RAMFFS_BLKSIZE_LOG2 and RAMFFS_NBLOCKS need to be defined" 1>&2
+		exit 1
+	fi
+	export_to_c	RAMFFS_BLKSIZE_LOG2
+	export_to_m4	RAMFFS_BLKSIZE_LOG2
+	export_to_c	RAMFFS_NBLOCKS
+	export_to_m4	RAMFFS_NBLOCKS
+fi
+
 # At some point the list of build components will probably become
 # dependent on feature or maybe even target configurations, but for
 # now it is static.
--- a/gsm-fw/cfgmagic/target.gtamodem	Mon Dec 23 19:32:22 2013 +0000
+++ b/gsm-fw/cfgmagic/target.gtamodem	Wed Dec 25 08:40:20 2013 +0000
@@ -9,6 +9,10 @@
 CONFIG_FWFLASH_SIZE=0x300000
 # the post-target fragment exports these
 
+# RAMFFS: default to 32 KiB x 4
+RAMFFS_BLKSIZE_LOG2=15
+RAMFFS_NBLOCKS=4
+
 DBB_type=751992A
 ABB_type=Iota3025
 RF_type=Rita
--- a/gsm-fw/cfgmagic/target.pirelli	Mon Dec 23 19:32:22 2013 +0000
+++ b/gsm-fw/cfgmagic/target.pirelli	Wed Dec 25 08:40:20 2013 +0000
@@ -9,6 +9,14 @@
 CONFIG_FWFLASH_SIZE=0x800000
 # the post-target fragment exports these
 
+# RAMFFS: default to 64 KiB x 8
+RAMFFS_BLKSIZE_LOG2=16
+RAMFFS_NBLOCKS=8
+
+# 2nd flash chip select
+FLASH2_BASE_ADDR=0x02000000
+export_to_c	FLASH2_BASE_ADDR
+
 DBB_type=751992A
 ABB_type=Iota3014
 RF_type=Rita