2023年10月27日 星期五

ASUS Tinker Board 2S - Build Android 11- 4

 ASUS Tinker Board 2S - 4

https://snoopymemory.blogspot.com/2023/10/asus-tinker-board-2s-1.html

https://snoopymemory.blogspot.com/2023/10/asus-tinker-board-2s-2.html

https://snoopymemory.blogspot.com/2023/10/asus-tinker-board-2s-3.html


Build Android

$ ./docker_builder/docker-builder-run.sh

$ source build/envsetup.sh

$ lunch WW_Tinker_Board_2-userdebug

$ ./build.sh -UCKAu

-U 編譯 uboot

-A 編譯 Android

-K 編譯 Kernel

-u 編譯update.img

  

-   如果您有修改/Packages 下之內容, 可以直接把 /out 目錄刪除,這樣才會重新編譯

-  在$ lunch WW_Tinker_Board_2-userdebug 這一步驟

    如果只輸入 $ lunch 

    會列出所有可以編譯的環境版本

    5.  $ lunch WW_Tinker_Board_2-user

        這版本可以編譯成功, 但無法正確開機

    6. $ lunch WW_Tinker_Board_2-userdebug

        這版本可以編譯成功, 也可以正確開機


   關於lunch之解說

     https://www.sunofbeach.net/a/1464572420835794946


-   Build Image file 放在這邊

   /rockdev/Image-WW_Tinker_Board_2/WW_Tinker_Board_2-raw.img

  然後使用 balenaEtcher 工具燒錄到 SD Card 中


   echo "USAGE: [-U] [-CK] [-A] [-p] [-o] [-u] [-v VERSION_NAME] [-n BUILD_NUMBER]"

    echo "No ARGS means use default build option                  "

    echo "WHERE: -U = build uboot                                 "

    echo "       -C = build kernel with Clang                     "

    echo "       -K = build kernel                                "

    echo "       -A = build android                               "

    echo "       -p = will build packaging in IMAGE      "

    echo "       -o = build OTA package                           "

    echo "       -u = build update.img                            "

    echo "       -v = build android with 'user' or 'userdebug'    "

    echo "       -n = set build number    "

    echo "       -r = pack the release    "

    echo "       -d = huild kernel dts name    "

    echo "       -V = build version    "

    echo "       -J = build jobs    "



ASUS Tinker Board 2S - Build Android 11- 3

 ASUS Tinker Board 2S - 3


// Android ASOP 下載源代碼

 https://source.android.com/setup/build/downloading?hl=zh-tw


下載 ASUS Tinker Board 2S Android source 官方公告的最後一個版本

