Host machine: Ubuntu 16.04,
根据I.MX_Yocto_project_User‘s_Guild
1.Set up the Repo ultility
$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
然后改写 vi .~/.bashrc,在最后一行加上:
export PATH=~/bin:$PATH
用于设置环境变量,后面可以直接调用repo命令
2.Set up Yocto project
首席配置好git信息,如果已经配置好可以忽略
$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ git config --list
然后创建一个目录imx-yocto-bsp,目录名可以自定义,这个名字是官方文档中用的
$ mkdir imx-yocto-bsp
$ cd imx-yocto-bsp
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-honister -m imx-5.15.5-1.0.0.xml
$ repo sync
这里调用repo init命令会报错,显示链接失败,报错:
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
因为前面我们用是命令:
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
用是的谷歌的源,国内被墙了。
解决方案是:
在命令后面增加:--repo-url=https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
修改后的命令为
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-honister -m imx-5.15.5-1.0.0.xml --repo-url=https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
再次调用还是报错:
Traceback (most recent call last):
File "/home/gateway/imx-yocto-bsp/.repo/repo/main.py", line 42, in <module>
from git_config import RepoConfig
File "/home/gateway/imx-yocto-bsp/.repo/repo/git_config.py", line 774
self._Set(f'superproject.{key}', value)
^
SyntaxError: invalid syntax
原因是Ubuntu默认安装的python3.5,这里需要python3.7.
运行如下命令:
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
下载3.7的安装包,
然后安装下面的依赖项
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus \
dist-upgrade build-essential libncursesw5-dev libgdbm-dev libc6-dev \
zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev
调用
sudo mkdir /usr/local/python3/
sudo cp ./Python-3.7.3.tgz /usr/local/python3/
cd /usr/local/python3/
tar -zxvf Python-3.7.3.tgz
cd Python-3.7.3
sudo ./configuration
sudo make
sudo make install
这时候再回去调用命令
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-honister -m imx-5.15.5-1.0.0.xml --repo-url=https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
不再报错。
下载完成后 内容如下:
然后执行命令:
DISTRO=fsl-imx-fb MACHINE=imx6ull14x14evk source imx-setup-release.sh -b build_dir
echo "UBOOT_CONFIG = \"emmc\"" >> conf/local.conf
上面的命令会生成build_dir目录,并且会进入到build_dir,然后执行echo命令将上述的Uboot配置写入到conf/local.conf。
执行命令,安装编译环境:
bitbake meta-toolchain
报错:
ERROR: The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:
lz4c pzstd zstd
提示这几个安装包没有,在Ubuntu16.04 下用apt-get 命令安装不了,准备换到Ubuntu20.04下再来一波