forked from len0rd/rockbox
This is a script to patch a native bootloader (bootloader.*) into a stock OF firmware image (update.upt). Usage: hibyos_nativepatcher.sh <path/to/update.upt> <path/to/bootloder.*> Resulting file will be placed next to the original update, and will be named [$orig_name]_patched_[$rbver].upt Now with some rudimentary error checking at key points! Works on macos. Works on linux, at least debian in docker. Linux usage requires 7z and genisoimage. Change-Id: I2878e7ab4652b73f44c6f1efd54047953f636c86
27 lines
608 B
Perl
Executable file
27 lines
608 B
Perl
Executable file
#!/usr/bin/perl
|
|
# add bootloader info to update manifest
|
|
# usage: ./patch_manifest.pl <md5sum> <path/to/update.txt>
|
|
|
|
my $md5 = $ARGV[0];
|
|
my $updatefile = $ARGV[1];
|
|
my $bootloader_manif =
|
|
"bootloader={
|
|
name=uboot
|
|
file_path=autoupdate/uboot.bin
|
|
md5=$md5
|
|
}\n";
|
|
|
|
# read in existing manifest
|
|
open(FH, '<', "$updatefile");
|
|
read(FH, my $manifest, -s FH);
|
|
close(FH);
|
|
|
|
# delete existing bootloader entry if exists
|
|
$manifest =~ s/bootloader\s*=\s*{[^}]*}//;
|
|
|
|
# add our own bootloader entry
|
|
$manifest = "$bootloader_manif$manifest";
|
|
|
|
open(FH, '>', "$updatefile");
|
|
print FH $manifest;
|
|
close(FH);
|