====== VIM Yocto SDK developer guide ======
===== Introduction =====
This documentation will guide you to build Yocto images for ''VIM4/3/3L/1S''.
===== Preparation =====
Install essential dependencies. **It is recommended to use Ubuntu 20.04/22.04 for compilation**, or you can choose to [[#build-in-docker | Build in Docker]].
```shell
sudo apt update && sudo apt install git ssh make gcc libssl-dev \
liblz4-tool expect expect-dev g++ patchelf chrpath gawk texinfo chrpath \
diffstat binfmt-support qemu-user-static live-build bison flex fakeroot \
cmake gcc-multilib g++-multilib unzip device-tree-compiler ncurses-dev \
libgucharmap-2-90-dev bzip2 expat gpgv2 cpp-aarch64-linux-gnu libgmp-dev \
libmpc-dev bc python-is-python3 python2 libstdc++-12-dev xz-utils repo
```
===== Get SDK =====
1. Download the base SDK packages here: [[https://dl.khadas.com/development/yocto/khadas_vims_yocto_sdk_base/ | khadas_vims_yocto_sdk_base.tar.gz0x]]
You need to download all 3 compressed files:
* khadas_vims_yocto_sdk_base.tar.gz00
* khadas_vims_yocto_sdk_base.tar.gz01
* khadas_vims_yocto_sdk_base.tar.gz02
You can also download the [[dl>development/yocto/khadas_vims_yocto_sdk_base/md5sum/ | md5 checksum]] to verify the downloaded files:
```shell
$ md5sum -c md5sum/*
khadas_vims_yocto_sdk_base.tar.gz00: OK
khadas_vims_yocto_sdk_base.tar.gz01: OK
khadas_vims_yocto_sdk_base.tar.gz02: OK
```
2. Create and enter the working directory:
```shell
$ mkdir -p ~/project/vims-yocto-sdk && cd ~/project/vims-yocto-sdk
```
3. Decompress base SDK:
```shell
$ cat path/to/sdk-base-packages/khadas_vims_yocto_sdk_base.tar.gz* | tar -zxv -C ~/project/vims-yocto-sdk
```
4. Then you can see ''.repo'' derctory in ''~/project/vims-yocto-sdk'' directory by using ''ls -la'' command.
```shell
$ ls -al ~/project/vims-yocto-sdk
total 12
drwxrwxr-x 3 nick nick 4096 Dec 31 14:40 .
drwxrwxr-x 3 nick nick 4096 Dec 31 14:39 ..
drwxrwxr-x 7 nick nick 4096 Dec 30 16:21 .repo
```
5. Sync and update code:
```shell
$ .repo/repo/repo sync -l
$ .repo/repo/repo sync -c
$ ls
aml-comp aml-patches meta-aml-cfg meta-gplv2 meta-meson meta-openembedded meta-python2 meta-qt5 meta-security meta-selinux poky
```
6. Create a work branch for each repository:
```shell
$ .repo/repo/repo start khadas --all
```
===== Compile =====
==== Setup the Compile Configuration ====
You should setup the compile configuration before compilation.
```shell
$ cd
$ source meta-meson/aml-setenv.sh
You're building on Linux
Lunch menu...pick a combo:
1. mesong12b-kvim3-k5.15
2. mesongsm1-kvim3l-k5.15
3. mesons4-kvim1s-5.15
4. mesont7c-kvim4-5.15
Which would you like? [2]
```
* ''mesong12b-kvim3-k5.15'' - Configuration for ''VIM3''
* ''mesongsm1-kvim3l-k5.15'' - Configuration for ''VIM3L''
* ''mesons4-kvim1s-5.15'' - Configuration for ''VIM1S''
* ''mesont7c-kvim4-5.15'' - Configuration for ''VIM4''
Build:
```shell
$ bitbake amlogic-yocto
```
The image located in ''SDK/build/tmp/deploy/images/CONFIGURATION/vimx-yocto-xxxxxx.img''.
The CONFIGURATION should be:
* ''mesong12b-kvim3-k5.15''
* ''mesongsm1-kvim3l-k5.15''
* ''mesons4-kvim1s-5.15''
* ''mesont7c-kvim4-5.15''
===== Build in Docker =====
You can also choose to build the OS image in a Docker container.
==== Install Docker ====
Please refer to [[https://docs.docker.com/engine/install/|Docker Documentation]].
==== Add User to a Docker Group ====
```shell
$ sudo usermod -aG docker $USER
```
You need to logout or reboot the system to take effect.
==== Build SDK in Docker ====
Get Docker image:
```shell
$ docker pull wesion/yocto-amlogic
```
Enter Docker:
```shell
$ cd ~/project/vims-yocto-sdk
$ docker run --rm -it -u $(id -u):$(id -g) -v /opt:/opt -v $(pwd):/home/khadas/yocto wesion/yocto-amlogic bash
```
Start your build from inside the Docker container.
```shell
khadas@0126a0629f9a:~/yocto$ source meta-meson/aml-setenv.sh
khadas@0126a0629f9a:~/yocto$ bitbake amlogic-yocto
```
===== Install the Yocto image =====
Please refer to:
* [[products:sbc:vim4:install-os:install-os-into-emmc-via-usb-tool|]]
* [[products:sbc:vim3:install-os:install-os-into-emmc-via-usb-tool|]]
* [[products:sbc:vim1s:install-os:install-os-into-emmc-via-usb-tool|]]