diff --git a/scripts/kernel_upgrade.pl b/scripts/kernel_upgrade.pl index 1310a8d5ad20c7..a86fa5d70da4b0 100755 --- a/scripts/kernel_upgrade.pl +++ b/scripts/kernel_upgrade.pl @@ -44,7 +44,7 @@ ($$$) local $/="\0"; open(my $fd, '-| :raw :bytes', 'git', 'ls-tree', '-trz', '--full-tree', -'--name-only', $commit.':', '--', $target)||die("failed to read git tree"); +'--name-only', $commit.':', '--', @$target)||die("failed to read git tree"); while(<$fd>) { chop($_); @@ -52,6 +52,21 @@ ($$$) if(substr($_, -length($from)) eq $from); } + check: foreach my $entr (@$target) { + my ($lo, $hi)=(0, scalar(@$ret)); + while($lo!=$hi) { + $_=substr($ret->[($lo+$hi)>>1], 0, length($entr)) cmp $entr; + if($_<0) { + $lo=(($lo+$hi)>>1)+1; + } elsif($_>0) { + $hi=($lo+$hi)>>1; + } else { + next check; + } + } + die("no files matching \"$from\" found in $entr"); + } + @$ret=sort({length($b)-length($a)} @$ret); return $ret; @@ -209,8 +224,8 @@ () } # end of interface to git fast-import -die(<<"__USAGE__") if(@ARGV!=2); -Usage: $0 +die(<<"__USAGE__") if(@ARGV<2); +Usage: $0 [] Copies all kernel configuration files and patches from the old version to the new version. Git history is preserved on the copies by using a @@ -225,6 +240,12 @@ () Note, the two strings are non-optional, but completely free-form. There are no limitations besides whether they can be used in a file-name (\\0 is the only invalid character). + +One or more boards can be specified to update a subset of boards. This +can include "generic", this can also include a subdirectory for a device. + +The end merge commit /can/ be amended to remove files which should not +be included during an update. __USAGE__ my $from=shift(@ARGV); @@ -238,9 +259,13 @@ () die('git failed, likely not inside OpenWRT git repository?') unless($start|| ($0=~m/^(.*)\// and chdir($1) and $start=gethead())); -my $list=getlistmatch('HEAD', $target, $from); - -die("no files matching \"$from\" found") unless(@$list); +my $list; +unless(@ARGV) { + $list=getlistmatch('HEAD', [$target], $from); +} else { + $_=$target.$_ foreach(@ARGV); + $list=getlistmatch('HEAD', \@ARGV, $from); +} my $git=GitImporter->new();