MU300/ZTE F50: custom 5.4 kernel, Ubuntu 26.04 rootfs, modem/PM bring-up, Wi-Fi

Boot tooling, kernel config fragment and patches, systemd units, Android vendor
runtime extraction scripts and the technical findings for running Linux on the
ZTE F50 / MU300 (Unisoc T760).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Abdurrahman Kaan DikeçandClaude Opus 5 committed 2026-09-16 21:51:13 +03:00
commit 2e1650e3f1
40 files changed
+9336

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
# device dumps, proprietary blobs and build outputs never belong in this repository
dumps/
firmware/
android-subset/
out/
*.img
*.tar
*.tar.gz
*.tgz
*.bin
*.ko
busybox
tools/logdw/logdw
logs-*/
rootfs/base.tar
__pycache__/
.DS_Store
+23
View File
@@ -0,0 +1,23 @@
MIT License
Copyright (c) 2026 dikeckaan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note: kernel/patches/*.patch modify GPL-2.0 kernel code and are licensed GPL-2.0.
+137
View File
@@ -0,0 +1,137 @@
# Linux on the ZTE F50 / MU300 (Unisoc T760)
Ubuntu 26.04 LTS with systemd, SSH, telnet, a USB serial console, a working modem/PM co-processor and
Wi-Fi on the ZTE F50 5G mobile hotspot (hardware MU300, Unisoc T760 / UMS9620). It runs a custom
5.4.254 kernel built from ZTE's GPL source and boots next to Android without changing the partition table.
> **Türkçe özet:** ZTE F50 / MU300 (Unisoc T760) üzerinde, Android'e ve bölüm tablosuna dokunmadan,
> ZTE'nin GPL kaynağından derlenmiş 5.4.254 kernel ile Ubuntu 26.04 LTS (systemd, SSH, telnet, USB seri
> konsol, modem ve Wi-Fi) çalıştırmak için gereken her şey. Ayrıntılar İngilizce; teknik bulguların tamamı
> [`docs/FINDINGS.md`](docs/FINDINGS.md) içinde.
> **Warning.** This writes to `boot_b` and to the `misc` partition, and creates a filesystem in unused eMMC space.
> It requires an unlocked/verification-bypassed device with root on Android and a working SPD download-mode
> recovery path. You can brick your device. Nothing here is endorsed by ZTE or Unisoc.
## Status
| Feature | State |
|---|---|
| Custom kernel (5.4.254, ZTE U30 Air source + fragment) | ✅ boots, 86 vendor modules rebuilt from source |
| Boot without touching `boot_a`, GPT or `userdata` | ✅ slot b one-shot trial, init restores slot a |
| USB Ethernet (ECM) + DHCP | ✅ `192.168.77.1`, host gets `192.168.77.2-9` |
| USB serial console (CDC-ACM) | ✅ `serial-getty@ttyGS0` |
| Ubuntu 26.04.1 LTS, systemd 259 | ✅ `running` (kernel 5.4 = systemd minimum baseline) |
| SSH and telnet | ✅ |
| PM co-processor watchdog / no power cut after ~290 s | ✅ via Android `modem_control` in a chroot |
| Modem firmware boot (`Modem Alive`) | ✅ |
| Wi-Fi (SC2355 / Marlin3) | ✅ station scan and access-point mode (`hostapd` AP-ENABLED) |
| Mobile data | ⏳ planned (AT commands + `sipa_eth`) |
| Default boot to Linux | ⏳ planned (currently a one-shot trial, reboot returns to Android) |
| OpenWrt rootfs | ⏳ planned |
## How it works
```
LK (slot b, tries=2) ─► custom 5.4 kernel + vendor_boot DTB
└─► initramfs /init (boot/init)
├─ load 86 modules in a fixed order (boot/module-order.txt)
├─ write slot-a bootloader_control back to misc (next reboot = Android)
├─ bind USB gadget: ECM (usb0 up immediately) + ACM console
├─ losetup -o 27762098176 /dev/mmcblk0 → ext4 "mu300root" (free space after userdata)
└─ switch_root → systemd
├─ mu300-vendor : Android modem_control in a chroot (disarms PM watchdog, boots modem)
├─ mu300-usb-net : usb0 192.168.77.1 + dnsmasq DHCP
├─ mu300-wifi : pcie-sprd, wcn_bsp, sprd_wlan_combo
└─ ssh.socket, telnetd, serial-getty@ttyGS0
```
Read [`docs/FINDINGS.md`](docs/FINDINGS.md) for the reasoning behind each step (LK slot rules, LZ4 ramdisk,
USB dependency chain, the PM watchdog, the `modem_control` process-name check, macOS ECM link state, …).
## Repository layout
| Path | Contents |
|---|---|
| `kernel/` | Docker build env, stock F50 config, `mu300-linux.fragment`, build scripts, Wi-Fi driver patch |
| `boot/` | `init`, `module-order.txt`, `build-boot-image.py`, `flash-trial.sh` |
| `rootfs/` | Ubuntu 26.04 `Dockerfile`, `assemble.sh`, systemd units and helper scripts (`overlay/`) |
| `android-vendor/` | Scripts to extract the Android runtime subset from *your* device, permission generator |
| `tools/` | `logdw` (liblog sink), SSH/SCP/telnet/serial helpers, log collector, Android-side mount helper |
| `docs/` | Findings and notes |
Related: the kernel source used here is mirrored at
[`dikeckaan/zte-ums9620-kernel-5.4.254`](https://github.com/dikeckaan/zte-ums9620-kernel-5.4.254)
(ZTE U30 Air GPL release, 5.4.254).
**Not included** (proprietary or device-specific): stock partition images, Android vendor binaries and libraries,
`/dev/__properties__`, Wi-Fi/modem firmware, device dumps and identifiers. The scripts extract these from your own device.
## Requirements
* A rooted MU300/F50 with the boot verification bypass (Android must already boot a modified `boot` image),
`adb` access, and a tested SPD/BROM recovery path.
* macOS or Linux host with Docker (arm64 native or emulation), Python 3, `lz4`, `adb`.
* Your own dumps: `boot_a.img` and the first 4 KiB of `misc` (`dd if=/dev/block/by-name/misc bs=4096 count=1`).
## Build and run
### 1. Kernel
```sh
git clone https://github.com/dikeckaan/zte-ums9620-kernel-5.4.254 # or the Enceka U30 Air repo
docker build -t mu300-kbuild kernel/
docker volume create mu300-kernel
docker run --rm -v mu300-kernel:/src -v "$PWD/../zte-ums9620-kernel-5.4.254":/tree mu300-kbuild cp -a /tree /src/zte-u30air
cp kernel/f50-stock-B09.config kernel/device.config
docker run --rm -v mu300-kernel:/src -v "$PWD/kernel":/work mu300-kbuild bash /work/build-linux.sh
```
`build-linux.sh` merges `mu300-linux.fragment` into the stock config, switches to ThinLTO and builds `Image` + modules
into `/src/out-linux`. Copy `Image`, `modules.builtin*` and all `*.ko` (flattened, `llvm-strip --strip-debug`) to `out/`.
Wi-Fi driver: extract `kernel_modules/kernel5.4/wcn/wlan/wlan_combo` from the realme C51/C53 AndroidT kernel source into
the volume as `/src/ext-wlan_combo`, then run `kernel/build-wlan.sh` (applies `patches/wlan_combo-default-board-config.patch`).
### 2. Android vendor subset (from your device)
```sh
android-vendor/extract-subset.sh android-subset
python3 android-vendor/gen-ueventd-perms.py android-subset/vendor/etc/ueventd.rc <vendor init *.rc> > android-vendor/ueventd-perms.sh
```
### 3. Boot image
```sh
docker build -t mu300-ubuntu:26.04 rootfs/
docker run --rm mu300-ubuntu:26.04 cat /bin/busybox > busybox && chmod +x busybox # static, has mdev/losetup/switch_root/telnetd
docker run --rm -v "$PWD/tools/logdw":/w mu300-kbuild gcc -O2 -static -o /w/logdw /w/logdw.c
python3 boot/build-boot-image.py --stock-boot dumps/boot_a.img --misc-head dumps/misc-head.bin \
--kernel out/Image --modules out/modules --busybox busybox --logdw tools/logdw/logdw \
--ueventd-perms android-vendor/ueventd-perms.sh --android-subset android-subset --out boot-linux-slotb.img
```
### 4. Root filesystem on the free eMMC region
1. Check on *your* device that the space after `userdata` is really unallocated (compare the last partition end with
the GPT's last usable LBA) and adjust `ROOT_OFFSET` in `boot/init` and `tools/android-mount-mu300root.sh`.
2. On Android (root), create the filesystem through a bounded loop device and verify offset/size first.
3. Assemble and deploy:
```sh
cid=$(docker create mu300-ubuntu:26.04); docker export $cid > rootfs/base.tar; docker rm $cid
docker run --rm -v "$PWD/rootfs":/w -v "$PWD/out/modules":/kmods:ro -v "$PWD/out":/kout:ro \
-v "$PWD/firmware":/firmware:ro -v "$PWD/android-subset":/android-subset:ro -v "$PWD/tools/logdw/logdw":/logdw:ro \
mu300-ubuntu:26.04 bash /w/assemble.sh
```
Push `mu300-ubuntu-26.04-rootfs.tar.gz` to the device and extract it with `tools/android-mount-mu300root.sh`.
`firmware/` holds `wcnmodem.bin`, `gnssmodem.bin` and `wifi_board_config*.ini` from the device's `/odm/firmware`.
### 5. Boot Linux (one-shot)
```sh
boot/flash-trial.sh boot-linux-slotb.img
```
After about 50 s: `ssh ubuntu@192.168.77.1` (password `ubuntu`, **change it**), `telnet 192.168.77.1`, or
`screen /dev/cu.usbmodem* 115200`. `sudo reboot` returns to Android. If a trial fails, collect logs from Android with
`tools/collect-logs.sh`.
## Credits and licenses
* Kernel source: ZTE GPL release for the U30 Air (mirrored by Enceka), Unisoc drivers therein — GPL-2.0.
* Wi-Fi driver source: realme C51/C53 AndroidT kernel release (`wlan_combo`) — GPL-2.0; the patch in `kernel/patches` is GPL-2.0.
* Scripts, tools and documentation in this repository: MIT (see `LICENSE`).
* Stock firmware, Android vendor components and bootloaders belong to their owners and are not distributed here.
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
# Pull the Android vendor runtime needed by modem_control from a rooted device (adb + su) and build
# the chroot subset used by the initramfs (/android) and the rootfs (/opt/mu300/android).
# These files are proprietary (ZTE/Unisoc/Google) and are NOT part of this repository.
set -eu
OUT=${1:-android-subset}
TMP=$(mktemp -d)
adb exec-out 'su -c "tar -chf - /apex/com.android.runtime /system/lib64 /vendor/bin/modem_control /vendor/bin/sh /vendor/bin/toybox_vendor /vendor/bin/getprop /vendor/lib64/libkernelbootcp.trusty.so /vendor/etc /dev/__properties__ 2>/dev/null"' | tar -xf - -C "$TMP"
rm -rf "$OUT" && mkdir -p "$OUT"
cd "$TMP"
tar -cf - apex/com.android.runtime/bin/linker64 apex/com.android.runtime/lib64/bionic \
system/lib64/libcutils.so system/lib64/libexpat.so system/lib64/liblog.so system/lib64/libhardware_legacy.so \
system/lib64/libc++.so system/lib64/libbase.so system/lib64/libbinder.so system/lib64/libbinder_ndk.so \
system/lib64/libhidlbase.so system/lib64/libutils.so system/lib64/android.system.suspend-V1-ndk.so \
system/lib64/libtrusty.so system/lib64/libandroid_runtime_lazy.so system/lib64/libvndksupport.so \
system/lib64/libz.so system/lib64/libcrypto.so system/lib64/libselinux.so system/lib64/libpcre2.so \
system/lib64/libpackagelistparser.so system/lib64/libprocessgroup.so system/lib64/libcgrouprc.so \
vendor/lib64/libkernelbootcp.trusty.so vendor/bin/modem_control vendor/bin/sh vendor/bin/toybox_vendor vendor/bin/getprop \
vendor/etc/modem_cp_info.xml vendor/etc/modem_sp_info.xml vendor/etc/modem_ch_info.xml vendor/etc/cp_dump_info.xml \
vendor/etc/ueventd.rc dev/__properties__ | tar -xf - -C "$OLDPWD/$OUT"
cd "$OLDPWD"
mkdir -p "$OUT/system/bin" "$OUT/linkerconfig"
ln -sfn /apex/com.android.runtime/bin/linker64 "$OUT/system/bin/linker64"
: > "$OUT/linkerconfig/ld.config.txt"
rm -rf "$TMP"
du -sh "$OUT"
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""Generate ueventd-perms.sh: apply Android device node ownership (ueventd.rc + init *.rc chown/chmod)
on plain Linux, because modem_control drops to uid system(1000) before opening /dev/modem etc.
usage: gen-ueventd-perms.py vendor/etc/ueventd.rc vendor-init/*.rc > ueventd-perms.sh"""
import sys
AID = {'root': 0, 'system': 1000, 'radio': 1001, 'bluetooth': 1002, 'graphics': 1003, 'input': 1004, 'audio': 1005,
'camera': 1006, 'log': 1007, 'wifi': 1010, 'media': 1013, 'dhcp': 1014, 'gps': 1021, 'nfc': 1027,
'audioserver': 1041, 'cameraserver': 1047, 'shell': 2000, 'net_bt_admin': 3001, 'net_bt': 3002,
'inet': 3003, 'net_raw': 3004}
out = ['#!/bin/sh', '# generated by gen-ueventd-perms.py']
ueventd, rcs = sys.argv[1], sys.argv[2:]
for line in open(ueventd):
f = line.split('#')[0].split()
if len(f) >= 4 and f[0].startswith('/dev/') and f[2] in AID and f[3] in AID:
out.append(f'for n in {f[0]}; do [ -e "$n" ] && chown {AID[f[2]]}:{AID[f[3]]} "$n" && chmod {f[1]} "$n"; done')
for rc in rcs:
for line in open(rc):
f = line.split('#')[0].split()
if len(f) < 3 or f[0] not in ('chown', 'chmod') or not f[-1].startswith(('/dev/', '/sys/', '/proc/')):
continue
if f[0] == 'chmod':
out.append(f'for n in {f[-1]}; do [ -e "$n" ] && chmod {f[1]} "$n"; done')
elif f[1] in AID and (len(f) == 3 or f[2] in AID):
g = AID[f[2]] if len(f) == 4 else AID[f[1]]
out.append(f'for n in {f[-1]}; do [ -e "$n" ] && chown {AID[f[1]]}:{g} "$n"; done')
out.append('# from Android system init.rc: wakelocks are written by uid system')
out.append('for n in /sys/power/wake_lock /sys/power/wake_unlock; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done')
out.append('true')
print('\n'.join(out))
+60
View File
@@ -0,0 +1,60 @@
"""Pull an Android binary and its shared-library closure from the device, preserving paths.
Search order approximates the vendor linker namespace: vendor, VNDK apex, system, bionic."""
import struct, subprocess, sys, os
from pathlib import Path
ROOT=Path('rootfs')
SEARCH=['/vendor/lib64','/vendor/lib64/hw','/odm/lib64','/apex/com.android.vndk.v33/lib64',
'/system/lib64','/apex/com.android.runtime/lib64/bionic','/apex/com.android.runtime/lib64',
'/apex/com.android.i18n/lib64','/system_ext/lib64']
import time
def adb(cmd):
# adb drops out when the device reboots; never treat that as "file missing"
for attempt in range(30):
r=subprocess.run(['adb','exec-out',f"su -c '{cmd}; echo __RC$?'"],capture_output=True)
out=r.stdout
i=out.rfind(b'__RC')
if r.returncode==0 and i>=0:
return out[:i] if out[i+4:].strip()==b'0' else b''
time.sleep(5)
raise SystemExit('adb unavailable')
def pull(path):
dst=ROOT/path.lstrip('/')
if dst.exists(): return dst
real=adb(f'readlink -f {path}').decode().strip()
data=adb(f'cat {real}')
if not data.startswith(b'\x7fELF') and path.endswith('.so'): return None
dst.parent.mkdir(parents=True,exist_ok=True); dst.write_bytes(data); return dst
def needed(p):
b=p.read_bytes()
if b[:4]!=b'\x7fELF': return []
shoff,=struct.unpack_from('<Q',b,0x28); phoff,=struct.unpack_from('<Q',b,0x20)
phnum,=struct.unpack_from('<H',b,0x38)
dyn=None; loads=[]
for i in range(phnum):
t,f,off,va,pa,fs,ms,al=struct.unpack_from('<IIQQQQQQ',b,phoff+i*56)
if t==2: dyn=(off,fs)
if t==1: loads.append((va,off,fs))
if not dyn: return []
ents=[struct.unpack_from('<qQ',b,dyn[0]+j) for j in range(0,dyn[1],16)]
strtab=[v for t,v in ents if t==5][0]
stroff=[o+strtab-va for va,o,fs in loads if va<=strtab<va+fs][0]
out=[]
for t,v in ents:
if t==1:
e=b.index(b'\0',stroff+v); out.append(b[stroff+v:e].decode())
return out
todo=list(sys.argv[1:]); seen=set(); missing=[]
while todo:
path=todo.pop()
if path in seen: continue
seen.add(path)
p=pull(path)
if not p: missing.append(path); continue
for lib in needed(p):
for d in SEARCH:
cand=f'{d}/{lib}'
if cand in seen: break
if adb(f'[ -e {cand} ] && echo y').strip().endswith(b'y'):
todo.append(cand); break
else: missing.append(lib)
print('pulled',len(seen)-len(missing)); print('missing',sorted(set(missing)))
+598
View File
@@ -0,0 +1,598 @@
#!/bin/sh
# generated from vendor/etc/ueventd.rc: apply Android device node ownership on plain Linux
for n in /dev/apipe-pcm; do [ -e "$n" ] && chown 1000:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/apipe-cmd-in; do [ -e "$n" ] && chown 1000:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/apipe-cmd-out; do [ -e "$n" ] && chown 1000:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/vbc_turning; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/vbc_turning*; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/l_agdsp_a; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/l_agdsp_b; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/audio_dsp*; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 666 "$n"; done
for n in /dev/audio_pipe*; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 660 "$n"; done
for n in /dev/audio_dsp_call_info; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/logo; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/nr_*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/calinv; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/pm_sys*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/ch_sys*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/vdsp*; do [ -e "$n" ] && chown 1047:1000 "$n" && chmod 660 "$n"; done
for n in /dev/iio:device*; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/data0_gnss; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0666 "$n"; done
for n in /dev/block/by-name/gnssmodem_a; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/gnssmodem_b; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/sttygnss0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_gnss0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_gnss1; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stime_pm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stime_ch; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/wcn_gnss_dump; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_gnss; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_wcn0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyS3; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyS4; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyS0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/gnss_pmnotify_ctl; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/power_ctl; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/gnss_dbg; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/fm; do [ -e "$n" ] && chown 1013:1013 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyM0; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyM1; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/trusty-ipc-dev0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/tshm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/tui_dev; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/madev0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sttybt0; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyBT0; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/trusty-ipc-dev0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stty_lte*; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_lte; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_pm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_ch; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sctl_pm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sctl_ch; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sdiag_lte; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_ldsp; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_time_sync; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte5; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte4; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte6; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte9; do [ -e "$n" ] && chown 1001:1001 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte14; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_pm*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0666 "$n"; done
for n in /dev/spipe_ch*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/snv_lte; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stty_nr*; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_nr; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_phy; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sdiag_nr; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr5; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr4; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr6; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr9; do [ -e "$n" ] && chown 1001:1001 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr14; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/snv_nr; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/vser; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyGS*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ion; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_ion; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_dmabuf; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/dma_heap/uncached_carveout_mm; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/dma_heap/uncached_carveout_oem; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/dma_heap/carveout_fd; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/gsp; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0660 "$n"; done
for n in /dev/mali0; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/pvr_sync; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_jpg; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_jpg1; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_vsp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/vdma; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/vpu_enc0; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/vpu_enc1; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_vpp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_vsp_enc; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_image; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_isp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_sensor; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_cpp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/input/event*; do [ -e "$n" ] && chown 1000:1004 "$n" && chmod 0660 "$n"; done
for n in /dev/map_user; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/iio:device*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/rtc*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/gnssmodem; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/gnssmodem_a; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/rpmb0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/tmc_etb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/pn553; do [ -e "$n" ] && chown 1027:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/st21nfc; do [ -e "$n" ] && chown 1027:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/st54spi; do [ -e "$n" ] && chown 1027:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/miscdata; do [ -e "$n" ] && chown 0:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/persist; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/sysdumpdb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/fulldumpdb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/mmcblk1p*; do [ -e "$n" ] && chown 0:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/mmcblk0rpmb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/mmcblk0rpmb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/memdisk0p1; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0770 "$n"; done
for n in /dev/block/pmem0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0770 "$n"; done
# chown/chmod from vendor init *.rc (Android init applies these after ueventd)
for n in /sys/class/typec/port0/power_role; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/typec/port0/data_role; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/typec/port0/port_type; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/typec/port0/power_role; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/typec/port0/data_role; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/typec/port0/port_type; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/usb_notify/usb_control/usb_data_enabled; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/usb_notify/usb_control/usb_data_enabled; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chmod 0666 "$n"; done
for n in /sys/power/wakeup_count; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/module/zte_misc/parameters/cc_connect; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/soc0/soc_manufacturer; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /sys/devices/soc0/soc_model; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /sys/devices/soc0/soc_manufacturer; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/devices/soc0/soc_model; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/devices/platform/soc/soc:aon/64400000.spi/spi_master/spi4/spi4.0/sc27xx-7sreset/hard_mode; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/asound/sprdphonesc2730/asoc-sprd-debug; do [ -e "$n" ] && chown 1041:1005 "$n"; done
for n in /proc/asound/sprdphonesc2730/asoc-sprd-debug; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/devices/virtual/misc/sprd_sensor/camera_sensor_name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/devices/virtual/misc/sprd_sensor/camera_sensor_name; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/isp-dvfs/isp_governor/set_work_freq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/isp-dvfs/isp_governor/set_work_freq; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/irq_register; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/dispc0/irq_unregister; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/panel0/esd_check_enable; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/dsi/dpms_mode; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/resolution; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/esd_check_enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dsi/dpms_mode; do [ -e "$n" ] && chown 1003:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/dpu_version; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/irq_register; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/irq_unregister; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1003:1000 "$n"; done
for n in /sys/class/display/dispc0/low_res_simu; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/gamma; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/hsv; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/epf; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/scl; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/disable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/gamma; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/hsv; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/epf; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/scl; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/disable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/max_brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/backlight/max_brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/frame_count; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/frame_count; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/graphics/fb0; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/fb0; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/adf0; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /dev/adf-interface0.0; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /dev/adf-overlay-engine0.0; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1003:1000 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/max_brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/iq_mem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/sprd-adf/dispc0/dynamic_pclk; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/sprd-adf/dispc0/dynamic_mipi_clk; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/sprd_bm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/dmc_mpu; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/sr_epf; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/ltm; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/lut3d; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/status; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_mode; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist_v2; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_gain; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_bl_fix; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_cur_bl; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/vsync_count; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/frame_no; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_run; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_state; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_param; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp_lut; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/luts_print; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/update_luts; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/ud; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/panel0/resolution; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/sr_epf; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/ltm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/lut3d; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/status; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_mode; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist_v2; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_gain; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_bl_fix; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_cur_bl; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_run; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/vsync_count; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/frame_no; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_state; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_param; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp_lut; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/luts_print; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/update_luts; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/ud; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/cptl/wdtirq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/stop; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/start; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/modem; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/deltanv; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/gdsp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/ldsp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/cdsp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/fixnv; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/runnv; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/cpcmdline; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/modemassert; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/ddr_smem; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/pmic/aon_iram; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/ldinfo; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/mini_dump; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/mem; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/modemassert; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/ddr_smem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/aon_iram; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/wdtirq; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/stop; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/start; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/modem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/deltanv; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/ldsp; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/gdsp; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/cdsp; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/fixnv; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/runnv; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/cpcmdline; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/ldinfo; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/mini_dump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/cptl/mem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/modem; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/phycp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/pmsys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/chsys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/mdm_ctrl; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/sctl_ch; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/devices/platform/spool@0/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /sys/devices/platform/spool@1/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@5/sipc-virt:core@5:channel@5/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@7/sipc-virt:core@7:channel@5/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /dev/modem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/phycp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/pmsys; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/chsys; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/mdm_ctrl; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sctl_ch; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/spool@0/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/spool@1/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@5/sipc-virt:core@5:channel@5/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@7/sipc-virt:core@7:channel@5/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cp_dump; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/cp_dump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/debug-log/freq; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/modem/debug-log/channel; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/modem/debug-log/freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/debug-log/channel; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/sctl_pm; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/iq_mem; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/iq_mem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/sctl_pm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/mdbg; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/mdbg/assert; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/mdbg/wdtirq; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/mdbg/at_cmd; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/mdbg/loopcheck; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/mdbg; do [ -e "$n" ] && chmod 770 "$n"; done
for n in /proc/mdbg/assert; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /proc/mdbg/wdtirq; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /proc/mdbg/at_cmd; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /proc/mdbg/loopcheck; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /dev/mbox; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_smsg; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_smem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_sbuf; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_sblock; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipx; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/devices/platform/soc/soc:ipa-apb/soc:ipa-apb:sipa-dele/sipa_dele_reset; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/power_supply/battery/charge_control_limit; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/max_brightness; do [ -e "$n" ] && chmod 0644 "$n"; done
for n in /sys/class/display/backlight/max_brightness; do [ -e "$n" ] && chmod 0644 "$n"; done
for n in /sys/class/thermal/thermal_zone4/trip_point_0_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/trip_point_1_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/user_power_range; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device3/min_core_num; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device3/min_freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device3/max_ctrl_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device4/min_core_num; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device4/min_freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device4/max_ctrl_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device5/min_core_num; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device5/min_freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device5/max_ctrl_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/policy; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/policy; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/thermal/thermal_zone4/thm_enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone3/thm_enable; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/auto_dfs_on_off; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scaling_force_ddr_freq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scenario_dfs; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scenario_dfs; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/exit_scene; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/exit_scene; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_boost_dfs; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_boost_dfs; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_freq_set; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_freq_set; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/power_supply/battery/stop_charge; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/power_supply/battery/stop_charge; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/stop_charge; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/enable_power_path; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/stop_charge; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/enable_power_path; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/jeita_control; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/keep_awake; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/power_supply/sprdfgu/cc_test_cmd; do [ -e "$n" ] && chmod 0666 "$n"; done
for n in /sys/class/power_supply/battery/input_current_limit; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/power_supply/battery/constant_charge_current; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/stop; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/start; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/pm_sys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/mem; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/pmic/status; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/wdtirq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/ldinfo; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/stop; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/start; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/pm_sys; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/mem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/status; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/wdtirq; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/cali_lib; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/ldinfo; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/sc27xx:red/brightness; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:green/brightness; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:blue/brightness; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:red/trigger; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:green/trigger; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:blue/trigger; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:red/brightness; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:green/brightness; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:blue/brightness; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:red/trigger; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:green/trigger; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:blue/trigger; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_power_enable; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_dump; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_subsys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_power_enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_dump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_subsys; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/touchscreen/ts_suspend; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/touchscreen/ts_suspend; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /dev/cpuctl; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/foreground; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/background; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/top-app; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/rt; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/foreground/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/background/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/top-app/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/rt/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/foreground/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/background/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/top-app/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/rt/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/kernel/hmp/boost; do [ -e "$n" ] && chown 1013:1000 "$n"; done
for n in /sys/kernel/hmp/boostpulse; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/kernel/hmp/packing_boost; do [ -e "$n" ] && chown 1013:1000 "$n"; done
for n in /sys/kernel/hmp/packing_boostpulse; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/kernel/hmp/boostpulse_duration; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/kernel/hmp/boost; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/boostpulse; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/packing_boost; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/packing_boostpulse; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/boostpulse_duratio; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse_duration; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse_duration; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_max_limit; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_min_limit; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_max_limit; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_max_limit; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster0_freq_min; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster0_freq_max; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster1_freq_min; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster1_freq_max; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster0_freq_min; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster0_freq_max; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster1_freq_min; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster1_freq_max; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy0/scaling_governor; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy0/scaling_governor; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy4/scaling_governor; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy4/scaling_governor; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /proc/sprd_sysdump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/tmc_etb; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/tmc_etb; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/sprd_bm; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/dmc_mpu; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/sprd_bm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/dmc_mpu; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes0/channel; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes1/channel; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes0/channel; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes1/channel; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes0/freq; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes1/freq; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes0/freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes1/freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/rt5512; do [ -e "$n" ] && chown 1000:1005 "$n"; done
for n in /dev/rt5512; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/reserve_space/black_list; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/reserve_space/white_list; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/reserve_space/black_list_comm; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/reserve_space/white_list_comm; do [ -e "$n" ] && chmod 640 "$n"; done
for n in /proc/reserve_space/app_guid; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /sys/class/leds/skey0/mode_operation; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey0/sensy_config; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey0/aot_cali; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey1/mode_operation; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey1/sensy_config; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey1/aot_cali; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey0/mode_operation; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey0/sensy_config; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey0/aot_cali; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey1/mode_operation; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey1/sensy_config; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey1/aot_cali; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/block/zram0/writeback_limit; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/block/zram0/writeback_limit; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/block/zram0/writeback_limit_enable; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/block/zram0/writeback_limit_enable; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/leds/aw_led/groupcolor; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/leds/aw_led/groupcolor; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/touchscreen/wake_gesture; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/touchscreen/wake_gesture; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/touchscreen/smart_cover; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/touchscreen/smart_cover; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/touchscreen/screen_state_interface; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /proc/touchscreen/screen_state_interface; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/bus/platform/devices/zte_touch/uevent; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_cmd; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_filename; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_ini_file_path; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_path; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_name; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration_start; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_cmd; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_filename; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_ini_file_path; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_path; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_name; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration_start; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /dev/gtp_tools; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/class/tp_ps/enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/delay; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/batch; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/flush; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/enable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/tp_ps/delay; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/tp_ps/batch; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/tp_ps/flush; do [ -e "$n" ] && chmod 664 "$n"; done
# from Android system init.rc: wakelocks are written by uid system
for n in /sys/power/wake_lock /sys/power/wake_unlock; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
true
+171
View File
@@ -0,0 +1,171 @@
#!/usr/bin/env python3
"""Build a ZTE F50 / MU300 (Unisoc T760, UMS9620) Linux boot image for slot b.
The image reuses the stock boot image header and AVB footer layout (the device runs a
boot-verification bypass, the AVB descriptor is kept as-is), replaces the kernel and the
boot ramdisk, and adds a bootloader_control block that init writes back to misc so the
next reboot returns to slot a (Android).
Inputs are the user's own dumps; nothing device-specific is embedded in this script.
Example:
build-boot-image.py \
--stock-boot dumps/boot_a.img --misc-head dumps/misc-head.bin \
--kernel out/Image --modules out/modules --busybox busybox-static-arm64 \
--logdw tools/logdw/logdw --android-subset android-subset \
--ueventd-perms android-vendor/ueventd-perms.sh --out boot-linux-slotb.img
"""
import argparse
import hashlib
import json
import os
import stat
import struct
import subprocess
import sys
import zlib
from pathlib import Path
HERE = Path(__file__).resolve().parent
PAGE = 4096
BOOT_CMDLINE = b'loglevel=5'
MISC_BC_OFFSET = 0x800
# persistent init log lives at 48 MiB inside boot_b (8 MiB); the image must end before it
PERSIST_LOG_OFFSET = 48 << 20
def cpio_record(name, data, mode, ino, rdev=(0, 0)):
nb = name.encode() + b'\0'
fields = [ino, mode, 0, 0, 1, 0, len(data), 0, 0, rdev[0], rdev[1], len(nb), 0]
h = b'070701' + b''.join(('%08x' % v).encode() for v in fields)
x = h + nb
x += b'\0' * ((-len(x)) % 4)
x += data
x += b'\0' * ((-len(data)) % 4)
return x
def bootloader_control(misc_head):
"""Return (slot_a_block, slot_b_trial_block) derived from the live misc bootloader_control."""
bc = misc_head[MISC_BC_OFFSET:MISC_BC_OFFSET + 32]
if bc[4:8] != b'BCAB':
sys.exit('misc head has no bootloader_control magic at 0x800')
if zlib.crc32(bc[:28]) != struct.unpack('<I', bc[28:])[0]:
sys.exit('misc bootloader_control CRC mismatch')
def with_slots(suffix, a, b):
x = bytearray(bc)
x[0:4] = suffix
x[12] = a
x[14] = b
x[28:32] = struct.pack('<I', zlib.crc32(bytes(x[:28])))
return bytes(x)
# slot_info byte: priority (4 bits) | tries_remaining (3 bits) | successful_boot (1 bit)
slot_a = with_slots(b'_a\0\0', 0x9f, 0x1e) # a: prio 15, tries 1, successful
# Unisoc LK treats tries==1 && !successful as an already failed boot, so the one-shot
# trial needs tries=2 (LK decrements to 1; a failed boot then rolls back to slot a).
slot_b_trial = with_slots(b'_b\0\0', 0x9e, 0x2f) # a: prio 14 successful, b: prio 15 tries 2
return slot_a, slot_b_trial
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument('--stock-boot', required=True, type=Path, help='stock boot_a.img dump (64 MiB, header v4)')
ap.add_argument('--misc-head', required=True, type=Path, help='first 4 KiB of the misc partition')
ap.add_argument('--kernel', required=True, type=Path, help='arm64 Image built from kernel/')
ap.add_argument('--modules', required=True, type=Path, help='flat directory with the built .ko files')
ap.add_argument('--module-order', type=Path, default=HERE / 'module-order.txt')
ap.add_argument('--init', type=Path, default=HERE / 'init')
ap.add_argument('--busybox', required=True, type=Path, help='static arm64 busybox')
ap.add_argument('--logdw', required=True, type=Path, help='tools/logdw build (static arm64)')
ap.add_argument('--ueventd-perms', required=True, type=Path)
ap.add_argument('--android-subset', type=Path, help='directory produced by android-vendor/extract-subset.sh')
ap.add_argument('--out', required=True, type=Path)
a = ap.parse_args()
base = a.stock_boot.read_bytes()
if base[:8] != b'ANDROID!' or struct.unpack_from('<I', base, 40)[0] != 4:
sys.exit('stock boot is not an Android boot image header v4')
slot_a_bc, slot_b_bc = bootloader_control(a.misc_head.read_bytes())
files = {
'init': (a.init.read_bytes(), stat.S_IFREG | 0o755),
'bin/busybox': (a.busybox.read_bytes(), stat.S_IFREG | 0o755),
'bin/sh': (b'busybox', stat.S_IFLNK | 0o777),
'bin/logdw': (a.logdw.read_bytes(), stat.S_IFREG | 0o755),
'etc/ueventd-perms.sh': (a.ueventd_perms.read_bytes(), stat.S_IFREG | 0o755),
'etc/misc-bc-slot-a.bin': (slot_a_bc, stat.S_IFREG | 0o644),
'etc/module-order': (a.module_order.read_bytes(), stat.S_IFREG | 0o644),
}
dirs = {'bin', 'sbin', 'etc', 'proc', 'sys', 'dev', 'run', 'tmp', 'root', 'config', 'linux-modules'}
for name in a.module_order.read_text().split():
ko = a.modules / name
if not ko.exists():
sys.exit(f'missing module {ko}')
files['linux-modules/' + name] = (ko.read_bytes(), stat.S_IFREG | 0o644)
if a.android_subset:
dirs.add('android')
for f in sorted(a.android_subset.rglob('*')):
rel = 'android/' + str(f.relative_to(a.android_subset))
if f.is_symlink():
files[rel] = (os.readlink(f).encode(), stat.S_IFLNK | 0o777)
elif f.is_dir():
dirs.add(rel)
else:
files[rel] = (f.read_bytes(), stat.S_IFREG | (0o755 if os.access(f, os.X_OK) else 0o644))
cpio = bytearray()
ino = 1
for d in sorted(dirs, key=lambda x: (x.count('/'), x)):
cpio += cpio_record(d, b'', stat.S_IFDIR | 0o755, ino)
ino += 1
for name, (data, mode) in files.items():
cpio += cpio_record(name, data, mode, ino)
ino += 1
# the kernel opens /dev/console before running /init
cpio += cpio_record('dev/console', b'', stat.S_IFCHR | 0o600, ino, (5, 1))
ino += 1
cpio += cpio_record('TRAILER!!!', b'', 0, ino)
# must match vendor_boot's LZ4 legacy framing: a gzip segment makes this 5.4 kernel fall
# back to the /dev/ram0 image path and panic "Unable to mount root fs on unknown-block(1,0)"
ram = subprocess.run(['lz4', '-l', '-12', '-c'], input=bytes(cpio), capture_output=True, check=True).stdout
assert ram[:4] == bytes.fromhex('02214c18')
kern = a.kernel.read_bytes()
hdr = bytearray(base[:PAGE])
struct.pack_into('<I', hdr, 8, len(kern))
struct.pack_into('<I', hdr, 12, len(ram))
hdr[44:44 + 1536] = BOOT_CMDLINE + b'\0' * (1536 - len(BOOT_CMDLINE))
struct.pack_into('<I', hdr, 1580, 0) # signature_size
body = bytes(hdr) + kern + b'\0' * ((-len(kern)) % PAGE) + ram
body += b'\0' * ((-len(body)) % PAGE)
original_size = len(body)
avb_off, avb_size = struct.unpack_from('>QQ', base, len(base) - 44)
body += base[avb_off:avb_off + avb_size]
if len(body) > PERSIST_LOG_OFFSET:
sys.exit(f'image data ({len(body)} bytes) overlaps the persistent log area at 48 MiB')
body += b'\0' * (len(base) - 64 - len(body))
footer = bytearray(base[-64:])
struct.pack_into('>QQQ', footer, 12, original_size, original_size, avb_size)
image = body + bytes(footer)
assert len(image) == len(base)
a.out.write_bytes(image)
a.out.with_suffix('.misc-slot-b-trial.bin').write_bytes(slot_b_bc)
manifest = {
'image': a.out.name,
'sha256': hashlib.sha256(image).hexdigest(),
'kernel_sha256': hashlib.sha256(kern).hexdigest(),
'ramdisk_size': len(ram),
'modules': len(a.module_order.read_text().split()),
'misc_slot_b_trial_hex': slot_b_bc.hex(),
'misc_slot_a_hex': slot_a_bc.hex(),
}
a.out.with_suffix('.json').write_text(json.dumps(manifest, indent=2) + '\n')
print(json.dumps(manifest, indent=2))
if __name__ == '__main__':
main()
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
# One-shot trial boot of a Linux image on slot b, from rooted Android (adb + su).
# Writes ONLY boot_b and the 32-byte bootloader_control in misc; boot_a is never touched.
# usage: flash-trial.sh boot-linux-slotb.img (expects .json and .misc-slot-b-trial.bin next to it)
set -eu
IMG=$1
BASE=${IMG%.img}
EXP=$(python3 -c "import json,sys;print(json.load(open(sys.argv[1]))['sha256'])" "$BASE.json")
BC_B=$BASE.misc-slot-b-trial.bin
A_HEX=$(python3 -c "import json,sys;print(json.load(open(sys.argv[1]))['misc_slot_a_hex'])" "$BASE.json")
su_do() { adb shell "su -c '$1'" | tr -d '\r'; }
[ "$(shasum -a 256 "$IMG" | cut -d' ' -f1)" = "$EXP" ] || { echo "local image hash mismatch" >&2; exit 1; }
[ "$(su_do 'getprop ro.boot.slot_suffix')" = "_a" ] || { echo "device is not running slot a" >&2; exit 1; }
live=$(su_do 'dd if=/dev/block/by-name/misc bs=1 skip=2048 count=32 2>/dev/null | od -An -tx1 -v' | tr -d ' \n')
[ "$live" = "$A_HEX" ] || { echo "misc bootloader_control is not the expected slot-a state: $live" >&2; exit 1; }
adb push "$IMG" /data/local/tmp/mu300-boot.img
adb push "$BC_B" /data/local/tmp/mu300-bc-b.bin
[ "$(su_do 'sha256sum /data/local/tmp/mu300-boot.img' | cut -d' ' -f1)" = "$EXP" ] || { echo "pushed image hash mismatch" >&2; exit 1; }
su_do 'dd if=/data/local/tmp/mu300-boot.img of=/dev/block/by-name/boot_b bs=4M && sync'
[ "$(su_do 'sha256sum /dev/block/by-name/boot_b' | cut -d' ' -f1)" = "$EXP" ] || { echo "boot_b verify failed; slot a is still active" >&2; exit 1; }
su_do 'dd if=/data/local/tmp/mu300-bc-b.bin of=/dev/block/by-name/misc bs=1 seek=2048 conv=notrunc && sync'
new=$(su_do 'dd if=/dev/block/by-name/misc bs=1 skip=2048 count=32 2>/dev/null | od -An -tx1 -v' | tr -d ' \n')
[ "$new" = "$(xxd -p "$BC_B" | tr -d '\n')" ] || { echo "misc verify failed: $new" >&2; exit 1; }
echo "slot b armed (one-shot). Rebooting."
adb reboot
+250
View File
@@ -0,0 +1,250 @@
#!/bin/busybox sh
# MU300 standalone Linux initramfs v10 (switch_root to Ubuntu on the free eMMC region; comm fix; custom kernel + modem_control + node perms + slot a modem) (slot b, tries=2 one-shot trial).
# Every stage is written to /dev/kmsg at KERN_ERR so it survives in
# /sys/fs/pstore/console-ramoops-0 after the fallback boot into Android.
/bin/busybox mkdir -p /bin /sbin /proc /sys /dev /run /tmp /root /etc /config
/bin/busybox --install -s /bin
export PATH=/bin:/sbin HOME=/root TERM=vt100
mount -t proc proc /proc
mount -t sysfs sysfs /sys
echo 7 > /proc/sys/kernel/printk
# the custom kernel has devtmpfs; fall back to tmpfs + mknod for safety
if ! mount -t devtmpfs -o mode=0755 devtmpfs /dev; then
mount -t tmpfs -o mode=0755 tmpfs /dev
mknod /dev/null c 1 3
mknod /dev/console c 5 1
mknod /dev/kmsg c 1 11
mknod /dev/zero c 1 5
mknod /dev/urandom c 1 9
fi
pmsg_major=$(awk '$2=="pmsg"{print $1}' /proc/devices)
[ -n "$pmsg_major" ] && [ ! -e /dev/pmsg0 ] && mknod /dev/pmsg0 c "$pmsg_major" 0
log() {
echo "<3>MU300-LINUX: $*" > /dev/kmsg
[ -c /dev/pmsg0 ] && echo "MU300-LINUX: $*" > /dev/pmsg0
[ -d /run ] && echo "$(cut -d' ' -f1 /proc/uptime) $*" >> /run/stages
}
# Persistent log: 8 MiB at 48 MiB inside boot_b, past the image and its AVB data
# (image ends near 39 MiB). Survives a cold power cycle, unlike pstore.
bootb=
persist() {
[ -n "$bootb" ] && [ -b "$bootb" ] || return
# the periodic loop and the reboot timer both call this
mkdir /run/persist.lock 2>/dev/null || return
{
echo "MU300-PERSIST-BEGIN uptime=$(cut -d' ' -f1 /proc/uptime)"
cat /run/stages
echo "--- lsmod"
cat /proc/modules
echo "--- udc"
ls /sys/class/udc 2>&1
echo "--- logcat"
tail -c 400000 /run/logcat.txt 2>&1
echo "--- modem_control"
cat /run/modem_control.log 2>&1 | tail -c 200000
echo "--- deferred"
cat /sys/kernel/debug/devices_deferred 2>&1
echo "--- dmesg"
dmesg | tail -c 6000000
echo "MU300-PERSIST-END"
} > /run/persist.txt 2>&1
head -c 65536 /dev/zero >> /run/persist.txt
dd if=/run/persist.txt of="$bootb" bs=4096 seek=12288 count=2048 conv=notrunc 2>/dev/null
sync
rmdir /run/persist.lock
}
log "stage=init-start pid=$$"
mkdir -p /dev/pts
mount -t devpts -o mode=0620,ptmxmode=0666 devpts /dev/pts
ln -sf pts/ptmx /dev/ptmx
mount -t tmpfs tmpfs /run
mount -t tmpfs tmpfs /tmp
mount -t debugfs debugfs /sys/kernel/debug
echo /bin/mdev > /proc/sys/kernel/hotplug
mdev -s
log "stage=devfs-ready"
# Turn hangs into panics; the vendor kernel reboots after a panic.
echo 1 > /proc/sys/kernel/softlockup_panic
echo 1 > /proc/sys/kernel/panic_on_oops
[ -e /proc/sys/kernel/hardlockup_panic ] && echo 1 > /proc/sys/kernel/hardlockup_panic
echo 1 > /proc/sys/kernel/sysrq
# Safety net: reboot after 5 minutes. By then misc points back at slot a.
# Create /run/stay (e.g. over telnet) to keep Linux running.
(sleep 300
if [ -e /run/stay ]; then log "stage=timer-skipped"; exit 0; fi
log "stage=timer-reboot"
while ! persist_done=$(mkdir /run/persist.lock 2>/dev/null && echo 1); do sleep 1; done
rmdir /run/persist.lock
persist; reboot -f; sleep 10; echo b > /proc/sysrq-trigger) &
loaded=0
failed=0
while read module; do
# vendor_boot's /lib/modules were built for the stock kernel; only our rebuilt copies match
file="/linux-modules/$module"
if insmod "$file" 2>/run/insmod.err; then
loaded=$((loaded + 1))
else
failed=$((failed + 1))
log "insmod-fail $module $(cat /run/insmod.err)"
fi
done < /etc/module-order
mdev -s
log "stage=modules-done loaded=$loaded failed=$failed"
# Point bootloader_control back at slot a so any later reset returns to Android.
misc=
for n in $(seq 1 20); do
for u in /sys/class/block/mmcblk*p*/uevent; do
grep -qx PARTNAME=misc "$u" 2>/dev/null || continue
misc=/dev/$(basename "$(dirname "$u")")
done
[ -n "$misc" ] && [ -b "$misc" ] && break
misc=
sleep 1
mdev -s
done
if [ -n "$misc" ]; then
dd if=/etc/misc-bc-slot-a.bin of="$misc" bs=1 seek=2048 conv=notrunc 2>/dev/null
sync
dd if="$misc" of=/run/bc.bin bs=1 skip=2048 count=32 2>/dev/null
if cmp -s /run/bc.bin /etc/misc-bc-slot-a.bin; then
log "stage=misc-restored dev=$misc"
else
log "stage=misc-restore-MISMATCH dev=$misc"
fi
else
log "stage=misc-NOT-FOUND"
fi
for u in /sys/class/block/mmcblk*p*/uevent; do
grep -qx PARTNAME=boot_b "$u" 2>/dev/null && bootb=/dev/$(basename "$(dirname "$u")")
done
log "stage=persist-target dev=${bootb:-none}"
persist
(while :; do sleep 15; persist; done) &
hostname mu300-linux
ifconfig lo 127.0.0.1 up
log "stage=usb-configfs"
mount -t configfs configfs /config
g=/config/usb_gadget/linux
mkdir -p "$g/strings/0x409" "$g/configs/c.1/strings/0x409" "$g/functions/ecm.usb0"
echo 0x0525 > "$g/idVendor"
echo 0xa4a1 > "$g/idProduct"
echo 0x0200 > "$g/bcdUSB"
echo MU300LINUX > "$g/strings/0x409/serialnumber"
echo Linux > "$g/strings/0x409/manufacturer"
echo "MU300 Linux USB Ethernet" > "$g/strings/0x409/product"
echo "Linux ECM + ACM console" > "$g/configs/c.1/strings/0x409/configuration"
echo 250 > "$g/configs/c.1/MaxPower"
echo 02:50:00:00:77:01 > "$g/functions/ecm.usb0/dev_addr"
echo 02:50:00:00:77:02 > "$g/functions/ecm.usb0/host_addr"
ln -s "$g/functions/ecm.usb0" "$g/configs/c.1/f1"
# USB serial console alongside ECM: recovery/debug access that does not depend on networking
mkdir -p "$g/functions/acm.GS0" && ln -s "$g/functions/acm.GS0" "$g/configs/c.1/f2"
log "stage=usb-wait-udc"
for n in $(seq 1 40); do
[ -e /sys/class/udc/25100000.dwc3 ] && break
sleep 1
done
udc=
[ -e /sys/class/udc/25100000.dwc3 ] && udc=25100000.dwc3
[ -z "$udc" ] && for u in /sys/class/udc/*; do [ -e "$u" ] && { udc=$(basename "$u"); break; }; done
log "stage=udc udc=${udc:-none} available=$(ls /sys/class/udc 2>/dev/null | tr '\n' ',')"
persist
sleep 1
log "stage=usb-bind-start"
[ -n "$udc" ] && echo "$udc" > "$g/UDC"
log "stage=usb-bind-done rc=$?"
persist
# Bring usb0 up immediately after binding, before the host selects the ECM data interface:
# f_ecm reports the link state in its first CONNECT notification, and macOS' ECM driver does not
# pick up a later "connected" notification (v10 left usb0 down until systemd ran -> host "inactive").
ifconfig usb0 up
ROOT_OFFSET=27762098176 # linux-boot/rootfs-region.env; outside every GPT partition
mkdir -p /newroot
# busybox mount only sets up a loop for regular files; for a block device the loop options would
# be handed to ext4 (EINVAL), so attach the loop explicitly and verify its offset
rootloop=$(losetup -f 2>/run/rootmount.err)
if [ -n "$rootloop" ] && losetup -o $ROOT_OFFSET "$rootloop" /dev/mmcblk0 2>>/run/rootmount.err \
&& [ "$(cat /sys/block/${rootloop#/dev/}/loop/offset)" = "$ROOT_OFFSET" ] \
&& [ "$(dd if="$rootloop" bs=1 skip=1080 count=2 2>/dev/null | od -An -tx1 | tr -d ' ')" = 53ef ] \
&& mount -t ext4 -o noatime "$rootloop" /newroot 2>>/run/rootmount.err \
&& [ -x /newroot/lib/systemd/systemd ]; then
log "stage=switch-root ubuntu=$(sed -n 's/^PRETTY_NAME=//p' /newroot/etc/os-release)"
persist
kill $(jobs -p) 2>/dev/null
for p in /proc/[0-9]*; do [ "${p#/proc/}" = 1 ] || kill -9 "${p#/proc/}" 2>/dev/null; done
umount /config 2>/dev/null
mount --move /dev /newroot/dev
mount --move /proc /newroot/proc
mount --move /sys /newroot/sys
mount --move /run /newroot/run 2>/dev/null
exec switch_root /newroot /lib/systemd/systemd
fi
log "stage=rootfs-unavailable $(cat /run/rootmount.err)"
ifconfig usb0 192.168.77.1 netmask 255.255.255.0 up
log "stage=usb0 $(ifconfig usb0 2>&1 | head -1)"
cat > /etc/udhcpd.conf <<'EOF'
start 192.168.77.2
end 192.168.77.9
interface usb0
option subnet 255.255.255.0
option lease 600
lease_file /run/udhcpd.leases
pidfile /run/udhcpd.pid
EOF
touch /run/udhcpd.leases
udhcpd /etc/udhcpd.conf
telnetd -b 192.168.77.1 -p 23 -l /bin/sh
mkdir -p /run/www
echo "MU300 standalone Linux v5: telnet 192.168.77.1; auto reboot to Android after 300s unless /run/stay exists" > /run/www/index.html
httpd -p 192.168.77.1:80 -h /run/www
log "stage=ready"
# Android vendor services in a chroot. modem_control reloads pm_sys through Trusty; only then
# can sprd_pmic_wdt send "watchdog rstoff" and stop the PM co-processor from cutting power.
A=/android
cp -a $A/dev/__properties__ /dev/__properties__
mkdir -p /dev/block/by-name
for u in /sys/class/block/mmcblk0p*/uevent; do
d=$(basename "$(dirname "$u")")
n=$(sed -n 's/^PARTNAME=//p' "$u")
ln -sf /dev/$d /dev/block/$d
[ -n "$n" ] && ln -sf /dev/$d /dev/block/by-name/$n
done
mkdir -p $A/dev $A/proc $A/sys $A/data/vendor $A/mnt $A/tmp
mount --bind /dev $A/dev
mount -t proc proc $A/proc
mount -t sysfs sysfs $A/sys
# modem_control switches to uid system(1000); apply Android's ueventd/init node ownership
sh /etc/ueventd-perms.sh
# LK boots us from slot b; the modem images Android uses (and keeps updated) are the _a copies
sed 's/androidboot.slot_suffix=_b/androidboot.slot_suffix=_a/' /proc/cmdline > /run/cmdline.android
mount --bind /run/cmdline.android $A/proc/cmdline
# liblog sends to logd's datagram socket; capture it so vendor daemons are debuggable
mkdir -p /dev/socket
/bin/logdw /dev/socket/logdw > /run/logcat.txt 2>&1 &
sleep 1
log "stage=android-chroot-ready nodes=$(ls /dev/modem /dev/pmsys /dev/sctl_pm /dev/trusty-ipc-dev0 2>&1 | tr '\n' ',')"
# exec the binary itself (interpreter /system/bin/linker64): sprd_modem_loader only accepts
# ioctls/writes from a task whose comm is exactly "modem_control"
LD_LIBRARY_PATH=/apex/com.android.runtime/lib64/bionic:/system/lib64:/vendor/lib64 \
chroot $A /vendor/bin/modem_control > /run/modem_control.log 2>&1 &
log "stage=modem_control-started pid=$!"
(for n in $(seq 1 120); do
if dmesg | grep -q "sbuf ready for pmic wdt init"; then log "stage=pmic-wdt-rstoff-ready t=$n"; exit 0; fi
sleep 2
done; log "stage=pmic-wdt-NOT-ready") &
while :; do
dmesg > /run/www/dmesg.txt
cat /proc/modules > /run/www/modules.txt
sleep 5
done
+86
View File
@@ -0,0 +1,86 @@
sprd_wdt_fiq.ko
sprd_sip_svc.ko
sprd_systimer.ko
sprd_time_sync.ko
sprd_time_sync_cp.ko
clk-sprd.ko
ums9620-clk.ko
spi-sprd-adi.ko
sprd-ump96xx-spi.ko
rtc-sc27xx.ko
ump9620-regulator.ko
ump9621-regulator.ko
sprd_soc_id.ko
rpmb.ko
ufs-sprd-qogirn6pro.ko
sprd_hwspinlock.ko
nvmem-sc27xx-efuse.ko
nvmem_sprd_efuse.ko
i2c-sprd.ko
sprd-cpufreq-v2.ko
sprd-cpufreq-public.ko
sprd_7sreset.ko
sprd_manufacturer_model.ko
trusty.ko
trusty-pm.ko
trusty-log.ko
trusty-irq.ko
trusty-ipc.ko
trusty-virtio.ko
sprd_shm.ko
gpio-eic-sprd.ko
gpio-sprd.ko
gpio-pmic-eic-sprd.ko
mmc_hsq.ko
mmc_swcq.ko
sdhci-sprd.ko
dwc3-sprd-core.ko
sprd_pmic_syscon.ko
sprd_pdbg.ko
sprd_power_stat.ko
kfifo_buf.ko
sprd_power_manager.ko
unisoc-mailbox.ko
sprd-sipc-virt-bus.ko
sipc-core.ko
spipe.ko
spool.ko
sipx.ko
seth.ko
sprd_modem_loader.ko
sipa-sys.ko
sipa-core.ko
sipa-dele.ko
sipa_eth.ko
sipa_usb.ko
sfp_core.ko
usb_f_vser.ko
slog_bridge.ko
sbuf_bridge.ko
sblock_bridge.ko
extcon-usb-gpio.ko
sc27xx_adc.ko
sprd_battery_info.ko
sprd_tcpm.ko
sprd-charger-manager.ko
sc27xx_fuel_gauge.ko
bq2560x-charger.ko
pinctrl-sprd.ko
pinctrl-sprd-qogirn6pro.ko
ptn38003a-i2c.ko
phy-sprd-commonphy.ko
sprd-bc1p2.ko
musb_hdrc.ko
sprd_usbm.ko
phy-sprd-qogirn6pro.ko
phy-sprd-usb31-qogirn6pro.ko
sprd-pamu3.ko
sc27xx_typec.ko
dwc3-sprd.ko
musb_sprd.ko
sprd_ump96xx_tsensor.ko
sprd_thermal.ko
sprd_thermal_r5p0.ko
sc27xx-poweroff.ko
sprd_wdf.ko
sprd_pmic_wdt.ko
+152
View File
@@ -0,0 +1,152 @@
# Findings: running Linux on the ZTE F50 / MU300 (Unisoc T760)
Everything below was verified on a ZTE F50 (hardware MU300, firmware `MU300_ZYV1.0.0B09`,
Android 13, stock kernel `5.4.254-android12-9-g9c6342244991`) during September 2026.
Each item lists the symptom, the root cause and the fix, so it can be reused for other
UMS9620 devices (for example the ZTE U30 Air).
## Hardware and firmware facts
| Item | Value |
|---|---|
| SoC | Unisoc T760 (UMS9620, "qogirn6pro"), board `ums9620_2h10_feimao` |
| RAM | 2 GiB (about 1.4 GiB visible to Linux, the rest is reserved for modem/TEE) |
| Storage | eMMC, about 58.25 GiB (122159104 sectors) |
| PMIC | UMP9620 (+ UMP9621), charger IC bq2560x/sgm41513, fuel gauge sc27xx-fgu |
| Wi-Fi/BT | SC2355 "Marlin3" on PCIe, firmware `MARLIN3_20A_RLS2_W24.45.4` |
| USB | DWC3 (`25100000.dwc3`) + MUSB (`musb-hdrc.1.auto`), Type-C on the PMIC |
| Bootloader | Unisoc LK ("sprdlk"), Trusty TEE, A/B slots |
| Boot images | boot and vendor_boot are Android header v4, page 4096, LZ4 legacy ramdisks |
## Boot chain and safe testing
### 1. Slot b one-shot trial (never touch boot_a)
* Linux is written to **boot_b** only, and the 32-byte AOSP `bootloader_control` block at
offset `0x800` of `misc` is set so that slot b has the highest priority.
* **Unisoc LK treats `tries_remaining == 1 && successful_boot == 0` as an already failed boot**
(`ANDROID: slot 1 booted fail, rolling back spl and reboot into normal`). A one-shot trial therefore
needs `tries_remaining = 2`: LK decrements it to 1 and boots slot b; if that boot fails, the next boot
rolls back to slot a.
* Linux `init` writes the original slot-a block back to `misc` as one of its first steps, so any later
reboot returns to Android.
* The `uboot_log` partition contains LK's ring log. It is the best source for "which slot was chosen" and
"why did it reset" (`rst_mode`, `charge first poweron reset`, watchdog flags).
### 2. Boot ramdisk must be LZ4 legacy
* Symptom: `RAMDISK: lz4 image found at block 0`, `RAMDISK: incomplete write (-28 != 8388608)`, then
`VFS: Unable to mount root fs on unknown-block(1,0)`.
* Cause: vendor_boot's ramdisk is LZ4 legacy; a gzip boot ramdisk appended to it is not unpacked as an
initramfs by this 5.4 kernel, which then falls back to the legacy `/dev/ram0` image path.
* Fix: compress the boot ramdisk with `lz4 -l`. Also add a `dev/console` node to the cpio.
### 3. Logs without a serial console
* The stock cmdline has `loglevel=1`, so nothing reaches `console-ramoops`.
* pstore only survives a warm reset. Most failures on this device end in a power cut, so init also
persists its stage list and `dmesg` into unused space inside **boot_b at 48 MiB (8 MiB)**; it is read
back from Android.
* A USB CDC-ACM function (`acm.GS0`) next to ECM gives a login console on the host
(`/dev/cu.usbmodem*` on macOS) that works even when networking does not.
## Hardware bring-up with the vendor modules
### 4. USB gadget dependency chain
The UDC only appears when the whole chain probes, in this order:
`extcon-usb-gpio` (the PHY node references `extcon-gpio`) → PHYs → `sc27xx_adc` → `sprd_battery_info`
→ `sprd-charger-manager` → `sc27xx_fuel_gauge` → `bq2560x-charger` (provides the `otg-vbus` regulator used as
`vbus-supply` by DWC3 and MUSB) → `dwc3-sprd` / `musb_sprd`.
* **`sc27xx_adc` must be loaded before the fuel gauge.** The vendor `sc27xx-fgu` driver returns a hard error
(not `-EPROBE_DEFER`) when its IIO channel is missing and is never probed again.
* The exact working order of the 86 modules is in `boot/module-order.txt`.
### 5. The ~290 s power cut (PM co-processor watchdog)
* Symptom: Linux runs normally, then the device loses power about 290 s after boot. LK shows
`charge first poweron reset`, not a watchdog reset.
* Cause: the PM co-processor (CM4, `pm_sys`) runs its own watchdog. `sprd_pmic_wdt` disarms it by sending
`watchdog rstoff` over an SIPC sbuf channel, but that channel only becomes ready after Android's
`modem_control` reloads `pm_sys` (and the modem) through Trusty (`kernelbootcp` TA).
* Fix: run Android's own `/vendor/bin/modem_control` in a chroot with Android's bionic linker and
libraries. Requirements that were each discovered by failure:
1. Copy `/dev/__properties__` from a running Android so property reads work.
2. Create `/dev/block/by-name` links and apply Android's node ownership (`ueventd.rc` plus `chown`/`chmod`
from vendor `init*.rc`), because `modem_control` drops to uid `system` (1000).
3. Bind-mount a copy of `/proc/cmdline` with `androidboot.slot_suffix=_a` so it loads the `_a` modem images
(LK passes `_b` when booting the trial slot).
4. **Exec the binary directly.** `sprd_modem_loader` rejects every ioctl/write unless `current->comm` is
exactly `modem_control` (`drivers/unisoc_platform/modem_loader`); running it as
`linker64 /vendor/bin/modem_control` makes the task name `linker64`.
5. Provide a sink for liblog (`tools/logdw`, listens on `/dev/socket/logdw`), otherwise the daemon's logs vanish.
* Result: `kbc_verify_all_avb2() ret = 0`, `SEC_KBC_START_CP() ret = 0`,
`sprd-pmic-wdt: sbuf ready for pmic wdt init!`, `Modem Alive`, and no more power cut.
### 6. Load average of about 12 is not CPU usage
Vendor kernel threads (`sprd-rotation/N`, `sipa-*`, `slog`) wait in `D` state; Linux counts them in the load
average. `top` shows about 98 % idle.
## Custom kernel
### 7. Matching source
* The ZTE U30 Air kernel (`github.com/Enceka/android_kernel_zte_ums9620_mifi_u30air`, "downloaded from ZTE
opensource") is exactly 5.4.254, covers 137 of the 150 F50 vendor modules and all but one derived config
symbol of the F50 stock config.
* Missing from that tree: camera/display/GPU/touch modules (not used on this device) and the Wi-Fi driver
`sprd_wlan_combo`, which is taken from the realme C51/C53 AndroidT kernel_modules drop.
* An older Unisoc 5.4.147 tree lacks the whole qogirn6pro USB stack and is not usable.
### 8. Build notes
* Full LTO needs more than 8 GiB in the linker step; ThinLTO keeps CFI and links fine.
* Stock config + `kernel/mu300-linux.fragment` adds devtmpfs, fhandle, autofs, SysV IPC, namespaces, nftables,
btrfs/xfs/squashfs, NFS/CIFS, USB serial/modem/audio host drivers, crypto user API, CDC-ACM gadget, and removes
`STATIC_USERMODEHELPER` and forced module signatures.
* All vendor modules must be rebuilt from the same tree (symbol CRCs change).
## Root filesystem on free eMMC space
### 9. Unused space after userdata
* `userdata` is 20 GiB and ends at sector 54218752; the GPT's last usable LBA is 122155007 and the backup GPT
is at the very end. About **32.4 GiB between them belongs to no partition** and read back as zeros.
* The rootfs is an ext4 filesystem (`mu300root`) at byte offset `27762098176` (sector 54222848), 32.39 GiB,
accessed through a loop device with an offset. **The GPT, userdata and all Android partitions are unchanged.**
* `userdata` uses metadata encryption (`dm-default-key`, `inlinecrypt`), so it cannot be shrunk or shared.
### 10. Mounting gotchas
* busybox `mount -o loop,offset=` only creates a loop for regular files; for a block device the options go to
ext4 and fail with `EINVAL`. Use `losetup -o` and verify `/sys/block/loopN/loop/offset`.
* Android's `losetup -f` can return a loop index whose node does not exist yet; allocate, wait for the node and
refuse to attach the same offset twice (two loops mounting one ext4 corrupted it once).
* Toybox `od` on 64 MiB is extremely slow; never interrupt a safety check, an interrupted pipeline "passed" once.
## Ubuntu 26.04 LTS on kernel 5.4
### 11. systemd 259 works on 5.4
5.4 is systemd's minimum baseline; the system boots to `running` with the `old-kernel` taint.
### 12. USB Ethernet must be up before the host activates ECM
* Symptom: macOS shows the "MU300 Linux USB Ethernet" interface as `inactive` forever, no DHCP, although on the
device `usb0` is UP with carrier.
* Cause: `usb0` was only brought up by a systemd unit a few seconds after the UDC was bound. f_ecm reports the link
in its first CONNECT notification and macOS' `AppleUserECM` does not pick up a later "connected" notification.
* Fix: `ifconfig usb0 up` immediately after binding the UDC in the initramfs.
### 13. Userland needing newer syscalls
* Ubuntu 26.04's GNU `tar` fails with `Function not implemented` when extracting (it relies on `openat2`,
Linux 5.6). Use busybox `tar` on the device or extract from another system.
* `ssh.service` is socket-activated on 26.04; enable `ssh.socket`, not only `ssh.service`.
* Extracting an archive that contains a `lib/` directory over Ubuntu replaces the `/lib -> usr/lib` symlink with a
directory (systemd then disappears). Always ship files under `usr/lib/...`.
* `docker export` leaves `/etc/hostname` empty.
## Wi-Fi (SC2355 / Marlin3)
### 14. Bring-up
* Modules: `pcie-sprd-misc`, `pcie-sprd`, `wcn_bsp`, `sprd_wlan_combo`.
* Firmware and board config come from Android's `/odm/firmware`: `wcnmodem.bin`, `gnssmodem.bin`,
`wifi_board_config.ini`, `wifi_board_config_ab.ini`. Place them in `/usr/lib/firmware`.
* The realme `wlan_combo` driver falls back to `wifi_board_config_hulk.ini` for unknown projects; the firmware then
asserts with `CMD_DOWNLOAD_INI / LOAD_INI_DATA_FAILED` and the chip stays in "card dump" state, so `wlan0` cannot
be brought up (`RTNETLINK answers: No such device`). `kernel/patches/wlan_combo-default-board-config.patch` fixes it.
* `rmmod wcn_bsp` crashes the kernel; reboot instead of reloading the Wi-Fi stack.
* The driver logs `API version not match` for a few command IDs (the realme driver is slightly older than the ZTE
firmware) and a `WARNING` in `sc2355_free_cmd_buf` (spin_unlock_bh in IRQ context).
* Verified after the fix: the driver parses `wifi_board_config.ini`, `wlan0` comes up, `iw dev wlan0 scan` lists
nearby networks and `hostapd` (nl80211, WPA2) reaches `AP-ENABLED`. The MAC address is randomized on each load.
* A crash right after installing a module can leave a 0-byte `.ko` on ext4; run `sync` after installing files.
+9
View File
@@ -0,0 +1,9 @@
# Native arm64 build environment for the Unisoc 5.4 kernel (device kernel used Android clang 12.0.5)
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
clang-12 lld-12 llvm-12 build-essential bc bison flex libssl-dev libelf-dev \
python3 python-is-python3 cpio git kmod ca-certificates rsync lz4 xz-utils file \
&& rm -rf /var/lib/apt/lists/*
ENV PATH=/usr/lib/llvm-12/bin:$PATH
WORKDIR /src
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# Build the MU300 Linux kernel: stock F50 config + mu300-linux.fragment, ThinLTO
set -e
cd /src/zte-u30air
OUT=/src/out-linux
mkdir -p $OUT
M="make O=$OUT ARCH=arm64 LLVM=1 LLVM_IAS=1 CC=clang LD=ld.lld -j10"
cp /work/device.config $OUT/.config
./scripts/config --file $OUT/.config --enable THINLTO
KCONFIG_CONFIG=$OUT/.config ./scripts/kconfig/merge_config.sh -m -O $OUT $OUT/.config /work/mu300-linux.fragment > /work/merge.log 2>&1
$M olddefconfig
# report fragment options that Kconfig refused (dependency not met / symbol missing)
python3 - <<'P'
import re
want={}
for l in open('/work/mu300-linux.fragment'):
m=re.match(r'(CONFIG_[A-Z0-9_]+)=(.*)',l) or re.match(r'# (CONFIG_[A-Z0-9_]+) is not set',l)
if m: want[m.group(1)]=m.group(2) if m.lastindex==2 else 'n'
got={}
for l in open('/src/out-linux/.config'):
m=re.match(r'(CONFIG_[A-Z0-9_]+)=(.*)',l) or re.match(r'# (CONFIG_[A-Z0-9_]+) is not set',l)
if m: got[m.group(1)]=m.group(2) if m.lastindex==2 else 'n'
bad=[f'{k}: want {v} got {got.get(k,"absent")}' for k,v in want.items() if got.get(k,'n' if v=='n' else 'absent')!=v]
open('/work/fragment-rejected.txt','w').write('\n'.join(bad)+'\n'); print('fragment rejected:',len(bad))
P
cp $OUT/.config /work/linux.config
start=$(date +%s)
$M Image modules 2>&1 | grep -E "error|Error|warning: unused|LTO|^make" | tail -40
echo "BUILD_SECONDS $(( $(date +%s) - start ))"
ls -la $OUT/arch/arm64/boot/Image
find $OUT -name "*.ko" | wc -l
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# Build sprd_wlan_combo (SC2355 Wi-Fi) as an external module against out-linux.
# Source: realme C51/C53 AndroidT kernel_modules/kernel5.4/wcn/wlan/wlan_combo (GPL), patched for the MU300.
set -e
WSRC=${WSRC:-/src/ext-wlan_combo}
cd "$WSRC" && patch -p1 --forward < /work/patches/wlan_combo-default-board-config.patch || true
cd /src/zte-u30air
make O=/src/out-linux ARCH=arm64 LLVM=1 LLVM_IAS=1 CC=clang LD=ld.lld -j"$(nproc)" M="$WSRC" modules
llvm-strip --strip-debug -o /src/out-linux/sprd_wlan_combo.ko "$WSRC/sprd_wlan_combo.ko"
File diff suppressed because it is too large. Load diff
+129
View File
@@ -0,0 +1,129 @@
# MU300 (ZTE F50) general-purpose Linux additions on top of the stock F50 config.
# Applied with scripts/kconfig/merge_config.sh; everything not listed stays as stock.
# --- systemd / udev requirements
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_FHANDLE=y
CONFIG_AUTOFS_FS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_NET_PRIO=y
CONFIG_CGROUP_NET_CLASSID=y
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_IPC_NS=y
CONFIG_PID_NS=y
CONFIG_USER_NS=y
CONFIG_NET_NS=y
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_KCMP=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_INOTIFY_USER=y
CONFIG_FANOTIFY=y
CONFIG_SECCOMP_FILTER=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_ENCRYPTED_KEYS=y
CONFIG_KEY_DH_OPERATIONS=y
# Android restricts usermode helpers to a single static binary; Linux needs modprobe/hotplug
# CONFIG_STATIC_USERMODEHELPER is not set
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH=""
# Linux distributions expect these; SELinux stays built in but is disabled on the cmdline
CONFIG_SECURITY_APPARMOR=y
CONFIG_AUDIT=y
# --- networking
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
CONFIG_NF_TABLES_NETDEV=y
CONFIG_NFT_CT=y
CONFIG_NFT_COUNTER=y
CONFIG_NFT_LOG=y
CONFIG_NFT_LIMIT=y
CONFIG_NFT_MASQ=y
CONFIG_NFT_NAT=y
CONFIG_NFT_REJECT=y
CONFIG_NFT_COMPAT=y
CONFIG_NFT_FIB_INET=y
CONFIG_NF_TABLES_IPV4=y
CONFIG_NF_TABLES_IPV6=y
CONFIG_NFT_FIB_IPV4=y
CONFIG_NFT_FIB_IPV6=y
CONFIG_NF_TABLES_BRIDGE=y
CONFIG_IP_SET=y
CONFIG_MACVLAN=y
CONFIG_MACVTAP=y
CONFIG_IPVLAN=y
CONFIG_VXLAN=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_VLAN_8021Q=y
CONFIG_NET_SCH_FQ_CODEL=y
CONFIG_NET_SCH_CAKE=y
CONFIG_TCP_CONG_BBR=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_ACT_BPF=y
CONFIG_PACKET_DIAG=y
CONFIG_UNIX_DIAG=y
CONFIG_INET_DIAG=y
# --- filesystems
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_XFS_FS=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
CONFIG_SQUASHFS_LZ4=y
CONFIG_ISO9660_FS=y
CONFIG_UDF_FS=y
CONFIG_CIFS=m
CONFIG_NFS_FS=m
CONFIG_NFS_V4=m
CONFIG_NFSD=m
CONFIG_ZSWAP=y
CONFIG_Z3FOLD=y
CONFIG_ZRAM=y
CONFIG_QUOTA=y
# --- USB host devices (modems, serial adapters, audio, storage, networking)
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_PL2303=m
CONFIG_USB_SERIAL_CH341=m
CONFIG_USB_SERIAL_CP210X=m
CONFIG_USB_NET_RNDIS_HOST=m
CONFIG_USB_NET_QMI_WWAN=m
CONFIG_USB_NET_HUAWEI_CDC_NCM=m
CONFIG_USB_NET_CDC_MBIM=m
CONFIG_USB_WDM=m
CONFIG_SND_USB_AUDIO=y
CONFIG_USB_PRINTER=m
# --- crypto user APIs (cryptsetup, iwd, kernel TLS)
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
CONFIG_CRYPTO_USER_API_AEAD=y
CONFIG_CRYPTO_USER_API_RNG=y
CONFIG_TLS=y
# --- vendor modules are rebuilt from this tree, so forced signatures are no longer needed
# CONFIG_MODULE_SIG_FORCE is not set
CONFIG_IKHEADERS=m
# --- USB gadget serial console (CDC-ACM) for recovery access over USB
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_F_ACM=y
@@ -0,0 +1,16 @@
Use the generic wifi_board_config.ini for unknown projects.
The realme C51/C53 driver falls through to wifi_board_config_hulk.ini for any
project name it does not know. The ZTE F50/MU300 ships wifi_board_config.ini,
so the firmware asserts with CMD_DOWNLOAD_INI / LOAD_INI_DATA_FAILED.
--- a/sc2355/hw_param.c
+++ b/sc2355/hw_param.c
@@ -503,6 +503,6 @@
return hw_param_nvm_parse(priv, SYSTEM_WIFI_CONFIG_FILE_HULKBC, (void *)p);
}else{
printk("[kernel] SYSTEM_WIFI_CONFIG_FILE");
- return hw_param_nvm_parse(priv, SYSTEM_WIFI_CONFIG_FILE_HULK, (void *)p);
+ return hw_param_nvm_parse(priv, SYSTEM_WIFI_CONFIG_FILE, (void *)p);
}
}
+17
View File
@@ -0,0 +1,17 @@
# Ubuntu 26.04 LTS arm64 root filesystem for the MU300 (exported with `docker export`, not run as a container)
FROM ubuntu:26.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
systemd systemd-sysv systemd-timesyncd systemd-resolved udev dbus kmod \
iproute2 iputils-ping net-tools nftables dnsmasq-base ethtool \
openssh-server busybox-static \
wpasupplicant hostapd iw wireless-regdb rfkill \
ca-certificates curl wget nano vim-tiny less htop sudo bash-completion \
locales tzdata e2fsprogs dosfstools file procps psmisc lsof strace usbutils pciutils \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i 's/^# *\(en_US.UTF-8\|tr_TR.UTF-8\)/\1/' /etc/locale.gen && locale-gen \
&& ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime && echo Europe/Istanbul > /etc/timezone \
&& echo mu300 > /etc/hostname \
&& (id ubuntu >/dev/null 2>&1 || useradd -m -s /bin/bash ubuntu) \
&& usermod -aG sudo ubuntu && echo 'ubuntu:ubuntu' | chpasswd \
&& printf 'LABEL=mu300root / ext4 defaults,noatime 0 1\n' > /etc/fstab
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# Assemble the MU300 rootfs tarball from the exported Ubuntu image + overlay + kernel modules
set -e
KREL=5.4.254-gb50db5b6224c
R=/build/rootfs
rm -rf $R && mkdir -p $R
tar -xf /w/base.tar -C $R
cp -a /w/overlay/. $R/
# /lib is a symlink to usr/lib on Ubuntu; always write through usr/lib
mkdir -p $R/usr/lib/modules/$KREL/extra
cp /kmods/*.ko $R/usr/lib/modules/$KREL/extra/
cp /kout/modules.builtin /kout/modules.builtin.modinfo $R/usr/lib/modules/$KREL/
depmod -b $R $KREL
# per-device identity is created on first boot
rm -f $R/etc/ssh/ssh_host_* ; : > $R/etc/machine-id; rm -f $R/var/lib/dbus/machine-id
# docker manages /etc/hostname, so the exported file is empty
echo mu300 > $R/etc/hostname
# vendor firmware for Wi-Fi (wcnmodem.bin, wifi_board_config*.ini) is copied from the device's /odm/firmware
if [ -d /firmware ]; then mkdir -p $R/usr/lib/firmware && cp /firmware/* $R/usr/lib/firmware/; fi
# the Android vendor subset (modem_control + libs + properties) comes from android-vendor/extract-subset.sh
if [ -d /android-subset ]; then mkdir -p $R/opt/mu300/android && cp -a /android-subset/. $R/opt/mu300/android/ && mv $R/opt/mu300/android/dev/__properties__ $R/opt/mu300/android/dev-properties && rmdir $R/opt/mu300/android/dev; fi
cp /logdw $R/opt/mu300/bin/logdw
for u in mu300-vendor.service:sysinit.target mu300-usb-net.service:multi-user.target mu300-ssh-hostkeys.service:multi-user.target mu300-telnetd.service:multi-user.target serial-getty@ttyGS0.service:getty.target ssh.socket:sockets.target mu300-wifi.service:multi-user.target systemd-networkd.service:multi-user.target; do
svc=${u%%:*}; tgt=${u##*:}
mkdir -p $R/etc/systemd/system/$tgt.wants
src=/etc/systemd/system/$svc; [ -e $R$src ] || src=/usr/lib/systemd/system/$svc
case $svc in serial-getty@*) src=/usr/lib/systemd/system/serial-getty@.service;; esac
ln -sfn $src $R/etc/systemd/system/$tgt.wants/$svc
done
# no graphical/serial login noise on a headless dongle; keep ttyS1 console for debugging
ln -sfn /dev/null $R/etc/systemd/system/getty@tty1.service
cd $R && tar --numeric-owner -czf /w/mu300-ubuntu-26.04-rootfs.tar.gz .
ls -la /w/mu300-ubuntu-26.04-rootfs.tar.gz; du -sh $R
+3
View File
@@ -0,0 +1,3 @@
127.0.0.1 localhost
127.0.1.1 mu300
::1 localhost ip6-localhost ip6-loopback
@@ -0,0 +1,2 @@
PasswordAuthentication yes
PermitRootLogin no
@@ -0,0 +1,3 @@
[Journal]
# the device can lose power abruptly; keep the on-disk journal close to live
SyncIntervalSec=10s
@@ -0,0 +1,11 @@
[Unit]
Description=Generate unique SSH host keys on first boot
Before=ssh.service ssh.socket
ConditionPathExists=!/etc/ssh/ssh_host_ed25519_key
[Service]
Type=oneshot
ExecStart=/usr/bin/ssh-keygen -A
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,10 @@
[Unit]
Description=Telnet server (busybox telnetd, login required)
After=network.target
[Service]
ExecStart=/bin/busybox telnetd -F -p 23 -l /bin/login
Restart=always
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,12 @@
[Unit]
Description=MU300 USB Ethernet (usb0 192.168.77.1 + DHCP)
After=network-pre.target
Wants=network-pre.target
[Service]
ExecStart=/opt/mu300/bin/usb-net-start
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,14 @@
[Unit]
Description=MU300 Android vendor services (modem_control: PM/modem bring-up, disarms PM watchdog)
DefaultDependencies=no
After=local-fs.target systemd-udevd.service
Before=sysinit.target
[Service]
Type=simple
ExecStart=/opt/mu300/bin/android-vendor-start
Restart=on-failure
RestartSec=3
[Install]
WantedBy=sysinit.target
@@ -0,0 +1,12 @@
[Unit]
Description=MU300 Wi-Fi (SC2355/Marlin3 over PCIe)
After=mu300-vendor.service systemd-udevd.service
Wants=mu300-vendor.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/opt/mu300/bin/wifi-start
[Install]
WantedBy=multi-user.target
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
# Start Android's modem_control in a chroot. It (re)loads pm_sys/modem through Trusty; without it the
# PM co-processor watchdog cuts power ~290 s after boot. See linux-boot/STATUS.md (v9).
set -e
A=/opt/mu300/android
mkdir -p /dev/socket /dev/block/by-name
[ -S /dev/socket/logdw ] || { /opt/mu300/bin/logdw /dev/socket/logdw >> /var/log/android-logcat.txt 2>&1 & sleep 1; }
[ -e /dev/__properties__/property_info ] || cp -a $A/dev-properties /dev/__properties__
for u in /sys/class/block/mmcblk0p*/uevent; do
d=$(basename "$(dirname "$u")")
n=$(sed -n 's/^PARTNAME=//p' "$u")
ln -sfn /dev/$d /dev/block/$d
[ -n "$n" ] && ln -sfn /dev/$d /dev/block/by-name/$n
done
sh /opt/mu300/bin/ueventd-perms.sh
for m in dev proc sys; do mkdir -p $A/$m; done
mkdir -p $A/data/vendor $A/mnt $A/tmp
mountpoint -q $A/dev || mount --rbind /dev $A/dev
mountpoint -q $A/proc || mount -t proc proc $A/proc
mountpoint -q $A/sys || mount -t sysfs sysfs $A/sys
sed 's/androidboot.slot_suffix=_b/androidboot.slot_suffix=_a/' /proc/cmdline > /run/mu300-cmdline.android
mount --bind /run/mu300-cmdline.android $A/proc/cmdline
# sprd_modem_loader only accepts a task whose comm is exactly "modem_control": exec it directly
export LD_LIBRARY_PATH=/apex/com.android.runtime/lib64/bionic:/system/lib64:/vendor/lib64
exec chroot $A /vendor/bin/modem_control
@@ -0,0 +1,598 @@
#!/bin/sh
# generated from vendor/etc/ueventd.rc: apply Android device node ownership on plain Linux
for n in /dev/apipe-pcm; do [ -e "$n" ] && chown 1000:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/apipe-cmd-in; do [ -e "$n" ] && chown 1000:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/apipe-cmd-out; do [ -e "$n" ] && chown 1000:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/vbc_turning; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/vbc_turning*; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/l_agdsp_a; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/l_agdsp_b; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/audio_dsp*; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 666 "$n"; done
for n in /dev/audio_pipe*; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 660 "$n"; done
for n in /dev/audio_dsp_call_info; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/logo; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/nr_*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/calinv; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/pm_sys*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/ch_sys*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/vdsp*; do [ -e "$n" ] && chown 1047:1000 "$n" && chmod 660 "$n"; done
for n in /dev/iio:device*; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/data0_gnss; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0666 "$n"; done
for n in /dev/block/by-name/gnssmodem_a; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/gnssmodem_b; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/sttygnss0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_gnss0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_gnss1; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stime_pm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stime_ch; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/wcn_gnss_dump; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_gnss; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_wcn0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyS3; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyS4; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyS0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/gnss_pmnotify_ctl; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/power_ctl; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/gnss_dbg; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/fm; do [ -e "$n" ] && chown 1013:1013 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyM0; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyM1; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/trusty-ipc-dev0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/tshm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/tui_dev; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/madev0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sttybt0; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyBT0; do [ -e "$n" ] && chown 1002:3001 "$n" && chmod 0660 "$n"; done
for n in /dev/trusty-ipc-dev0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stty_lte*; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_lte; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_pm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_ch; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sctl_pm; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sctl_ch; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sdiag_lte; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_ldsp; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_time_sync; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte5; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte4; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte6; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte9; do [ -e "$n" ] && chown 1001:1001 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_lte14; do [ -e "$n" ] && chown 1041:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_pm*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0666 "$n"; done
for n in /dev/spipe_ch*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/snv_lte; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/stty_nr*; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_nr; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/slog_phy; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/sdiag_nr; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr5; do [ -e "$n" ] && chown 1001:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr4; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr6; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr9; do [ -e "$n" ] && chown 1001:1001 "$n" && chmod 0660 "$n"; done
for n in /dev/spipe_nr14; do [ -e "$n" ] && chown 1013:1005 "$n" && chmod 0660 "$n"; done
for n in /dev/snv_nr; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/vser; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ttyGS*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/ion; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_ion; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_dmabuf; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/dma_heap/uncached_carveout_mm; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/dma_heap/uncached_carveout_oem; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/dma_heap/carveout_fd; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/gsp; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0660 "$n"; done
for n in /dev/mali0; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/pvr_sync; do [ -e "$n" ] && chown 1000:1003 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_jpg; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0666 "$n"; done
for n in /dev/sprd_jpg1; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_vsp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/vdma; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/vpu_enc0; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/vpu_enc1; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_vpp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_vsp_enc; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_image; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_isp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_sensor; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/sprd_cpp; do [ -e "$n" ] && chown 1000:1006 "$n" && chmod 0660 "$n"; done
for n in /dev/input/event*; do [ -e "$n" ] && chown 1000:1004 "$n" && chmod 0660 "$n"; done
for n in /dev/map_user; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/iio:device*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/rtc*; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/gnssmodem; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/gnssmodem_a; do [ -e "$n" ] && chown 1000:0 "$n" && chmod 0660 "$n"; done
for n in /dev/rpmb0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/tmc_etb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/pn553; do [ -e "$n" ] && chown 1027:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/st21nfc; do [ -e "$n" ] && chown 1027:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/st54spi; do [ -e "$n" ] && chown 1027:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/miscdata; do [ -e "$n" ] && chown 0:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/persist; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/sysdumpdb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/by-name/fulldumpdb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/mmcblk1p*; do [ -e "$n" ] && chown 0:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/mmcblk0rpmb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/mmcblk0rpmb; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
for n in /dev/block/memdisk0p1; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0770 "$n"; done
for n in /dev/block/pmem0; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0770 "$n"; done
# chown/chmod from vendor init *.rc (Android init applies these after ueventd)
for n in /sys/class/typec/port0/power_role; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/typec/port0/data_role; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/typec/port0/port_type; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/typec/port0/power_role; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/typec/port0/data_role; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/typec/port0/port_type; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/usb_notify/usb_control/usb_data_enabled; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/usb_notify/usb_control/usb_data_enabled; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chmod 0666 "$n"; done
for n in /sys/power/wakeup_count; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/module/zte_misc/parameters/cc_connect; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/soc0/soc_manufacturer; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /sys/devices/soc0/soc_model; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /sys/devices/soc0/soc_manufacturer; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/devices/soc0/soc_model; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/devices/platform/soc/soc:aon/64400000.spi/spi_master/spi4/spi4.0/sc27xx-7sreset/hard_mode; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/asound/sprdphonesc2730/asoc-sprd-debug; do [ -e "$n" ] && chown 1041:1005 "$n"; done
for n in /proc/asound/sprdphonesc2730/asoc-sprd-debug; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/devices/virtual/misc/sprd_sensor/camera_sensor_name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/devices/virtual/misc/sprd_sensor/camera_sensor_name; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/isp-dvfs/isp_governor/set_work_freq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/isp-dvfs/isp_governor/set_work_freq; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/devices/virtual/misc/sprd_flash/test; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/irq_register; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/dispc0/irq_unregister; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/panel0/esd_check_enable; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/dsi/dpms_mode; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/resolution; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/esd_check_enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dsi/dpms_mode; do [ -e "$n" ] && chown 1003:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/dpu_version; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/irq_register; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/irq_unregister; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1003:1000 "$n"; done
for n in /sys/class/display/dispc0/low_res_simu; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/gamma; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/hsv; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/epf; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/scl; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/disable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/gamma; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/hsv; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/epf; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/scl; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/disable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/max_brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/backlight/max_brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/frame_count; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/frame_count; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/graphics/fb0; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/fb0; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/adf0; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /dev/adf-interface0.0; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /dev/adf-overlay-engine0.0; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chmod 666 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/display/dphy0/hop; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dphy0/ssc; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/panel0/name; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/vsync_rate_report; do [ -e "$n" ] && chown 1003:1000 "$n"; done
for n in /sys/class/display/dispc0/bg_color; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/refresh; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/display/dispc0/disable_flip; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/max_brightness; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/iq_mem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/sprd-adf/dispc0/dynamic_pclk; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/sprd-adf/dispc0/dynamic_mipi_clk; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/sprd_bm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/dmc_mpu; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/sr_epf; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/ltm; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/lut3d; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/status; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_mode; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist_v2; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_gain; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_bl_fix; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_cur_bl; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/vsync_count; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/frame_no; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_run; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_state; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_param; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp_lut; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/luts_print; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/update_luts; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/ud; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/panel0/resolution; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/display/dispc0/PQ/enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/sr_epf; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/ltm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/lut3d; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/status; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_mode; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_hist_v2; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_gain; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_bl_fix; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_cur_bl; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_run; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/vsync_count; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/frame_no; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_state; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/cabc_param; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/slp_lut; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/luts_print; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/update_luts; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/display/dispc0/PQ/ud; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/cptl/wdtirq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/stop; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/start; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/modem; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/deltanv; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/gdsp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/ldsp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/cdsp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/fixnv; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/runnv; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/cpcmdline; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/modemassert; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/cptl/ddr_smem; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/pmic/aon_iram; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/ldinfo; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/mini_dump; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/mem; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/cptl/modemassert; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/ddr_smem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/aon_iram; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/wdtirq; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/stop; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/start; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/modem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/deltanv; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/ldsp; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/gdsp; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/cdsp; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/fixnv; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/runnv; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/cpcmdline; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/ldinfo; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/cptl/mini_dump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/cptl/mem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/modem; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/phycp; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/pmsys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/chsys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/mdm_ctrl; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/sctl_ch; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/devices/platform/spool@0/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /sys/devices/platform/spool@1/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@5/sipc-virt:core@5:channel@5/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@7/sipc-virt:core@7:channel@5/base_addr; do [ -e "$n" ] && chmod 444 "$n"; done
for n in /dev/modem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/phycp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/pmsys; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/chsys; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/mdm_ctrl; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sctl_ch; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/spool@0/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/spool@1/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@5/sipc-virt:core@5:channel@5/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/platform/sipc-virt/sipc-virt:core@7/sipc-virt:core@7:channel@5/base_addr; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cp_dump; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/cp_dump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/debug-log/freq; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/modem/debug-log/channel; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/modem/debug-log/freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/debug-log/channel; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/sctl_pm; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/iq_mem; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/iq_mem; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/sctl_pm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/mdbg; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/mdbg/assert; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/mdbg/wdtirq; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/mdbg/at_cmd; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/mdbg/loopcheck; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/mdbg; do [ -e "$n" ] && chmod 770 "$n"; done
for n in /proc/mdbg/assert; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /proc/mdbg/wdtirq; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /proc/mdbg/at_cmd; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /proc/mdbg/loopcheck; do [ -e "$n" ] && chmod 760 "$n"; done
for n in /dev/mbox; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_smsg; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_smem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_sbuf; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipc_sblock; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /dev/sipx; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/devices/platform/soc/soc:ipa-apb/soc:ipa-apb:sipa-dele/sipa_dele_reset; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/power_supply/battery/charge_control_limit; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/backlight/sprd_backlight/max_brightness; do [ -e "$n" ] && chmod 0644 "$n"; done
for n in /sys/class/display/backlight/max_brightness; do [ -e "$n" ] && chmod 0644 "$n"; done
for n in /sys/class/thermal/thermal_zone4/trip_point_0_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/trip_point_1_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/user_power_range; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device3/min_core_num; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device3/min_freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device3/max_ctrl_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device4/min_core_num; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device4/min_freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device4/max_ctrl_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device5/min_core_num; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device5/min_freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/cooling_device5/max_ctrl_temp; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/policy; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone4/policy; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/thermal/thermal_zone4/thm_enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/thermal/thermal_zone3/thm_enable; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/auto_dfs_on_off; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scaling_force_ddr_freq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scenario_dfs; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scenario_dfs; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/exit_scene; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/exit_scene; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_boost_dfs; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_boost_dfs; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_freq_set; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/devfreq/scene-frequency/sprd-governor/scene_freq_set; do [ -e "$n" ] && chown 1047:1000 "$n"; done
for n in /sys/class/power_supply/battery/stop_charge; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/power_supply/battery/stop_charge; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/stop_charge; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/enable_power_path; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/stop_charge; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/enable_power_path; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/jeita_control; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/power_supply/battery/charger.0/keep_awake; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/power_supply/sprdfgu/cc_test_cmd; do [ -e "$n" ] && chmod 0666 "$n"; done
for n in /sys/class/power_supply/battery/input_current_limit; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/power_supply/battery/constant_charge_current; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/stop; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/start; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/pm_sys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/mem; do [ -e "$n" ] && chmod 440 "$n"; done
for n in /proc/pmic/status; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/wdtirq; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/ldinfo; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/pmic/stop; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/start; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/pm_sys; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/mem; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/status; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/wdtirq; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/cali_lib; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /proc/pmic/ldinfo; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/bus/iio/devices/trigger0/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/length; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/buffer/enable; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/trigger/current_trigger; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/class/sprd_sensorhub/sensor_hub/iio/name; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chown 1000:0 "$n"; done
for n in /sys/module/sensorhub/parameters/gryo_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/acc_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/mag_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/pressure_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/light_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/prox_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/sensorhub/parameters/color_temp_firms; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/module/firmware_class/parameters/path; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/sc27xx:red/brightness; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:green/brightness; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:blue/brightness; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:red/trigger; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:green/trigger; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:blue/trigger; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/leds/sc27xx:red/brightness; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:green/brightness; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:blue/brightness; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:red/trigger; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:green/trigger; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/leds/sc27xx:blue/trigger; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_power_enable; do [ -e "$n" ] && chmod 220 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_dump; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_subsys; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_power_enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_dump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/misc/gnss_common_ctl/gnss_subsys; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/touchscreen/ts_suspend; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/touchscreen/ts_suspend; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /dev/cpuctl; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/foreground; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/background; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/top-app; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/rt; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/foreground/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/background/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/top-app/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/rt/tasks; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cpuctl/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/foreground/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/background/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/top-app/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /dev/cpuctl/rt/tasks; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/kernel/hmp/boost; do [ -e "$n" ] && chown 1013:1000 "$n"; done
for n in /sys/kernel/hmp/boostpulse; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/kernel/hmp/packing_boost; do [ -e "$n" ] && chown 1013:1000 "$n"; done
for n in /sys/kernel/hmp/packing_boostpulse; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/kernel/hmp/boostpulse_duration; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/kernel/hmp/boost; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/boostpulse; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/packing_boost; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/packing_boostpulse; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/kernel/hmp/boostpulse_duratio; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse_duration; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/boostpulse_duration; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_max_limit; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_min_limit; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_max_limit; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpuhotplug/cluster0_core_max_limit; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster0_freq_min; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster0_freq_max; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster1_freq_min; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster1_freq_max; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/cluster0_freq_min; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster0_freq_max; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster1_freq_min; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/cluster1_freq_max; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy0/scaling_governor; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy0/scaling_governor; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy4/scaling_governor; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/system/cpu/cpufreq/policy4/scaling_governor; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /proc/sprd_sysdump; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/tmc_etb; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/tmc_etb; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /dev/sprd_bm; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/dmc_mpu; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /dev/sprd_bm; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/dmc_mpu; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes0/channel; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes1/channel; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes0/channel; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes1/channel; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes0/freq; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes1/freq; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/modem/serdes0/freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/modem/serdes1/freq; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /dev/rt5512; do [ -e "$n" ] && chown 1000:1005 "$n"; done
for n in /dev/rt5512; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /proc/reserve_space/black_list; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/reserve_space/white_list; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/reserve_space/black_list_comm; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/reserve_space/white_list_comm; do [ -e "$n" ] && chmod 640 "$n"; done
for n in /proc/reserve_space/app_guid; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /sys/class/leds/skey0/mode_operation; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey0/sensy_config; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey0/aot_cali; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey1/mode_operation; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey1/sensy_config; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey1/aot_cali; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/leds/skey0/mode_operation; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey0/sensy_config; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey0/aot_cali; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey1/mode_operation; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey1/sensy_config; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/class/leds/skey1/aot_cali; do [ -e "$n" ] && chmod 660 "$n"; done
for n in /sys/block/zram0/writeback_limit; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/block/zram0/writeback_limit; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/block/zram0/writeback_limit_enable; do [ -e "$n" ] && chown 0:1000 "$n"; done
for n in /sys/block/zram0/writeback_limit_enable; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /sys/class/leds/aw_led/groupcolor; do [ -e "$n" ] && chmod 0660 "$n"; done
for n in /sys/class/leds/aw_led/groupcolor; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/touchscreen/wake_gesture; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/touchscreen/wake_gesture; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/touchscreen/smart_cover; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /proc/touchscreen/smart_cover; do [ -e "$n" ] && chmod 644 "$n"; done
for n in /proc/touchscreen/screen_state_interface; do [ -e "$n" ] && chmod 0664 "$n"; done
for n in /proc/touchscreen/screen_state_interface; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/bus/platform/devices/zte_touch/uevent; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_cmd; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_filename; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_ini_file_path; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_path; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_name; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration_start; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_cmd; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_filename; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_ini_file_path; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_path; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_save_file_name; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/devices/virtual/tsp_fw/touchscreen/tpd_test_bsc_calibration_start; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /dev/gtp_tools; do [ -e "$n" ] && chmod 0646 "$n"; done
for n in /sys/class/tp_ps/enable; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/delay; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/batch; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/flush; do [ -e "$n" ] && chown 1000:1000 "$n"; done
for n in /sys/class/tp_ps/enable; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/tp_ps/delay; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/tp_ps/batch; do [ -e "$n" ] && chmod 664 "$n"; done
for n in /sys/class/tp_ps/flush; do [ -e "$n" ] && chmod 664 "$n"; done
# from Android system init.rc: wakelocks are written by uid system
for n in /sys/power/wake_lock /sys/power/wake_unlock; do [ -e "$n" ] && chown 1000:1000 "$n" && chmod 0660 "$n"; done
true
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
# The initramfs already bound the ECM gadget (usb0). Give it an address and serve DHCP to the host.
for n in $(seq 1 30); do ip link show usb0 >/dev/null 2>&1 && break; sleep 1; done
ip addr replace 192.168.77.1/24 dev usb0
ip link set usb0 up
exec dnsmasq --keep-in-foreground --conf-file=/dev/null --interface=usb0 --bind-interfaces \
--dhcp-range=192.168.77.2,192.168.77.9,255.255.255.0,12h --dhcp-leasefile=/run/mu300-usb0.leases
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
# Bring up the SC2355 (Marlin3) Wi-Fi: PCIe host, WCN platform driver, then the WLAN driver.
# Firmware (wcnmodem.bin, wifi_board_config*.ini) comes from Android's /odm/firmware -> /usr/lib/firmware.
set -e
depmod -a
for m in pcie-sprd-misc pcie-sprd wcn_bsp sprd_wlan_combo; do
modprobe "$m"
done
for n in $(seq 1 30); do [ -e /sys/class/net/wlan0 ] && break; sleep 1; done
ls /sys/class/net
+32
View File
@@ -0,0 +1,32 @@
#!/system/bin/sh
# Attach the mu300root ext4 (free eMMC region) on Android via a bounded loop device and mount it.
# usage: android-mount-mu300root.sh <mountpoint> | android-mount-mu300root.sh -u <mountpoint>
set -e
OFF=27762098176
SIZE=34776023040
if [ "$1" = -u ]; then
L=$(grep " $2 " /proc/mounts | cut -d' ' -f1)
umount "$2"; [ -n "$L" ] && losetup -d "$L"; echo UNMOUNTED; exit 0
fi
MP=$1
# never attach the same ext4 twice (two loops mounting one filesystem corrupts it)
for o in /sys/block/loop*/loop/offset; do
[ "$(cat "$o" 2>/dev/null)" = "$OFF" ] && { echo "ALREADY-ATTACHED ${o%/loop/offset}"; exit 1; }
done
f=$(losetup -f 2>&1 | grep -o '/dev/block/loop[0-9]*' | head -1)
n=${f##*loop}
[ -n "$n" ] || { echo NO-LOOP-INDEX; exit 1; }
[ -e /sys/block/loop$n/dev ] || { echo NO-SYSFS-loop$n; exit 1; }
L=/dev/block/loop$n
[ -b "$L" ] || mknod "$L" b $(cut -d: -f1 /sys/block/loop$n/dev) $(cut -d: -f2 /sys/block/loop$n/dev)
[ ! -e /sys/block/loop$n/loop/backing_file ] || { echo LOOP-BUSY-$L; exit 1; }
losetup -o $OFF -S $SIZE "$L" /dev/block/mmcblk0
[ "$(cat /sys/block/loop$n/loop/offset)" = "$OFF" ] && [ "$(cat /sys/block/loop$n/loop/backing_file)" = /dev/block/mmcblk0 ] && [ "$(blockdev --getsize64 $L)" = "$SIZE" ] || { echo LOOP-MISMATCH; losetup -d "$L"; exit 1; }
# ext4 superblock at 1024: s_magic @+56 (0xEF53), s_volume_name @+120 (16 bytes)
magic=$(dd if="$L" bs=1 skip=1080 count=2 2>/dev/null | od -An -tx1 | tr -d ' \n')
[ "$magic" = 53ef ] || { echo "NO-EXT4 magic=$magic"; losetup -d "$L"; exit 1; }
label=$(dd if="$L" bs=1 skip=1144 count=16 2>/dev/null | tr -d '\000')
[ "$label" = mu300root ] || { echo "NOT-MU300ROOT label=$label"; losetup -d "$L"; exit 1; }
mkdir -p "$MP"
mount -t ext4 -o noatime "$L" "$MP"
echo "MOUNTED $L on $MP"
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# After a trial falls back to Android: collect LK log, pstore and the init log persisted in boot_b.
set -eu
OUT=${1:-logs-$(date +%Y%m%d-%H%M%S)}
mkdir -p "$OUT"
adb shell "su -c 'getprop ro.boot.slot_suffix; ls -la /sys/fs/pstore'" | tee "$OUT/state.txt"
for f in $(adb shell "su -c 'ls /sys/fs/pstore'" | tr -d '\r'); do adb exec-out "su -c 'cat /sys/fs/pstore/$f'" > "$OUT/$f"; done
adb exec-out "su -c 'cat /dev/block/by-name/uboot_log'" > "$OUT/uboot_log.raw"
strings -n 6 "$OUT/uboot_log.raw" > "$OUT/uboot_log.txt"
# init writes stages + dmesg to boot_b at 48 MiB (8 MiB)
adb exec-out "su -c 'dd if=/dev/block/by-name/boot_b bs=4096 skip=12288 count=2048 2>/dev/null'" | tr -d '\000' > "$OUT/linux-persist.txt"
sed -n '/MU300-PERSIST-BEGIN/,/--- lsmod/p' "$OUT/linux-persist.txt" || true
echo "saved: $OUT"
+37
View File
@@ -0,0 +1,37 @@
/* Minimal logd writer-socket sink: lets Android vendor binaries (liblog) log on plain Linux.
* Binds /dev/socket/logdw (SOCK_DGRAM) and prints "time prio tag: msg" lines to stdout. */
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
int main(int argc, char **argv) {
const char *path = argc > 1 ? argv[1] : "/dev/socket/logdw";
int fd = socket(AF_UNIX, SOCK_DGRAM, 0);
struct sockaddr_un a = {.sun_family = AF_UNIX};
strncpy(a.sun_path, path, sizeof(a.sun_path) - 1);
unlink(path);
if (fd < 0 || bind(fd, (struct sockaddr *)&a, sizeof(a)) < 0) { perror("logdw bind"); return 1; }
chmod(path, 0222);
setvbuf(stdout, NULL, _IOLBF, 0);
static const char prios[] = "??VDIWEFS";
unsigned char buf[5 * 1024];
for (;;) {
ssize_t n = recv(fd, buf, sizeof(buf) - 1, 0);
/* android_log_header_t: id u8, tid u16, sec u32, nsec u32 = 11 bytes */
if (n < 12) continue;
buf[n] = 0;
uint16_t tid; uint32_t sec;
memcpy(&tid, buf + 1, 2); memcpy(&sec, buf + 3, 4);
unsigned char *p = buf + 11;
if (buf[0] == 2 /* events */ || buf[0] == 4 /* security */) continue;
unsigned prio = p[0];
char *tag = (char *)p + 1;
char *msg = tag + strnlen(tag, (size_t)(buf + n - (unsigned char *)tag)) + 1;
if ((unsigned char *)msg >= buf + n) msg = "";
printf("%u %5u %c %s: %s\n", sec, tid, prio < sizeof(prios) - 1 ? prios[prio] : '?', tag, msg);
}
}
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
"""scp to the MU300 with password auth (no sshpass). usage: mu300-scp.py LOCAL REMOTE_PATH"""
import os, pty, select, sys
pw = os.environ.get('MU300_PASS', 'ubuntu').encode()
cmd = ['scp', '-O', '-o', 'StrictHostKeyChecking=no', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'LogLevel=ERROR',
'-o', 'PubkeyAuthentication=no', sys.argv[1], 'ubuntu@192.168.77.1:' + sys.argv[2]]
pid, fd = pty.fork()
if pid == 0:
os.execvp(cmd[0], cmd)
buf = b''; sent = False
while True:
r, _, _ = select.select([fd], [], [], 600)
if not r: break
try: d = os.read(fd, 4096)
except OSError: break
if not d: break
buf += d
if not sent and b'assword:' in buf:
os.write(fd, pw + b'\n'); sent = True; buf = b''
_, status = os.waitpid(pid, 0)
sys.stdout.write(buf.decode(errors='replace'))
sys.exit(os.WEXITSTATUS(status))
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
"""Run shell commands on the MU300 over its USB CDC-ACM console (ttyGS0 getty).
usage: mu300-serial.py [--user U --password P] 'command; command' (stdlib only)"""
import argparse, glob, os, select, sys, termios, time, tty
def open_port():
ports = sorted(glob.glob('/dev/cu.usbmodem*'))
if not ports:
sys.exit('no /dev/cu.usbmodem* port (is the MU300 ACM function up?)')
fd = os.open(ports[-1], os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
attrs = termios.tcgetattr(fd)
tty.setraw(fd)
attrs = termios.tcgetattr(fd)
attrs[4] = attrs[5] = termios.B115200
termios.tcsetattr(fd, termios.TCSANOW, attrs)
return fd
def read_until(fd, needles, timeout):
buf = b''
end = time.time() + timeout
while time.time() < end:
r, _, _ = select.select([fd], [], [], 0.2)
if r:
try:
chunk = os.read(fd, 4096)
except BlockingIOError:
continue
buf += chunk
if any(n in buf for n in needles):
return buf
return buf
def main():
ap = argparse.ArgumentParser()
ap.add_argument('--user', default='ubuntu')
ap.add_argument('--password', default='ubuntu')
ap.add_argument('--timeout', type=float, default=60)
ap.add_argument('command')
a = ap.parse_args()
fd = open_port()
os.write(fd, b'\r')
out = read_until(fd, [b'login:', b'$ ', b'# '], 10)
if b'login:' in out:
os.write(fd, a.user.encode() + b'\r')
read_until(fd, [b'assword:'], 10)
os.write(fd, a.password.encode() + b'\r')
read_until(fd, [b'$ ', b'# '], 20)
marker = b'__MU300_DONE__'
os.write(fd, b"stty -echo; " + a.command.encode() + b"; echo __MU300_DONE__\r")
out = read_until(fd, [marker + b'\r\n', marker + b'\n'], a.timeout)
text = out.decode(errors='replace').replace('\r', '')
sys.stdout.write(text.split('__MU300_DONE__')[0])
if __name__ == '__main__':
main()
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
"""Run a command in the already logged-in shell on the MU300 USB serial console (ttyGS0).
usage: mu300-sh.py [--timeout N] 'command' -- prints the command output (ANSI/OSC stripped)."""
import glob, os, re, select, sys, time, tty
def main():
timeout = 60.0
args = sys.argv[1:]
if args[:1] == ['--timeout']:
timeout = float(args[1]); args = args[2:]
cmd = ' '.join(args)
fd = os.open(sorted(glob.glob('/dev/cu.usbmodem*'))[-1], os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
tty.setraw(fd)
tag = 'MU300_%d' % int(time.time() * 1000)
os.write(fd, ("stty -echo 2>/dev/null; { %s ; } 2>&1; echo %s_END\r" % (cmd, tag)).encode())
buf = b''
end = time.time() + timeout
while time.time() < end and (tag + '_END').encode() not in buf.split(b'echo ' + tag.encode())[-1]:
r, _, _ = select.select([fd], [], [], 0.2)
if r:
try:
buf += os.read(fd, 65536)
except BlockingIOError:
pass
text = buf.decode(errors='replace')
text = re.sub(r'\x1b\][^\x1b\x07]*(\x1b\\|\x07)', '', text) # OSC (shell integration)
text = re.sub(r'\x1b\[[0-9;?]*[A-Za-z]', '', text).replace('\r', '')
text = text.split(tag + '_END')[-2] if text.count(tag + '_END') >= 2 else text.split(tag + '_END')[0]
lines = [l for l in text.split('\n') if 'stty -echo' not in l and not l.endswith('$ ')]
sys.stdout.write('\n'.join(lines).strip() + '\n')
main()
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""Run a command on the MU300 over SSH with password auth (no sshpass needed).
usage: MU300_PASS=ubuntu mu300-ssh.py 'command' (host 192.168.77.1, user ubuntu)"""
import os, pty, select, sys, time
host = os.environ.get('MU300_HOST', 'ubuntu@192.168.77.1')
pw = os.environ.get('MU300_PASS', 'ubuntu').encode()
cmd = ['ssh', '-o', 'StrictHostKeyChecking=no', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'LogLevel=ERROR',
'-o', 'PubkeyAuthentication=no', host, ' '.join(sys.argv[1:]) + '; sleep 0.5']
pid, fd = pty.fork()
if pid == 0:
os.execvp(cmd[0], cmd)
out = b''; sent = False
while True:
r, _, _ = select.select([fd], [], [], 120)
if not r:
break
try:
d = os.read(fd, 65536)
except OSError:
break
if not d:
break
out += d
if not sent and b'assword:' in out:
os.write(fd, pw + b'\n'); sent = True; out = b''
sys.stdout.write(out.decode(errors='replace').replace('\r', ''))
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""Run commands on the MU300 over telnet (busybox telnetd + /bin/login). stdlib only.
usage: mu300-telnet.py 'command' env: MU300_HOST (192.168.77.1), MU300_USER/MU300_PASS (ubuntu)"""
import os, re, socket, sys, time
IAC, DONT, DO, WONT, WILL, SB, SE = 255, 254, 253, 252, 251, 250, 240
def strip_negotiation(sock, data):
out = bytearray(); i = 0
while i < len(data):
b = data[i]
if b == IAC and i + 1 < len(data):
cmd = data[i + 1]
if cmd in (DO, DONT, WILL, WONT) and i + 2 < len(data):
opt = data[i + 2]
reply = WONT if cmd in (DO, DONT) else DONT
sock.sendall(bytes([IAC, reply, opt])); i += 3; continue
if cmd == SB:
j = data.find(bytes([IAC, SE]), i)
i = len(data) if j < 0 else j + 2; continue
i += 2; continue
out.append(b); i += 1
return bytes(out)
def read_until(sock, needles, timeout):
buf = b''; end = time.time() + timeout
sock.settimeout(0.5)
while time.time() < end:
try:
d = sock.recv(65536)
if not d: break
buf += strip_negotiation(sock, d)
if any(n in buf for n in needles): break
except socket.timeout:
pass
return buf
s = socket.create_connection((os.environ.get('MU300_HOST', '192.168.77.1'), 23), 10)
read_until(s, [b'login: '], 15); s.sendall(os.environ.get('MU300_USER', 'ubuntu').encode() + b'\r\n')
read_until(s, [b'assword: '], 15); s.sendall(os.environ.get('MU300_PASS', 'ubuntu').encode() + b'\r\n')
read_until(s, [b'$ ', b'# '], 20)
tag = 'MU300END%d' % int(time.time())
s.sendall(('stty -echo; %s; echo; echo %s\r\n' % (' '.join(sys.argv[1:]), tag)).encode())
out = read_until(s, [('\n' + tag).encode()], float(os.environ.get('MU300_TIMEOUT', '120')))
text = out.decode(errors='replace').replace('\r', '')
text = re.sub(r'\x1b\][^\x07\x1b]*(\x07|\x1b\\)', '', text); text = re.sub(r'\x1b\[[0-9;?]*[A-Za-z]', '', text)
body = text.split('\n' + tag)[0]
sys.stdout.write('\n'.join(l for l in body.split('\n') if 'stty -echo' not in l).strip() + '\n')