X-Git-Url: http://git.rot13.org/?p=android-command-line.git;a=blobdiff_plain;f=rockchip-flash-helper.pl;h=e91f0b3a6995daeb8a18cc4a573d56cc893fb4c3;hp=df9744d7cbedec147f61957b1edc0507d971a7d8;hb=HEAD;hpb=476feb6abaad0c815fdb801352000cb4a728d602 diff --git a/rockchip-flash-helper.pl b/rockchip-flash-helper.pl index df9744d..e91f0b3 100755 --- a/rockchip-flash-helper.pl +++ b/rockchip-flash-helper.pl @@ -4,7 +4,8 @@ use strict; use Getopt::Long; -my $mode = lc($ARGV[0]) || die "usage: $0 (backup|restore|update)\n"; +my @files = @ARGV; +my $mode = lc(shift @files) || die "usage: $0 (backup|restore|update|flash /path/to/file.img)\n"; my $cmdline = ; my $rkflashtool = '/virtual/android/android-command-line/rkflashtool/rkflashtool'; @@ -43,6 +44,21 @@ foreach ( split(/,/,$cmdline) ) { warn "SKIP $start $size $name - not found in update\n"; next; } + + } elsif ( $mode eq 'flash' ) { + + foreach my $file ( @files ) { + if ( $file =~ m/$name/ && -e $file ) { + $cmd = "$rkflashtool w $start $size < $file"; + } else { + next; + } + } + + next if ! $cmd; + + } else { + die "unknown mode $mode\n"; } warn "# $cmd\n";