gistfile1.txt
· 1.7 KiB · Text
Raw
#!/bin/sh
# SPDX-License-Identifier: MIT
#
# This script is responsible for loading firmware blobs for the HexagonFS
# on qcom devices. It assumes to be run after msm-firmware-loader.
#
# Base directory that msm-firmware-loader uses.
BASEDIR="/lib/firmware/msm-firmware-loader"
# HexagonFS base directory.
HEXAGONFSDIR="/usr/share/qcom"
# socinfo file base directory.
SOCINFODIR="/usr/share/hexagonfs-firmware-loader"
# Preparations:
mount -o mode=755,nodev,noexec,nosuid,uid=fastrpc,gid=fastrpc -t tmpfs none "$HEXAGONFSDIR"
mkdir "$HEXAGONFSDIR/sensors"
# Get the device codename (in the form of vendor-device) from the compatible
# in the devicetree.
DEVICE=$(tr '\0,' '\n-' < /sys/firmware/devicetree/base/compatible | head -n1)
# Symlink the files and directories from msm-firmware-loader mounts:
ln -s "$BASEDIR"/mnt/vendor/etc/acdbdata "$HEXAGONFSDIR"/acdb
# Some devices have a dsp partition, others have /vendor/dsp.
# The ones with dsp partition have a mount point for it at /vendor/dsp, but
# we don't mount it there, so we need to fall back to /vendor/dsp.
if [ -d "$BASEDIR"/mnt/dsp ]
then
ln -s "$BASEDIR"/mnt/dsp "$HEXAGONFSDIR"/dsp
else
ln -s "$BASEDIR"/mnt/vendor/dsp "$HEXAGONFSDIR"/dsp
fi
ln -s "$BASEDIR"/mnt/vendor/etc/sensors/config "$HEXAGONFSDIR"/sensors/config
ln -s "$BASEDIR"/mnt/persist/sensors/registry/registry "$HEXAGONFSDIR"/sensors/registry
ln -s "$BASEDIR"/mnt/vendor/etc/sensors/sns_reg_config "$HEXAGONFSDIR"/sensors/sns_reg.conf
# Some devices (hey, Xiaomi!) require a bunch of files from /sys/devices/soc0.
# Since that is device-specific, let's check if we have a directory for this device.
if [ -d "$SOCINFODIR"/"$DEVICE" ]
then
ln -s "$SOCINFODIR"/"$DEVICE" "$HEXAGONFSDIR"/socinfo
fi
1 | #!/bin/sh |
2 | # SPDX-License-Identifier: MIT |
3 | |
4 | # |
5 | # This script is responsible for loading firmware blobs for the HexagonFS |
6 | # on qcom devices. It assumes to be run after msm-firmware-loader. |
7 | # |
8 | |
9 | # Base directory that msm-firmware-loader uses. |
10 | BASEDIR="/lib/firmware/msm-firmware-loader" |
11 | |
12 | # HexagonFS base directory. |
13 | HEXAGONFSDIR="/usr/share/qcom" |
14 | |
15 | # socinfo file base directory. |
16 | SOCINFODIR="/usr/share/hexagonfs-firmware-loader" |
17 | |
18 | # Preparations: |
19 | |
20 | mount -o mode=755,nodev,noexec,nosuid,uid=fastrpc,gid=fastrpc -t tmpfs none "$HEXAGONFSDIR" |
21 | |
22 | mkdir "$HEXAGONFSDIR/sensors" |
23 | |
24 | # Get the device codename (in the form of vendor-device) from the compatible |
25 | # in the devicetree. |
26 | DEVICE=$(tr '\0,' '\n-' < /sys/firmware/devicetree/base/compatible | head -n1) |
27 | |
28 | # Symlink the files and directories from msm-firmware-loader mounts: |
29 | |
30 | ln -s "$BASEDIR"/mnt/vendor/etc/acdbdata "$HEXAGONFSDIR"/acdb |
31 | |
32 | # Some devices have a dsp partition, others have /vendor/dsp. |
33 | # The ones with dsp partition have a mount point for it at /vendor/dsp, but |
34 | # we don't mount it there, so we need to fall back to /vendor/dsp. |
35 | if [ -d "$BASEDIR"/mnt/dsp ] |
36 | then |
37 | ln -s "$BASEDIR"/mnt/dsp "$HEXAGONFSDIR"/dsp |
38 | else |
39 | ln -s "$BASEDIR"/mnt/vendor/dsp "$HEXAGONFSDIR"/dsp |
40 | fi |
41 | |
42 | ln -s "$BASEDIR"/mnt/vendor/etc/sensors/config "$HEXAGONFSDIR"/sensors/config |
43 | |
44 | ln -s "$BASEDIR"/mnt/persist/sensors/registry/registry "$HEXAGONFSDIR"/sensors/registry |
45 | |
46 | ln -s "$BASEDIR"/mnt/vendor/etc/sensors/sns_reg_config "$HEXAGONFSDIR"/sensors/sns_reg.conf |
47 | |
48 | # Some devices (hey, Xiaomi!) require a bunch of files from /sys/devices/soc0. |
49 | # Since that is device-specific, let's check if we have a directory for this device. |
50 | if [ -d "$SOCINFODIR"/"$DEVICE" ] |
51 | then |
52 | ln -s "$SOCINFODIR"/"$DEVICE" "$HEXAGONFSDIR"/socinfo |
53 | fi |
54 |