# To run this script, you need Scrcpy from: # # https://github.com/alex-ab/scrcpy.git - branch: direct # # build hints: # snap install androidsdk # androidsdk --list # export ANDROID_HOME=/home//snap/androidsdk/24/AndroidSDK # # meson build --buildtype release --strip -Db_lto=true # ninja -C build # # adb devices -l # adb tcpip 5555 # adb connect :5555 # adb devices -l # List of devices attached # :5555 device product:gta3xlwifieea model:SM_T510 device:gta3xlwifi transport_id:6 # # adb push x/server/scrcpy-server /data/local/tmp/scrcpy-server.jar # # - 8Mbit, encode H264 with android resolution # adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.13 0 8000000 0 -1 true - true true 0 27184 # # - 8Mbit, encode H264 on Android with 1280 # adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.13 1280 8000000 0 -1 true - true true 0 27184 # # - 4Mbit, crop screen to reduce stretch load on Genode side # adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.13 0 4000000 0 -1 true 1080:1920:0:0 true true 0 27184 # # Now, you can try to boot Genode with this script to connect to Android Scrcpy server # or on Linux local testing, use: # ./run build --server-local --server-port 27184 # set use_lxip 0 set use_nic_router 1 set ld_nic "yes" if {[have_spec linux]} { set ld_nic "no" } set use_interactive_pkg 1 if { [have_spec x86] && ![have_include "power_on/qemu"] && ![have_spec linux] } { # use intel_fb_drv on x86 to get max resolution set use_interactive_pkg 0 } # repos/libports/run/fetchurl.inc: # # This run script works on Linux with NAT setup from tap0 to uplink # device uplink0 like follows. # # iptables -t nat -A POSTROUTING -o uplink0 -j MASQUERADE # iptables -A FORWARD -i tap0 -o uplink0 -j ACCEPT # iptables -A FORWARD -i uplink0 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT # echo 1 > /proc/sys/net/ipv4/ip_forward # set use_ping 0 set use_top 0 set use_top_view 0 set use_trace [expr $use_top || $use_top_view] set use_backdrop 1 set use_nic 1 set use_wifi [expr ![have_spec linux] && !$use_nic] set lx_ip_addr "10.0.2.55" set lx_gw_addr "10.0.2.1" set dst_ip "10.0.0.8" set dst_port "27184" proc socket_fs_plugin {} { global use_lxip if { $use_lxip } { return lxip } return lwip } proc binary_nic_drv { } { if {[have_spec linux]} { return "linux_nic_drv" } if {[have_spec x86]} { return "ipxe_nic_drv" } if {[have_spec imx8q_evk]} { return "fec_nic_drv" } return "unknown_nic_drv" } proc binary_nic_config { } { if {[have_spec imx8q_evk]} { return {} } return "" } # # Configure wireless lan # proc wifi_ssid { } { if {[info exists ::env(GENODE_WIFI_SSID)]} { return $::env(GENODE_WIFI_SSID) } else { return "unknown" } } proc wifi_psk { } { if {[info exists ::env(GENODE_WIFI_PSK)]} { return $::env(GENODE_WIFI_PSK) } else { return "unknown" } } # # widi_drv config generator (supporting a network list) # # You may script your tests with this function in the dynamic_rom config below. # The syntax for the networks parameter is # # { ssid protection passphrase explicit_scan } # # Example dynamic_rom config: # # { # } [wifi_config 30 5 no [list "net1 WPA2 net1_psk no" "net2 WPA2 net2_psk no"]] { # # # } [wifi_config 30 5 no [list "net1 WPA2 net1_psk no" "net2 WPA2 net2_psk yes"]] { # } set wifi_verbose false set wifi_verbose_state false proc wifi_config { connected_scan_interval scan_interval rfkill networks } { global wifi_verbose global wifi_verbose_state set config "\n" foreach n $networks { append config " \n" } append config "\n" return $config } create_boot_directory import_from_depot [depot_user]/src/[base_src] \ [depot_user]/pkg/[drivers_interactive_pkg] \ [depot_user]/src/init \ [depot_user]/src/nitpicker \ [depot_user]/src/nit_focus \ [depot_user]/src/vfs \ [depot_user]/src/vfs_jitterentropy \ [depot_user]/src/vfs_[socket_fs_plugin] \ [depot_user]/src/zlib \ [depot_user]/src/report_rom \ [depot_user]/src/nic_router \ [depot_user]/src/libpng \ [depot_user]/src/libc \ [depot_user]/raw/genode_bg \ [depot_user]/pkg/backdrop \ [depot_user]/pkg/fonts_fs set build_components { app/scrcpy } if { !$use_interactive_pkg } { append build_components drivers/framebuffer source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components } lappend_if $use_nic build_components drivers/nic lappend_if $use_wifi build_components drivers/wifi lappend_if $use_wifi build_components drivers/rtc lappend_if $use_ping build_components app/ping lappend_if $use_top build_components app/top append_if $use_top_view build_components { app/menu_view app/top_view app/graph } build $build_components set config { } append_if $use_trace config { } append config { } append_if $use_interactive_pkg config { } if { !$use_interactive_pkg } { append_platform_drv_config append_if [have_spec x86] config { } append_if [have_spec x86] config { } } append_if $use_nic config { } [binary_nic_config] { } append_if $use_nic_router config { } append_if [expr $use_nic_router && $use_nic] config { } append_if [expr $use_nic_router && $use_wifi] config { } append_if $use_nic_router config { } append config { } append_if $use_backdrop config { } append_if $use_ping config { } append_if $use_top config { } append_if $use_top_view config { } append_if $use_wifi config { } append config { 2020-06-18 15:25 01234567890123456789 <} [socket_fs_plugin] { dhcp="yes"/> } install_config $config # write wifi config file set cfg_fd [open "bin/wifi_config" w] puts $cfg_fd [wifi_config 30 5 no [list "[wifi_ssid] WPA2 [wifi_psk] yes"]] close $cfg_fd set firmware_modules { iwlwifi-6000-4.ucode iwlwifi-6000g2a-6.ucode iwlwifi-6000g2b-6.ucode iwlwifi-7260-17.ucode iwlwifi-7265-17.ucode iwlwifi-7265D-29.ucode iwlwifi-8000C-36.ucode iwlwifi-8265-36.ucode regulatory.db} set boot_modules { scrcpy sdl2.lib.so avutil.lib.so avcodec.lib.so avformat.lib.so } if { !$use_interactive_pkg } { append_platform_drv_boot_modules append_if [have_spec x86] boot_modules { intel_fb_drv } } lappend_if $use_nic boot_modules [binary_nic_drv] append_if $use_wifi boot_modules { wifi_drv libcrypto.lib.so libssl.lib.so wifi.lib.so wpa_driver_nl80211.lib.so wpa_supplicant.lib.so } append_if $use_wifi boot_modules $firmware_modules lappend_if $use_wifi boot_modules rtc_drv lappend_if $use_wifi boot_modules wifi_config lappend_if $use_ping boot_modules ping lappend_if $use_top boot_modules top append_if $use_top_view boot_modules { menu_view menu_view_styles.tar top_view graph } build_boot_image $boot_modules append qemu_args " -net nic,model=e1000 -net user " run_genode_until forever