From 8347820de97d4e197e716646c5a3a98c8169a41e Mon Sep 17 00:00:00 2001 From: Dean Sanner Date: Tue, 9 Jul 2013 11:27:14 -0500 Subject: Replace ffs tool with fcp and fpart Change-Id: I06da562001e54c8e4d4b632b6d5b8815f520daef Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5344 Tested-by: Jenkins Server Reviewed-by: ADAM R. MUHLE Reviewed-by: A. Patrick Williams III --- src/build/buildpnor/buildpnor.pl | 110 ++++++++++++++++-------------------- src/build/mkrules/hbfw/img/makefile | 20 +++++-- 2 files changed, 63 insertions(+), 67 deletions(-) (limited to 'src/build') diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl index af93b9251..3c7ded545 100755 --- a/src/build/buildpnor/buildpnor.pl +++ b/src/build/buildpnor/buildpnor.pl @@ -57,6 +57,8 @@ my $tocVersion = 0x1; my $g_TOCEyeCatch = "part"; my $emitTestSections = 0; my $g_ffsCmd = ""; +my $g_fpartCmd = ""; +my $g_fcpCmd = ""; if ($#ARGV < 0) { usage(); @@ -90,6 +92,12 @@ for (my $i=0; $i < $#ARGV + 1; $i++) elsif($ARGV[$i] =~ /--ffsCmd/) { $g_ffsCmd = $ARGV[++$i]; } + elsif($ARGV[$i] =~ /--fpartCmd/) { + $g_fpartCmd = $ARGV[++$i]; + } + elsif($ARGV[$i] =~ /--fcpCmd/) { + $g_fcpCmd = $ARGV[++$i]; + } elsif($ARGV[$i] =~ /--test/) { $emitTestSections = 1; } @@ -102,23 +110,10 @@ for (my $i=0; $i < $#ARGV + 1; $i++) #Extract ffs version number from help text. #Use to trigger using proper input parms.. -my $ffsParms = 0; -my $ffsVersion = `$g_ffsCmd 2>&1 | grep "Partition Tool" `; -$ffsVersion =~ s/.*(v[0-9\.]*).*/\1/; -$ffsVersion = $1; - -if($ffsVersion eq "v1.0.0") -{ - #use v1.0.0 parms - $ffsParms = 100; - trace(1, "ffs exec version: $ffsVersion, ffsParms=$ffsParms"); -} -else -{ - #use v2.0.0 parms - $ffsParms = 200; - trace(1, "ffs exec version: $ffsVersion, ffsParms=$ffsParms"); -} +#my $ffsParms = 0; +#my $ffsVersion = `$g_ffsCmd 2>&1 | grep "Partition Tool" `; +#$ffsVersion =~ s/.*(v[0-9\.]*).*/\1/; +#$ffsVersion = $1; #Load PNOR Layout XML file my $rc = loadPnorLayout($pnorLayoutFile, \%pnorLayout); @@ -269,20 +264,16 @@ sub createPnorImage #Offset of Partition Table A in PNOR my $sideAOffset = $$i_pnorLayoutRef{metadata}{sideAOffset}; - if($ffsParms == 200) - { - #ffs --create --target tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force - my $ffsOut = `$g_ffsCmd --create --target $i_pnorBinName --partition-offset $sideAOffset --size $imageSize --block $blockSize --force`; - } - else - { - #ffs --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force - my $ffsOut = `$g_ffsCmd --create $i_pnorBinName --partition-offset $sideAOffset --size $imageSize --block $blockSize --force`; + #f{fs,part} --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force + if ($g_ffsCmd eq "") { + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --create --size $imageSize --block $blockSize --force`; + } else { + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --create --size $imageSize --block $blockSize --force`; } $rc = $?; if($rc) { - trace(0, "$this_func: Call to ffs creating image failed. rc=$rc. Aborting!"); + trace(0, "$this_func: Call to creating image failed. rc=$rc. Aborting!"); return $rc; } @@ -326,24 +317,30 @@ sub createPnorImage } #Add Partition - if($ffsParms == 200) - { - #ffs --add --target tuleta.pnor --partition-offset 0 --offset 0x1000 --size 0x280000 --name HBI --flags 0x0 - my $ffsOut = `$g_ffsCmd --add --target $i_pnorBinName --partition-offset $sideAOffset --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; - #Force Actual Size = Partition size (implicit when trunc is called with no value) - #ffs --target tuleta.pnor --partition-offset 0 --name HBI --trunc - my $ffsRc = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --name $eyeCatch --trunc`; - + #f{fs,part} --add --target tuleta.pnor --partition-offset 0 --offset 0x1000 --size 0x280000 --name HBI --flags 0x0 + if ($g_ffsCmd eq "") { + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; + } else { + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; } - else + $rc = $?; + if($rc) { - #ffs --add tuleta.pnor --partition-offset 0 --offset 0x1000 --size 0x280000 --name HBI --type data --flags 0x0 - my $ffsOut = `$g_ffsCmd --add $i_pnorBinName --partition-offset $sideAOffset --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --type data --flags 0x0`; + trace(0, "$this_func: Call to add partition $eyeCatch failed. rc=$rc. Aborting!"); + last; + } + + #Trunc Partition + #f{fs,part} --target tuleta.pnor --partition-offset 0 --name HBI --trunc + if ($g_ffsCmd eq "") { + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --trunc --name $eyeCatch`; + } else { + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --trunc --name $eyeCatch`; } $rc = $?; if($rc) { - trace(0, "$this_func: Call to ffs adding partition $eyeCatch failed. rc=$rc. Aborting!"); + trace(0, "$this_func: Call to trunc partition $eyeCatch failed. rc=$rc. Aborting!"); last; } } @@ -351,20 +348,12 @@ sub createPnorImage #Disable usewords for now. Will get re-enabled and fixed up as #we add support for underlying functions -# if($ffsParms == 200) -# { - #ffs --target tuleta.pnor --partition-offset 0 --name HBI --user 0 --value 0x12345678 -# my $ffsRc = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --name $eyeCatch --user 0 --value $actualRegionSize`; -# } -# else -# { - #ffs --modify tuleta.pnor --partition-offset 0 --name HBI --user 0 --value 0x12345678 -# my $ffsRc = `$g_ffsCmd --modify $i_pnorBinName --partition-offset $sideAOffset --name $eyeCatch --user 0 --value $actualRegionSize`; -# } +# my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset +# --user 0 --name $eyeCatch --value $actualRegionSize`; # $rc = $?; # if($rc) # { -# trace(0, "$this_func: Call to ffs setting user 0 for partition $eyeCatch failed. rc=$rc. Aborting!"); +# trace(0, "$this_func: Call to fpart setting user 0 for partition $eyeCatch failed. rc=$rc. Aborting!"); # last; # } @@ -516,20 +505,17 @@ sub fillPnorImage } trace(5, "$this_func: populating section $eyeCatch, filename=$inputFile"); - if($ffsParms == 200) - { - #ffs --target tuleta.pnor --partition-offset 0 --name HBI --write hostboot_extended.bin - my $ffsRc = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --name $eyeCatch --write $inputFile`; - } - else - { - #ffs --write tuleta.pnor --partition-offset 0 --name HBI --pad 0xff --data hostboot_extended.bin - my $ffsRc = `$g_ffsCmd --write $i_pnorBinName --partition-offset $sideAOffset --name $eyeCatch --pad 0xff --data $inputFile`; + + #fcp --target tuleta.pnor --partition-offset 0 --name HBI --write hostboot_extended.bin + if ($g_ffsCmd eq "") { + my $Out = `$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $sideAOffset --write`; + } else { + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --name $eyeCatch --write $inputFile`; } $rc = $?; if($rc) { - trace(0, "$this_func: Call to ffs adding data to partition $eyeCatch failed. rc=$rc. Aborting!"); + trace(0, "$this_func: Call to fcp adding data to partition $eyeCatch failed. rc=$rc. Aborting!"); last; } @@ -669,7 +655,9 @@ print <<"ENDUSAGE"; --binFile_TOC murano.toc A section declared as Blank in the XML does not need to have a binFile specified - --ffsCmd invoke string for executing the ffs tool + --ffsCmd invoke string for executing the ffs tool + --fpartCmd invoke string for executing the fpart tool + --fcpCmd invoke string for executing the fcp tool --test Output test-only sections. Current Limitations: diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile index 1d603f3ee..f56194cab 100755 --- a/src/build/mkrules/hbfw/img/makefile +++ b/src/build/mkrules/hbfw/img/makefile @@ -31,7 +31,6 @@ .if($(CONTEXT:R) == "ppc") -FFSCMD = ffs VPATH += ../fsp DEFAULT_PATH = ${.PATH} @@ -81,7 +80,7 @@ clobber_cp_hbfiles: # --binFile_HBI ${.PATH:Fhostboot_extended.bin} \ # --binFile_HBD ${.PATH:F${MURANO_TARGETING}} \ # --binFile_HBB ${.PATH:Fhostboot.bin} \ -# --ffsCmd "${FFSCMD}" +# --fpartCmd "${FPARTCMD}" --fcpCmd "${FCPCMD}" ################################################## PNOR_BUILD_SCRIPT = ${buildpnor.pl:P} @@ -121,14 +120,23 @@ BUILD_SPECIFIC_IMAGE: .SPECTARG ${IMAGE_TARGET} #@echo BINARIES ${IMAGE_BINS} #@echo BIN_OPTION ${IMAGE_BIN_OPTION} +FFSCMD = ${DUMMY:!which ffs 2>/dev/null!i} + ${IMAGE_TARGET}: ${IMAGE_LAYOUT} ${IMAGE_BINS} ${PNOR_BUILD_SCRIPT} - ${PNOR_BUILD_SCRIPT} --pnorOutBin ${IMAGE_TARGET} \ - ${TARGET_TEST:b--test} --pnorLayout ${IMAGE_LAYOUT} \ - ${IMAGE_BIN_OPTION} --ffsCmd "${FFSCMD}" + .if empty(FFSCMD) + ${PNOR_BUILD_SCRIPT} --pnorOutBin ${IMAGE_TARGET} \ + ${TARGET_TEST:b--test} --pnorLayout ${IMAGE_LAYOUT} \ + ${IMAGE_BIN_OPTION} --fpartCmd "fpart" --fcpCmd "fcp" + .else + ${PNOR_BUILD_SCRIPT} --pnorOutBin ${IMAGE_TARGET} \ + ${TARGET_TEST:b--test} --pnorLayout ${IMAGE_LAYOUT} \ + ${IMAGE_BIN_OPTION} --ffsCmd "ffs" + + .endif .endif -build_pnor_images: .SPECTARG ${PNOR_IMG_INFO:S/^/__IMAGE_BUILD\//g} +build_pnor_images:.SPECTARG ${PNOR_IMG_INFO:S/^/__IMAGE_BUILD\//g} clobber_build_pnor_images: ${PNOR_IMG_INFO:@image@${pnorimg:!rm -f ${image:s/:/ /g:xs/ .*//};!e}@} -- cgit v1.2.1