From 89fd4d0a519a0185c6446de127fc5236990b6a8c Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Sat, 31 Aug 2024 15:49:28 +0000 Subject: 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 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 --- tools/hibyos_nativepatcher/patch_manifest.pl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 tools/hibyos_nativepatcher/patch_manifest.pl (limited to 'tools/hibyos_nativepatcher/patch_manifest.pl') 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 @@ +#!/usr/bin/perl +# add bootloader info to update manifest +# usage: ./patch_manifest.pl + +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); -- cgit v1.2.3