(https://github.com/TinkerBoard/TinkerBoard/wiki/Developer-Guide)

(https://github.com/TinkerBoard/rockchip-linux-manifest/blob/main/README.md)

(https://github.com/TinkerBoard-Android/rockchip-android-manifest)

(Define Last Version: android11-rockchip)

$ mkdir TinkerBoard2sAndroid11latest

$ cd TinkerBoard2sAndroid11latest

$ repo init -u https://github.com/TinkerBoard-Android/rockchip-android-manifest.git -b android11-rockchip

如果下面這行出現錯誤

   > warning: Python 3 support is currently experimental. YMMV.

   > Please use Python 2.6 - 2.7 instead.

則改用 python3指令

  $ python3 ~/bin/repo init -u https://github.com/TinkerBoard-Android/rockchip-android-manifest.git -b android11-rockchip

如沒有錯誤, 則開始下載檔案

 $ repo sync

 或 

 $ python3 ~/bin/repo sync


如果下載中斷, 要全部刪除

 cd TinkerBoard2sAndroid11201

  刪除 /TinkerBoard2sAndroid11201/.repo

 $ rm -r /home/XXX/.repo

 重新下 repo init...等指令

 

或 下載 ASUS Tinker Board 2S Android source 官方公告的android11-2.0.1

(https://github.com/TinkerBoard2-Android/manifest/tree/android11-rk3399)

$ mkdir TinkerBoard2sAndroid11201

$ cd TinkerBoard2sAndroid11201

 $ repo init -u https://github.com/TinkerBoard2-Android/manifest.git -b android11-rk3399 -m tinker_board_2-android11-2.0.1.xml



如果下面這行出現錯誤

  > warning: Python 3 support is currently experimental. YMMV.

  > Please use Python 2.6 - 2.7 instead.

則改用 python3指令

 $ python3 ~/bin/repo init -u https://github.com/TinkerBoard2-Android/manifest.git -b android11-rk3399 -m tinker_board_2-android11-2.0.1.xml


如沒有錯誤, 則開始下載檔案

 $ repo sync

 或 

 $ python3 ~/bin/repo sync

ASUS Tinker Board 2S - Build Android 11- 2

 ASUS Tinker Board 2S - 2


https://github.com/TinkerBoard/TinkerBoard/wiki

https://github.com/TinkerBoard

https://github.com/TinkerBoard2


1. Ubuntu 編譯環境

原廠建議使用Ubuntu16.04 64位元或Ubuntu18.04 64位元系統, 

或 windows subsystem for linux,

我個人是在 Ubuntu 18中測試,

建議先重新安裝一套系統,

如果和舊系統中試, 有些真的會心理崩潰

硬碟空間要大一些, 因為最後編譯出來的檔案都很大

如果幾個版本都試, 很快就出現空間不足

(一個版本約230-250GB 之間)


2. 

$ sudo apt-get install openjdk-8-jdk

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install p7zip-full

$ sudo apt-get install gawk

$ sudo apt-get install liblz4-tool

$ sudo snap install curl

$ curl --version

 // Ubuntu 18

 $ sudo apt-get install git gnupg flex bison gperf libsdl1.2-dev \

libesd-java libwxgtk3.0-dev squashfs-tools build-essential zip curl \

libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils \

xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev \

lib32readline-dev gcc-multilib libswitch-perl libssl-dev unzip zip

 

 // Ubuntu 20

 $ sudo apt-get install git gnupg flex bison gperf libsdl1.2-dev \

libesd-java libwxgtk3.0-gtk3-dev squashfs-tools build-essential zip curl \

libncurses-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils \

xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses-dev \

lib32readline-dev gcc-multilib libswitch-perl libssl-dev unzip zip



$ sudo apt-get install git

$ git version

$ sudo apt install software-properties-common

$ sudo add-apt-repository ppa:deadsnakes/ppa


3.

$ sudo apt-get install python (這會安裝2.7.17)

$ python --version

$ python

 => exit()

$ mkdir ~/bin

$ PATH=~/bin:$PATH

 

 下面是出問題時的參考

  $ sudo apt update

  python 3.8 的安裝方法

  $ sudo apt update

  $ sudo apt install python3.8

  $ python --version  

  (如果是2.x 後面的repo會有問題, python3.8指定為python)

   $ sudo rm -rf /usr/bin/python

   $ sudo ln -s /usr/bin/python3.8 /usr/bin/python

   $ python --version

4.

 git config --global user.name XXXX

 git config --global user.email XXXX@example.com


5. 安裝 Android 源代碼管理工具

// https://source.android.com/setup/develop?hl=zh-tw

// https://source.android.com/setup/develop?hl=zh-tw#installing-repo

$ sudo apt-get update

$ sudo apt-get install repo

$ cd Home/xxx user dir

$ mkdir bin

$ export REPO=$(mktemp /tmp/repo.XXXXXXXXX)

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

$ gpg --keyserver keyserver.escomposlinux.org --recv-key 8BB9AD793E8E6153AF0F9A4416530D5E920F5C65

$ curl -s https://storage.googleapis.com/git-repo-downloads/repo.asc | gpg --verify - ${REPO} && install -m 755 ${REPO} ~/bin/repo

$ repo version


  > File "/home/jun/.repo/repo/main.py", line 94

  >   )

  >   ^

  > SyntaxError: invalid syntax

  $ python --version

    Python 2.7.17

  $ python3 --version

    Python 3.6.9

  $ cd /usr/bin

  $ sudo rm python

  $ sudo ln -s /usr/bin/python3 /usr/bin/python

  $ repo version

  

5. 安裝Docker

// https://github.com/TinkerBoard/TinkerBoard/wiki/Developer-Guide

 Kernel 4.19

  Install Docker environment

   Install Docker Engine – Community


$ sudo apt-get remove docker docker-engine docker.io containerd runc

$ sudo apt update

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common


$ sudo apt-get update

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

$ sudo apt-key fingerprint 0EBFCD88

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

$ sudo apt-get update

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

$ sudo docker run hello-world


ASUS Tinker Board 2S - Build Android 11-1

 ASUS Tinker Board 2S - 1


 因為工作關係, 開始研究這一片板子

 坦白說 華碩對這方面的技術支援並不多

 至少要有一個 TFAE吧. 

 只是把板子做出來後面就不理了

 這樣怎會賣的好, 也許是只想賣賣教育市場就夠了.

 台灣也有另一家用這顆cpu生產出板子

 但其保守的作法也另我有些傻眼

 簡單的說"得一切靠自己"

 

下面是一些重要的網址

 https://tinker-board.asus.com/tw/series/tinker-board-2s.html

 https://tinker-board.asus.com/tw/download-list.html?product=tinker-board-2s

 https://robotkingdom.com.tw/


Open souce on GitHub

 https://github.com/TinkerBoard

 https://github.com/TinkerBoard2


Developer Guide

 https://github.com/TinkerBoard/TinkerBoard/wiki/Developer-Guide

 https://github.com/TinkerBoard/TinkerBoard/wiki

風火輪 Wiki 

 https://wiki.youyeetoo.cn/tinker/page/Compiling_And_Burning/Compilation_Environment

論壇

 https://tinker-board.asus.com/forum/index.php?/forum/21-tinker-board-2-series/

 https://youyeetoo.cn/forum-65-1.html

 https://www.tinkerboard.cn/forum.php?mod=forumdisplay&fid=39


2023年10月18日 星期三

Mac OS XCode 15 "Command PhaseScriptExecution failed with a nonzero exit code"

因為舊的Mac mini 變的超級慢, 也無法安裝XCode 15, 上傳到 Apple Store.

只好購買一台新的Mac mini (Apple M2)

使用輔助移轉工具把就電腦全部移轉到新電腦

重新安裝 XCode 15

但編譯專案後出現錯誤 "Command PhaseScriptExecution failed with a nonzero exit code"

另一個方法重新安裝 XCode 15.1


解決方法:

https://developer.apple.com/forums/thread/727525

開啟 XCode->Setings->Locations

   把 Deriver Data和 Archive 這2個目錄下所有檔案都刪除

開啟終端機

sudo security lock-keychain ~/Library/Keychains/login.keychain-db

sudo security unlock-keychain ~/Library/Keychains/login.keychain-db

rm -rf ~/Library/Developer/Xcode/DerivedData/

rm -rf ~/Library/Caches/CocoaPods/

sudo gem uninstall cocoapods --all

sudo gem install cocoapods

sudo gem install cocoapods-deintegrate cocoapods-clean

pod deintegrate

pod update

pod clean

到專案podfile目錄中

pod install

pod update

重新下載XCode 15.1

用XCode 開啟專案的 xxx.xcwork.space

重新編譯