Kernel - Slight reworks to timer code
[tpg/acess2.git] / Modules / Filesystems / InitRD / GenerateInitRD.php
index 8757f0e..e7cd4f7 100644 (file)
@@ -15,7 +15,8 @@ $ARCH = getenv("ARCH");
 
 $gInputFile = $argv[1];
 $gOutputFile = $argv[2];
-$gDepFile = ($argc > 3 ? $argv[3] : false);
+$gOutputLDOptsFile = $argv[3];
+$gDepFile = ($argc > 4 ? $argv[4] : false);
 
 $gDependencies = array();
 
@@ -66,11 +67,13 @@ function hd8($fp)
 }
 
 $inode = 0;
+$gSymFiles = array();
 function ProcessFolder($prefix, $items)
 {
        global  $gOutput, $gDependencies;
        global  $ACESSDIR, $ARCH;
        global  $inode;
+       global  $gSymFiles;
        foreach($items as $i=>$item)
        {
                $inode ++;
@@ -95,8 +98,7 @@ tVFS_Node {$prefix}_{$i} = {
        .Size = $size,
        .Inode = {$inode},
        .ImplPtr = {$prefix}_{$i}_entries,
-       .ReadDir = InitRD_ReadDir,
-       .FindDir = InitRD_FindDir
+       .Type = &gInitRD_DirType
 };
 
 EOF;
@@ -119,10 +121,12 @@ EOF;
                                exit(1);
                        }
                        $size = filesize($path);
-                       
+       
+/*             
+                       $_sym = $prefix."_".$i."_data";
                        $fp = fopen($path, "rb");
                        
-                       $gOutput .= "Uint8 {$prefix}_{$i}_data[] = {\n";
+                       $gOutput .= "Uint8 $_sym[] = {\n";
                        for( $j = 0; $j + 16 < $size; $j += 16 ) {
                                $gOutput .= "\t";
                                $gOutput .= hd8($fp).",".hd8($fp).",";
@@ -141,6 +145,13 @@ EOF;
                        }
                        fclose($fp);
                        $gOutput .= "\n};\n";
+*/
+                       
+//*
+                       $_sym = "_binary_".str_replace(array("/","-","."), "_", $path)."_start";
+                       $gOutput .= "extern Uint8 {$_sym}[];";
+                       $gSymFiles[] = $path;
+//*/
                        $gOutput .= <<<EOF
 tVFS_Node {$prefix}_{$i} = {
        .NumACLs = 1,
@@ -148,8 +159,8 @@ tVFS_Node {$prefix}_{$i} = {
        .Flags = 0,
        .Size = $size,
        .Inode = {$inode},
-       .ImplPtr = {$prefix}_{$i}_data,
-       .Read = InitRD_ReadFile
+       .ImplPtr = $_sym,
+       .Type = &gInitRD_FileType
 };
 
 EOF;
@@ -177,8 +188,7 @@ tVFS_Node gInitRD_RootNode = {
        .Flags = VFS_FFLAG_DIRECTORY,
        .Size = $nRootFiles,
        .ImplPtr = gInitRD_Root_Files,
-       .ReadDir = InitRD_ReadDir,
-       .FindDir = InitRD_FindDir
+       .Type = &gInitRD_DirType
 };
 EOF;
 
@@ -214,6 +224,15 @@ $fp = fopen($gOutputFile, "w");
 fputs($fp, $gOutput);
 fclose($fp);
 
+// - Create options call
+$fp = fopen($gOutputLDOptsFile, "w");
+fputs($fp, "--format binary\n");
+foreach($gSymFiles as $sym=>$file)
+{
+       fputs($fp, "$file\n");
+//     fputs($fp, "--defsym $sym=_binary_".$sym_filename."_start\n");
+}
+fclose($fp);
 
 if($gDepFile !== false)
 {

UCC git Repository :: git.ucc.asn.au