1
0
Fork 0
forked from len0rd/rockbox
foxbox/tools/hibyos_nativepatcher/patch_manifest.pl
Dana Conrad 89fd4d0a51 hibyOS: OF patcher script for Native ports
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
2024-09-08 12:29:23 -04:00

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);