#!/bin/bash
#################################################################################
# Firmware for the (Snapdragon) sc8280xp SoC.
# Boards using this SoC:
# * Lenovo ThinkPad X13s gen 1
# Stolen from the rk3399 script. Thanks Stuart!
# Also see
# - https://wiki.gentoo.org/wiki/Lenovo_ThinkPad_X13s#User-space
# - https://github.com/ironrobin/x13s-alarm/blob/trunk/x13s-firmware/PKGBUILD
#################################################################################

CWD=$PWD
TMP=/tmp/fw-assets
OUT=$CWD/assets
REPO="https://github.com/ironrobin/x13s-alarm.git"

rm -rf $TMP $OUT
mkdir -pv $TMP $OUT

cd $TMP
git clone --depth=1 $REPO

FILES="a690_gmu.bin hpnv21.b8c qcvss8280.mbn"
for ef in $FILES;
do
  cp x13s-alarm/x13s-firmware/$ef $OUT || exit 1
done
cd $OUT
xz -vze9 *
