Merge re-apply fixes for Bug 2149, 2283, GCCE support and rom_sbs.pl RCL_3 PDK_3.0.3
authorandy simpson <andrews@symbian.org>
Fri, 17 Sep 2010 16:50:19 +0100
branchRCL_3
changeset 264 cbb906b0db9b
parent 263 9e2d4f7f5028 (current diff)
parent 258 880ff05ad710 (diff)
child 295 5460f47b94ad
Merge re-apply fixes for Bug 2149, 2283, GCCE support and rom_sbs.pl
--- a/bsptemplate/asspandvariant/template_variant/bld.inf	Tue Sep 14 23:56:21 2010 +0300
+++ b/bsptemplate/asspandvariant/template_variant/bld.inf	Fri Sep 17 16:50:19 2010 +0100
@@ -109,6 +109,7 @@
 
 PRJ_EXTENSIONS
 
+#if 0 // Removing changes associated with introduction of bootstrap.flm - see Bug 2149
 #ifdef SBSV2 // If using SBSv2 with bootstrap FLM, MEMMODEL MUST begin with a capital letter
 
 start		extension		base.bootstrap bootstrap
@@ -130,6 +131,9 @@
 end
 
 #else // !SBSV2
+#endif // more workaround - close the #ifdef SBSV2 here, to regain the other bit
+#endif // first part of workaround - close the #ifdef 0
+
 
 start		extension		base/bootstrap bootstrap
 
@@ -149,4 +153,5 @@
 
 end
 
+#if 0  // second part of workaround - avoid dangling #endif
 #endif // !SBSV2
--- a/kernel/eka/compsupp/bld.inf	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/compsupp/bld.inf	Fri Sep 17 16:50:19 2010 +0100
@@ -32,47 +32,62 @@
 
 PRJ_MMPFILES
 
-#if !defined GCCXML && !defined GCCE
+#if !defined(GCCXML) && !defined(GCCE)
 
     symcpp/scppnwdl.mmp
     rvct/dfprvct-thunk.mmp
     rvct/usrt.mmp
     rvct/ksrt.mmp
 
-    #ifndef SMP // Only static libraries build for SMP.
+    #ifndef SMP // Don't build dynamic libraries for SMP.
 
-    rvct/drtaeabi.mmp
+        rvct/drtaeabi.mmp
 
-    rvct/dfpaeabi.mmp
-    rvct/dfpaeabi_vfpv2.mmp
+        rvct/dfpaeabi.mmp
+        rvct/dfpaeabi_vfpv2.mmp
 
-    #if defined(ARMCC_2_2) || defined(ARMCC_3_1)
+        #if defined(ARMCC_2_2) || defined(ARMCC_3_1)
 
-        rvct/drtrvct.mmp
-        rvct/drtrvct_vfpv2.mmp
+            rvct/drtrvct.mmp
+            rvct/drtrvct_vfpv2.mmp
+
+            rvct/dfprvct.mmp
+            rvct/dfprvct_vfpv2.mmp
 
-        rvct/dfprvct.mmp
-        rvct/dfprvct_vfpv2.mmp
-    #endif
+        #endif
 
-    #endif
+    #endif // #ifndef SMP
+
+#endif // #if !defined(GCCXML) && !defined(GCCE)
+
 
 PRJ_EXTENSIONS
 
-// Unzip RVCT3.1 runtime if being built with RVCT2.2 or RVCT4.0
+#if !defined(GCCXML) && !defined(GCCE)
+
+    // We need the runtime libraries for all versions of the compiler.
+    // The version we're running with will build its own runtime library;
+    // we need to extract the other versions from archives.
 
-start extension tools/compsupp
+    #ifndef ARMCC_2_2
+        start extension tools/compsupp
+        option FILE  $(EXTENSION_ROOT)/rt_2_2.zip
+        option TODIR $(EPOCROOT)epoc32/release
+        end
+    #endif
 
-#if defined(ARMCC_2_2) || defined(ARMCC_4_0)
-option  FILE  $(EXTENSION_ROOT)/rt_3_1.zip
-#elif defined(ARMCC_3_1)
-option  FILE  $(EXTENSION_ROOT)/rt_2_2.zip
-#endif
+    #ifndef ARMCC_3_1
+        start extension tools/compsupp
+        option FILE  $(EXTENSION_ROOT)/rt_3_1.zip
+        option TODIR $(EPOCROOT)epoc32/release
+        end
+    #endif
 
-option  TODIR $(EPOCROOT)epoc32/release
-
-end
+    #ifndef ARMCC_4_0
+        start extension tools/compsupp
+        option FILE  $(EXTENSION_ROOT)/rt_4_0.zip
+        option TODIR $(EPOCROOT)epoc32/release
+        end
+    #endif
 
-#endif // #if !defined GCCXML && !defined GCCE
-
-
+#endif // #if !defined(GCCXML) && !defined(GCCE)
--- a/kernel/eka/compsupp/gcce/gcce.h	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/compsupp/gcce/gcce.h	Fri Sep 17 16:50:19 2010 +0100
@@ -97,6 +97,7 @@
 // __NAKED__ from cpudefs.h
 #define __NAKED__ __declspec(naked)
 #define ____ONLY_USE_NAKED_IN_CIA____ __declspec(naked)
+#define __WEAK__  __attribute__((weak))
 
 // Int64 and Uint64 from nkern\nklib.h
 typedef long long Int64;
Binary file kernel/eka/compsupp/rt_2_2.zip has changed
Binary file kernel/eka/compsupp/rt_3_1.zip has changed
Binary file kernel/eka/compsupp/rt_4_0.zip has changed
--- a/kernel/eka/compsupp/rvct.h	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/compsupp/rvct.h	Fri Sep 17 16:50:19 2010 +0100
@@ -116,6 +116,7 @@
 // __NAKED__ from cpudefs.h
 #define __NAKED__ __asm
 #define ____ONLY_USE_NAKED_IN_CIA____ __asm
+#define __WEAK__  __attribute__((weak))
 
 // Int64 and Uint64 from nkern\nklib.h
 typedef long long Int64;
