Skip to content

Commit

Permalink
Fix for Shelly v1.1.0 firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 committed Dec 21, 2023
1 parent 0463dcd commit f7898d2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 27 deletions.
Binary file modified build-files/C3_4MB_partition-table.bin
Binary file not shown.
Binary file modified build-files/bootloader-tasmota-c3.bin
Binary file not shown.
Binary file removed build-files/bootloader-tasmota.bin
Binary file not shown.
Binary file added build-files/bootloader.bin
Binary file not shown.
Binary file added build-files/fs.img
Binary file not shown.
File renamed without changes.
Binary file not shown.
59 changes: 32 additions & 27 deletions build-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,73 +28,78 @@ then
partition_file="C3_4MB_partition-table.bin"
else
platform="esp32"
boot_file="bootloader-tasmota.bin"
boot_file="bootloader.bin"
boot_file_addr=4096
partition_file="partition-table-tasmota.bin"
partition_file="partition-table.bin"
fi

#General:
otadata_file="otadata-tasmota.bin"
otadata_file="otadata.bin"

#Generated:

build_id=$(date '+%Y%m%d-%H%M%S')
build_date=$(date '+%Y-%m-%dT%H:%M:%SZ')
app_file_size=$(wc -c build-files/$app_file | awk '{print $1}')
app_file_cs1=$(shasum -a1 build-files/$app_file | awk '{print $1}')
app_file_cs256=$(shasum -a256 build-files/$app_file | awk '{print $1}')
boot_file_size=$(wc -c build-files/$boot_file | awk '{print $1}')
boot_file_cs1=$(shasum -a1 build-files/$boot_file | awk '{print $1}')
boot_file_cs256=$(shasum -a256 build-files/$boot_file | awk '{print $1}')
fs_file_size=$(wc -c build-files/$fs_file | awk '{print $1}')
fs_file_cs1=$(shasum -a1 build-files/$fs_file | awk '{print $1}')
fs_file_cs256=$(shasum -a256 build-files/$fs_file | awk '{print $1}')
otadata_file_size=$(wc -c build-files/$otadata_file | awk '{print $1}')
otadata_file_cs1=$(shasum -a1 build-files/$otadata_file | awk '{print $1}')
otadata_file_cs256=$(shasum -a256 build-files/$otadata_file | awk '{print $1}')
partition_file_size=$(wc -c build-files/$partition_file | awk '{print $1}')
partition_file_cs1=$(shasum -a1 build-files/$partition_file | awk '{print $1}')
partition_file_cs256=$(shasum -a256 build-files/$partition_file | awk '{print $1}')
otadata_file_size=$(wc -c build-files/$otadata_file | awk '{print $1}')
otadata_file_cs1=$(shasum -a1 build-files/$otadata_file | awk '{print $1}')
otadata_file_cs256=$(shasum -a256 build-files/$otadata_file | awk '{print $1}')
app_file_size=$(wc -c build-files/$app_file | awk '{print $1}')
app_file_cs1=$(shasum -a1 build-files/$app_file | awk '{print $1}')
app_file_cs256=$(shasum -a256 build-files/$app_file | awk '{print $1}')
fs_file_size=$(wc -c build-files/$fs_file | awk '{print $1}')
fs_file_cs1=$(shasum -a1 build-files/$fs_file | awk '{print $1}')
fs_file_cs256=$(shasum -a256 build-files/$fs_file | awk '{print $1}')

