]> glassweightruler.freedombox.rocks Git - waydroid.git/blob - scripts/run-container.sh
anbox: Switch to default wayland display
[waydroid.git] / scripts / run-container.sh
1 #!/bin/bash
2 cd /home/anbox
3
4 if [ ! -e /dev/anbox-hwbinder ] || [ ! -e /dev/ashmem ]; then
5 modprobe binder_linux devices="anbox-binder,anbox-hwbinder,anbox-vndbinder"
6 modprobe ashmem_linux
7 mkdir /dev/binderfs
8 mount -t binder binder /dev/binderfs
9 ln -s /dev/binderfs/* /dev/
10 fi
11 if [ ! -e /dev/anbox-hwbinder ] || [ ! -e /dev/ashmem ]; then
12 echo "ERROR: Binder and ashmem nodes not found!"
13 exit
14 fi
15
16 # just in case, stop Anbox 7
17 stop anbox-container || true
18
19 # start cgroup-lite, else container may fail to start.
20 start cgroup-lite
21 umount -l /sys/fs/cgroup/schedtune
22
23 # start sensors hal
24 start anbox-sensors
25
26 # start anbox-net, that sets up lxc bridge
27 /home/anbox/anbox-net.sh start
28
29 # stop nfcd to not conflict with anbox
30 stop nfcd
31
32 # umount rootfs if it was mounted
33 umount -l rootfs || true
34
35 mount anbox_*_system.img rootfs
36 mount -o remount,ro rootfs
37 mount anbox_*_vendor.img rootfs/vendor
38 mount -o remount,ro rootfs/vendor
39 mount -o bind anbox.prop rootfs/vendor/anbox.prop
40
41 if mountpoint -q -- /odm; then
42 mount -o bind /odm rootfs/odm_extra
43 else
44 if [ -d /vendor/odm ]; then
45 mount -o bind /vendor/odm rootfs/odm_extra
46 fi
47 fi
48
49 # Anbox binder permissions
50 chmod 666 /dev/anbox-*binder
51 chmod 777 /dev/ashmem
52
53 # Wayland socket permissions
54 chmod 777 -R /run/user/32011
55
56 # Set sw_sync permissions
57 chmod 777 /dev/sw_sync
58 chmod 777 /sys/kernel/debug/sync/sw_sync
59
60 # Media nodes permissions
61 chmod 777 /dev/Vcodec
62 chmod 777 /dev/MTK_SMI
63 chmod 777 /dev/mdp_sync
64 chmod 777 /dev/mtk_cmdq
65 chmod 777 /dev/video32
66 chmod 777 /dev/video33
67
68 # Graphics nodes permissions
69 chmod 777 -R /dev/dri/*
70 chmod 777 -R /dev/graphics/*
71 chmod 777 -R /dev/fb*
72
73 lxc-start -n anbox -F -- /init