--- a/kernel/eka/euser/epoc/arm/uc_dll.cpp	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/euser/epoc/arm/uc_dll.cpp	Fri Sep 17 16:50:19 2010 +0100
@@ -44,11 +44,11 @@
 	return 0;
 	}
 
-#elif defined(__ARMCC__)
+#elif defined(__EABI__)
 
 void __DLL_Export_Table__(void);
 void __cpp_initialize__aeabi_(void);
-__weak void run_static_dtors(void);
+__WEAK__ void run_static_dtors(void);
 
 GLDEF_C TInt _E32Dll_Body(TInt aReason)
 	{
--- a/kernel/eka/euser/epoc/arm/uc_exe.cpp	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/euser/epoc/arm/uc_exe.cpp	Fri Sep 17 16:50:19 2010 +0100
@@ -70,11 +70,11 @@
 	}
 }
 
-#elif defined(__ARMCC__)
+#elif defined(__EABI__)
 
 TInt CallThrdProcEntry(TInt (*aFn)(void*), void* aPtr, TInt aNotFirst);
 
-__weak void run_static_dtors(void);
+__WEAK__ void run_static_dtors(void);
 
 void globalDestructorFunc()
 	{
--- a/kernel/eka/generic.inf	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/generic.inf	Fri Sep 17 16:50:19 2010 +0100
@@ -17,6 +17,10 @@
 // 
 //
 
+PRJ_EXPORTS
+rombuild/rom.flm		/epoc32/tools/makefile_templates/base/rom.flm
+rombuild/rom.meta		/epoc32/tools/makefile_templates/base/rom.meta
+rombuild/rom.xml		/epoc32/tools/makefile_templates/base/rom.xml
 
 PRJ_EXTENSIONS
 start		extension		base/genexec
--- a/kernel/eka/include/e32def.h	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/include/e32def.h	Fri Sep 17 16:50:19 2010 +0100
@@ -446,7 +446,7 @@
 #if __GNUC__ < 4
 #define _FOFF(c,f)			(((TInt)&(((c *)0x1000)->f))-0x1000)
 #else
-#define _FOFF(c,f)			__builtin_offsetof(c,f)
+#define _FOFF(c,f)			(__builtin_offsetof(c,f))
 #endif
 #endif
 
--- a/kernel/eka/kernel/arm/d_entry.cpp	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/kernel/arm/d_entry.cpp	Fri Sep 17 16:50:19 2010 +0100
@@ -49,11 +49,11 @@
 	return KernelModuleEntry(aReason);
 	}
 
-#elif defined(__ARMCC__)
+#elif defined(__EABI__)
 
 void __DLL_Export_Table__(void);
 void __cpp_initialize__aeabi_(void);
-__weak void run_static_dtors(void);
+__WEAK__ void run_static_dtors(void);
 
 GLDEF_C TInt _E32Dll_Body(TInt aReason)
 //
--- a/kernel/eka/kernel/arm/k_entry.cia	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/kernel/arm/k_entry.cia	Fri Sep 17 16:50:19 2010 +0100
@@ -71,7 +71,7 @@
 	asm("__CtorList: ");
 	asm(".word __CTOR_LIST__ ");
 	}
-#elif defined(__ARMCC__)
+#elif defined(__EABI__)
 void __DLL_Export_Table__(void);
 void __cpp_initialize__aeabi_();
   
@@ -80,7 +80,7 @@
 void __record_needed_destruction (void * d){}
 // 2.1 calls __aeabi_atexit passing __dso_handle. This can be a dummy (i.e. just a label)
 
-__asm void __dso_handle(void) {}
+__NAKED__ void __dso_handle(void) {}
 void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){}
 
 void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage);
--- a/kernel/eka/kernel/arm/l_entry.cia	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/kernel/arm/l_entry.cia	Fri Sep 17 16:50:19 2010 +0100
@@ -19,7 +19,7 @@
 
 extern "C" {
 
-#if defined(__ARMCC__)
+#if defined(__EABI__)
 void __DLL_Export_Table__(void);
 #endif
 
--- a/kernel/eka/kernel/arm/v_entry.cpp	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/kernel/arm/v_entry.cpp	Fri Sep 17 16:50:19 2010 +0100
@@ -46,7 +46,7 @@
 	return KErrGeneral;
 	}
 
-#elif defined(__ARMCC__)
+#elif defined(__EABI__)
 
 void __DLL_Export_Table__(void);
 void __cpp_initialize__aeabi_();
@@ -55,7 +55,7 @@
 // needs destruction. But kernel side static objects will never need this so, define it as a nop
 void __record_needed_destruction (void * d){}
 // 2.1 calls __aeabi_atexit passing __dso_handle. This can just be a label since its not used
-__asm void __dso_handle(void) {}
+__NAKED__ void __dso_handle(void) {}
 void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){}
 
 GLDEF_C TInt _E32Dll_Body(TInt aReason)
--- a/kernel/eka/kernel/arm/x_entry.cpp	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/kernel/arm/x_entry.cpp	Fri Sep 17 16:50:19 2010 +0100
@@ -41,7 +41,7 @@
 	return KernelModuleEntry(aReason);
 	}
 
-#elif defined(__ARMCC__)
+#elif defined(__EABI__)
 
 void __DLL_Export_Table__(void);
 void __cpp_initialize__aeabi_();
@@ -50,7 +50,7 @@
 // needs destruction. But the kernel never will need this so, define it as a nop
 void __record_needed_destruction (void * d){}
 // 2.1 calls __aeabi_atexit passing __dso_handle. This can just be a label since its not used.
-__asm void __dso_handle(void){}
+__NAKED__ void __dso_handle(void){}
 void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){}
 
 GLDEF_C TInt _E32Dll_Body(TInt aReason)
--- a/kernel/eka/nkern/arm/nk_entry.cia	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/nkern/arm/nk_entry.cia	Fri Sep 17 16:50:19 2010 +0100
@@ -80,7 +80,7 @@
 	asm("__CtorList: ");
 	asm(".word __CTOR_LIST__ ");
 	}
