mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 12:03:37 +00:00
* Invoke cabman when building a CD
* Entrypoint attribute on <module> to override default entrypoint * Use entrypoint _DrvEnableDriver@12 for display drivers svn path=/branches/xmlbuildsystem/; revision=13216
This commit is contained in:
parent
ac58a35d34
commit
d0acee6af8
8 changed files with 162 additions and 31 deletions
|
@ -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" />
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -193,6 +193,8 @@ MingwBackend::GenerateGlobalVariables () const
|
|||
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 @@ MingwBackend::IncludeInAllTarget ( const Module& module ) const
|
|||
{
|
||||
if ( module.type == ObjectLibrary )
|
||||
return false;
|
||||
if ( module.type == BootSector )
|
||||
return false;
|
||||
if ( module.type == Iso )
|
||||
return false;
|
||||
return true;
|
||||
|
|
|
@ -960,7 +960,8 @@ MingwModuleHandler::GenerateMacrosAndTargets (
|
|||
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 @@ MingwModuleHandler::GenerateMacrosAndTargets (
|
|||
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 @@ MingwModuleHandler::GenerateMacrosAndTargets (
|
|||
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 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module )
|
|||
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 @@ MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ( const Modul
|
|||
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 @@ MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ( const
|
|||
{
|
||||
string* cflags = new string ( "-D__NTDRIVER__" );
|
||||
GenerateMacrosAndTargetsTarget ( module,
|
||||
cflags );
|
||||
cflags,
|
||||
NULL );
|
||||
delete cflags;
|
||||
|
||||
fprintf ( fMakefile, "%s: %s %s\n",
|
||||
|
@ -1484,7 +1508,8 @@ MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ( const
|
|||
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 @@ MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ( const Module& modul
|
|||
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 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module
|
|||
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 @@ MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ( const Module& module
|
|||
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 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ( const Module& mod
|
|||
}
|
||||
|
||||
|
||||
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 @@ MingwIsoModuleHandler::Process ( const Module& module )
|
|||
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" );
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ protected:
|
|||
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 @@ private:
|
|||
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 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class MingwBootSectorModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBootSectorModuleHandler ();
|
||||
virtual void Process ( const Module& module );
|
||||
private:
|
||||
void GenerateBootSectorModuleTarget ( const Module& module );
|
||||
};
|
||||
|
||||
|
||||
class MingwIsoModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -61,10 +61,16 @@ Module::Module ( const Project& project,
|
|||
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 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
|
|||
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 @@ Module::GetDefaultModuleExtension () const
|
|||
case KernelModeDriver:
|
||||
case BootLoader:
|
||||
return ".sys";
|
||||
case BootSector:
|
||||
return ".o";
|
||||
case Iso:
|
||||
return ".iso";
|
||||
}
|
||||
|
@ -300,6 +310,35 @@ Module::GetDefaultModuleExtension () const
|
|||
__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
|
||||
{
|
||||
|
|
|
@ -80,6 +80,7 @@ enum ModuleType
|
|||
Win32DLL,
|
||||
Win32GUI,
|
||||
BootLoader,
|
||||
BootSector,
|
||||
Iso
|
||||
};
|
||||
|
||||
|
@ -91,6 +92,7 @@ public:
|
|||
const XMLElement& node;
|
||||
std::string name;
|
||||
std::string extension;
|
||||
std::string entrypoint;
|
||||
std::string path;
|
||||
ModuleType type;
|
||||
ImportLibrary* importLibrary;
|
||||
|
@ -123,6 +125,7 @@ public:
|
|||
void ProcessXML();
|
||||
private:
|
||||
std::string GetDefaultModuleExtension () const;
|
||||
std::string GetDefaultModuleEntrypoint () const;
|
||||
void ProcessXMLSubElement ( const XMLElement& e,
|
||||
const std::string& path,
|
||||
If* pIf = NULL );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue