-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit
More file actions
36 lines (29 loc) · 998 Bytes
/
init
File metadata and controls
36 lines (29 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/system/bin/sh
# Mount the rootfs loopback file
mount -t f2fs -o loop /boot/boot/rootfs.f2fs /root
# Bind mount the exfat partition
mount -o bind /boot /root/media
# Iterate the required folders
for f in dev dev/pts proc sys tmp firmware vendor/firmware lib/firmware lib/modules device-resources $DEVICE_CUSTOM_ROOTFS_MOUNTS
do
# Create a mount point
mkdir -p /root/$f
# And bind mount the folder to it
mount -o bind /$f /root/$f
done
# Setup the shell environment
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export HOME=/root
export SHELL=/bin/sh
# Set the CPU governors to performance
# This is needed for devices with buggy governors (most T310/T618/H700 devices)
# It's currently enabled for all devices to make debugging easier
for policy_dir in /sys/devices/system/cpu/cpufreq/policy*
do
if [ -d "$policy_dir" ]
then
echo performance > "$policy_dir/scaling_governor"
fi
done
# And hand off control to the rootfs
chroot /root /usr/bin/init