* Invoke cabman when building a CD * Entrypoint attribute on <module> to override default entrypoint * Use entrypoint _DrvEnableDriver@12 for display drivers
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml Modified: branches/xmlbuildsystem/reactos/drivers/video/displays/framebuf/framebuf.xml Modified: branches/xmlbuildsystem/reactos/drivers/video/displays/vga/vgaddi.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml 2005-01-22 17:38:31 UTC (rev 13216) @@ -1,11 +1,4 @@
-<!--<module name="bootsector" type="bootsector">
- <include base="bootsector">freeldr/include</include>
- <compilerflag>-nostdlib</compilerflag>
- <compilerflag>-nostdinc</compilerflag>
- <compilerflag>-ffreestanding</compilerflag>
- <compilerflag>-no-builtin</compilerflag>
- <compilerflag>-no-inline</compilerflag>
- <compilerflag>-no-zero-initialized-in-bss</compilerflag>
+<module name="bootsector" type="bootsector">
<directory name="bootsect"> <file>dosmbr.asm</file> <file>ext2.asm</file> @@ -15,7 +8,7 @@
<file>win2k.asm</file> <file>wxpfat16.asm</file> </directory>
-</module>-->
+</module>
<directory name="freeldr"> <xi:include href="freeldr/freeldr_startup.xml" /> <xi:include href="freeldr/freeldr_base64k.xml" />
--- branches/xmlbuildsystem/reactos/drivers/video/displays/framebuf/framebuf.xml 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/drivers/video/displays/framebuf/framebuf.xml 2005-01-22 17:38:31 UTC (rev 13216) @@ -1,4 +1,4 @@
-<module name="framebuf" type="kernelmodedriver">
+<module name="framebuf" type="kernelmodedll" entrypoint="_DrvEnableDriver@12">
<importlibrary definition="framebuf.def" /> <include base="framebuf">.</include> <define name="__USE_W32API" />
--- branches/xmlbuildsystem/reactos/drivers/video/displays/vga/vgaddi.xml 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/drivers/video/displays/vga/vgaddi.xml 2005-01-22 17:38:31 UTC (rev 13216) @@ -1,4 +1,4 @@
-<module name="vgaddi" type="kernelmodedriver">
+<module name="vgaddi" type="kernelmodedll" entrypoint="_DrvEnableDriver@12">
<importlibrary definition="vgaddi.def" /> <include base="vgaddi">.</include> <define name="__USE_W32API" />
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 17:38:31 UTC (rev 13216) @@ -193,6 +193,8 @@
fprintf ( fMakefile, "NUL=NUL\n" ); fprintf ( fMakefile, "winebuild = tools" SSEP "winebuild" SSEP "winebuild\n" ); fprintf ( fMakefile, "bin2res = tools" SSEP "bin2res" SSEP "bin2res\n" );
+ fprintf ( fMakefile, "cabman = tools" SSEP "cabman" SSEP "cabman\n" ); + fprintf ( fMakefile, "cdmake = tools" SSEP "cdmake" SSEP "cdmake\n" );
fprintf ( fMakefile, "\n" ); GenerateGlobalCFlagsAndProperties ( "=", @@ -213,6 +215,8 @@
{ if ( module.type == ObjectLibrary ) return false;
+ if ( module.type == BootSector ) + return false;
if ( module.type == Iso ) return false; return true;
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-01-22 17:38:31 UTC (rev 13216) @@ -960,7 +960,8 @@
const string& cc, const string& cppc, const string& ar,
- const string* cflags ) const
+ const string* cflags,
+ const string* nasmflags ) const
{ string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ()); string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ()); @@ -982,7 +983,15 @@
cflagsMacro.c_str (), cflags->c_str () ); }
-
+ + if ( nasmflags != NULL ) + { + fprintf ( fMakefile, + "%s += %s\n\n", + nasmflagsMacro.c_str (), + nasmflags->c_str () ); + } +
// generate phony target for module name fprintf ( fMakefile, ".PHONY: %s\n", module.name.c_str () ); @@ -1021,21 +1030,33 @@
void MingwModuleHandler::GenerateMacrosAndTargetsHost ( const Module& module ) const {
- GenerateMacrosAndTargets ( module, "${host_gcc}", "${host_gpp}", "${host_ar}", NULL );
+ GenerateMacrosAndTargets ( module, + "${host_gcc}", + "${host_gpp}", + "${host_ar}", + NULL, + NULL );
} void MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module ) const { GenerateMacrosAndTargetsTarget ( module,
+ NULL,
NULL ); } void MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module,
- const string* clags ) const
+ const string* cflags,
+ const string* nasmflags ) const
{
- GenerateMacrosAndTargets ( module, "${gcc}", "${gpp}", "${ar}", clags );
+ GenerateMacrosAndTargets ( module, + "${gcc}", + "${gpp}", + "${ar}", + cflags, + nasmflags );
} string @@ -1306,8 +1327,9 @@
string base_tmp = ros_junk + module.name + ".base.tmp"; string junk_tmp = ros_junk + module.name + ".junk.tmp"; string temp_exp = ros_junk + module.name + ".temp.exp";
- string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,_NtProcessStartup -Wl,--image-base,0xC0000000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",
- module.GetBasePath ().c_str () );
+ string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0xC0000000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",
+ module.GetBasePath ().c_str (),
+ module.entrypoint.c_str () );
GenerateMacrosAndTargetsTarget ( module ); @@ -1429,7 +1451,8 @@
archiveFilename.c_str (), importLibraryDependencies.c_str () );
- string linkerParameters ( "-Wl,--subsystem,native -Wl,--entry,_DriverEntry@8 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll" );
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",
+ module.entrypoint.c_str () );
GenerateLinkerCommand ( module, "${gcc}", linkerParameters, @@ -1476,7 +1499,8 @@
{ string* cflags = new string ( "-D__NTDRIVER__" ); GenerateMacrosAndTargetsTarget ( module,
- cflags );
+ cflags,
+ NULL );
delete cflags; fprintf ( fMakefile, "%s: %s %s\n", @@ -1484,7 +1508,8 @@
archiveFilename.c_str (), importLibraryDependencies.c_str () );
- string linkerParameters ( "-Wl,--subsystem,native -Wl,--entry,_DriverEntry@8 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll" );
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",
+ module.entrypoint.c_str () );
GenerateLinkerCommand ( module, "${gcc}", linkerParameters, @@ -1546,7 +1571,8 @@
archiveFilename.c_str (), importLibraryDependencies.c_str () );
- string linkerParameters ( "-Wl,--subsystem,native -Wl,--entry,_DllMainCRTStartup@12 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll" );
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll",
+ module.entrypoint.c_str () );
GenerateLinkerCommand ( module, "${gcc}", linkerParameters, @@ -1618,7 +1644,8 @@
objectFilenames.c_str (), linkingDependencies.c_str () );
- string linkerParameters ( "-Wl,--subsystem,console -Wl,--entry,_DllMain@12 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll" );
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll",
+ module.entrypoint.c_str () );
GenerateLinkerCommand ( module, "${gcc}", linkerParameters, @@ -1669,7 +1696,8 @@
objectFilenames.c_str (), importLibraryDependencies.c_str () );
- string linkerParameters ( "-Wl,--subsystem,windows -Wl,--entry,_WinMainCRTStartup -Wl,--image-base,0x00400000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000" );
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,0x00400000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
+ module.entrypoint.c_str () );
GenerateLinkerCommand ( module, "${gcc}", linkerParameters, @@ -1734,6 +1762,40 @@
}
+static MingwBootSectorModuleHandler bootsectormodule_handler; + +MingwBootSectorModuleHandler::MingwBootSectorModuleHandler () + : MingwModuleHandler ( BootSector ) +{ +} + +void +MingwBootSectorModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateBootSectorModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ( const Module& module ) +{ + string objectsMacro = GetObjectsMacro ( module ); + + string* nasmflags = new string ( "-f bin" ); + GenerateMacrosAndTargetsTarget ( module, + NULL, + nasmflags); + + fprintf ( fMakefile, ".PHONY: %s\n\n", + module.name.c_str ()); + fprintf ( fMakefile, + "%s: %s\n", + module.name.c_str (), + objectsMacro.c_str () ); +} + +
static MingwIsoModuleHandler isomodule_handler; MingwIsoModuleHandler::MingwIsoModuleHandler () @@ -1752,10 +1814,28 @@
void MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) {
- string target ( FixupTargetFilename ( module.GetPath ()) );
+ string isoboot = "$(ROS_INTERMEDIATE)" + FixupTargetFilename ( "boot/freeldr/bootsect/isoboot.o" );
- fprintf ( fMakefile, "%s: all\n",
- target.c_str () );
+ fprintf ( fMakefile, ".PHONY: %s\n\n",
+ module.name.c_str ());
fprintf ( fMakefile,
- "\t\n" );
+ "%s: all %s\n",
+ module.name.c_str (),
+ isoboot.c_str () );
+ fprintf ( fMakefile,
+ "\t${cabman} /C %s /L $(ROS_INTERMEDIATE)%s /I\n",
+ FixupTargetFilename ( "bootdata/packages/reactos.dff" ).c_str (),
+ FixupTargetFilename ( "bootcd/reactos" ).c_str () );
+ fprintf ( fMakefile,
+ "\t${cabman} /C %s /RC $(ROS_INTERMEDIATE)%s /L $(BOOTCD_DIR)reactos /N\n",
+ FixupTargetFilename ( "bootdata/packages/reactos.dff" ).c_str (),
+ FixupTargetFilename ( "bootcd/reactos/reactos.inf" ).c_str () );
+ fprintf ( fMakefile,
+ "\t- ${rm} $(ROS_INTERMEDIATE)%s\n",
+ FixupTargetFilename ( "bootcd/reactos/reactos.inf" ).c_str () );
+ fprintf ( fMakefile,
+ "\t${cdmake} -v -m -b %s $(ROS_INTERMEDIATE)bootcd REACTOS ReactOS.iso\n",
+ isoboot.c_str () );
+ fprintf ( fMakefile,
+ "\n" );
}
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-01-22 17:38:31 UTC (rev 13216) @@ -42,7 +42,8 @@
void GenerateMacrosAndTargetsHost ( const Module& module ) const; void GenerateMacrosAndTargetsTarget ( const Module& module ) const; void GenerateMacrosAndTargetsTarget ( const Module& module,
- const std::string* clags ) const;
+ const std::string* cflags,
+ const std::string* nasmflags ) const;
std::string GetInvocationDependencies ( const Module& module ) const; std::string GetInvocationParameters ( const Invoke& invoke ) const; void GenerateInvocations ( const Module& module ) const; @@ -141,7 +142,8 @@
const std::string& cc, const std::string& cppc, const std::string& ar,
- const std::string* clags ) const;
+ const std::string* clags,
+ const std::string* nasmflags ) const;
std::string GetPreconditionDependenciesName ( const Module& module ) const; std::string GetSpecObjectDependencies ( const std::string& filename ) const; }; @@ -248,6 +250,16 @@
};
+class MingwBootSectorModuleHandler : public MingwModuleHandler +{ +public: + MingwBootSectorModuleHandler (); + virtual void Process ( const Module& module ); +private: + void GenerateBootSectorModuleTarget ( const Module& module ); +}; + +
class MingwIsoModuleHandler : public MingwModuleHandler { public:
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 17:38:31 UTC (rev 13216) @@ -61,10 +61,16 @@
type = GetModuleType ( node.location, *att ); att = moduleNode.GetAttribute ( "extension", false );
- if (att != NULL)
+ if ( att != NULL )
extension = att->value; else extension = GetDefaultModuleExtension ();
+ + att = moduleNode.GetAttribute ( "entrypoint", false ); + if ( att != NULL ) + entrypoint = att->value; + else + entrypoint = GetDefaultModuleEntrypoint ();
} Module::~Module () @@ -265,6 +271,8 @@
return Win32GUI; if ( attribute.value == "bootloader" ) return BootLoader;
+ if ( attribute.value == "bootsector" ) + return BootSector;
if ( attribute.value == "iso" ) return Iso; throw InvalidAttributeValueException ( location, @@ -293,6 +301,8 @@
case KernelModeDriver: case BootLoader: return ".sys";
+ case BootSector: + return ".o";
case Iso: return ".iso"; } @@ -300,6 +310,35 @@
__LINE__ ); }
+string +Module::GetDefaultModuleEntrypoint () const +{ + switch (type) + { + case Kernel: + return "_NtProcessStartup"; + case Win32GUI: + return "_WinMainCRTStartup"; + case KernelModeDLL: + return "_DriverEntry@8"; + case NativeDLL: + return "_DllMainCRTStartup@12"; + case Win32DLL: + return "_DllMain@12"; + case KernelModeDriver: + return "_DriverEntry@8"; + case BuildTool: + case StaticLibrary: + case ObjectLibrary: + case BootLoader: + case BootSector: + case Iso: + return ""; + } + throw InvalidOperationException ( __FILE__, + __LINE__ ); +} +
bool Module::HasImportLibrary () const {
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 15:48:00 UTC (rev 13215) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 17:38:31 UTC (rev 13216) @@ -80,6 +80,7 @@
Win32DLL, Win32GUI, BootLoader,
+ BootSector,
Iso }; @@ -91,6 +92,7 @@
const XMLElement& node; std::string name; std::string extension;
+ std::string entrypoint;
std::string path; ModuleType type; ImportLibrary* importLibrary; @@ -123,6 +125,7 @@
void ProcessXML(); private: std::string GetDefaultModuleExtension () const;
+ std::string GetDefaultModuleEntrypoint () const;
void ProcessXMLSubElement ( const XMLElement& e, const std::string& path, If* pIf = NULL );