Author: ion
Date: Tue Jun 13 08:50:14 2006
New Revision: 22339
URL:
http://svn.reactos.ru/svn/reactos?rev=22339&view=rev
Log:
- Enable ROS_LEAN_AND_MEAN if you want 50% smaller binaries and a 20MB reduction in memory
usage.
- Create a new module type: exportdriver for drivers which also export files. Not
supremely useful right now, but it helps us decrease compilation time of normal drivers by
not running useless commands on them. Later we'll also strip out their export table.
We can also make exportdrivers automatically read their .def file instead of specfiygone
one.
Modified:
trunk/reactos/Makefile
trunk/reactos/drivers/multimedia/ks/ks.rbuild
trunk/reactos/drivers/multimedia/portcls/portcls.rbuild
trunk/reactos/drivers/network/ndis/ndis.rbuild
trunk/reactos/drivers/network/tcpip/tcpip.rbuild
trunk/reactos/drivers/network/tdi/tdi.rbuild
trunk/reactos/drivers/storage/class2/class2.rbuild
trunk/reactos/drivers/storage/diskdump/diskdump.rbuild
trunk/reactos/drivers/storage/pciidex/pciidex.rbuild
trunk/reactos/drivers/storage/scsiport/scsiport.rbuild
trunk/reactos/drivers/usb/usbd/usbd.rbuild
trunk/reactos/drivers/usb/usbport/usbport.rbuild
trunk/reactos/drivers/usb/usbstor/usbstor.rbuild
trunk/reactos/drivers/video/videoprt/videoprt.rbuild
trunk/reactos/subsystems/win32/win32k/win32k.rbuild
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
trunk/reactos/tools/rbuild/bootstrap.cpp
trunk/reactos/tools/rbuild/module.cpp
trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/Makefile
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/Makefile?rev=22339&r1=2…
==============================================================================
--- trunk/reactos/Makefile (original)
+++ trunk/reactos/Makefile Tue Jun 13 08:50:14 2006
@@ -96,6 +96,12 @@
# can be either yes (to build non-symbol-stripped versions of executable
# output files) or no (to not build non-symbol-stripped versions of
# executable output files). The variable defaults to no.
+#
+# ROS_LEAN_AND_MEAN
+# This variable controls if all binaries should be stripped out of useless
+# data added by GCC/LD as well as of RSYM symbol data. Output binary size
+# will go from 80 to 40MB, memory usage from 58 to 38MB and the install CD
+# from 18 to 13MB. The variable defaults to no.
#
# ROS_RBUILDFLAGS
# Pass parameters to rbuild.
@@ -203,6 +209,7 @@
ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
+ ECHO_STRIP =@echo $(QUOTE)[STRIP] $@$(QUOTE)
else
ECHO_CP =
ECHO_MKDIR =
@@ -231,6 +238,7 @@
ECHO_REGTESTS=
ECHO_TEST =
ECHO_GENDIB =
+ ECHO_STRIP =
endif
@@ -256,6 +264,7 @@
ar = $(Q)$(PREFIX)-ar
objcopy = $(Q)$(PREFIX)-objcopy
dlltool = $(Q)$(PREFIX)-dlltool
+ strip = $(Q)$(PREFIX)-strip
windres = $(Q)$(PREFIX)-windres
rm = $(Q)rm -f
cp = $(Q)cp
@@ -275,6 +284,7 @@
ar = $(Q)ar
objcopy = $(Q)objcopy
dlltool = $(Q)dlltool
+ strip = $(Q)strip
windres = $(Q)windres
rm = $(Q)rm -f
cp = $(Q)cp
@@ -293,6 +303,7 @@
ar = $(Q)ar
objcopy = $(Q)objcopy
dlltool = $(Q)dlltool
+ strip = $(Q)strip
windres = $(Q)windres
rm = $(Q)del /f /q
cp = $(Q)copy /y
Modified: trunk/reactos/drivers/multimedia/ks/ks.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/multimedia/ks/ks.rb…
==============================================================================
--- trunk/reactos/drivers/multimedia/ks/ks.rbuild (original)
+++ trunk/reactos/drivers/multimedia/ks/ks.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="ks" type="kernelmodedriver"
installbase="system32/drivers" installname="ks.sys"
warnings="true">
+<module name="ks" type="exportdriver"
installbase="system32/drivers" installname="ks.sys"
warnings="true">
<include base="ks">.</include>
<include base="ks">..</include>
<importlibrary definition="ks.def" />
Modified: trunk/reactos/drivers/multimedia/portcls/portcls.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/multimedia/portcls/…
==============================================================================
--- trunk/reactos/drivers/multimedia/portcls/portcls.rbuild (original)
+++ trunk/reactos/drivers/multimedia/portcls/portcls.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="portcls" type="kernelmodedriver"
installbase="system32/drivers" installname="portcls.sys">
+<module name="portcls" type="exportdriver"
installbase="system32/drivers" installname="portcls.sys">
<importlibrary definition="portcls.def" />
<define name="__USE_W32API" />
<library>ntoskrnl</library>
Modified: trunk/reactos/drivers/network/ndis/ndis.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/network/ndis/ndis.r…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis.rbuild (original)
+++ trunk/reactos/drivers/network/ndis/ndis.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="ndis" type="kernelmodedriver"
installbase="system32/drivers" installname="ndis.sys">
+<module name="ndis" type="exportdriver"
installbase="system32/drivers" installname="ndis.sys">
<importlibrary definition="ndis.def"></importlibrary>
<include base="ndis">include</include>
<define name="NDIS_WRAPPER" />
Modified: trunk/reactos/drivers/network/tcpip/tcpip.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip.rbuild (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="tcpip" type="kernelmodedriver"
installbase="system32/drivers" installname="tcpip.sys">
+<module name="tcpip" type="exportdriver"
installbase="system32/drivers" installname="tcpip.sys">
<importlibrary definition="tcpip.def"></importlibrary>
<include base="tcpip">include</include>
<include base="oskittcp">include</include>
Modified: trunk/reactos/drivers/network/tdi/tdi.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/network/tdi/tdi.rbu…
==============================================================================
--- trunk/reactos/drivers/network/tdi/tdi.rbuild (original)
+++ trunk/reactos/drivers/network/tdi/tdi.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="tdi" type="kernelmodedriver"
installbase="system32/drivers" installname="tdi.sys">
+<module name="tdi" type="exportdriver"
installbase="system32/drivers" installname="tdi.sys">
<importlibrary definition="misc/tdi.def"></importlibrary>
<define name="__USE_W32API" />
<library>ntoskrnl</library>
Modified: trunk/reactos/drivers/storage/class2/class2.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/storage/class2/clas…
==============================================================================
--- trunk/reactos/drivers/storage/class2/class2.rbuild (original)
+++ trunk/reactos/drivers/storage/class2/class2.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="class2" type="kernelmodedriver"
installbase="system32/drivers" installname="class2.sys">
+<module name="class2" type="exportdriver"
installbase="system32/drivers" installname="class2.sys">
<bootstrap base="reactos" />
<define name="__USE_W32API" />
<importlibrary definition="class2.def" />
Modified: trunk/reactos/drivers/storage/diskdump/diskdump.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/storage/diskdump/di…
==============================================================================
--- trunk/reactos/drivers/storage/diskdump/diskdump.rbuild (original)
+++ trunk/reactos/drivers/storage/diskdump/diskdump.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="diskdump" type="kernelmodedriver"
installbase="system32/drivers" installname="diskdump.sys">
+<module name="diskdump" type="exportdriver"
installbase="system32/drivers" installname="diskdump.sys">
<bootstrap base="reactos" />
<define name="__USE_W32API" />
<include base="ReactOS">include/reactos/drivers</include>
Modified: trunk/reactos/drivers/storage/pciidex/pciidex.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/storage/pciidex/pci…
==============================================================================
--- trunk/reactos/drivers/storage/pciidex/pciidex.rbuild (original)
+++ trunk/reactos/drivers/storage/pciidex/pciidex.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="pciidex" type="kernelmodedriver"
installbase="system32/drivers" installname="pciidex.sys">
+<module name="pciidex" type="exportdriver"
installbase="system32/drivers" installname="pciidex.sys">
<importlibrary definition="pciidex.def" />
<define name="__USE_W32API" />
<library>ntoskrnl</library>
Modified: trunk/reactos/drivers/storage/scsiport/scsiport.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/storage/scsiport/sc…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport/scsiport.rbuild (original)
+++ trunk/reactos/drivers/storage/scsiport/scsiport.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="scsiport" type="kernelmodedriver"
installbase="system32/drivers" installname="scsiport.sys">
+<module name="scsiport" type="exportdriver"
installbase="system32/drivers" installname="scsiport.sys">
<bootstrap base="reactos" />
<define name="__USE_W32API" />
<define name="_SCSIPORT_" />
Modified: trunk/reactos/drivers/usb/usbd/usbd.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/usbd/usbd.rbuil…
==============================================================================
--- trunk/reactos/drivers/usb/usbd/usbd.rbuild (original)
+++ trunk/reactos/drivers/usb/usbd/usbd.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="usbd" type="kernelmodedriver"
installbase="system32/drivers" installname="usbd.sys">
+<module name="usbd" type="exportdriver"
installbase="system32/drivers" installname="usbd.sys">
<importlibrary definition="usbd.def" />
<define name="__USE_W32API" />
<library>ntoskrnl</library>
Modified: trunk/reactos/drivers/usb/usbport/usbport.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/usbport/usbport…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/usbport.rbuild (original)
+++ trunk/reactos/drivers/usb/usbport/usbport.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="usbport" type="kernelmodedriver"
installbase="system32/drivers" installname="usbport.sys">
+<module name="usbport" type="exportdriver"
installbase="system32/drivers" installname="usbport.sys">
<importlibrary definition="usbport.def" />
<define name="__USE_W32API" />
<library>sys_base</library>
Modified: trunk/reactos/drivers/usb/usbstor/usbstor.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/usbstor/usbstor…
==============================================================================
--- trunk/reactos/drivers/usb/usbstor/usbstor.rbuild (original)
+++ trunk/reactos/drivers/usb/usbstor/usbstor.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="usbstor" type="kernelmodedriver"
installbase="system32/drivers" installname="usbstor.sys"
allowwarnings="true">
+<module name="usbstor" type="exportdriver"
installbase="system32/drivers" installname="usbstor.sys"
allowwarnings="true">
<define name="__USE_W32API" />
<define name="DEBUG_MODE" />
<include base="ntoskrnl">include</include>
Modified: trunk/reactos/drivers/video/videoprt/videoprt.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/video/videoprt/vide…
==============================================================================
--- trunk/reactos/drivers/video/videoprt/videoprt.rbuild (original)
+++ trunk/reactos/drivers/video/videoprt/videoprt.rbuild Tue Jun 13 08:50:14 2006
@@ -1,4 +1,4 @@
-<module name="videoprt" type="kernelmodedriver"
installbase="system32/drivers" installname="videoprt.sys">
+<module name="videoprt" type="exportdriver"
installbase="system32/drivers" installname="videoprt.sys">
<importlibrary definition="videoprt.def" />
<include base="videoprt">.</include>
<include base="ntoskrnl">include</include>
Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/win…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/win32k.rbuild (original)
+++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild Tue Jun 13 08:50:14 2006
@@ -154,7 +154,7 @@
</compilationunit>
</directory>
</module>
-<module name="win32k" type="kernelmodedriver"
installbase="system32" installname="win32k.sys"
allowwarnings="true">
+<module name="win32k" type="exportdriver"
installbase="system32" installname="win32k.sys"
allowwarnings="true">
<importlibrary definition="win32k.def" />
<library>win32k_base</library>
<library>pseh</library>
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Tue Jun 13 08:50:14 2006
@@ -223,6 +223,7 @@
handler = new MingwWin32DLLModuleHandler ( module );
break;
case KernelModeDriver:
+ case ExportDriver: // maybe change this later
handler = new MingwKernelModeDriverModuleHandler ( module );
break;
case BootLoader:
@@ -1450,6 +1451,19 @@
}
void
+MingwModuleHandler::GenerateRunStripCode () const
+{
+ fprintf ( fMakefile,
+ "ifeq ($(ROS_LEAN_AND_MEAN),yes)\n" );
+ fprintf ( fMakefile,
+ "\t$(ECHO_STRIP)\n" );
+ fprintf ( fMakefile,
+ "\t${strip} -sx $@\n\n" );
+ fprintf ( fMakefile,
+ "endif\n" );
+}
+
+void
MingwModuleHandler::GenerateLinkerCommand (
const string& dependencies,
const string& linker,
@@ -1521,19 +1535,18 @@
objectsMacro.c_str (),
libsMacro.c_str (),
GetLinkerMacro ().c_str () );
-
- if ( pefixupParameters.length() != 0 )
- {
- fprintf ( fMakefile,
- "\t$(Q)$(PEFIXUP_TARGET) %s -exports %s\n",
- target.c_str (),
- pefixupParameters.c_str() );
- }
+
+#if 0 // causes crashes sometimes
+ fprintf ( fMakefile,
+ "\t${objcopy} -R .edata %s\n",
+ target.c_str () );
+#endif
}
GenerateBuildMapCode ();
GenerateBuildNonSymbolStrippedCode ();
GenerateRunRsymCode ();
+ GenerateRunStripCode ();
GenerateCleanObjectsAsYouGoCode ();
}
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Tue Jun 13 08:50:14 2006
@@ -112,6 +112,7 @@
std::string GetLinkerMacro () const;
void GenerateCleanObjectsAsYouGoCode () const;
void GenerateRunRsymCode () const;
+ void GenerateRunStripCode () const;
void GenerateLinkerCommand ( const std::string& dependencies,
const std::string& linker,
const std::string& linkerParameters,
Modified: trunk/reactos/tools/rbuild/bootstrap.cpp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/bootstrap.cpp?…
==============================================================================
--- trunk/reactos/tools/rbuild/bootstrap.cpp (original)
+++ trunk/reactos/tools/rbuild/bootstrap.cpp Tue Jun 13 08:50:14 2006
@@ -43,6 +43,7 @@
{
case Kernel:
case KernelModeDLL:
+ case ExportDriver:
case NativeDLL:
case NativeCUI:
case Win32DLL:
Modified: trunk/reactos/tools/rbuild/module.cpp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?rev…
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp (original)
+++ trunk/reactos/tools/rbuild/module.cpp Tue Jun 13 08:50:14 2006
@@ -731,6 +731,8 @@
return Kernel;
if ( attribute.value == "kernelmodedll" )
return KernelModeDLL;
+ if ( attribute.value == "exportdriver" )
+ return ExportDriver;
if ( attribute.value == "kernelmodedriver" )
return KernelModeDriver;
if ( attribute.value == "nativedll" )
@@ -793,6 +795,7 @@
return ".dll";
case KernelModeDriver:
case BootLoader:
+ case ExportDriver:
return ".sys";
case BootSector:
return ".o";
@@ -822,6 +825,8 @@
case Kernel:
return "_NtProcessStartup";
case KernelModeDLL:
+ case KernelModeDriver:
+ case ExportDriver:
return "_DriverEntry@8";
case NativeDLL:
return "_DllMainCRTStartup@12";
@@ -841,8 +846,6 @@
return "_wWinMainCRTStartup";
else
return "_WinMainCRTStartup";
- case KernelModeDriver:
- return "_DriverEntry@8";
case BuildTool:
case StaticLibrary:
case ObjectLibrary:
@@ -879,6 +882,7 @@
return "0x00400000";
case KernelModeDLL:
case KernelModeDriver:
+ case ExportDriver:
return "0x00010000";
case BuildTool:
case StaticLibrary:
@@ -910,10 +914,11 @@
{
case Kernel:
case KernelModeDLL:
+ case ExportDriver:
case NativeDLL:
case Win32DLL:
+ return true;
case KernelModeDriver:
- return true;
case NativeCUI:
case Win32CUI:
case Test:
@@ -943,6 +948,7 @@
{
case Kernel:
case KernelModeDLL:
+ case ExportDriver:
case NativeDLL:
case Win32DLL:
case KernelModeDriver:
@@ -1397,6 +1403,7 @@
return true;
case Kernel:
case KernelModeDLL:
+ case ExportDriver:
case NativeDLL:
case NativeCUI:
case Win32CUI:
Modified: trunk/reactos/tools/rbuild/rbuild.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=2…
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h (original)
+++ trunk/reactos/tools/rbuild/rbuild.h Tue Jun 13 08:50:14 2006
@@ -264,7 +264,8 @@
RpcClient = 17,
Alias = 18,
BootProgram = 19,
- Win32SCR = 20
+ Win32SCR = 20,
+ ExportDriver = 21
};
enum HostType