Skip to content

Commit 88867f6

Browse files
committed
overlaycheck: Support reading arm64 dts files
Previously it has been assumed that all dts files live in the arch/arm tree, but now the bcm2712-* files are moving to arch/arm64 where they belong. Adjust overlaycheck accordingly. Signed-off-by: Phil Elwell <[email protected]>
1 parent 7e3763a commit 88867f6

File tree

1 file changed

+80
-32
lines changed

1 file changed

+80
-32
lines changed

overlaycheck/overlaycheck

+80-32
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ my @extra_base_files = (
3232
"bcm2710-rpi-2-b",
3333
"bcm2711-rpi-400",
3434
"bcm2712-rpi-cm5-cm4io",
35+
"bcm2712-rpi-cm5l-cm5io",
36+
"bcm2712-rpi-cm5l-cm4io",
3537
);
3638

3739
my %platform_reps = (
@@ -96,10 +98,52 @@ my $kerndir = `git rev-parse --show-toplevel 2>/dev/null`;
9698
chomp($kerndir);
9799
fatal_error("This isn't a Linux repository") if (!-d "$kerndir/kernel");
98100

99-
my $dtsdir = $kerndir."/arch/arm/boot/dts";
100-
my $dtssubdir = $dtsdir;
101-
$dtssubdir .= "/broadcom" if (-f $dtsdir."/broadcom/Makefile");
102-
chdir($dtssubdir);
101+
# 32-bit first, to avoid the #include "arm/broadcom..." versions in the arm64 tree
102+
my $dtspath = (-f $kerndir."/arch/arm/boot/dts/broadcom/Makefile") ?
103+
$kerndir."/arch/arm/boot/dts/broadcom" :
104+
$kerndir."/arch/arm/boot/dts";
105+
106+
my $dts64path = (-f $kerndir."/arch/arm64/boot/dts/broadcom/Makefile") ?
107+
$kerndir."/arch/arm64/boot/dts/broadcom" :
108+
$kerndir."/arch/arm64/boot/dts";
109+
110+
my (@base32_files, @base64_files, @extra_base32_files, @extra_base64_files);
111+
112+
foreach my $base (@base_files)
113+
{
114+
if (-f $dtspath."/".$base.".dts")
115+
{
116+
push @base32_files, $base;
117+
}
118+
elsif (-f $dts64path."/".$base.".dts")
119+
{
120+
push @base64_files, $base;
121+
}
122+
}
123+
124+
foreach my $base (@extra_base_files)
125+
{
126+
if (-f $dtspath."/".$base.".dts")
127+
{
128+
push @extra_base32_files, $base;
129+
}
130+
elsif (-f $dts64path."/".$base.".dts")
131+
{
132+
push @extra_base64_files, $base;
133+
}
134+
}
135+
136+
my @dtsgroups = (
137+
[ $dts64path, \@base64_files ],
138+
[ $dtspath, \@base32_files ],
139+
);
140+
141+
my @extra_dtsgroups = (
142+
[ $dts64path, \@extra_base64_files ],
143+
[ $dtspath, \@extra_base32_files ],
144+
);
145+
146+
my $overlaysdir = $kerndir."/arch/arm/boot/dts/overlays";
103147

104148
my @cpp_cmd =
105149
(
@@ -147,19 +191,19 @@ foreach my $warn (@warnings_to_suppress)
147191

148192
my $dtc_opts = join(' ', @dtc_opts);
149193

194+
# Parse the exclusions
195+
150196
my ($ignore_missing, $ignore_vestigial) = parse_exclusions($exclusions_file);
151197

152198
# Parse the README
153199

154-
chdir($dtsdir);
155-
156-
my $readme = parse_readme("overlays/README");
200+
chdir($overlaysdir);
157201

158-
# Parse the base dts's and overlays
202+
my $readme = parse_readme("README");
159203

160-
my $source = parse_source_files($dtsdir, $dtssubdir);
204+
# Parse the base dts files and overlays
161205

162-
# Parse the exclusions
206+
my $source = parse_source_files($overlaysdir, @dtsgroups, @extra_dtsgroups);
163207

164208
# Compare the two
165209

@@ -217,9 +261,9 @@ foreach my $overlay (@$common)
217261

218262
# Parse the Makefile
219263

220-
chdir($dtsdir);
264+
chdir($overlaysdir);
221265

222-
my $makefile = parse_makefile("overlays/Makefile");
266+
my $makefile = parse_makefile("Makefile");
223267

224268
($left_only, $common, $right_only) =
225269
compare_sets([keys(%$source)], $makefile);
@@ -231,19 +275,20 @@ $fail ||= (@$left_only || @$right_only);
231275

232276
# Now some build/runtime checks
233277

234-
chdir($dtssubdir);
235-
236-
foreach my $base (@base_files, @extra_base_files)
278+
foreach my $group (@dtsgroups, @extra_dtsgroups)
237279
{
238-
next if (!-f "$base.dts");
239-
dtc_cpp("$base.dts", "$TMPDIR/$base.dtb");
240-
if (system("ovmerge -q $base.dts") >> 8)
280+
chdir($group->[0]);
281+
foreach my $base (@{$group->[1]})
241282
{
242-
error(" Error ^ in base file $base.dts\n");
283+
dtc_cpp("$base.dts", "$TMPDIR/$base.dtb");
284+
if (system("ovmerge -q $base.dts") >> 8)
285+
{
286+
error(" Error ^ in base file $base.dts\n");
287+
}
243288
}
244289
}
245290

246-
chdir($dtsdir."/overlays");
291+
chdir($overlaysdir);
247292

248293
dtc_cpp("overlay_map.dts", "$TMPDIR/overlay_map.dtb") if (-r "overlay_map.dts");
249294

@@ -281,7 +326,7 @@ if ($try_all)
281326
foreach my $base (@base_files)
282327
{
283328
next if (!-f "$TMPDIR/$base.dtb");
284-
next if (($overlay =~ /(wifi|bt)/) && ($base !~ /^(bcm2708-rpi-zero-w|bcm2709-rpi-zero-2|bcm2710-rpi-3-|bcm2711-rpi-(4|cm4$)|bcm2712-rpi-5)/));
329+
next if (($overlay =~ /(wifi|bt)/) && ($base !~ /^(bcm2708-rpi-zero-w|bcm2709-rpi-zero-2|bcm2710-rpi-3-|bcm2711-rpi-(4|cm4$)|bcm2712-rpi-(5|cm5))/));
285330
next if ($overlay_props->{'bcm2711'} && $base !~ /^bcm2711/);
286331
next if ($overlay_props->{'bcm2712'} && $base !~ /^bcm2712/);
287332
next if (system("$DTMERGE $TMPDIR/$base.dtb $MERGED_DTB $TMPDIR/$overlay.dtbo >/dev/null 2>&1") == ((-2 & 0xff) << 8));
@@ -361,35 +406,38 @@ sub list_print
361406

362407
sub parse_source_files
363408
{
364-
my ($dtsdir, $dtssubdir) = @_;
409+
my ($overlaydir, @dtsgroups) = @_;
365410
my $overlays = {};
366411

367412
my %params;
368413

369-
chdir($dtssubdir);
370-
371-
foreach my $file (glob("bcm2708*.dts bcm2709*.dts bcm2710*.dts bcm2711*.dts bcm2712*.dts"))
414+
foreach my $group (@dtsgroups)
372415
{
373-
foreach my $param (get_params($file))
416+
chdir($group->[0]);
417+
418+
foreach my $file (@{$group->[1]})
374419
{
375-
next if (ref $param);
376-
$params{$param} = 1;
420+
foreach my $param (get_params($file.".dts"))
421+
{
422+
next if (ref $param);
423+
$params{$param} = 1;
424+
}
377425
}
378426
}
379427

380-
chdir($dtsdir);
428+
chdir($overlaydir);
381429

382430
$overlays->{'<The base DTB>'} = [ sort(keys(%params)) ];
383431

384-
foreach my $file (glob("overlays/*-overlay.dts"))
432+
foreach my $file (glob("*-overlay.dts"))
385433
{
386-
my $overlay = ($file =~ /^overlays\/(.*)-overlay.dts$/)[0];
434+
my $overlay = ($file =~ /^(.*)-overlay.dts$/)[0];
387435

388436
my $redo_cmd = `grep '// redo: ' $file`;
389437
if ($redo_cmd =~ /\/\/ redo: ([^\r\n]+)/)
390438
{
391439
system("cp $file overlaycheck.dts");
392-
system("cd overlays; ovmerge -r ../overlaycheck.dts > $overlay-overlay.dts");
440+
system("ovmerge -r overlaycheck.dts > $overlay-overlay.dts");
393441
system("rm overlaycheck.dts");
394442
if (system("git diff --quiet $file") >> 8)
395443
{

0 commit comments

Comments
 (0)