20180605_jeffrey - silenceuncrio/diary GitHub Wiki

0905

review

繼續完善 Ubuntu 上的開發環境

安裝 git

安裝 curl

安裝 zsh

sudo apt install zsh

安裝 Oh My Zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

tmux

sudo apt install tmux

安裝 Docker CE

0945

先準備 M360 的開發環境

跟 GitLab 連線的前置作業

產生 ssh 連線所需的 key

➜  ~ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jeffrey/.ssh/id_rsa):
Created directory '/home/jeffrey/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jeffrey/.ssh/id_rsa.
Your public key has been saved in /home/jeffrey/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:paWMUdreqVHqk4cOviCCc4TMelgbKDMx6BqSbJZPYVg jeffrey@jbox
The key's randomart image is:
+---[RSA 2048]----+
|   E    .        |
|. o    +         |
|+. o  o . +      |
|=*o .  = O .     |
|XO+.  . S o      |
|OBoo   . =       |
|B =.. . * .      |
| = . o o o       |
|      o..        |
+----[SHA256]-----+

cat 剛剛產生的 key 然後加入 GitLab

➜  ~ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDG64BpZbo7p6HFcSl2hngs4LXDan+dDRaUwc2y4p2aR/FbI0YaONlccMPQwqrGIn+doPOmcwckb1+jal6mhMLx/KXpcAYa3q3y2KaYV764GByj9KpLHnyksDuFYgMbCJqu4aV5Pcn7ZELfWkvI9ipslGYEtTuUv5/vZLTCyRC4oEYvMRb+d67aCIOgOPBW4j2Mrm392P1WxumjYU+GV2SUWGMInODaFLRDx2mWLpd76gK3mEkN77+XAORcERuYH1l6W50HXN5T7e4UaRn18j57vVMt5EL9C/D3v136pBd2Rh5U8RRAnNBnG7oWoF1f+7BNd7wOT3oiFU4BFzUvreZp jeffrey@jbox

git clone build-m360.git 並從 Dockerfile 來產生 m360 所需的編譯環境

git clone [email protected]:RD/build-m360.git
cd build-m360
docker build -t build-m360 .

這個步驟需要一些時間

1010

image build 好囉

➜  build-m360 git:(master) docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
build-m360          latest              580d1d087c4f        35 seconds ago      464MB
ubuntu              14.04               8cef1fa16c77        5 weeks ago         223MB
hello-world         latest              e38bc07ac18e        7 weeks ago         1.85kB

git clone M360P 的 source code

記得 checkout develop branch

Create the container based on build-m360 images which named build-m360.

cd <your m360 source>

docker run --name build-m360 \
           -e LOCAL_USER_ID=`id -u $USER` \
           -v `pwd`:/home/user \
           -it --restart=always -d build-m360 /bin/bash

可以看到 run 起來的 container

➜  M360P git:(develop) docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
10972b0a698a        build-m360          "/entrypoint.sh /bin…"   9 seconds ago       Up 8 seconds                            build-m360

Enter the container shell (Normal used)

docker exec -it -u user build-m360 /bin/bash

可以 build code 囉

1100

M360 外層的 compile 耗時如下

 ...
 make[3] -C target/linux install
 make[2] package/index
 make[2] target/install
 make[3] -C target/linux install
 make[2] package/index

real    34m26.526s
user    72m39.007s
sys     18m16.580s
user@10972b0a698a:~$

內層 proscend 耗時如下

real    1m4.784s
user    0m47.437s
sys     0m16.066s
user@10972b0a698a:~/proscend$

1110

VMware 上的 Ubuntu 要能讓 window 編輯 source code

ubuntu 上裝 samba 是最方便的方式

sudo apt install samba

修改 Samba 設定 - /etc/samba/smb.conf

...
[jbox]
path = /home/jeffrey
writable = yes
guest account = jeffrey
force user = jeffrey
public = yes
force group = jeffrey
browseable = yes

create mask = 0664
directory mask = 0775

重新啟動 samba

sudo service smbd restart
sudo service nmbd restart

window 10 便可利用連線網路磁碟機的方式來編輯 M360P 的 source code

安裝 source insight

1145

又可以工作囉

commit cb838f12865f4751ca94cdeba1e229969affae88
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Tue Jun 5 11:44:38 2018 +0800

    add 'PCI ID' field at 'Engineer Info' web page

 proscend/prosrc/webcgi/lte.c                  | 13 +++++++------
 proscend/prosrc/www/app/feature/eng_info.html |  7 +++++++
 proscend/prosrc/www/app/locale-en.json        |  1 +
 proscend/prosrc/www/app/locale-fr.json        |  1 +
 proscend/prosrc/www/app/locale-zh-tw.json     |  1 +
 5 files changed, 17 insertions(+), 6 deletions(-)

1300

改準備 M300 的開發環境

git clone build-m300.git 並從 Dockerfile 來產生 m300 所需的編譯環境

git clone git clone [email protected]:RD/build-m300.git
cd build-m300
docker build -t build-m300 .

這個步驟一樣也是需要一些時間

1435

的確花了一些時間

...
Successfully built 765ca8470286
Successfully tagged build-m300:latest
docker build -t build-m300 .  0.67s user 0.82s system 0% cpu 1:30:47.58 total

git clone M300 的 source code

git clone [email protected]:RD/M300.git

記得 checkout develop branch

➜  ~ git clone [email protected]:RD/M300.git
Cloning into 'M300'...
remote: Counting objects: 39304, done.
remote: Compressing objects: 100% (127/127), done.
remote: Total 39304 (delta 101), reused 79 (delta 46)
Receiving objects: 100% (39304/39304), 177.29 MiB | 10.70 MiB/s, done.
Resolving deltas: 100% (26643/26643), done.
Checking connectivity... done.
➜  ~ cd M300
➜  M300 git:(master) git checkout develop
Branch develop set up to track remote branch develop from origin.
Switched to a new branch 'develop'
➜  M300 git:(develop) git pull
Already up-to-date.
➜  M300 git:(develop)

Create the container based on build-m300 images which named build-m300.

cd <your m300 source>

docker run --name build-m300 \
           -e LOCAL_USER_ID=`id -u $USER` \
           -v `pwd`:/home/user \
           -it --restart=always -d build-m300 /bin/bash

可以看到 run 起來的 container

➜  M300 git:(develop) docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
be6d814a16da        build-m300          "/entrypoint.sh /bin…"   32 seconds ago      Up 31 seconds                           build-m300
10972b0a698a        build-m360          "/entrypoint.sh /bin…"   4 hours ago         Up 4 hours                              build-m360
➜  M300 git:(develop)

Enter the container shell (Normal used)

docker exec -it -u user build-m300 /bin/bash

來 build code 吧

M300 第一次的 compile 要很久

1725

compile 完成

real    159m0.805s
user    221m14.149s
sys     204m3.654s
user@be6d814a16da:~/build_small$

趕緊試一下平常對於 proscend 的修改要耗時多久

real    10m45.589s
user    3m49.648s
sys     6m15.568s
user@be6d814a16da:~/build_small$

1805

再 try 一次

real    10m24.348s
user    3m46.790s
sys     6m8.824s