Last active 1741117091

gistfile1.txt Raw
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.
10BASEDIR="/lib/firmware/msm-firmware-loader"
11
12# HexagonFS base directory.
13HEXAGONFSDIR="/usr/share/qcom"
14
15# socinfo file base directory.
16SOCINFODIR="/usr/share/hexagonfs-firmware-loader"
17
18# Preparations:
19
20mount -o mode=755,nodev,noexec,nosuid,uid=fastrpc,gid=fastrpc -t tmpfs none "$HEXAGONFSDIR"
21
22mkdir "$HEXAGONFSDIR/sensors"
23
24# Get the device codename (in the form of vendor-device) from the compatible
25# in the devicetree.
26DEVICE=$(tr '\0,' '\n-' < /sys/firmware/devicetree/base/compatible | head -n1)
27
28# Symlink the files and directories from msm-firmware-loader mounts:
29
30ln -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.
35if [ -d "$BASEDIR"/mnt/dsp ]
36then
37 ln -s "$BASEDIR"/mnt/dsp "$HEXAGONFSDIR"/dsp
38else
39 ln -s "$BASEDIR"/mnt/vendor/dsp "$HEXAGONFSDIR"/dsp
40fi
41
42ln -s "$BASEDIR"/mnt/vendor/etc/sensors/config "$HEXAGONFSDIR"/sensors/config
43
44ln -s "$BASEDIR"/mnt/persist/sensors/registry/registry "$HEXAGONFSDIR"/sensors/registry
45
46ln -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.
50if [ -d "$SOCINFODIR"/"$DEVICE" ]
51then
52 ln -s "$SOCINFODIR"/"$DEVICE" "$HEXAGONFSDIR"/socinfo
53fi
54