diff --git a/aaos_iasw/AndroidBoard.mk b/aaos_iasw/AndroidBoard.mk new file mode 100644 index 000000000..7627dcc86 --- /dev/null +++ b/aaos_iasw/AndroidBoard.mk @@ -0,0 +1,61 @@ +DOCKERD_ENV_RESOLV_CONF := $(PRODUCT_OUT)/system/etc/resolv.conf +$(DOCKERD_ENV_RESOLV_CONF): + @ln -sf /data/vendor/docker/etc/resolv.conf $(PRODUCT_OUT)/system/etc/resolv.conf +$(PRODUCT_OUT)/system.img: $(DOCKERD_ENV_RESOLV_CONF) + +LIC_COMMON_SOURCE := $(PRODUCT_OUT)/vendor/etc/docker/common.tar.gz +$(LIC_COMMON_SOURCE): + @mkdir -p $(PRODUCT_OUT)/vendor/etc/docker +ifneq ($(wildcard $(TOP)/vendor/intel/weston-in-docker/common),) + @tar --exclude .git -czf $(PRODUCT_OUT)/vendor/etc/docker/common.tar.gz -C $(TOP)/vendor/intel/weston-in-docker/common . +endif + +$(PRODUCT_OUT)/vendor.img: $(LIC_COMMON_SOURCE) + +BUILDIN_DOCKER_IMAGE ?= false + +.PHONY: lic_resources +lic_resources: +ifneq ($(wildcard $(TOP)/vendor/intel/weston-in-docker/gamecore),) + @rm -rf $(PRODUCT_OUT)/docker/lic/gamecore + @mkdir -p $(PRODUCT_OUT)/docker/lic/gamecore + @cp -r $(TOP)/vendor/intel/weston-in-docker/gamecore/* $(TOP)/vendor/intel/weston-in-docker/gamecore/.* $(TOP)/vendor/intel/weston-in-docker/common/* $(PRODUCT_OUT)/docker/lic/gamecore + @tar --exclude .git -cf $(PRODUCT_OUT)/vendor/etc/docker/gamecore.tar -C $(PRODUCT_OUT)/docker/lic/gamecore . +endif +ifneq ($(wildcard $(TOP)/vendor/intel/weston-in-docker/aicore),) + @tar --exclude .git -cf $(PRODUCT_OUT)/vendor/etc/docker/aicore.tar -C $(TOP)/vendor/intel/weston-in-docker/aicore . +endif + +define lic_base_build +if [ -z "$$(docker images $(2):$(3) | grep $(2))" ]; then DOCKER_BUILDKIT=0 docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) --build-arg no_proxy=localhost -f $(1)/Dockerfile.base -t $(2):$(3) $(1); else echo "Reuse existing $(2):$(3) "; fi +endef + +define lic_build + @mkdir -p $(2) + @cp $(1)/TAG $(2) + @DOCKER_BUILDKIT=0 docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) --build-arg no_proxy=localhost -t $(3):$(4) $(1) + @docker save $(3):$(4) | gzip > $(2)/$(3).tar.gz + @docker rmi $(3):$(4) +endef + +GAMECORE_VERSION := $(shell cat $(TOP)/vendor/intel/weston-in-docker/gamecore/TAG) +GAMECORE_BASE_VERSION := $(shell cat $(TOP)/vendor/intel/weston-in-docker/gamecore/BASE_TAG) +AICORE_VERSION := $(shell cat $(TOP)/vendor/intel/weston-in-docker/aicore/TAG) +AICORE_BASE_VERSION := $(shell cat $(TOP)/vendor/intel/weston-in-docker/aicore/BASE_TAG) + +.PHONY: lic +lic: .KATI_NINJA_POOL := console +lic: + @rm -rf $(PRODUCT_OUT)/docker/lic/gamecore + @mkdir -p $(PRODUCT_OUT)/docker/lic/gamecore + @cp -r $(TOP)/vendor/intel/weston-in-docker/gamecore/* $(TOP)/vendor/intel/weston-in-docker/gamecore/.* $(TOP)/vendor/intel/weston-in-docker/common/* $(PRODUCT_OUT)/docker/lic/gamecore + $(call lic_base_build,$(PRODUCT_OUT)/docker/lic/gamecore,gamecore-base,$(GAMECORE_BASE_VERSION)) + $(call lic_build,$(PRODUCT_OUT)/docker/lic/gamecore,$(PRODUCT_OUT)/vendor/etc/docker/image/gamecore,gamecore,$(GAMECORE_VERSION)) + $(call lic_base_build,$(TOP)/vendor/intel/weston-in-docker/aicore,aicore-base,$(AICORE_BASE_VERSION)) + $(call lic_build,$(TOP)/vendor/intel/weston-in-docker/aicore,$(PRODUCT_OUT)/vendor/etc/docker/image/aicore,aicore,$(AICORE_VERSION)) + +ifeq ($(BUILDIN_DOCKER_IMAGE),true) +$(PRODUCT_OUT)/vendor.img: lic +else +$(PRODUCT_OUT)/vendor.img: lic_resources +endif diff --git a/aaos_iasw/AndroidProducts.mk b/aaos_iasw/AndroidProducts.mk new file mode 100644 index 000000000..b852501f1 --- /dev/null +++ b/aaos_iasw/AndroidProducts.mk @@ -0,0 +1,22 @@ +# +# Copyright 2014 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +PRODUCT_MAKEFILES := \ + $(LOCAL_DIR)/aaos_iasw.mk \ + +COMMON_LUNCH_CHOICES += \ + aaos_iasw-userdebug + diff --git a/aaos_iasw/BoardConfig.mk b/aaos_iasw/BoardConfig.mk new file mode 100644 index 000000000..7b119afb3 --- /dev/null +++ b/aaos_iasw/BoardConfig.mk @@ -0,0 +1,24 @@ +# +# Copyright 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +BOARD_SEPOLICY_DIRS += $(INTEL_PATH_SEPOLICY)/docker + +BOARD_KERNEL_CMDLINE += enforcing=0 +ifeq ($(BOOTCONFIG_ENABLE), true) +BOARD_BOOTCONFIG += androidboot.selinux=permissive +else +BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive +endif diff --git a/aaos_iasw/aaos_iasw.mk b/aaos_iasw/aaos_iasw.mk new file mode 100644 index 000000000..56418c215 --- /dev/null +++ b/aaos_iasw/aaos_iasw.mk @@ -0,0 +1,22 @@ +# +# Copyright 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +$(call inherit-product, device/intel/project-celadon/base_aaos/base_aaos.mk) +include device/intel/project-celadon/aaos_iasw/AndroidBoard.mk +include device/intel/project-celadon/aaos_iasw/BoardConfig.mk +include device/intel/project-celadon/aaos_iasw/device.mk + +PRODUCT_NAME := aaos_iasw diff --git a/aaos_iasw/device.mk b/aaos_iasw/device.mk new file mode 100644 index 000000000..07c55a6ca --- /dev/null +++ b/aaos_iasw/device.mk @@ -0,0 +1,58 @@ +# +# Copyright 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/../base_aaos/fstab:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.base_aaos \ + $(LOCAL_PATH)/../base_aaos/fstab:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/first_stage_ramdisk/fstab.base_aaos \ + $(LOCAL_PATH)/init.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.aaos_iasw.rc + + +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/extra_files/docker/lic_install.sh:/vendor/bin/lic_install.sh \ + $(LOCAL_PATH)/extra_files/docker/docker_manager:/vendor/bin/docker_manager \ + $(LOCAL_PATH)/extra_files/docker/containerd:/vendor/bin/containerd \ + $(LOCAL_PATH)/extra_files/docker/containerd-shim-runc-v2:/vendor/bin/containerd-shim-runc-v2 \ + $(LOCAL_PATH)/extra_files/docker/docker:/vendor/bin/docker \ + $(LOCAL_PATH)/extra_files/docker/dockerd:/vendor/bin/dockerd \ + $(LOCAL_PATH)/extra_files/docker/dockerd-dev:/vendor/bin/dockerd-dev \ + $(LOCAL_PATH)/extra_files/docker/runc:/vendor/bin/runc \ + $(LOCAL_PATH)/extra_files/docker/99-ignore-keyboard.rules:/vendor/etc/docker/config/99-ignore-keyboard.rules \ + $(LOCAL_PATH)/extra_files/docker/99-ignore-mouse.rules:/vendor/etc/docker/config/99-ignore-mouse.rules \ + $(LOCAL_PATH)/extra_files/docker/config.toml:/vendor/etc/docker/etc/containerd/config.toml \ + $(LOCAL_PATH)/extra_files/docker/daemon.json:/vendor/etc/docker/etc/docker/daemon.json \ + +PRODUCT_PACKAGES += sumClientInAndroid \ + multiplyServiceInAndroid \ + multiplyClientInAndroid \ + subtractServiceApplicationInAndroid \ + SharedBufferServiceInAndroid \ + SharedBufferClientInAndroid \ + Steam \ + Genshin \ + Epic \ + LIC \ + liblic-epic \ + liblic-genshin \ + liblic-steam \ + liblic-proxy \ + ContainerManager \ + libstreamingbindersdk \ + libaaudiosdk + +PRODUCT_PROPERTY_OVERRIDES += \ + vendor.nn.hal.grpc_socket_path=/data/vendor/neuralnetworks/ai.socket \ + persist.vendor.lic.device=/dev/dri/renderD129 diff --git a/aaos_iasw/extra_files/docker/99-ignore-keyboard.rules b/aaos_iasw/extra_files/docker/99-ignore-keyboard.rules new file mode 100644 index 000000000..04e90e58a --- /dev/null +++ b/aaos_iasw/extra_files/docker/99-ignore-keyboard.rules @@ -0,0 +1,4 @@ +ACTION=="add|change", KERNEL=="event[0-9]*", \ + ENV{ID_VENDOR_ID}=="03f0", \ + ENV{ID_MODEL_ID}=="0324", \ + ENV{LIBINPUT_IGNORE_DEVICE}="1" diff --git a/aaos_iasw/extra_files/docker/99-ignore-mouse.rules b/aaos_iasw/extra_files/docker/99-ignore-mouse.rules new file mode 100644 index 000000000..583ae25ff --- /dev/null +++ b/aaos_iasw/extra_files/docker/99-ignore-mouse.rules @@ -0,0 +1,4 @@ +ACTION=="add|change", KERNEL=="event[0-9]*", \ + ENV{ID_VENDOR_ID}=="046d", \ + ENV{ID_MODEL_ID}=="c52b", \ + ENV{LIBINPUT_IGNORE_DEVICE}="1" diff --git a/aaos_iasw/extra_files/docker/config.toml b/aaos_iasw/extra_files/docker/config.toml new file mode 100644 index 000000000..c206bf4f9 --- /dev/null +++ b/aaos_iasw/extra_files/docker/config.toml @@ -0,0 +1,16 @@ +root = "/data/vendor/docker/var/lib/containerd" +state = "/data/vendor/docker/run/containerd" +imports = ["/data/vendor/docker/etc/containerd/runtime_*.toml", "./debug.toml"] + +[grpc] + address = "/data/vendor/docker/run/containerd/containerd.sock" + +[debug] + address = "/data/vendor/docker/run/containerd/debug.sock" + +[plugins] + [plugins.opt] + path = "/data/vendor/docker/opt" + [plugins.cri.cni] + bin_dir = "/data/vendor/docker/opt/cni/bin" + conf_dir = "/data/vendor/docker/etc/cni/net.d" diff --git a/aaos_iasw/extra_files/docker/containerd b/aaos_iasw/extra_files/docker/containerd new file mode 100755 index 000000000..45446c1d4 Binary files /dev/null and b/aaos_iasw/extra_files/docker/containerd differ diff --git a/aaos_iasw/extra_files/docker/containerd-shim-runc-v2 b/aaos_iasw/extra_files/docker/containerd-shim-runc-v2 new file mode 100755 index 000000000..1abf8f4a2 Binary files /dev/null and b/aaos_iasw/extra_files/docker/containerd-shim-runc-v2 differ diff --git a/aaos_iasw/extra_files/docker/daemon.json b/aaos_iasw/extra_files/docker/daemon.json new file mode 100644 index 000000000..fcc12a2d6 --- /dev/null +++ b/aaos_iasw/extra_files/docker/daemon.json @@ -0,0 +1,12 @@ +{ + "data-root": "/data/vendor/docker/lib/docker", + "exec-root": "/data/vendor/docker/run/docker", + "pidfile": "/data/vendor/docker/run/docker.pid", + "hosts": [ + "unix:///data/vendor/docker/run/docker.sock" + ], + "storage-driver": "overlay2", + "insecure-registries": [ + "localhost:5000" + ] +} diff --git a/aaos_iasw/extra_files/docker/docker b/aaos_iasw/extra_files/docker/docker new file mode 100755 index 000000000..7925ce100 Binary files /dev/null and b/aaos_iasw/extra_files/docker/docker differ diff --git a/aaos_iasw/extra_files/docker/docker_manager b/aaos_iasw/extra_files/docker/docker_manager new file mode 100755 index 000000000..67201ef52 Binary files /dev/null and b/aaos_iasw/extra_files/docker/docker_manager differ diff --git a/aaos_iasw/extra_files/docker/dockerd b/aaos_iasw/extra_files/docker/dockerd new file mode 100755 index 000000000..dcab49af9 --- /dev/null +++ b/aaos_iasw/extra_files/docker/dockerd @@ -0,0 +1,15 @@ +#!/system/bin/sh + +opts='rw,nosuid,nodev,noexec,relatime' +cgroups='cpu cpuset devices memory' + +for cg in ${cgroups}; do + if ! mountpoint -q "/sys/fs/cgroup/${cg}" 2>/dev/null; then + mkdir -p "/sys/fs/cgroup/${cg}" + mount -t cgroup -o "${opts},${cg}" "${cg}" "/sys/fs/cgroup/${cg}" \ + || rmdir "/sys/fs/cgroup/${cg}" + fi +done + +dockerd-dev $@ + diff --git a/aaos_iasw/extra_files/docker/dockerd-dev b/aaos_iasw/extra_files/docker/dockerd-dev new file mode 100755 index 000000000..e3c9e669a Binary files /dev/null and b/aaos_iasw/extra_files/docker/dockerd-dev differ diff --git a/aaos_iasw/extra_files/docker/lic_install.sh b/aaos_iasw/extra_files/docker/lic_install.sh new file mode 100644 index 000000000..a8eaae9f8 --- /dev/null +++ b/aaos_iasw/extra_files/docker/lic_install.sh @@ -0,0 +1,293 @@ +#!/system/bin/sh + +CORECONTAINERS="gamecore aicore" +COREIMAGES="gamecore aicore" + +function msg() { + echo ">> $@" +} + +function start_container() { + for i in $* + do + if [[ ! -z "$(docker ps -a | tail -n +2 | awk '{print $NF}' | grep $i)" ]]; then + msg "Start $i container..." + ci=$(docker ps -a | awk '$NF~/^'$i'*/ {print $NF}') + docker start $ci + fi + done +} + +function stop_container() { + for i in $* + do + if [[ ! -z "$(docker ps | tail -n +2 | awk '{print $NF}' | grep $i)" ]]; then + msg "Stop $i container..." + docker stop -t0 $(docker ps -a | awk '$NF~/^'$i'*/ {print $NF}') + fi + done +} + +function cleanup_container() { + for i in $* + do + if [[ ! -z "$(docker ps -a | tail -n +2 | awk '{print $NF}' | grep $i)" ]]; then + msg "Stop and rm existed $i container..." + docker stop -t0 $(docker ps -a | awk '$NF~/^'$i'*/ {print $NF}') + docker rm -f $(docker ps -a | awk '$NF~/^'$i'*/ {print $NF}') + fi + done +} + +function cleanup_image() { + for i in $* + do + if [[ ! -z "$(docker images | tail -n +2 | awk '{print $1}' | grep $i)" ]]; then + msg "Remove image $i ..." + docker rmi $(docker image list | awk '$1~/^'$i'*/ {print $1}') + fi + done +} + +function build() { + local ai_build="false" + local full_ai_build="false" + local magic=intel + local mesa="true" + + local help=$( + cat <] + Build LIC for celadon ivi + + -a : enable ai build, default: $ai_build + -A : enable full ai build, default: $full_ai_build + -m : Magic. Default: $magic + -M : Mesa. Default: $mesa + -h: print the usage message +EOF + ) + + while getopts 'aAm:M:h' opt; do + case $opt in + a) + ai_build="true" + ;; + A) + ai_build="true" + full_ai_build="true" + ;; + m) + magic=$OPTARG + ;; + M) + mesa=$OPTARG + ;; + h) + echo "$help" && exit + ;; + esac + done + + echo "Build LIC:" + echo "ai_build=$ai_build" + echo "full_ai_build=$full_ai_build" + echo "magic=$magic" + + uninstall + + if [[ ! -z "$http_proxy" ]]; then + msg "restart dockerd under proxy environment..." + killall dockerd-dev + while [[ ! -z "$(ps -A | awk '{print $NF}' | grep -w dockerd)" ]]; do + msg "wait for dockerd to terminated..." + sleep 1 + done + export XDG_RUNTIME_DIR=/data/vendor/docker/tmp + dockerd --iptables=false & + sleep 20 + fi + + msg "build gamecore docker" + cat /vendor/etc/docker/gamecore.tar | docker build - --network=host --build-arg MAGIC=$magic --build-arg MESA=$mesa --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=localhost -t liccore --target liccore + cat /vendor/etc/docker/gamecore.tar | docker build - --network=host --build-arg MAGIC=$magic --build-arg MESA=$mesa --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=localhost -t gamecore + + if [ $ai_build == "true" ]; then + msg "building aicore container with Intel tensorflow extension for GPU" + if [ $full_ai_build == "true" ]; then + ai_opts="--build-arg SETUP_AI_TOOLS=true" + fi + cat /vendor/etc/docker/aicore.tar | docker build - --network=host $ai_opts --build-arg MAGIC=$magic --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=localhost -t aicore + fi + + msg "Done!" +} + +function install() { + local ai_build="false" + local backend="drm" + local device="/dev/dri/renderD128" + local size="1920x1080" + local privileged="false" + local mem_total=$(expr $(cat /proc/meminfo | grep MemTotal | awk '{print $2}') / 1024 / 1024) + memory_size=${mem_total}g + + local lic_device=$(getprop persist.vendor.lic.device) + if [ -n "$lic_device" ] && [ -c $lic_device ]; then + device=$lic_device + elif [ -c /dev/dri/renderD129 ]; then + device="/dev/dri/renderD129" + fi + + if [ "$device" = "/dev/dri/renderD129" ]; then + vendor_id=$(cat /sys/class/drm/renderD129/device/uevent | grep "PCI_ID" | awk -F'=' '{print $2}' | awk -F':' '{print $1}') + if [ "$vendor_id" = "1AF4" ]; then + device="/dev/dri/renderD128" + fi + fi + + setprop persist.vendor.lic.device $device + + if [[ ! -z "$(docker images | tail -n +2 | awk '{print $1}' | grep aicore)" ]]; then + ai_build="true" + fi + + local help=$( + cat <] [-s ] [-p] [m ] + Install LIC for android ivi + + -b : weston backend, default: $backend + -s : resolution of LIC in headless backend, default: $size + -p: create container with privileged mode + -m Memory size(a positive integer, followed by a suffix of b, k, m, g, to indicate bytes, kilobytes, megabytes, or gigabytes). Maximum and default: $memory_size + -h: print the usage message +EOF + ) + + while getopts 'b:d:s:hpn:m:' opt; do + case $opt in + b) + backend=$OPTARG + ;; + s) + size=$OPTARG + ;; + p) + privileged="true" + ;; + m) + memory_size=$OPTARG + ;; + h) + echo "$help" && exit + ;; + esac + done + + local width + local height + IFS="x" read width height <<<"$size" + + echo "Install LIC:" + echo "backend = $backend" + echo "memory_size = $memory_size" + if [ $backend == "headless" ]; then + echo "size = $size" + echo "width = $width height = $height" + echo "privileged = $privileged" + echo "device = $device" + fi + + cleanup_container $CORECONTAINERS + + msg "create gamecore container with $backend backend..." + create_opts="-ti --network=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -v /dev/binder:/dev/binder -v /data/vendor/docker/sys/class/power_supply:/sys/class/power_supply -v /data/vendor/docker/config/99-ignore-mouse.rules:/etc/udev/rules.d/99-ignore-mouse.rules -v /data/vendor/docker/config/99-ignore-keyboard.rules:/etc/udev/rules.d/99-ignore-keyboard.rules --shm-size 8G --memory=$memory_size" + if [ $backend == "drm" ]; then + create_opts="$create_opts --privileged --user root -v /data/vendor/docker/steam:/home/wid/.steam -v /data/vendor/docker/xdg_config:/home/wid/xdg_config -v /data/vendor/docker/Games:/home/wid/Games --name gamecore --hostname gamecore" + docker create $create_opts gamecore + elif [ $backend == "headless" ]; then + rm -rf -v /data/vendor/docker/image/workdir/ipc + mkdir -p -v /data/vendor/docker/image/workdir/ipc + create_opts="$create_opts -e BACKEND=$backend -e DEVICE=$device -e K8S_ENV_DISPLAY_RESOLUTION_X=$width -e K8S_ENV_DISPLAY_RESOLUTION_Y=$height -e HEADLESS=true -v /data/vendor/docker/image/workdir/ipc:/workdir/ipc --ulimit nofile=524288:524288" + create_opts="$create_opts -v /data/vendor/docker/steam:/home/wid/.steam -v /data/vendor/docker/xdg_config:/home/wid/xdg_config -v /data/vendor/docker/Games:/home/wid/Games -e CONTAINER_ID=1 --name gamecore --hostname gamecore" + if [ $privileged == "true" ]; then + docker create $create_opts --privileged gamecore + else + if [ -c /dev/video50 ]; then + docker create $create_opts --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device-cgroup-rule='a *:* rmw' -v /sys:/sys:rw --device $device --device /dev/snd --device /dev/tty0 --device /dev/tty1 --device /dev/tty2 --device /dev/tty3 --device /dev/video50 --cap-add=NET_ADMIN --cap-add=SYS_ADMIN gamecore + else + docker create $create_opts --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device-cgroup-rule='a *:* rmw' -v /sys:/sys:rw --device $device --device /dev/snd --device /dev/tty0 --device /dev/tty1 --device /dev/tty2 --device /dev/tty3 --cap-add=NET_ADMIN --cap-add=SYS_ADMIN gamecore + fi + fi + fi + + if [ $ai_build == "true" ]; then + msg "create aicore container..." + docker create -ti --network=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -v /dev/binder:/dev/binder -v /data/vendor/neuralnetworks/:/home/wid/.ipc/ --memory=$memory_size --name aicore --hostname aicore --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device-cgroup-rule='a *:* rmw' -v /sys:/sys:rw --device $device --device /dev/snd --device /dev/tty0 --device /dev/tty1 --device /dev/tty2 --device /dev/tty3 --cap-add=NET_ADMIN --cap-add=SYS_ADMIN aicore + fi + + msg "Done!" +} + +function uninstall() { + cleanup_container $CORECONTAINERS + cleanup_image $COREIMAGES +} + +function start() { + start_container $CORECONTAINERS +} + +function stop() { + stop_container $CORECONTAINERS +} + +function main() { + local help=$( + cat < + export https_proxy= + lic_install.sh + +Run with no command: + lic_install.sh equivalent to lic_install.sh build && lic_install.sh install + +Run "$SELF COMMAND -h" for more information of a command +EOF + ) + + local cmd=$1 + if [[ -n $cmd ]]; then + shift + else + build + install + exit 0 + fi + + case $cmd in + build | install | uninstall | start | stop) + $cmd $@ + ;; + help | -h) echo "$help" && exit ;; + *) echo "no such command: $cmd" && exit 1 ;; + esac + +} + +main "$@" diff --git a/aaos_iasw/extra_files/docker/runc b/aaos_iasw/extra_files/docker/runc new file mode 100755 index 000000000..efd9910ea Binary files /dev/null and b/aaos_iasw/extra_files/docker/runc differ diff --git a/aaos_iasw/extra_files/vendor-partition/mkshrc_recovery b/aaos_iasw/extra_files/vendor-partition/mkshrc_recovery new file mode 100644 index 000000000..c103d6c56 --- /dev/null +++ b/aaos_iasw/extra_files/vendor-partition/mkshrc_recovery @@ -0,0 +1,21 @@ +# Copyright (c) 2010, 2012, 2013, 2014 +# Thorsten Glaser +# This file is provided under the same terms as mksh. +#- +# Minimal /system/etc/mkshrc for Android +# +# Support: https://launchpad.net/mksh + +: ${HOSTNAME:=$(getprop ro.product.device)} +: ${HOSTNAME:=android} +: ${TMPDIR:=/tmp} +export HOSTNAME TMPDIR + +if (( USER_ID )); then PS1='$'; else PS1='#'; fi +PS4='[$EPOCHREALTIME] '; PS1='${| + local e=$? + + (( e )) && REPLY+="$e|" + + return $e +}$HOSTNAME:${PWD:-?} '"$PS1 " diff --git a/aaos_iasw/extra_files/vendor-partition/sh_recovery b/aaos_iasw/extra_files/vendor-partition/sh_recovery new file mode 100755 index 000000000..0ebd20914 Binary files /dev/null and b/aaos_iasw/extra_files/vendor-partition/sh_recovery differ diff --git a/aaos_iasw/extra_files/vendor-partition/toolbox_recovery b/aaos_iasw/extra_files/vendor-partition/toolbox_recovery new file mode 100755 index 000000000..5a04be67f Binary files /dev/null and b/aaos_iasw/extra_files/vendor-partition/toolbox_recovery differ diff --git a/aaos_iasw/init.rc b/aaos_iasw/init.rc new file mode 100644 index 000000000..ceca402ce --- /dev/null +++ b/aaos_iasw/init.rc @@ -0,0 +1,9 @@ +service docker_manager /vendor/bin/docker_manager + group root shell + user root + class main + setenv XDG_RUNTIME_DIR /data/vendor/docker/tmp + disabled + +on property:sys.boot_completed=1 + start docker_manager