init web ems all
This commit is contained in:
182
wxc2_omc/configuration/bssomc/read_bssdist.inc
Executable file
182
wxc2_omc/configuration/bssomc/read_bssdist.inc
Executable file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
//
|
||||
// Created on: 11 Sep 2001
|
||||
//
|
||||
// Input : software version (e.g: iw05_01.048)
|
||||
//
|
||||
// Output : 2D array of source and destination filename
|
||||
// : Array(
|
||||
// Array(src 1,dest 1)
|
||||
// Array(src 2,dest 2)
|
||||
// .. .. ..
|
||||
// Array(src n,dest n)
|
||||
// );
|
||||
//
|
||||
// Supported format:
|
||||
// compile/PROC/bsc.o:bschd
|
||||
// compile/PROC/startup.hdd.fld.bsc:bschd=iwvstart=root=path
|
||||
// iwlib/platform/KERNEL/bootrom.bin:bschd:bsxhd:btshd
|
||||
// trxxil/btstrx.004:bschd:bsxhd: ne:trxxil/btstrxne.004:r
|
||||
// trxxil/irprxic.bit:bschd:bsxhd:btshd ne:trxxil/irprxicn.bit a52:trxxil/irprxic2.bit:r
|
||||
//
|
||||
//
|
||||
// Remarks :
|
||||
// - file format for bssdist.fls can be found at the header of bssdist.fls
|
||||
// - Use explode() as a faster split()
|
||||
// - special keywords in bssdist.fls: KERNEL, PROC, ALL_CPU_TYPES
|
||||
// - support for "bschd" only
|
||||
// - does not support "=path" (i.e. it does not modify the path inside iwvstart)
|
||||
//
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
function get_sw_filenames ($version, $build_path, $iwbox_type)
|
||||
{
|
||||
$index=0;
|
||||
$src_prefix = $build_path;
|
||||
|
||||
$trans_68k = Array("ALL_CPU_TYPES" => "68k");
|
||||
$trans_ppc = Array("ALL_CPU_TYPES" => "ppc");
|
||||
|
||||
$filename = "$build_path/$version/compile/pkg";
|
||||
$fileptr = fopen($filename,"r");
|
||||
if ($fileptr == false)
|
||||
{
|
||||
echo "Failed to open file: $filename<BR>\n";
|
||||
echo "Please check the BSS software is properly installed<BR>\n";
|
||||
return;
|
||||
}
|
||||
$pkg = fgets($fileptr,3);
|
||||
fclose($fileptr);
|
||||
|
||||
$filename = "$build_path/$version/compile/bssdist.fls";
|
||||
$fileptr = fopen($filename,"r");
|
||||
if ($fileptr == false)
|
||||
{
|
||||
echo "Failed to open file: $filename<BR>\n";
|
||||
echo "Please check the BSS software is properly installed<BR>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
while ( !feof($fileptr) )
|
||||
{
|
||||
/***********************************************************
|
||||
* Read the input file line by line for ":bschd" or ":bsxhd"
|
||||
***********************************************************/
|
||||
$buffer = ltrim(fgets($fileptr, 1024));
|
||||
$exist = ereg(":" . $iwbox_type ,$buffer);
|
||||
if ( $exist == false)
|
||||
continue;
|
||||
|
||||
/***********************
|
||||
* Extract the comment
|
||||
***********************/
|
||||
$commentstart = strpos($buffer,"#");
|
||||
if ($commentstart === false)
|
||||
{
|
||||
$theline = rtrim($buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
$theline = rtrim(substr($buffer,0,$commentstart));
|
||||
}
|
||||
if ($theline == "")
|
||||
continue;
|
||||
|
||||
/**********************************************************
|
||||
* Split the line into 2 columns delimited by space or tab
|
||||
* Process each column seperately
|
||||
**********************************************************/
|
||||
$column = split("[ \t]+",$theline);
|
||||
$left = $column[0];
|
||||
|
||||
|
||||
/*****************************************
|
||||
* Process the left column
|
||||
*
|
||||
* Remarks:
|
||||
* bschd=<path> or bsxhd=<path>
|
||||
* root mean /hd0/
|
||||
* path is meaningless for hdxfer
|
||||
*
|
||||
*****************************************/
|
||||
$left_field_by_colon = explode(":",$left);
|
||||
if ($left_field_by_colon[0] == $left)
|
||||
{
|
||||
echo "<BR>Error decoding bssdist.fls<BR>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$src_path = "$src_prefix/$version";
|
||||
$src_file = $left_field_by_colon[0];
|
||||
$dest_path = "$version";
|
||||
$dest_file = $left_field_by_colon[0];
|
||||
|
||||
// For each field seperated by ":"
|
||||
// e.g. vxWorks:bschd=vxWorks=root:bsxhd=vxWorks=root
|
||||
for ($i=1;isset($left_field_by_colon[$i]); $i++)
|
||||
{
|
||||
if (ereg($iwbox_type,$left_field_by_colon[$i]) == false)
|
||||
continue;
|
||||
|
||||
$left_sub_field = explode($iwbox_type . "=",$left_field_by_colon[$i]);
|
||||
if ($left_sub_field[0] != $left_field_by_colon[$i])
|
||||
{
|
||||
// "bschd=XXXX" or bschd=XXXX=root , "bsxhd=XXXX" or bsxhd=XXXX=root
|
||||
$left_sub_sub_field = explode("=",$left_sub_field[1]);
|
||||
$dest_file = "$left_sub_sub_field[0]";
|
||||
// "bschd=XXXX=root", "bsxhd=XXXX=root"
|
||||
$store_in_hd0 = ereg("=root", $left_sub_field[1]);
|
||||
if ($store_in_hd0 != false)
|
||||
{
|
||||
$output[$index++]
|
||||
= Array("$src_path/$src_file", "$dest_file");
|
||||
//echo "$src_path/$src_file --> $dest_file<BR>";
|
||||
}
|
||||
}
|
||||
break; // break because we just do ":bschd" or ":bsxhd"
|
||||
}
|
||||
|
||||
|
||||
for ($i=1;isset($column[$i]);$i++)
|
||||
{
|
||||
// ne:file
|
||||
$right_field = explode(":",$column[$i]);
|
||||
if (!strcmp($right_field[0],$pkg))
|
||||
{
|
||||
if (ereg(":r$",$column[$i]) == false)
|
||||
{
|
||||
$src_file = $right_field[1];
|
||||
$dest_file = $right_field[1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// processing the right column NOW (seperated by TAB)
|
||||
// e.g. ne:trxxil/irprxicn.bit a52:trxxil/irprxic2.bit:r
|
||||
//
|
||||
if (ereg("ALL_CPU_TYPES",$src_file) || ereg("ALL_CPU_TYPES",$dest_file))
|
||||
{
|
||||
$output[$index++]
|
||||
= Array(strtr("$src_path/$src_file",$trans_68k), strtr("$dest_path/$dest_file",$trans_68k));
|
||||
$output[$index++]
|
||||
= Array(strtr("$src_path/$src_file",$trans_ppc), strtr("$dest_path/$dest_file",$trans_ppc));
|
||||
//echo strtr("$src_path/$src_file --> $dest_path/$dest_file<BR>",$trans_68k);
|
||||
//echo strtr("$src_path/$src_file --> $dest_path/$dest_file<BR>",$trans_ppc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output[$index++] = Array("$src_path/$src_file", "$dest_path/$dest_file");
|
||||
//echo "$src_path/$src_file --> $dest_path/$dest_file<BR>";
|
||||
}
|
||||
}
|
||||
fclose($fileptr);
|
||||
|
||||
return ($output);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user