Skip to content

Check firmware update #1337

Check firmware update

Check firmware update #1337

Workflow file for this run

name: Check firmware update
on:
schedule:
- cron: '0 0 * * *'
push:
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- model: "SM-E625F"
region: "INS"
imei: "350641034358959"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G970F"
region: "DBT"
imei: "354889108726363"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G970N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G973F"
region: "DBT"
imei: "356127105158894"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G973N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G975F"
region: "DBT"
imei: "356172100810248"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G975N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G977B"
region: "VD2"
imei: "356151100525758"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-G977N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-G980F"
region: "DBT"
imei: "356007117597901"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G985F"
region: "DBT"
imei: "356844831856563"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G981B"
region: "DBT"
imei: "354397115116271"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G986B"
region: "DBT"
imei: "359847104662532"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G988B"
region: "DBT"
imei: "351828119844123"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G991B"
region: "DBT"
imei: "357275657904162"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4 vddcal_fw.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-M625F"
region: "EGY"
imei: "354295851027712"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-N970F"
region: "DBT"
imei: "357452104639739"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-N971N"
region: "KOO"
imei: "358777105279203"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-N975F"
region: "DBT"
imei: "356210102048357"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-N976B"
region: "BTU"
imei: "358782100103564"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-N976N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-P610"
region: "XEF"
imei: "R52N804CKLF"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
- model: "SM-P615"
region: "XEF"
imei: "353919118587132"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-P620"
region: "EUX"
imei: "R52X407BTPE"
files_ap: "modem.bin.lz4 modem_debug.bin.lz4"
files_bl: "fld.bin.lz4 harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 tzsw.img.lz4 tzar.img.lz4 uh.bin.lz4 up_param.bin.lz4"
- model: "SM-P625"
region: "EUX"
imei: "R52X404Z7LP"
files_bl: "fld.bin.lz4 harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 tzsw.img.lz4 tzar.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y lz4 python3-pip
pip3 install git+https://github.com/martinetd/samloader.git
- name: Compare latest version with current version
id: check
run: |
need_update=0
latest=`samloader -m ${{ matrix.model }} -r ${{ matrix.region }} checkupdate`
latest_short=`echo $latest | cut -f1 -d '/'`
current=`cat current.${{ matrix.model }}` || need_update=1
[[ $latest != $current ]] && need_update=1
echo "latest_version=$latest" >> $GITHUB_OUTPUT
echo "latest_version_short=$latest_short" >> $GITHUB_OUTPUT
echo "need_update=$need_update" >> $GITHUB_OUTPUT
- name: Fetch firmware
if: steps.check.outputs.need_update == 1
run: |
samloader -m ${{ matrix.model }} -r ${{ matrix.region }} -i ${{ matrix.imei }} download -v ${{ steps.check.outputs.latest_version }} -o ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip.enc4 -D
mkdir -p out
echo ${{ steps.check.outputs.latest_version_short }} >> version.txt
- name: Extract images from AP
if: steps.check.outputs.need_update == 1 && matrix.files_ap
run: |
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "AP*" | tar xvf - -C out ${{ matrix.files_ap }}
cd out; for IMAGE in ${{ matrix.files_ap }}; do [ "$(echo $IMAGE | rev | cut -f1 -d '.' | rev)" = "lz4" ] && lz4 -d -m --rm $IMAGE; done; cd ..
- name: Extract images from BL
if: steps.check.outputs.need_update == 1 && matrix.files_bl
run: |
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "BL*" | tar xvf - -C out ${{ matrix.files_bl }}
cd out; for IMAGE in ${{ matrix.files_bl }}; do [ "$(echo $IMAGE | rev | cut -f1 -d '.' | rev)" = "lz4" ] && lz4 -d -m --rm $IMAGE; done; cd ..
- name: Extract images from CP
if: steps.check.outputs.need_update == 1 && matrix.files_cp
run: |
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "CP*" | tar xvf - -C out ${{ matrix.files_cp }}
cd out; for IMAGE in ${{ matrix.files_cp }}; do [ "$(echo $IMAGE | rev | cut -f1 -d '.' | rev)" = "lz4" ] && lz4 -d -m --rm $IMAGE; done; cd ..
- name: Generate heimdall info
if: steps.check.outputs.need_update == 1
run: |
make -C tools/pithelper
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "CSC*" | tar xvf - --wildcards *.pit
HEIMDALL_COMMAND="heimdall flash"
cd out; for IMAGE in *; do HEIMDALL_COMMAND="$HEIMDALL_COMMAND --$(../tools/pithelper/get-pit-partition ../*.pit $IMAGE) $IMAGE"; done; cd ..
echo $HEIMDALL_COMMAND > heimdall.txt
- name: Archive images for upload
if: steps.check.outputs.need_update == 1
run: |
cd out; tar cvf ../firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar *; cd ..
sha256sum firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar > firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar.sha256
- name: Update current version
if: steps.check.outputs.need_update == 1
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull origin ${{github.ref}} --ff-only
echo ${{ steps.check.outputs.latest_version }} > current.${{ matrix.model }}
git add current.${{ matrix.model }}
git commit -m "${{ matrix.model }}: ${{ steps.check.outputs.latest_version }}"
git tag ${{ steps.check.outputs.latest_shortversion }}
- name: Push changes to repo
if: steps.check.outputs.need_update == 1
uses: ad-m/github-push-action@master
with:
tags: true
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release assets
if: steps.check.outputs.need_update == 1
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: heimdall.txt
tag_name: ${{ steps.check.outputs.latest_version_short }}
files: |
firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar
firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar.sha256
heimdall.txt