使用 Buildroot SDK
交叉编译
提示
这里的交叉编译是指在 X86 的 PC 上编译 Jupiter 的固件。
开发环境
硬件配置
推荐配置:
- CPU:12th Gen Intel(R) Core(TM) i5 或以上
- Memory:16GB 或以上
- Disk:SSD,256GB 或以上
操作系统
推荐 Ubuntu 20.04,其他 Linux 发行版本尚未测试。
安装依赖
-
Ubuntu 16.04 and 18.04
sudo apt-get install git build-essential cpio unzip rsync file bc wget python3 libncurses5-dev libssl-dev dosfstools mtools u-boot-tools flex bison python3-pip zip
sudo pip3 install pyyaml
-
Ubuntu 20.04
sudo apt-get install git build-essential cpio unzip rsync file bc wget python3 python-is-python3 libncurses5-dev libssl-dev dosfstools mtools u-boot-tools flex bison python3-pip zip
sudo pip3 install pyyaml
下载源码
使用 repo(版本 >= 2.41)下载完整SDK。如果没有 repo,请参考 Git Repo 镜像使用帮助 安装。
使用 repo 前请检查 git 环境是否配置了 user 信息,如果没有配置,可以参考如下命令配置:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
创建并进入工作目录:
mkdir jupiter-linux
cd jupiter-linux
下载代码,例如下载 k1-bl-v2.1.y
分支:
repo init -u https://github.com/milkv-jupiter/manifests.git -b main -m k1-bl-v2.1.y.xml
repo sync
repo start k1-bl-v2.1.y --all
后续需要同步最新的代码时,直接执行 repo sync
即可。
Buildroot 在编译过程中,会下载一些源码包,为避免因网络原因出现下载失败的情况,可以使用如下命令提前从 spacemit 服务器下载所需的源码包:
wget -c -r -nv -np -nH -R "index.html*" http://archive.spacemit.com/buildroot/dl
下载的源码包在 buildroot/dl
目录中。
目录结构:
├── bsp-src # Linux kernel,uboot and opensbi source code
│ ├── linux-6.6
│ ├── opensbi
│ └── uboot-2022.10
├── buildroot # Buildroot main directory
│ ├── dl # Buildroot dependent packages
├── buildroot-ext # Customized ext, such as board, configs, package, and patches
├── Makefile # Top Makefile
├── package-src # Locally deployed application or library source directory
│ ├── ai-support
│ ├── drm-test
│ ├── factorytest
│ ├── glmark2
│ ├── img-gpu-powervr
│ ├── jetson-utils
│ ├── k1x-cam
│ ├── k1x-jpu