@@ -336,6 +336,11 @@ foreach my $overlay (sort(keys(%$source)))
336336 {
337337 error(" Error ^ in overlay $overlay \n " );
338338 }
339+
340+ dormant_checker($overlay );
341+
342+ my $checker = $overlay_checkers {$overlay };
343+ ($checker -> [0])-> ($overlay , $checker -> [1], $source -> {$overlay }) if ($checker );
339344}
340345
341346if ($try_all )
@@ -353,8 +358,6 @@ if ($try_all)
353358 next if (system (" $DTMERGE $TMPDIR /$base .dtb $MERGED_DTB $TMPDIR /$overlay .dtbo >/dev/null 2>&1" ) == ((-2 & 0xff) << 8));
354359 error(" Failed to merge $overlay with $base " ) if (system ($DTMERGE , $verbose ? (' -d' ) : (), " $TMPDIR /$base .dtb" , $MERGED_DTB , " $TMPDIR /$overlay .dtbo" ) != 0);
355360 }
356- my $checker = $overlay_checkers {$overlay };
357- ($checker -> [0])-> ($overlay , $checker -> [1], $source -> {$overlay }) if ($checker );
358361 }
359362}
360363
@@ -826,7 +829,6 @@ sub get_params
826829 }
827830 }
828831
829- # print(join("\n", @lines), "\n") if ($fail);
830832 return ($props , sort (@params ));
831833}
832834
@@ -869,6 +871,66 @@ sub container_checker
869871 }
870872}
871873
874+ sub dormant_checker
875+ {
876+ my ($overlay ) = @_ ;
877+ my $ph ;
878+ my $fragnum ;
879+ my %is_dormant ;
880+ my %is_wakeable ;
881+ my $in_overrides = 0;
882+
883+ die if (!open ($ph , ' -|' , " ovmerge -N ${overlay} -overlay.dts" ));
884+ while (my $line = <$ph >)
885+ {
886+ chomp ($line );
887+ if ($in_overrides )
888+ {
889+ if ($line =~ / }/ )
890+ {
891+ $in_overrides = 0;
892+ }
893+ elsif ($line =~ / ^\s *([-\w ]+) = (.*?;)$ / )
894+ {
895+ my ($param , $rol ) = ($1 ,$2 );
896+ while ($rol =~ / \G <(&\w +|0)>, "([^"]+)"(?:, |;)/cg )
897+ {
898+ my ($ref , $override ) = ($1 , $2 );
899+ if ($ref eq ' 0' )
900+ {
901+ while ($override =~ / \G ([-+=!])(\d +)/cg )
902+ {
903+ my ($type , $num ) = ($1 , $2 );
904+ $is_wakeable {$num } = 1 if ($type ne ' -' );
905+ }
906+ }
907+ elsif ($override =~ / =$ / )
908+ {
909+ $rol =~ / \G [^,;]+(?:, |;)/cg ;
910+ }
911+ }
912+ }
913+ }
914+ elsif ($line =~ / \b fragment@(\d +)\s\{ / )
915+ {
916+ $fragnum = $1 ;
917+ }
918+ elsif ($line =~ / \b __dormant__\b / )
919+ {
920+ $is_dormant {$fragnum } = 1;
921+ }
922+ elsif ($line =~ / \b __overrides__\b / )
923+ {
924+ $in_overrides = 1;
925+ }
926+ }
927+
928+ foreach my $frag (sort { $a <=> $b } keys (%is_dormant ))
929+ {
930+ error(" $overlay : fragment $frag is dormant and cannot be activated" ) if (!$is_wakeable {$frag });
931+ }
932+ }
933+
872934sub error
873935{
874936 print (" * $_ [0]\n " );
0 commit comments