Using Buildroot SDK
Cross Compilation
Cross Compilation here refers to compiling Jupiter's firmware on an X86 PC.
Development Environment
Hardware requirements
Recommended hardware:
- CPU:12th Gen Intel(R) Core(TM) i5 or above
- Memory:16GB or above
- Disk:SSD,256GB or above
Operating System
Ubuntu 20.04 is recommended, other Linux distributions have not been tested.
Install Dependencies
-
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
Download source code
Use repo (version >= 2.41) to download the complete SDK.
Before using repo, please check whether the git environment is configured with user information. If not, you can refer to the following command to configure it:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Create and enter the working directory:
mkdir jupiter-linux
cd jupiter-linux
Download the code, for example download the bl-v1.0.y
branch:
repo init -u https://github.com/milkv-jupiter/manifests.git -b main -m bl-v1.0.y.xml
repo sync
repo start bl-v1.0.y --all
When you need to synchronize the latest code later, just execute repo sync
.
During the compilation process, Buildroot will download some source packages. To avoid download failures due to network reasons, you can use the following command to download the required source packages from the spacemit server in advance:
wget -c -r -nv -np -nH -R "index.html*" http://archive.spacemit.com/buildroot/dl
The downloaded source package is in the buildroot/dl
directory.
Directory Structure:
├── bsp-src # Linux kernel,uboot and opensbi source code
│ ├── linux-6.1
│ ├── 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
│ ├── img-gpu-powervr
│ ├── k1x-cam
│ ├── k1x-jpu
│ ├── k1x-vpu-firmware
│ ├── k1x-vpu-test
│ ├── mesa3d
│ ├── mpp
│ └── v2d-test
└── scripts # Scripts used during compilation
First full compilation
For the first compilation, it is recommended to use make envconfig
to compile completely. If buildroot-ext/configs/spacemit_k1_defconfig
is modified later, make envconfig
should be used to compile. In other cases, just use make
to compile.
make envconfig
Available configs in buildroot-ext/configs/:
1. spacemit_k1_defconfig
2. spacemit_k1_minimal_defconfig
3. spacemit_k1_plt_defconfig
4. spacemit_k1_v2_defconfig
your choice (1-4):
Enter 1
and press Enter to start compiling.
After the compilation is complete, you can see:
Images successfully packed into /build/jupiter-linux/output/k1/images/bianbu-linux-k1.zip
Generating sdcard image...................................
INFO: cmd: "mkdir -p "/build/jupiter-linux/output/k1/build/genimage.tmp"" (stderr):
INFO: cmd: "rm -rf "/build/jupiter-linux/output/k1/build/genimage.tmp"/*" (stderr):
INFO: cmd: "mkdir -p "/build/jupiter-linux/output/k1/images"" (stderr):
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition 'bootinfo' from 'factory/bootinfo_sd.bin' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition 'fsbl' (in MBR) from 'factory/FSBL.bin' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition 'env' (in MBR) from 'env.bin' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition 'opensbi' (in MBR) from 'fw_dynamic.itb' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition 'uboot' (in MBR) from 'u-boot.itb' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition 'bootfs' (in MBR) from 'bootfs.img' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition 'rootfs' (in MBR) from 'rootfs.ext4' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition '[MBR]' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition '[GPT header]' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition '[GPT array]' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): adding partition '[GPT backup]' ...
INFO: hdimage(bianbu-linux-k1-sdcard.img): writing GPT
INFO: hdimage(bianbu-linux-k1-sdcard.img): writing protective MBR
INFO: hdimage(bianbu-linux-k1-sdcard.img): writing MBR
Successfully generated at /build/jupiter-linux/output/k1/images/bianbu-linux-k1-sdcard.img
There are two images generated:
- bianbu-linux-k1.zip is suitable for the
titanflasher
tool, or you can decompress it and use fastboot to flash the device. - bianbu-linux-k1-sdcard.img is the SD card firmware. After decompression, you can use the
dd
command orbalenaEtcher
to write it to the SD card.
For detailed flashing methods, please refer to: Milk-V Jupiter Install OS Image.
The firmware default username is: root
, password is: bianbu
.
Modify configuration
If the default configuration does not meet your needs, such as you need to modify the kernel or add buildroot packages, you can modify it and recompile it by referring to the following method.
Buildroot
Call up the buildroot configuration interface:
make menuconfig
After modifying the configuration according to your needs, save the configuration. By default, it is saved to buildroot-ext/configs/spacemit_k1_defconfig
:
make savedefconfig
Linux Kernel
Call up the kernel configuration interface:
make linux-menuconfig
After modifying the configuration according to your needs, save the configuration. By default, it is saved to bsp-src/linux-6.1/arch/riscv/configs/k1_defconfig
:
make linux-update-defconfig
U-boot
Call up the u-boot configuration interface:
make uboot-menuconfig
After modifying the configuration according to requirements, save the configuration. By default, it is saved to bsp-src/uboot-2022.10/configs/k1_defconfig
:
make uboot-update-defconfig
Compile specified package
u-boot
Compile u-boot:
make uboot-rebuild