Adrian revised this gist . Go to revision
1 file changed, 2 insertions, 2 deletions
gistfile1.txt
| @@ -8,9 +8,9 @@ | |||
| 8 | 8 | # The file names are novatek_ts_huaxing_fw.bin and novatek_ts_tianma_fw.bin, | |
| 9 | 9 | # for both panels respectively. | |
| 10 | 10 | ||
| 11 | - | if lsmod | grep -wq "nt36xxx-spi" | |
| 11 | + | if lsmod | grep -wq "nt36xxx" | |
| 12 | 12 | then | |
| 13 | - | echo "nt36xxx-spi is loaded, mounting firmware for it!" | |
| 13 | + | echo "nt36xxx is loaded, mounting firmware for it!" | |
| 14 | 14 | ||
| 15 | 15 | mkdir /firmware-mnt | |
| 16 | 16 | ||
Adrian revised this gist . Go to revision
1 file changed, 38 insertions
gistfile1.txt(file created)
| @@ -0,0 +1,38 @@ | |||
| 1 | + | #!/bin/sh | |
| 2 | + | ||
| 3 | + | # Some devices (xiaomi-surya) ship with a touchscreen that has no persistent | |
| 4 | + | # firmware storage. That is unfortunate and means we need to provide firmware | |
| 5 | + | # from the initramfs for FDE to work. | |
| 6 | + | # This is only the case for the novatek touchscreens. Their firmware resides | |
| 7 | + | # in /vendor/firmware. Let's copy it over. | |
| 8 | + | # The file names are novatek_ts_huaxing_fw.bin and novatek_ts_tianma_fw.bin, | |
| 9 | + | # for both panels respectively. | |
| 10 | + | ||
| 11 | + | if lsmod | grep -wq "nt36xxx-spi" | |
| 12 | + | then | |
| 13 | + | echo "nt36xxx-spi is loaded, mounting firmware for it!" | |
| 14 | + | ||
| 15 | + | mkdir /firmware-mnt | |
| 16 | + | ||
| 17 | + | for part in /sys/block/sd*/sd* | |
| 18 | + | do | |
| 19 | + | DEVNAME="$(grep DEVNAME "$part"/uevent | sed 's/DEVNAME=//g')" | |
| 20 | + | PARTNAME="$(grep PARTNAME "$part"/uevent | sed 's/PARTNAME=//g')" | |
| 21 | + | ||
| 22 | + | # Could be vendor_a or vendor_b | |
| 23 | + | if [[ "$PARTNAME" == "vendor"* ]] | |
| 24 | + | then | |
| 25 | + | mount -o ro,nodev,noexec,nosuid \ | |
| 26 | + | "/dev/$DEVNAME" /firmware-mnt | |
| 27 | + | ||
| 28 | + | for firmware_file in /firmware-mnt/firmware/novatek_ts_*_fw.bin | |
| 29 | + | do | |
| 30 | + | echo "Found novatek firmware file at $firmware_file" | |
| 31 | + | ||
| 32 | + | cp $firmware_file /lib/firmware/ | |
| 33 | + | done | |
| 34 | + | ||
| 35 | + | umount /firmware-mnt | |
| 36 | + | fi | |
| 37 | + | done | |
| 38 | + | fi | |