From b1bf73dfbf50c72dad0e8da1fdc5506ba32a219d Mon Sep 17 00:00:00 2001 From: Rajkumar Ayyasamy Date: Mon, 9 Nov 2020 19:01:53 +0530 Subject: [PATCH] tools: add script to convert files in squashfs img to hex array Signed-off-by: Rajkumar Ayyasamy Change-Id: I3aa88737f832713a3ab371310f56025e5da30287 --- tools/squashfs_to_array.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 tools/squashfs_to_array.sh diff --git a/tools/squashfs_to_array.sh b/tools/squashfs_to_array.sh new file mode 100755 index 0000000000..8ec8041018 --- /dev/null +++ b/tools/squashfs_to_array.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +###################################################################### +# Copyright (c) 2020 The Linux Foundation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 and +# only version 2 as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +##################################################################### + +unsquashfs -d tmp bt_fw_patch_squashfs.img +echo "" > bt_binary_array.h +for entry in ./tmp/image/* +do + echo "$entry" + file_name=${entry##*/} + file_name="${file_name//./}" + + echo "unsigned char $file_name[] = {" >> bt_binary_array.h + hexdump -v -e '15/1 "0x%02X, " 1/1 " 0x%02X,\n"' $entry | sed 's/\, 0x .*//' >> bt_binary_array.h + + echo "};" >> bt_binary_array.h +done + +rm -rf ./tmp