JSON_STRING=$( jq -n \
--arg name "$shelly_device" \
--arg platform "$platform" \
--arg version "$tasmota_version" \
--arg build_id "$build_id/tasmota-$tasmota_version" \
--arg build_timestamp "$build_date" \
--arg app_file "$app_file" \
--argjson app_file_size $app_file_size \
--arg app_cs_sha1 "$app_file_cs1" \
--arg app_cs_sha256 "$app_file_cs256" \
--arg boot_file "$boot_file" \
--argjson boot_file_addr "$boot_file_addr" \
--argjson boot_file_size $boot_file_size \
--arg boot_cs_sha1 "$boot_file_cs1" \
--arg boot_cs_sha256 "$boot_file_cs256" \
--arg fs_file "$fs_file" \
--argjson fs_file_size $fs_file_size \
--arg fs_cs_sha1 "$fs_file_cs1" \
--arg fs_cs_sha256 "$fs_file_cs256" \
--arg otadata_file "$otadata_file" \
--argjson otadata_file_size $otadata_file_size \
--arg otadata_cs_sha1 "$otadata_file_cs1" \
--arg otadata_cs_sha256 "$otadata_file_cs256" \
--arg partition_file "$partition_file" \
--argjson partition_file_size $partition_file_size \
--arg partition_cs_sha1 "$partition_file_cs1" \
--arg partition_cs_sha256 "$partition_file_cs256" \
'{ "name" : $name, "platform" : $platform, "version" : $version, "build_id" : $build_id, "build_timestamp" : $build_timestamp, "parts": { "app": { "type": "app", "src": $app_file, "size": $app_file_size, "cs_sha1" : $app_cs_sha1, "cs_sha256" : $app_cs_sha256, "encrypt": true, "ptn": "app_0"}, "boot": { "type": "boot", "src": $boot_file, "addr": $boot_file_addr, "size": $boot_file_size, "cs_sha1" : $boot_cs_sha1, "cs_sha256": $boot_cs_sha256, "encrypt": true, "update": true }, "fs": { "type": "fs", "src": $fs_file, "size": $fs_file_size, "cs_sha1": $fs_cs_sha1, "cs_sha256": $fs_cs_sha256, "fs_size": $fs_file_size, "encrypt": true, "ptn": "fs_1" }, "nvs": { "type": "nvs", "size": 16384, "fill": 255, "ptn": "nvs" }, "otadata": { "type": "otadata", "src": $otadata_file, "size": $otadata_file_size, "cs_sha1": $otadata_cs_sha1, "cs_sha256": $otadata_cs_sha256, "encrypt": true, "ptn": "otadata"}, "pt": { "type": "pt", "src": $partition_file, "addr": 32768, "size": $partition_file_size, "cs_sha1": $partition_cs_sha1, "cs_sha256": $partition_cs_sha256, "encrypt": true }}}')
--arg otadata_file "$otadata_file" \
--argjson otadata_file_size $otadata_file_size \
--arg otadata_cs_sha1 "$otadata_file_cs1" \
--arg otadata_cs_sha256 "$otadata_file_cs256" \
--arg app_file "$app_file" \
--argjson app_file_size $app_file_size \
--arg app_cs_sha1 "$app_file_cs1" \
--arg app_cs_sha256 "$app_file_cs256" \
--arg fs_file "$fs_file" \
--argjson fs_file_size $fs_file_size \
--arg fs_cs_sha1 "$fs_file_cs1" \
--arg fs_cs_sha256 "$fs_file_cs256" \
'{ "name" : $name, "platform" : $platform, "version" : $version, "build_id" : $build_id, "build_timestamp" : $build_timestamp, "parts": { "boot": { "type": "boot", "src": $boot_file, "addr": $boot_file_addr, "size": $boot_file_size, "cs_sha1" : $boot_cs_sha1, "cs_sha256": $boot_cs_sha256, "encrypt": true, "min_version": "0.0.0" }, "pt": { "type": "pt", "src": $partition_file, "addr": 32768, "size": $partition_file_size, "cs_sha1": $partition_cs_sha1, "cs_sha256": $partition_cs_sha256, "encrypt": true }, "otadata": { "type": "otadata", "src": $otadata_file, "size": $otadata_file_size, "cs_sha1": $otadata_cs_sha1, "cs_sha256": $otadata_cs_sha256, "encrypt": true, "ptn": "otadata"}, "nvs": { "type": "nvs", "size": 16384, "fill": 255, "ptn": "nvs" }, "app": { "type": "app", "src": $app_file, "size": $app_file_size, "cs_sha1" : $app_cs_sha1, "cs_sha256" : $app_cs_sha256, "encrypt": true, "ptn": "app_0"}, "fs": { "type": "fs", "src": $fs_file, "size": $fs_file_size, "cs_sha1": $fs_cs_sha1, "cs_sha256": $fs_cs_sha256, "size": $fs_file_size, "encrypt": true, "ptn": "fs_0", "fs_size": $fs_file_size }}}')
printf "$JSON_STRING" > build-files/manifest.json
cd build-files
zip -0 mgos32-to-tasmota32-$shelly_device.zip manifest.json $app_file $boot_file $fs_file $otadata_file $partition_file
zip -0 mgos32-to-tasmota32-$shelly_device.zip manifest.json
zip -0 mgos32-to-tasmota32-$shelly_device.zip $boot_file
zip -0 mgos32-to-tasmota32-$shelly_device.zip $partition_file
zip -0 mgos32-to-tasmota32-$shelly_device.zip $otadata_file
zip -0 mgos32-to-tasmota32-$shelly_device.zip $app_file
zip -0 mgos32-to-tasmota32-$shelly_device.zip $fs_file
mv mgos32-to-tasmota32-$shelly_device.zip ../output/
cd ..
printf "\nDone mgos32-to-tasmota32-$shelly_device.zip\n\n"
}
}
ShellyPlusMini=( Plus1PMMini Plus1Mini PlusPMMini )
for i in "${ShellyPlusMini[@]}"
Expand Down

0 comments on commit f7898d2

Please sign in to comment.