#!/usr/bin/perl
my $origfilename = $ARGV[0];
my $newfilename = $ARGV[1];
my $bootblocksize = 131584;
my $origfilesize = (-s $origfilename);
my $newfilesize = $origfilesize - $bootblocksize;
open (my $origfp, '<', $origfilename);
binmode ($origfp);
seek ($origfp, $bootblocksize, 0);
read ($origfp, $newfirmware, $origfilesize);
close ($origfp);

open (my $newfp, '>', $newfilename);
binmode ($newfp);
print $newfp $newfirmware;
close ($newfp);
