Browse Source

+ Set UEFI application kind in the generated binary header

git-svn-id: branches/olivier/uefi@36058 -
olivier 8 years ago
parent
commit
7d4da65273
3 changed files with 23 additions and 1 deletions
  1. 5 1
      compiler/globtype.pas
  2. 14 0
      compiler/ogcoff.pas
  3. 4 0
      compiler/options.pas

+ 5 - 1
compiler/globtype.pas

@@ -449,7 +449,11 @@ interface
          app_arm7,      { for Nintendo DS target }
          app_arm9,      { for Nintendo DS target }
          app_bundle,    { dynamically loadable bundle, Darwin only }
-         app_com        { DOS .COM file }
+         app_com,       { DOS .COM file }
+         app_efi_app,   { EFI application (UEFI target) }
+         app_efi_boot,  { EFI boot driver (UEFI target) }
+         app_efi_run,   { EFI runtime driver (UEFI target) }
+         app_efi_rom    { EFI ROM (UEFI target) }         
        );
 
        { interface types }

+ 14 - 0
compiler/ogcoff.pas

@@ -340,6 +340,9 @@ implementation
        PE_SUBSYSTEM_WINDOWS_GUI    = 2;
        PE_SUBSYSTEM_WINDOWS_CUI    = 3;
        PE_SUBSYSTEM_WINDOWS_CE_GUI = 9;
+       PE_SUBSYSTEM_EFI_APP        = 10;
+       PE_SUBSYSTEM_EFI_BOOT       = 11;
+       PE_SUBSYSTEM_EFI_RUN        = 12;       
 
        PE_FILE_RELOCS_STRIPPED         = $0001;
        PE_FILE_EXECUTABLE_IMAGE        = $0002;
@@ -2578,6 +2581,17 @@ const pemagic : array[0..3] of byte = (
             else
               if target_info.system in systems_wince then
                 peoptheader.Subsystem:=PE_SUBSYSTEM_WINDOWS_CE_GUI
+              else if target_info.system in [system_i386_uefi] then
+                begin
+                  case apptype of
+                    app_efi_app :
+        	          peoptheader.Subsystem:=PE_SUBSYSTEM_EFI_APP;
+        	        app_efi_boot :
+            	      peoptheader.Subsystem:=PE_SUBSYSTEM_EFI_BOOT;
+            	    app_efi_run :
+            	      peoptheader.Subsystem:=PE_SUBSYSTEM_EFI_RUN;
+        	      end;                
+                end                
               else
                 if apptype=app_gui then
                   peoptheader.Subsystem:=PE_SUBSYSTEM_WINDOWS_GUI

+ 4 - 0
compiler/options.pas

@@ -2174,6 +2174,10 @@ begin
                             else
                               SetApptype(app_native);
                           end
+                        else if target_info.system in [system_i386_uefi] then
+                          begin
+                            SetApptype(app_efi_app);
+                          end                          
                         else
                           IllegalPara(opt);
                       end;