-#elif defined(__ARMCC__)
+#elif defined(__EABI__)
 void __DLL_Export_Table__(void);
 void __cpp_initialize__aeabi_();
   
@@ -89,7 +89,7 @@
 void __record_needed_destruction (void * d){}
 // 2.1 calls __aeabi_atexit passing __dso_handle. This can be a dummy (i.e. just a label)
 
-__asm void __dso_handle(void) {}
+__NAKED__  void __dso_handle(void) {}
 void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){}
 
 void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage);
--- a/kernel/eka/personality/example/personality.h	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/personality/example/personality.h	Fri Sep 17 16:50:19 2010 +0100
@@ -41,6 +41,8 @@
 typedef unsigned int size_t;
 #elif defined(__ARMCC__)
 typedef unsigned int size_t;
+#elif defined(__GCCE__)
+typedef unsigned int size_t;
 #endif
 
 #ifdef __cplusplus
--- a/kernel/eka/rombuild/e32tests.oby	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/rombuild/e32tests.oby	Fri Sep 17 16:50:19 2010 +0100
@@ -28,6 +28,7 @@
 // And now the tests
 
 #include <rom##E32PATH##\kernelhwsrv\kerneltest\e32test\group\##MAIN##test.iby>
+
 #if defined(SYMBIAN_INCLUDE_USB_OTG_HOST)
 #include "t_usbdi_helper.iby"
 #include "t_otgdi_helper.iby"
@@ -35,10 +36,11 @@
 #include <rom##E32PATH##\kernelhwsrv\kerneltest\e32test\usbho\t_usbdi\##MAIN##test.iby>
 #endif
 
+/*
 #ifndef VARIANT_PATH
 #include <rom##E32PATH##\##VARIANT##\test\##MAIN##test.iby>
 #else
 #define inc(a,b,c) <a\\b\\c>
 #include inc(rom##E32PATH##,VARIANT_PATH,\test\##MAIN##test.iby)
 #endif
-
+*/
--- a/kernel/eka/rombuild/f32tests.oby	Tue Sep 14 23:56:21 2010 +0300
+++ b/kernel/eka/rombuild/f32tests.oby	Fri Sep 17 16:50:19 2010 +0100
@@ -33,15 +33,17 @@
 // Include e32 and f32 tests
 
 #include <rom##E32PATH##\kernelhwsrv\kerneltest\e32test\group\##MAIN##test.iby>
+/*
 #ifndef VARIANT_PATH
 #include <rom##E32PATH##\##VARIANT##\test\##MAIN##test.iby>
 #else
 #define inc(a,b,c) <a\\b\\c>
 #include inc(rom##E32PATH##,VARIANT_PATH,\test\##MAIN##test.iby)
 #endif
+*/
 
 #include <rom##E32PATH##\kernelhwsrv\kerneltest\f32test\group\##MAIN##test.iby>
-#include <rom##E32PATH##\kernelhwsrv\kerneltest\f32test\rofs\##MAIN##test.iby>
+//#include <rom##E32PATH##\kernelhwsrv\kerneltest\f32test\rofs\##MAIN##test.iby>
 
 // Required for t_pageldrtst
 data=EPOCROOT##Epoc32\Release\##MAIN##\##BUILD##\d_exc.exe			\sys\bin\d_exc.exe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/rombuild/rom.flm	Fri Sep 17 16:50:19 2010 +0100
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2009 Symbian.  All rights reserved.
+#
+
+# macro for all the rules
+define rom
+
+FINAL::	
+ifeq ($(OSTYPE),unix)
+	$(call startrule,rom) \
+	echo "This is not supported currently"; \
+	$(call endrule,rom)
+else
+	$(call startrule,rom) \
+	$(PERL) $(EPOCROOT)/sf/os/kernelhwsrv/kernel/eka/rombuild/rom_sbs.pl --variant=$(REE_TARGET) --inst=$(PLATFORM) --build=$(CFG) --type=$(TYPE) --clean --name=$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img \
+	$(call endrule,rom)
+endif
+
+	$(call startrule,copy) \
+	mv rom.oby $(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_rom.oby; \
+	mv ROMBUILD.LOG $(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_ROMBUILD.LOG; \
+	mv $(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img $(EPOCROOT)/epoc32/rom/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img; \
+	$(call endrule,copy)
+
+endef
+
+# expand
+$(eval $(rom))
+
+# The items produced by this FLM:
+RELEASEABLES:=$(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_rom.oby $(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_ROMBUILD.LOG $(EPOCROOT)/epoc32/rom/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img
+
+## What targets -- declare the files produced here
+$(eval $(call whatmacro, $(RELEASEABLES)))
+## Clean up
+$(eval $(call GenerateStandardCleanTarget, $(RELEASEABLES)))
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/rombuild/rom.meta	Fri Sep 17 16:50:19 2010 +0100
@@ -0,0 +1,10 @@
+# Meta information for the syborg extension template
+#
+# Copyright (c) 2009 Symbian Foundation Ltd.  All rights reserved.
+#
+
+platform	armv5
+makefile 	gnumake
+techstream	base
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/rombuild/rom.xml	Fri Sep 17 16:50:19 2010 +0100
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?> 
+<!--
+#
+# Copyright (c) 2009 Symbian Foundation. 
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
+# which accompanies this distribution, and is available
+# at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
+#
+# Initial Contributors:
+# Symbian Foundation - initial contribution.
+#
+# Contributors:
+#
+# Description: Implementation of generic image generation for target using SBS/Raptor
+#
+-->
+<!--  Extension interfaces : replacements for Template Extension Makefiles  --> 
+
+<build xmlns="http://symbian.com/xml/build" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symbian.com/xml/build ../../schema/build/2_0.xsd">
+	<interface name="base.rom" extends="Symbian.KernelFLM" flm="rom.flm">
+		<param name="REE_TARGET"/>
+		<param name="TYPE"/>
+	</interface>
+</build>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/rombuild/rom_sbs.pl	Fri Sep 17 16:50:19 2010 +0100
@@ -0,0 +1,875 @@
+#!perl
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+# rom.pl - Build a rom
+#
+# Pre-processes the .oby/iby files then invokes rombuild.exe
+# (or other specified builder)
+
+# First, read our config file
+
+use strict;
+use Getopt::Long;
+use Cwd;
+
+#Getopt::Long::Configure("ignore_case");
+my %opts=();
+my $param_count = scalar(@ARGV);
+my $result = GetOptions (\%opts, "assp=s",
+						 "inst=s",
+						 "type=s",
+						 "variant=s",
+						 "build=s", 
+						 "conf=s",
+						 "name=s",
+						 "modules=s",
+						 "xabi=s",
+						 "clean",
+						 "quiet",
+						 "help",
+						 "_debug",
+						 "zip",
+						 "symbol",
+						 "noheader",
+						 "kerneltrace=s",
+						 "rombuilder=s",
+						 "define=s@",
+						 "rofsbuilder=s",
+						 "compress",
+						 );
+
+my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder);
+my $main;
+my $kmain;
+my $toroot;
+my $e32path;
+my $rombuildpath;
+my $euserdir;
+my $elocldir;
+my $kbdir;
+my $romname;
+my $single;
+my $smain;
+my $pagedCode;
+my $debug = $opts{_debug};
+my $quiet;
+$quiet = $opts{quiet} unless $debug;
+
+my $drive;
+
+# discover where this script is running from to set the $toroot and $e32path variables
+
+my $toolpath;
+my $Epoc32Path;
+my $EpocRoot;
+my $drive;
+my $BasePath;
+
+BEGIN {
+
+	$EpocRoot = $ENV{EPOCROOT};
+	die "ERROR: Must set the EPOCROOT environment variable.\n" if (!defined($EpocRoot));
+	print "Environmental epocroot - >$EpocRoot<\n";
+	$EpocRoot =~ s-/-\\-go;	# for those working with UNIX shells
+	if ($EpocRoot =~ /^([a-z]:)(.*)$/i)
+	{
+		# Raptor style: Drive letter and trailing \\ removed
+		$drive = $1;
+		$EpocRoot = "$2\\";
+		$ENV{EPOCROOT} = $EpocRoot;
+	}
+	die "ERROR: EPOCROOT must be an absolute path, " .
+		"not containing a drive letter.\n" if ($EpocRoot !~ /^\\/);
+	die "ERROR: EPOCROOT must not be a UNC path.\n" if ($EpocRoot =~ /^\\\\/);
+	die "ERROR: EPOCROOT must end with a backslash.\n" if ($EpocRoot !~ /\\$/);
+	die "ERROR: EPOCROOT must specify an existing directory.\n" if (!-d $EpocRoot);
+
+	# The cpp needed a drive apparently
+	my $cwd = Cwd::cwd();
+	$cwd =~ /^(.)/;
+	$drive = "$1:" unless $drive;
+	print "epocroot = >$EpocRoot<\n";
+	print "drive = >$drive<\n";
+
+	my $fp0 = $0;
+	$cwd =~ s/\//\\/g;
+	$fp0 =~ s/\//\\/g;
+	unless ($fp0 =~ /^([A-Za-z]:)?\\/) {
+		if ($cwd =~ /\\$/) {
+			$fp0 = "$cwd$fp0";
+		} else {
+			$fp0 = "$cwd\\$fp0";
+		}
+	}
+
+	my @path = split(/\\/, $cwd);
+	shift(@path);
+	$toroot = ('..\\') x @path;
+	$e32path = $fp0;
+	$e32path =~ s/\\kernelhwsrv\\kernel\\eka\\rombuild\\rom\.pl$//i;
+	$e32path =~ s/^[A-Za-z]://;
+	$rombuildpath = $toroot."sf\\os\\kernelhwsrv\\kernel\\eka\\rombuild";
+	$Epoc32Path = $toroot;
+	$Epoc32Path =~ s/\\$//;
+	$Epoc32Path .= $EpocRoot . "epoc32";
+	$toolpath = "$Epoc32Path\\tools\\";
+	push @INC, $toolpath;
+	$BasePath = $toroot . $e32path;
+}
+
+use E32Plat;
+{
+        Plat_Init($toolpath);
+}
+
+if ($debug) {
+	print "EpocRoot = $EpocRoot\n";
+	print "Epoc32Path = $Epoc32Path\n";
+	print "drive = $drive\n";
+	print "toolpath = $toolpath\n";
+	print "toroot = $toroot\n";
+	print "e32path = $e32path\n";
+	print "rombuildpath = $rombuildpath\n";
+	print "BasePath = $BasePath\n";
+}
+
+my $cppflags="-P -undef -traditional -lang-c++ -nostdinc -iwithprefixbefore $rombuildpath -I $rombuildpath -I $drive$Epoc32Path ";
+
+# Include variant hrh file defines when processing oby and ibys with cpp
+# (Code copied from \\EPOC\master\cedar\generic\tools\romkit\tools\buildrom.pm -
+# it used relative path to the working dir but we are using absolute path seems neater)
+use E32Variant;
+use Pathutl;
+my $variantMacroHRHFile = Variant_GetMacroHRHFile();
+if($variantMacroHRHFile){
+	# Using absolute paths so must include drive letter otherwise cpp will fail
+	# Also adding the directory containing the HRH file to main includes paths in
+	# case it includes files
+	my $variantFilePath = Path_Split('Path',$variantMacroHRHFile);
+	$cppflags .= " -I $drive$variantFilePath -include $drive$variantMacroHRHFile";
+}
+
+if($param_count == 0 || $opts{'help'} || !$result) {
+	usage();
+	exit 0;
+}
+
+# Now check that the options we have make sense
+
+checkopts();
+
+if (!$quiet) {
+	print "Starting directory: ", Cwd::cwd(), "\n";
+	print <<EOF;
+OPTIONS:
+\tTYPE: $opts{'type'}
+\tVARIANT: $opts{'variant'}
+\tINSTRUCTION SET: $opts{'inst'}
+\tBUILD: $opts{'build'}
+\tMODULES: $opts{'modules'}
+EOF
+}
+
+#Pick out the type file
+my $skel;
+
+if (-e "$opts{'type'}.oby") {
+	$skel="$opts{'type'}.oby";
+} elsif (-e "$rombuildpath\\$opts{'type'}.oby") {
+	$skel="$rombuildpath\\$opts{'type'}.oby";
+} else {
+	die "Can't find type file for type $opts{'type'}, $!";
+}
+
+print "Using type file $skel\n" if !$quiet;
+
+# If clean is specified, zap all the image and .oby files
+
+if($opts{'clean'}) {
+	unlink glob("*.img");
+	unlink "rom.oby";
+	unlink "rombuild.log";
+	unlink glob("*.rofs");
+	unlink "rofsbuild.log";
+}
+
+# Now pre-pre-process this file to point to the right places for .ibys
+# Unfortunately cpp won't do macro replacement in #include strings, so
+# we have to do it by hand
+
+my $k = $opts{kerneltrace};
+
+if ($opts{assp}=~/^m(\S+)/i) {
+	$kbdir="kb$1";
+	$kbdir="kbarm" if (lc $1 eq 'eig');
+} else {
+	$kbdir="kb$opts{assp}";
+}
+$single=1 if ($opts{assp}=~/^s(\S+)/i);
+
+if ($single) {
+	# Hackery to cope with old compiler
+	if ($main eq 'MARM') {
+		$smain='SARM';
+	} else {
+		$smain="S$main";
+	}
+} else {
+	$smain=$main;
+}
+
+open(X, "$skel") || die "Can't open type file $skel, $!";
+open(OUT, "> rom1.tmp") || die "Can't open output file, $!";
+
+# First output the ROM name
+print OUT "\nromname=$romname\n";
+while(<X>) {
+	s/\#\#ASSP\#\#/$opts{'assp'}/;
+	s/\#\#VARIANT\#\#/$opts{'variant'}/;
+	s/\#\#BUILD\#\#/$opts{'build'}/;
+	s/\#\#MAIN\#\#/$main/;
+	s/\#\#KMAIN\#\#/$kmain/;
+	s/\#\#E32PATH\#\#/$e32path/;
+	s/\#\#BASEPATH\#\#/$BasePath/;
+	s/\#\#EUSERDIR\#\#/$euserdir/;
+	s/\#\#ELOCLDIR\#\#/$elocldir/;
+	s/\#\#KBDIR\#\#/$kbdir/;
+	print OUT;
+}
+
+close X;
+close OUT;
+
+# Use cpp to pull in include chains and replace defines
+
+my $defines = "";
+$defines .= "-D MAIN=$main ";
+$defines .= "-D KMAIN=$kmain ";
+$defines .= "-D EUSERDIR=$euserdir ";
+$defines .= "-D ELOCLDIR=$elocldir ";
+$defines .= "-D E32PATH=$e32path ";
+$defines .= "-D BASEPATH=$BasePath ";
+$defines .= "-D EPOCROOT=$EpocRoot ";
+$defines .= "-D SMAIN=$smain " if $smain;
+
+foreach (@{$opts{'define'}}) {
+	my @array=split(/,/,$_);
+	foreach (@array) {
+		$defines.="-D ".uc $_." ";
+		$pagedCode = 1 if $_ eq 'PAGED_CODE';
+		}
+	}
+
+if ($opts{'modules'}) {
+	my @array=split(/,/,$opts{'modules'});
+	foreach (@array) {
+		$defines.="-D ".uc $_." ";
+		}
+	}
+
+foreach (keys %opts) {
+	next if ($_ eq 'name');
+	next if ($_ eq 'modules');
+	next if ($_ eq 'zip');
+	next if ($_ eq 'symbol');
+	next if ($_ eq 'kerneltrace');
+	next if ($_ eq 'define');
+	$defines.="-D ".uc $_."=".$opts{$_}." ";
+	$defines.="-D ".uc $_."_".$opts{$_}." ";
+}
+
+$defines.="-D SINGLE " if ($single);
+
+sub IsRVCTBuild($) {
+    my ($build)=@_;
+    return 1 if ($build =~ /^ARMV/i);
+	my @customizations = Plat_Customizations('ARMV5');
+	return 1 if (grep /$build/, @customizations);
+	return 0;
+}
+
+$defines.="-D RVCT " if (IsRVCTBuild($main));
+
+print "Using defines $defines\n" if !$quiet;
+
+my $ret=1;
+my $cppcmd;
+if($opts{'build'}=~/^u/i) {
+	# Unicode build
+	$cppcmd = "$Epoc32Path/gcc/bin/cpp $cppflags -D UNICODE $defines rom1.tmp rom2.tmp";
+} else {
+	$cppcmd = "cpp $cppflags $defines rom1.tmp rom2.tmp";
+}
+print "Executing CPP:\n\t$cppcmd\n" if $debug;
+$ret = system($cppcmd);
+die "ERROR EXECUTING CPP\n" if $ret;
+
+# Zap any ## marks REMS or blank lines
+
+cleanup("rom2.tmp", "rom3.tmp", $k);
+
+# scan tmp file and generate auxiliary files, if required
+open TMP, "rom3.tmp" or die("Can't open rom3.tmp\n");
+my $line;
+while ($line=<TMP>)
+	{
+	if ($line=~/\s*gentestpaged/i) {
+		genfile("paged");	}
+	if ($line=~/\s*gentestnonpaged/i) {
+		genfile("nonpaged");	}
+	}
+
+parsePatchData("rom3.tmp", "rom4.tmp");
+
+# break down the oby file into rom, rofs and extensions oby files
+
+my $oby_index =0;
+my $dumpfile="rom.oby";
+my $rofs=0;
+my $extension=0;
+my $corerofsname="";
+open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n");
+my $line;
+open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n");
+while ($line=<TMP>)
+	{
+	if ($line=~/^\s*rofsname/i)
+		{
+		close DUMPFILE;							# close rom.oby or previous rofs#/extension#.oby
+		$oby_index=1;
+		$corerofsname=$line;
+		$corerofsname =~ s/rofsname\s*=\s*//i;		# save core rofs name
+		$corerofsname =~ s/\s*$//g; 			# remove trailing \n
+		unlink $corerofsname || print "unable to delete $corerofsname";
+		my $dumpfile="rofs".$rofs.".oby";
+		$rofs++;
+		open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n"));
+		}
+
+	if ($line=~/^\s*coreimage/i)
+		{
+		close DUMPFILE;							# close rofs.oby
+		if ($oby_index ne 1) {
+			close TMP;
+			die "Must specify ROFS image before ROFS extension\n";
+		}
+		my $name=$line;
+		$name =~ s/coreimage\s*=\s*//i;		# read core rofs name
+		$name =~ s/\s*$//g; 			# remove trailing \n
+		if ($name ne $corerofsname) {
+			close TMP;
+			die "This extension does not relate to previous ROFS\n";
+		}
+		$oby_index=33;						# open window
+		my $dumpfile="extension".$extension.".oby";
+		$extension++;
+		open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n"));
+		}
+
+	if ($line=~/^\s*extensionrofs/i)
+		{
+		$oby_index=3 if ($oby_index eq 2);
+		}
+
+	if (($oby_index eq 2) && !($line=~/^\s*$/)) {
+		close TMP;
+		die "Bad ROFS extension specification\n";
+	}
+	print DUMPFILE $line;
+	$oby_index=2 if ($oby_index eq 33);		# close window
+	}
+close DUMPFILE;
+close TMP;
+
+# For paged roms that use rofs, move all data= lines in rom which are not 'paging_unmovable' to rofs, so that paged ram-loaded code
+# is automatically put into rofs
+rename('rom.oby', 'rom4.tmp') || die;
+
+open(IN, 'rom4.tmp') || die "Can't read rom4.tmp";
+open(ROM, '>rom.oby') || die "Can't write to rom.oby";
+
+if ($oby_index >= 1 && $pagedCode)	{
+	open(ROFS, '>>rofs0.oby') || die "Can't append to rofs0.oby";
+}
+
+while ($line=<IN>)
+{
+	if(($oby_index >= 1) && ($pagedCode) && ($line=~/^\s*data\s*=/) && !($line=~/\.*paging_unmovable\s*/)) {
+		print ROFS $line;
+	}
+	else {
+		$line=~s/paging_unmovable//;
+		print ROM $line;
+	}
+}
+
+close IN;
+close ROM;
+
+if ($oby_index >= 1 && $pagedCode)	{
+	close ROFS;
+}
+	unlink 'rom4.tmp';
+
+my $flags;
+
+foreach (@{$flags{$opts{'assp'}}}) {
+	$flags.=" -$_";
+}
+
+if($opts{'noheader'}) {
+	$flags.=" -no-header";
+}
+
+if($opts{'compress'}) {
+	$flags.=" -compress";
+}
+
+my $builder = $opts{'rombuilder'};
+$builder = "rombuild" unless ($builder);
+
+
+
+print "$builder $flags -type-safe-link -S rom.oby 2>&1\n\n";
+
+open(Y, "$builder $flags -type-safe-link -S rom.oby 2>&1 |") || 
+	die "Can't start $builder command, $!";
+
+my $nerrors=0;
+my $nwarnings=0;
+
+while(<Y>) {
+	my $error=(/^error:/i);
+	my $warning=(/^warning:/i);
+	print if ($error or $warning or !$quiet);
+	$nerrors++ if ($error);
+	$nwarnings++ if ($warning);
+}
+
+print "\nGenerated .oby file is rom.oby\n" if !$quiet;
+print "\nGenerated image file is $romname\n" if (!$nerrors);
+
+my$rerrors;
+my $rofsbuilder;
+if ($rofs) {
+	$rofsbuilder = $opts{'rofsbuilder'};
+	$rofsbuilder = "rofsbuild" unless ($rofsbuilder);
+	for(my $i=0;$i<$rofs;++$i) {
+		print "Executing $rofsbuilder on main rofs\n" if !$quiet;
+		my $image="rofs".$i.".oby";
+		system("$rofsbuilder $image");
+		if ($? != 0)
+			{
+			print "$rofsbuilder $image returned $?\n";
+			$rerrors++;
+			}
+		rename "rofsbuild.log", "rofs$i.log"
+		}
+}
+
+if ($rofs and $extension) {
+	for(my $i=0;$i<$extension;++$i) {
+		print "Executing $rofsbuilder on extension rofs\n" if !$quiet;
+		my $image="extension".$i.".oby";
+		system("$rofsbuilder $image");
+		if ($? != 0)
+			{
+			print "$rofsbuilder $image returned $?\n";
+			$rerrors++;
+			}
+		rename "rofsbuild.log", "extension$i.log"
+		}
+}
+
+if ($nerrors) {
+	print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n";
+} elsif ($nwarnings) {
+	print "\n\n Warnings during $builder!!\n\nLeaving tmp files\n";
+} elsif ($rerrors) {
+	print "\n\n Errors during $rofsbuilder!!\n\nLeaving tmp files\n";
+} else {
+	unlink glob("*.tmp") if !$debug;
+}
+if ($opts{zip} or $zip{$opts{assp}}) {
+	my $zipname=$romname;
+	$zipname =~ s/\.(\w+)$/\.zip/i;
+	unlink $zipname;
+	system("zip $zipname $romname");
+}
+if ($opts{symbol}) {
+	my $logname=$romname;
+	$logname =~ s/\.(\w+)$/\.log/i;
+	my $obyname=$romname;
+	$obyname =~ s/\.(\w+)$/\.oby/i;
+	unlink $logname;
+	unlink $obyname;
+	system("rename rombuild.log $logname");
+	system("rename rom.oby $obyname");
+	system("maksym $logname");
+}
+
+if ($nerrors || $nwarnings || $rerrors) {
+	exit 4;
+}	
+	
+exit 0;
+
+
+################################ Subroutines  ##################################
+
+sub usage {
+	print <<EOT;
+
+rom <options>
+
+Generate a rom image for the specified target, along with a rom.oby file
+that can be fed to (a) rombuild to regenerate the image.
+
+The following options are required:
+  --variant=<variant>         e.g. --variant=assabet
+  --inst=<instruction set>    e.g. --inst=arm4
+  --build=<build>             e.g. --build=udeb
+  --type=<type of rom>  
+         tshell for a text shell rom
+         e32tests for a rom with e32tests
+         f32tests for rom with f32tests
+         alltests for all the tests
+
+The following are optional:
+  --name=<image name>               Give image file specified name
+  --noheader                        Pass -no-header option on to rombuild
+  --help                            This help message.
+  --clean                           Remove existing generated files first
+  --quiet                           Be less verbose
+  --modules=<comma separated list>  List of additional modules for this ROM
+  --define=<comma separated list>   List of CPP macros to define
+
+Options may be specified as a short abbreviation 
+e.g. -b udeb instead of --build udeb
+
+EOT
+}
+
+sub cleanup($$$) {
+	my ($in, $out, $k) = @_;
+	my ($line, $lastblank);
+
+	open(OUTPUT_FILE, "> $out") or die "Cannot open $out for output";
+	open(INPUT_FILE, "< $in") or die "Cannot open for $in input";
+  
+	while ($line=<INPUT_FILE>) {
+		$line=~s/##//g;
+
+		# file=\epoc32\...  ==> file=%EPOCROOT%\epoc32\...
+		$line =~ s/(=\s*)\\epoc32/\1${EpocRoot}Epoc32/i;
+
+		# Now compress blank lines down to one
+	
+		if($line=~/^\s*$/) {
+			if($lastblank) {
+				# Do nothing
+			} else {
+				# This is the first blank line
+				$lastblank=1;
+				print OUTPUT_FILE $line;
+			}
+		} else {
+			# Not blank
+			$lastblank=0;
+			if ($k and $line=~/^\s*kerneltrace/i) {
+				$line = "kerneltrace $k\n";
+			}
+			print OUTPUT_FILE $line if !($line=~/^\s*REM\s+/i);
+		}
+	}
+	close(INPUT_FILE);
+	close(OUTPUT_FILE);
+}
+
+sub IsSmp($) {
+	my %SmpKernelDirs=(
+		'x86smp' => 1,
+		'x86gmp' => 1,
+		'arm4smp' => 1,
+		'armv4smp' => 1,
+		'armv5smp' => 1
+	);
+
+	my ($kdir) = @_;
+	return $SmpKernelDirs{lc $kdir};
+}
+
+sub checkopts {
+	unless($opts{variant}) { die "No Variant specified"; }
+	$opts{'build'}="UDEB" unless($opts{'build'});
+	$opts{'type'}="TSHELL" unless($opts{'type'});
+	$opts{'inst'}="ARM4" unless($opts{'inst'});
+
+	my $additional;
+	if ($opts{'modules'}) {
+		$additional="_".$opts{modules};
+		$additional=~ s/,/_/ig;
+	}
+	my $build=lc $opts{build};
+	my $inst=uc $opts{'inst'};
+	if ($inst eq "MARM") {
+		# Hackery to cope with old compiler
+		$main="MARM";
+		$euserdir="MARM";
+		$elocldir="MARM";
+	}
+	else {
+		$main=$inst;
+		if ($main eq "THUMB") {
+			$euserdir="ARMI";
+		} else {
+			$euserdir=$main;
+		}
+		if ($main eq "ARMI" or $main eq "THUMB") {
+			$elocldir="ARM4";
+		} else {
+			$elocldir=$main;
+		}
+	}
+	$kmain = $opts{'xabi'};
+	$kmain = $main unless ($kmain);
+	if (IsSmp($kmain)) {
+		$euserdir = $kmain;
+	}
+	if ($opts{name}) {
+		$romname=$opts{name};
+	} else {
+		$romname=uc($opts{variant}.$additional.$main);
+		if ($build=~/^\w*DEB$/i) {
+			$romname.='D';
+		}
+		$romname.='.IMG';
+	}
+}
+
+sub lookupFileInfo($$)
+{
+	my ($infile, $fullname) = @_;
+
+	my ($name, $ext) = $fullname =~ /^(.+)\.(\w+)$/ ? ($1, $2) : ($fullname, undef);
+
+	open TMP, $infile or die("Can't open $infile\n");
+	while(<TMP>)
+	{
+		$_ = lc;
+		if(/^\s*(\S+)\s*=\s*(\S+)\s+(\S+)/i)
+		{
+			my ($src, $dest) = ($2, $3);
+
+			my $destFullname = $dest =~ /^.*\\(.+)$/ ? $1 : $dest;
+			my ($destName, $destExt) = $destFullname =~ /^(.+?)\.(\w+)$/ ? ($1, $2) : ($destFullname, undef);
+
+			if ($destName eq $name && (!$ext || $ext eq $destExt))
+			{
+				close TMP;
+				return ($src, $dest);
+			}
+		}
+	}
+
+	die "patchdata: Can't find file $fullname\n";
+}
+
+sub lookupSymbolInfo($$)
+{
+	my ($file, $name) = @_;
+
+	open TMP, $file or die "Can't read $file\n";
+
+	# ignore local symbols.
+	while (<TMP> !~ /Global Symbols/) { }
+
+	while (<TMP>)
+	{
+		if (/^\s*(\S+)\s+(\S+)\s+data\s+(\S+)/i)
+		{
+			my ($symbol, $addr, $size) = ($1, $2, $3);
+			if ($symbol eq $name)
+			{
+				close TMP;
+				return ($addr, $size);
+			}
+		}
+
+		# This is a quick fix for RVCT 3.1, which uses the text "(EXPORTED)"
+		# in the map file. Here is an example:
+		#
+		# KHeapMinCellSize (EXPORTED) 0x0003d81c Data 4 mem.o(.constdata)
+		#
+		elsif (/^\s*(\S+)\s+\(exported\)\s+(\S+)\s+data\s+(\S+)/i)
+		{
+			my ($symbol, $addr, $size) = ($1, $2, $3);
+			if ($symbol eq $name)
+			{
+				close TMP;
+				return ($addr, $size);
+			}
+		}
+	}
+
+	die "patchdata: Can't find symbol $name\n";
+}
+
+sub parsePatchData($$)
+{
+	my ($infile, $outfile) = @_;
+
+	open IN, $infile or die("Can't read $infile\n");
+	open OUT, ">$outfile" or die("Can't write $outfile\n");
+
+	my $line;
+	while($line = <IN>)
+	{
+		if ($line =~ /^\s*patchdata\s+(.+?)\s*$/i)
+		{
+			if ($1 !~ /(\S+)\s*@\s*(\S+)\s+(\S+)\s*$/)
+			{
+				die "Bad patchdata command: $line\n";
+			}
+
+			my ($file, $symbol, $value) = (lc $1, $2, $3);
+			my ($srcFile, $destFile) = lookupFileInfo($infile, $file);
+			my ($index, $elementSize) = (undef, undef);
+			if ($symbol =~ s/:(\d+)\[(\d+)\]$//)
+			{
+				($index, $elementSize) = ($2, $1);
+				$index = hex($index) if $index =~ /^0x/i;
+			}
+
+			if ($srcFile =~ /\\armv5(smp)?\\/i)
+			{
+				my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol);
+
+				my $max;
+				if (defined($index))
+				{
+					my $bytes;
+					$bytes = 1, $max = 0xff       if $elementSize ==  8;
+					$bytes = 2, $max = 0xffff     if $elementSize == 16;
+					$bytes = 4, $max = 0xffffffff if $elementSize == 32;
+					die("patchdata: invalid element size $elementSize: $line\n") unless defined($bytes);
+
+					if ($bytes > 1 && (($symbolSize & ($bytes-1)) != 0))
+					{
+						die("patchdata: unexpected symbol size $symbolSize for array $symbol ($elementSize-bit elements)\n");
+					}
+
+					if ($index >= int($symbolSize / $bytes))
+					{
+						die("patchdata: index $index out of bounds for $symbol of $symbolSize bytes ($elementSize-bit elements)\n");
+					}
+
+					$symbolAddr = hex($symbolAddr) if $symbolAddr =~ /^0x/i;
+					$symbolAddr += $index * $bytes;
+					$symbolAddr = sprintf("0x%x", $symbolAddr);
+
+					$symbolSize = $bytes;
+				}
+				elsif ($symbolSize == 1) { $max = 0xff; }
+				elsif ($symbolSize == 2) { $max = 0xffff; }
+				elsif ($symbolSize == 4) { $max = 0xffffffff; }
+				else { die "patchdata: Unexpected symbol size $symbolSize for $symbol\n"; }
+
+				$value = hex($value) if $value =~ /^0x/i;
+				if ($value > $max)
+				{
+					print("Warning:  Value overflow of $symbol\n");
+					$value &= $max;
+				}					
+				$value = sprintf("0x%08x", $value);
+
+				$line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n";
+			}
+			else
+			{
+				$line = "";
+			}
+
+		}
+
+		print OUT $line;
+	}
+
+	close IN;
+	close OUT;
+}
+
+sub genfile {
+	my $count=0;
+	if($_[0] eq 'paged') {
+		my $file='gentestpaged.txt';
+		unlink $file;
+		open(OUTFILE, ">$file") or die "Can't open output file, $!";
+		for(my $i=0;$i<50000;++$i) {
+			if(($i >5) && ($i % 40 ==0)) {
+			print OUTFILE "\n";
+			$count++;
+			} 
+			if(($i+$count) % 5 ==0) {
+			print OUTFILE "SATOR ";
+			}
+			if(($i+$count) % 5 ==1) {
+			print OUTFILE "AREPO ";
+			}
+			if(($i+$count) % 5 ==2) {
+			print OUTFILE "TENET ";
+			}
+			if(($i+$count) % 5 ==3) {
+			print OUTFILE "OPERA ";
+			}
+			if(($i+$count) % 5 ==4) {
+			print OUTFILE "ROTAS ";
+			}
+		}
+	} else {
+		my $file='gentestnonpaged.txt';
+		unlink $file;
+		open(OUTFILE, ">$file") or die "Can't open output file, $!";
+		for(my $i=0;$i<20000;++$i) {
+			if(($i >5) && ($i % 40 ==0)) {
+			print OUTFILE "\n";
+			$count++;
+			} 
+			if(($i+$count) % 4 ==0) {
+			print OUTFILE "STEP ";
+			}
+			if(($i+$count) % 4 ==1) {
+			print OUTFILE "TIME ";
+			}
+			if(($i+$count) % 4 ==2) {
+			print OUTFILE "EMIT ";
+			}
+			if(($i+$count) % 4 ==3) {
+			print OUTFILE "PETS ";
+			}
+		}
+	}
+}
+
+__END__
+
+# Tell emacs that this is a perl script even 'though it has a .bat extension
+# Local Variables:
+# mode:perl
+# tab-width:4
+# End:
+
--- a/userlibandfileserver/fileserver/sfile/sf_func.h	Tue Sep 14 23:56:21 2010 +0300
+++ b/userlibandfileserver/fileserver/sfile/sf_func.h	Fri Sep 17 16:50:19 2010 +0100
@@ -918,9 +918,12 @@
 public:
 	static TInt Initialise(CFsRequest* aRequest);
 	static TInt DoRequestL(CFsRequest* aRequest);
+	
+#ifndef __GCCE__ // GCC does not like AddFsToCompositeMountL() being private 
 #ifndef __GCC32__ // GCC does not like AddFsToCompositeMountL() being private 
 private:
 #endif
+#endif
 	static void AddFsToCompositeMountL(TInt aDriveNumber, CFileSystem& aFileSystem, TInt aLocalDriveNumber);
 	};