Rate This Document
Findability
Accuracy
Completeness
Readability

Starting and Uninstalling a Cloud Phone

  • You can use the kbox_config.cfg file to flexibly configure the resources used by cloud phones to achieve optimal performance.
  • The kbox_config.cfg file contains configuration items such as KBOX_GPU_MAP, KBOX_MOUNT_MAP, and KBOX_CPUSET_MAP. You can change the value of the corresponding channel in the maps to select the GPU, CPU, and data volume storage path used by a container.
  • The kbox_config.cfg file exists in the startup path. The container uses the configuration in this file. Therefore, ensure that the configuration in the kbox_config.cfg file is correct. If the configuration file does not exist in the startup path, the cloud phone cannot be started.
  1. Decompress Kbox-AOSP11.zip and upload the deploy_scripts directory in the Kbox-AOSP11 folder to the ~/dependency directory on the server.
  2. (Optional) To enable hardware decoding, set ENABLE_HARD_DECODE to 1 in the kbox_config.cfg file in the deploy_scripts directory and perform the following steps to set the NETINT card node:
    1. Run the nvme list command to view the nodes of the NETINT card chips.
      #nvme list

      The NVMe nodes of the NETINT card chips are marked in the red boxes in the figure above. Each red box corresponds to an encoding card, and each encoding card contains four chips. The command output in the figure above is only an example.

    2. Check the mapping between NVMe nodes and PCIe bus numbers.
      {index} indicates the NVMe node number shown in the preceding figure. For example, in /dev/nvme2n1, the value of {index} is 2.
      #find /sys/devices/ -name nvme{index}

    3. Check the mapping between the node and NUMA based on the bus number.
      {busID} indicates the bus number obtained in the previous step. For example, in the preceding command output, {busID} is 0000:07:00.0.
      #lspci -vvvs {busID} | grep NUMA

    4. Change the value of NETINT in kbox_config.cfg based on the NUMA information corresponding to the NVMe node of the encoding card.

      For servers powered by Kunpeng 920 7265F or 7260 processors: Write NVMe nodes belonging to NUMA 0 and NUMA 1 in the NETINT0 field, and NVMe nodes belonging to NUMA 2 and NUMA 3 in the NETINT1 field.

      Two nodes need to be added for each device in a field. For example, for NVMe device 2, you need to add nodes /dev/nvme2 and /dev/nvme2n1.

      NETINT0="/dev/nvme0,/dev/nvme0n1,/dev/nvme1,/dev/nvme1n1,/dev/nvme2,/dev/nvme2n1,/dev/nvme3,/dev/nvme3n1"
      NETINT1="/dev/nvme5,/dev/nvme5n1,/dev/nvme6,/dev/nvme6n1,/dev/nvme7,/dev/nvme7n1,/dev/nvme8,/dev/nvme8n1"

      If there is only one NETINT card in the server environment (for example, only the first card shown in the NVMe list in 2.a), set both the NETINT0 and NETINT1 fields in kbox_config.cfg to the node names of the card.

      NETINT0="/dev/nvme0,/dev/nvme0n1,/dev/nvme1,/dev/nvme1n1,/dev/nvme2,/dev/nvme2n1,/dev/nvme3,/dev/nvme3n1"
      NETINT1="/dev/nvme0,/dev/nvme0n1,/dev/nvme1,/dev/nvme1n1,/dev/nvme2,/dev/nvme2n1,/dev/nvme3,/dev/nvme3n1"
      1. If the value of NETINT is empty when the container is started for the first time, do not set ENABLE_HARD_DECODE to 1. Do not set ENABLE_HARD_DECODE to 1 also when the container is restarted. Otherwise, a black screen will occur during video playback.
      2. If software decoding is used (by setting ENABLE_HARD_DECODE to 0) during startup, you can switch to hardware decoding (by setting ENABLE_HARD_DECODE to 1) during a restart, with the prerequisite that you have configured NETINT in the previous startup.
  3. Run the android11_kbox.sh script to start the container.
    1
    2
    3
    # cd ~/dependency/deploy_scripts
    # sudo chmod +x android11_kbox.sh
    # sudo ./android11_kbox.sh start {image_name:tag}  ${index1}  ${index2}
    

    Table 1 lists the default configurations of a Kbox basic cloud phone.

    Table 1 Default configurations

    Configuration Item

    Kbox Basic Cloud Phone

    Scenario

    Mobile office/Hosting

    vCPU

    2

    CPU core binding policy

    2 containers, 2 cores

    Memory

    6 GB

    System storage

    16 GB

    Resolution

    720 x 1280

    The following are examples of using the startup script:

    • Start instance 1.
      1
      # sudo ./android11_kbox.sh start kbox:latest  1
      
    • Start instances 1 to 5.
      1
      # sudo ./android11_kbox.sh start kbox:latest  1 5
      
  4. Run the following commands to check whether the Kbox container is started successfully. ${index} indicates the ID of the instance.
    1
    2
    # sudo docker exec -it kbox_${index} sh
    # getprop | grep boot
    

    In the output, if the value of sys.boot_completed is 1, the startup is successful.

  5. Stop and delete Kbox containers.

    In the Kbox solution, data volumes are mounted by default. The default docker stop and docker rm commands cannot completely clear container data. Run the following script to completely clear files on the host.

    Run the android11_kbox.sh script to stop and delete a running Kbox container.

    • Stop and delete the container whose ID is ${index}.
      1
      # sudo ./android11_kbox.sh delete ${index}
      
    • Stop and delete all the containers numbered from ${index1} to ${index2}.
      1
      # sudo ./android11_kbox.sh delete ${index1} ${index2}
      
  6. Restart Kbox containers.

    In the Kbox solution, data volumes are mounted by default. The default docker restart command cannot restart a container. Instead, run the following script to restart a container.

    Run the android11_kbox.sh script to restart Kbox containers.

    • Restart the container numbered ${index}.
      1
      # sudo ./android11_kbox.sh restart ${index}
      
    • Restart all the containers numbered from ${index1} to ${index2}.
      1
      # sudo ./android11_kbox.sh restart ${index1} ${index2}
      
    • If hardware decoding is used when the container is started, to switch to the software decoding mode in a restart, set ENABLE_HARD_DECODE in kbox_config.cfg to 0 and restart the container.
      1
      # sudo ./android11_kbox.sh restart ${index1}
      
    • If software decoding is used and NETINT is configured in kbox_config.cfg when the container is started, to switch to the hardware decoding mode in a restart, set ENABLE_HARD_DECODE in kbox_config.cfg to 1 and restart the container.
      1
      # sudo ./android11_kbox.sh restart ${index1}