Created
November 15, 2022 13:56
-
-
Save squidds/4d17f240cbe3721e317a652d7913e535 to your computer and use it in GitHub Desktop.
copy of Armbian Waydroid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================x64 debian===================================== | |
# upgrade kali linux kernel from 5.7 to 5.9+(download from: http://old.kali.org/kali/pool/main/l/linux/) | |
$ sudo dpkg -i linux-image-5.9.0-kali1-amd64_5.9.1-1kali2_amd64 | |
# install header file(download from: https://http.kali.org/kali/pool/main/l/linux/): | |
$ sudo dpkg -i linux-kbuild-5.9_5.9.1-1kali2_amd64.deb linux-headers-5.9.0-kali1-common_5.9.1-1kali2_all.deb linux-headers-5.9.0-kali1-amd64_5.9.1-1kali2_amd64.deb | |
$ git clone https://github.com/diyism/anbox-modules.git | |
$ cd anbox-modules | |
$ sudo ./INSTALL.sh | |
#reboot | |
#don't need to add binder.devices=binder,hwbinder,vndbinder,anbox-binder,anbox-hwbinder,anbox-vndbinder to grub boot parameters | |
$ dkms status | |
anbox-ashmem, 1, 5.9.0-kali1-amd64, x86_64: installed (original_module exists) | |
anbox-binder, 1, 5.9.0-kali1-amd64, x86_64: installed (original_module exists) | |
$ sudo waydroid init #download lineage image | |
$ XDG_SESSION_TYPE=wayland weston | |
# in weston: | |
$ sudo nohup waydroid container restart >/dev/null 2>&1 & | |
$ waydroid session start | |
$ waydroid status | |
Session: RUNNING | |
Container: RUNNING | |
Vendor type: MAINLINE | |
Session user: malcolm(1000) | |
Wayland display: wayland-0 | |
$ tail -f /var/lib/waydroid/waydroid.log | |
(687291) [20:46:03] Failed to start Clipboard manager service, check logs | |
(687291) [20:46:03] Failed to add service waydroidusermonitor: -1 | |
(685184) [20:46:04] Failed to add service waydroidhardware: -1 | |
$ waydroid show-full-ui | |
[11:02:41] Failed to get service waydroidplatform, trying again... | |
[11:02:42] Failed to get service waydroidplatform, trying again... | |
#need to wait for about 1 minute for "waydroidplatform error" stop repeating | |
$ nano /etc/gbinder.conf | |
[General] | |
ApiLevel = 29 | |
$ waydroid session start | |
[20:46:03] Failed to start Clipboard manager service, check logs | |
[20:47:00] Android with user 0 is ready | |
$ waydroid app list | |
Name: Files | |
packageName: com.android.documentsui | |
categories: | |
android.intent.category.LAUNCHER | |
Name: Contacts | |
packageName: com.android.contacts | |
categories: | |
android.intent.category.LAUNCHER | |
$ waydroid app install 1.apk | |
$ sudo waydroid shell | |
reboot | |
# if "sudo waydroid container start" shows error "mount: /var/lib/waydroid/rootfs: /dev/loopN already mounted or mount point busy." | |
# then try: | |
$ sudo umount /var/lib/waydroid/rootfs | |
$ sudo losetup -d /dev/loopN | |
$ lsof | grep loopN | |
$ fuser -k /dev/loopN | |
$ losetup -a | grep waydroid | |
$ rm /dev/loopN | |
# if everything is ok, then do this in weston: | |
while true; do nohup waydroid session start > /dev/null 2>&1; sleep 1; done & | |
# install libhoudini arm64 translation and open google gapps: | |
# https://forum.zorin.com/t/guide-for-android-emulation-with-arm64-translation/12852#arm-translation-5 | |
$ sudo apt install lzip | |
$ git clone --depth=1 https://github.com/casualsnek/waydroid_script | |
$ cd waydroid_script | |
$ sudo python3 -m pip install -r requirements.txt | |
$ sudo waydroid container stop | |
$ sudo python3 waydroid_extras.py -l | |
$ sudo python3 waydroid_extras.py -i | |
# you can see the gsf id, or in shelter work profile use "device id(onemlab.deviceid)" app to show gsf id | |
# register your gsf id into google server: https://google.com/android/uncertified/?pli=1 wait for 20 mins and clear play store service cache(settings/storage/other apps) if you haved installed play store | |
$ sudo python3 waydroid_extras.py -g | |
# sublime-text will automatically try xwayland mode and launched into weston window (wayland android in it) | |
# to avoid thus, I need to modify "subl" short command: | |
$ cat /usr/bin/subl | |
#!/bin/sh | |
GDK_BACKEND=x11 exec /opt/sublime_text/sublime_text --fwdargv0 "$0" "$@" | |
============================pine64 armbian===================================== | |
#download armbian focal image(withoud desktop) from https://www.armbian.com/pine64/#kernels-archive-all | |
#download https://redirect.armbian.com/pine64/Focal_current | |
$ wget https://mirrors.nju.edu.cn/armbian-releases/pine64/archive/Armbian_22.05.3_Pine64_focal_current_5.15.48.img.xz | |
#burn Armbian_22.05.3_Pine64_focal_current_5.15.48.img.xz into sd card with bztsrc/usbimager (https://gitlab.com/bztsrc/usbimager) | |
#insert sd card into pine64 single board and boot it | |
#set root passsword, user password | |
$ sudo su | |
$ apt update | |
$ apt install gnome-session-wayland #for chinese: apt install --no-install-recommends ibus-pinyin ibus ibus-gtk3 fonts-wqy-microhei | |
$ apt install gnome-terminal | |
$ apt install gdm3 #apt remove lightdm xfce4 | |
$ nano /etc/gdm3/custom.conf #ensure WaylandEnable=false is commented, and autologin is not commented | |
#WaylandEnable=false | |
AutomaticLoginEnable = true | |
AutomaticLogin = malcolm | |
$ nano /usr/lib/udev/rules.d/61-gdm.rules #comment all lines | |
//$ sed -i "s/# sleep-inactive-ac-type='suspend'/sleep-inactive-ac-type='nothing'/" /etc/gdm3/greeter.dconf-defaults | |
//$ sed -i "s/# sleep-inactive-ac-timeout=1200/sleep-inactive-ac-timeout=0/" /etc/gdm3/greeter.dconf-defaults | |
//$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type nothing | |
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 | |
$ gsettings set org.gnome.desktop.session idle-delay 0 | |
# if "sleep-inactive-ac-timeout"(20 minutes) and "idle-delay"(5 minutes) doesn't take effect(power off after 20 minutes), to use "gnome-session-inihibit top" to prevent logout/sleep/suspension | |
$ systemctl restart gdm3 | |
$ echo $XDG_SESSION_TYPE #it still shows tty | |
$ reboot | |
$ echo $XDG_SESSION_TYPE #now it shows wayland | |
$ apt install linux-headers-current-sunxi64 | |
$ git clone https://github.com/choff/anbox-modules.git | |
$ cd anbox-modules | |
$ ./INSTALL.sh | |
... | |
DKMS: install completed. | |
binder_linux 122880 0 | |
ashmem_linux 24576 0 | |
#export DISTRO="focal" && \ | |
#curl https://repo.waydro.id/waydroid.gpg --output /usr/share/keyrings/waydroid.gpg && \ | |
#echo "deb [signed-by=/usr/share/keyrings/waydroid.gpg] https://repo.waydro.id/ $DISTRO main" > ~/waydroid.list && \ | |
#mv ~/waydroid.list /etc/apt/sources.list.d/waydroid.list && \ | |
#update-alternatives --set python /usr/bin/python3.9 | |
#apt install waydroid #failed, the armbian os depends on python3.8, while the waydoird depends python3.9 and python3-gbinder | |
# to compile waydroid, cost about 10 minutes on pine64 | |
$ sudo rm -rf /var/lib/waydroid ~/.local/share/waydroid /usr/share/waydroid-extra | |
$ curl -s https://gist.githubusercontent.com/diyism/add38aaf34c4e14a76c25666439a318e/raw | bash | |
$ sudo waydroid init -f | |
$ waydroid session start | |
$ sudo waydroid container start | |
$ waydroid status | |
Session: RUNNING | |
Container: RUNNING | |
Vendor type: MAINLINE | |
Session user: malcolm(1000) | |
Wayland display: wayland-0 | |
$ waydroid show-full-ui | |
(011151) [14:41:37] Failed to get service waydroidplatform, trying again... | |
(011151) [14:41:38] Failed to get service waydroidplatform, trying again... | |
# A minute later, I can see the android desktop. | |
$ nano /etc/xdg/autostart/Waydroid.desktop | |
[Desktop Entry] | |
Type=Application | |
Name=Waydroid | |
Exec=waydroid show-full-ui #for chinese tv: "Exec=waydroid app launch com.cibn.tv", modify decoder "软解" | |
# Install open gapps: | |
$ sudo apt install lzip | |
$ git clone --depth=1 https://github.com/casualsnek/waydroid_script | |
$ cd waydroid_script | |
$ sudo python3 -m pip install -r requirements.txt | |
$ sudo waydroid container stop | |
$ sudo python3 waydroid_extras.py -i | |
# you can see the gsf id, or in shelter work profile use "device id(onemlab.deviceid)" app to show gsf id | |
# register your gsf id into google server: https://google.com/android/uncertified/?pli=1 wait for 20 mins and clear play store service cache(settings/storage/other apps) if you haved installed play store | |
$ sudo python3 waydroid_extras.py -g | |
#========modify keyboard, no effect======== | |
# get the android ip: | |
$ waydroid shell | |
# adb connect | |
$ adb connect 192.168.240.112 | |
# enable "rooted debugging" in settings/developer first | |
$ adb root | |
#========modify keyboard, has effect======== | |
$ df #found /dev/loopX is /var/lib/waydroid/rootfs | |
$ losetup /dev/loopX #found /var/lib/waydroid/images/system.img | |
$ waydroid container stop | |
# should expand about 5%, for example 10MB, or esle while edit Generic.kl it complains "No space left on device" | |
$ dd if=/dev/zero bs=1MiB of=/var/lib/waydroid/images/system.img conv=notrunc oflag=append count=10 | |
$ e2fsck -f /var/lib/waydroid/images/system.img #check the filesystem | |
$ mount -o rw /var/lib/waydroid/images/system.img /var/lib/waydroid/rootfs | |
$ losetup -c /dev/loop0 #resize device | |
$ resize2fs /dev/loop0 #resize filesystem | |
$ nano /var/lib/waydroid/rootfs/system/usr/keylayout/Generic.kl | |
# replace first line "key 1 ESCAPE" into "key 1 BACK" | |
$ reboot | |
#========================adb remote connect waydroid============== | |
#in armbian: | |
$ adb kill-server | |
$ nohup adb -a nodaemon server start >/dev/null 2>&1 & | |
$ adb connect 192.168.240.112 | |
$ adb forward tcp:5556 tcp:5555 | |
#in remote linux: | |
$ adb connect <armbian ip>:5556 | |
$ adb -s <armbian ip>:5556 shell screenrecord --verbose /sdcard/1.mp4 | |
Main display is 1920x1053 @60.00fps (orientation=0) | |
Configuring recorder for 1920x1052 video/avc at 20.00Mbps | |
Content area is 1918x1052 at offset x=1 y=0 | |
Stopping encoder and muxer | |
Encoder failed (err=-38) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment