Skip to content

Commit bd44dc5

Browse files
committed
ovmerge: Add "no renumber" option
It can be useful to pre-process and sanitise an overlay without renumbering the fragments. It's a feature that overlaycheck uses in order that any error messages refer to the same fragment numbers that appear in the source files. Add the option to prevent renumbering using "-N". N.B. There are situations, such as combining multiple overlays, where not renumbering may lead to non-functional output. Use with caution. Signed-off-by: Phil Elwell <[email protected]>
1 parent bd817cb commit bd44dc5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

ovmerge/ovmerge

+13-5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ my $redo = 0;
9696
my $sort = 0;
9797
my $warnings = 0;
9898
my $no_dts = 0;
99+
my $no_renumber = 0;
99100
my $cur_dt;
100101
my $retcode = 0;
101102
my $query = 0;
@@ -195,6 +196,10 @@ while ($ARGV[0] =~ /^-/)
195196
{
196197
$force = 1;
197198
}
199+
elsif ($arg eq '-N')
200+
{
201+
$no_renumber = 1;
202+
}
198203
elsif ($arg eq '-S')
199204
{
200205
my $indent_spaces = shift @ARGV;
@@ -267,13 +272,15 @@ foreach my $overlay (@ARGV)
267272
set_prop($overrides, 'i2c_vc', @prop);
268273
}
269274

270-
while ($overlay =~ /\G[,:]([^=,]+)(?:=([^,]+))?/g)
275+
if ($apply_params)
271276
{
272-
dtparam($dt, $1, defined($2) ? $2 : '');
277+
while ($overlay =~ /\G[,:]([^=,]+)(?:=([^,]+))?/g)
278+
{
279+
dtparam($dt, $1, defined($2) ? $2 : '');
280+
}
281+
ovapply1($dt) if ($dt->{'plugin'});
273282
}
274283

275-
ovapply1($dt) if ($dt->{'plugin'});
276-
277284
my $exports = get_node($dt, '/__exports__');
278285
if ($exports)
279286
{
@@ -305,7 +312,7 @@ exit(0) if (!@overlays);
305312
if ($overlays[0]->{'plugin'})
306313
{
307314
# Count and renumber the fragments in the base
308-
renumber_fragments($overlays[0], 0);
315+
renumber_fragments($overlays[0], 0) if (!$no_renumber);
309316

310317
for (my $i = 1; $i < @overlays; $i++)
311318
{
@@ -2171,6 +2178,7 @@ sub usage
21712178
print STDERR (" -i Show include hierarchy for each file\n");
21722179
print STDERR (" -l Like expand mode, but labels each line with source file\n");
21732180
print STDERR (" -n No .dts file header (just parsing .dtsi files)\n");
2181+
print STDERR (" -N Don't renumber overlay fragments (not guaranteed to work)\n");
21742182
print STDERR (" -p Emulate Pi firmware manipulation\n");
21752183
print STDERR (" -q Query mode (no output, just the success/failure return code)\n");
21762184
print STDERR (" -r Redo command comment in named files (c.f. '-c')\n");

0 commit comments

Comments
 (0)