summaryrefslogtreecommitdiff
path: root/tools/hibyos_nativepatcher/patch_manifest.pl
diff options
context:
space:
mode:
authorDana Conrad <dconrad@fastmail.com>2024-08-31 15:49:28 +0000
committerSolomon Peachy <pizza@shaftnet.org>2024-09-08 12:29:23 -0400
commit89fd4d0a519a0185c6446de127fc5236990b6a8c (patch)
tree624299658b0d6f3799cee8991537ddb60db381e0 /tools/hibyos_nativepatcher/patch_manifest.pl
parenta5462d6192909dd0abbae15b19d634ca1c0ed4a2 (diff)
downloadrockbox-89fd4d0a519a0185c6446de127fc5236990b6a8c.tar.gz
rockbox-89fd4d0a519a0185c6446de127fc5236990b6a8c.zip
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
Diffstat (limited to 'tools/hibyos_nativepatcher/patch_manifest.pl')
-rwxr-xr-xtools/hibyos_nativepatcher/patch_manifest.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/hibyos_nativepatcher/patch_manifest.pl b/tools/hibyos_nativepatcher/patch_manifest.pl
new file mode 100755
index 0000000000..82c6378c65
--- /dev/null
+++ b/tools/hibyos_nativepatcher/patch_manifest.pl
@@ -0,0 +1,27 @@
1#!/usr/bin/perl
2# add bootloader info to update manifest
3# usage: ./patch_manifest.pl <md5sum> <path/to/update.txt>
4
5my $md5 = $ARGV[0];
6my $updatefile = $ARGV[1];
7my $bootloader_manif =
8"bootloader={
9 name=uboot
10 file_path=autoupdate/uboot.bin
11 md5=$md5
12}\n";
13
14# read in existing manifest
15open(FH, '<', "$updatefile");
16read(FH, my $manifest, -s FH);
17close(FH);
18
19# delete existing bootloader entry if exists
20$manifest =~ s/bootloader\s*=\s*{[^}]*}//;
21
22# add our own bootloader entry
23$manifest = "$bootloader_manif$manifest";
24
25open(FH, '>', "$updatefile");
26print FH $manifest;
27close(FH);