summaryrefslogtreecommitdiffstats
path: root/src/build/buildpnor/buildpnor.pl
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-12-16 17:59:44 +1100
committerStephen Cprek <smcprek@us.ibm.com>2016-02-19 15:31:34 -0600
commit22a44e061029ddb8ce213c76fc55e99c4120494b (patch)
treee329d6d810ec8a123a229b658232872953545f87 /src/build/buildpnor/buildpnor.pl
parent05a617bcc2630aced6f922115d1acc0115e5aa26 (diff)
downloadtalos-hostboot-22a44e061029ddb8ce213c76fc55e99c4120494b.tar.gz
talos-hostboot-22a44e061029ddb8ce213c76fc55e99c4120494b.zip
Fix buildpnor.pl to both work and be slightly more deterministic
The current code seems to rely on perl hash ordering in order to create the PNOR file successfully. What was occuring was that we were writing the backup TOCs in an order that meant we triggered an error in fpart (from open-power/ffs): > fpart: unexpected : ../src/libffs.c(968) : (code=-1) 'BACKUP_PART' > at offset 33521664 and size 32768 overlaps 'part' at offset 33521664 > and size 4096 This patch enforces order in the universe and increases the determinism of the pnor creation process. Change-Id: I3bbaf977542a1bebaf1e0b0b528538a7c54541fa Reported-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Signed-off-by: Patrick Williams <iawillia@us.ibm.com> Forwardport: yes Github: fixes open-power/hostboot#44 Github: closes open-power/hostboot#45 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/23183 Tested-by: Jenkins Server Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/23187
Diffstat (limited to 'src/build/buildpnor/buildpnor.pl')
-rwxr-xr-xsrc/build/buildpnor/buildpnor.pl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl
index ad0cf72be..116c77912 100755
--- a/src/build/buildpnor/buildpnor.pl
+++ b/src/build/buildpnor/buildpnor.pl
@@ -506,12 +506,13 @@ sub addTOCInfo
my $other_idx = 0;
my $sideShift = 0;
my @all_tocs;
- foreach my $sideId (keys %{$$i_pnorLayout{metadata}{sides}})
+ foreach my $sideId (sort keys %{$$i_pnorLayout{metadata}{sides}})
{
push @all_tocs, $$i_pnorLayout{metadata}{sides}{$sideId}{toc}{primary};
push @all_tocs, $$i_pnorLayout{metadata}{sides}{$sideId}{toc}{backup};
}
- foreach my $sideId ( keys %{$$i_pnorLayout{metadata}{sides}} )
+ # sort sides so we write A,B not B,A
+ foreach my $sideId (sort keys %{$$i_pnorLayout{metadata}{sides}} )
{
my $physicalRegionSize = $$i_pnorLayout{metadata}{tocSize};
my $backup_part = "BACKUP_PART";
@@ -524,7 +525,9 @@ sub addTOCInfo
#This is used to search for all the TOCs in PnorRP code. The idea is to create a link between the tocs such that
#if we can find one valid TOC, then we can look at its BACKUP_PART entry or OTHER_SIDE entry in the TOC to
#determine the location of backup TOC.Each TOC has only one BACKUP_PART entry and one OTHER_SIDE entry.
- foreach my $toc (keys %{$$i_pnorLayout{metadata}{sides}{$sideId}{toc}})
+ #
+ # reverse sort is used to sort "primary,backup" rather than "backup,primary"
+ foreach my $toc (reverse sort keys %{$$i_pnorLayout{metadata}{sides}{$sideId}{toc}})
{
#adding backup_part
my $toc_offset = $$i_pnorLayout{metadata}{sides}{$sideId}{toc}{$toc};
OpenPOWER on IntegriCloud