If you are first time using, you can refer to this document for a complete system use guide.
This repository contains the source code for building MaixCam2, KVM Pro etc. basic system images.
This repository requires the submodules maix_ax620e_sdk_msp and maix_ax620e_sdk_kernel to be cloned before compiling.
Note: Currently only tested to compile successfully on
Ubuntu22.04
git clone https://github.com/sipeed/maix_ax620e_sdk
git submodule update --init --recursive- Download toolchain
# Download and extract
wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
sudo tar -xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz -C /opt
# Configure environment variables
echo 'export PATH=/opt/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin:${PATH}' >> ~/.bashrc
source ~/.bashrcAlternative toolchain download method: Download the gcc9.2-2019.12 toolchain from here
- Test toolchain
aarch64-none-linux-gnu-gcc --version
which aarch64-none-linux-gnu-gcc- Install necessary software
sudo dpkg-reconfigure dash # Then choose No
sudo apt install make libc6:i386 lib32stdc++6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools texinfo texlive gawk libssl-dev openssl bc bison flex gcc libgcc1 gdb build-essential lib32z1 u-boot-tools device-tree-compiler qemu qemu-user-static fusefat patchelf libpcre3
sudo python3 -m pip install --upgrade pip
sudo pip3 install lxml axp-tools pyelftools- Build ubuntu rootfs
# If the rootfs source code has not been modified, you only need to build once
cd rootfs/arm64/glibc/ubuntu_rootfs/
# For MaixCAM2
./mk_ubuntu_base_sipeed.sh .
# For KVM Pro
./mk_ubuntu_kvm_sipeed.sh .- Build System Image
Note: If you encounter a missing symbol error during the first compilation, try to recompile. This may be because some dependencies are generated during the compilation process. Or you can add the
-j1option to avoid multi-threaded compilation when compiling.
# export use_ubuntu_rootfs=no # For MaixCAM2 and KVM project, the default is yes
cd build
# For MaixCAM2
make p=AX630C_emmc_arm64_k419_sipeed_maixcam2 clean all install axp -j8
# For KVM Pro
make p=AX630C_emmc_arm64_k419_sipeed_nanokvm clean all install axp -j8- In
build/outdirectory, you will find theaxpformat package.
If you need to add or remove rootfs packages during development, you can modify the packaging script for the corresponding platform.
The path of the packaging script:
| Platform | Packaging script path |
|---|---|
| MaixCAM2 | rootfs/arm64/glibc/ubuntu_rootfs/mk_ubuntu_base_sipeed.sh |
| KVM Pro | rootfs/arm64/glibc/ubuntu_rootfs/mk_ubuntu_kvm_sipeed.sh |
Modification method reference:
- If you need to install the
i2c-toolsutility, addapt install -y i2c-toolsnear theapt installsection in the script. - If you need to install the Python package
pyaudio, addpip install pyaudionear thepip installsection in the script, or addtomlto therootfs/arm64/glibc/ubuntu_rootfs/requirements.txtfile. For KVM Pro, the configuration file iskvm_requirements.txt.
Read the packaging script code, you can customize the rootfs more freely by modifying the packaging script.
Note: If you modify the rootfs and add too many files, you need to modify
build/projects/xxxx/partition_ab.makto ensureROOTFS_PARTITION_SIZEis large enough, otherwise the packaging will be wrong.
This step is based on the already packaged rootfs to customize files, which can reduce the time required to modify rootfs every time.
| Platform | Project Directory |
|---|---|
| MaixCAM2 | build/projects/AX630C_emmc_arm64_k419_sipeed_maixcam2 |
| KVM Pro | build/projects/AX630C_emmc_arm64_k419_sipeed_nanokvm |
In the project directory, modify bootfs.filelist to specify the content of /boot to be updated, modify rootfs.filelist to specify the content of / to be updated.
Examples: If you want to add new files to /opt, just add the new files to rootfs/opt.
Download AXDL
Download AXDL Driver, extract and run DriverSetup.exe to install the driver.
By default, the build process generates an axp file, which is usually output to build/out/xxx.axp.
- The axp file can be directly flashed to EMMC using the official
AXDLtool (this method always works).
- Insert the SD card.
- Format the SD card and create an MBR partition table (it must be MBR).
- Create partition 1 as
fat32with 128 MB allocated. - Create partition 2 as
ext4, allocating all remaining space. Note: the partition order must not be changed. - Copy all contents of
build/out/AX630C_emmc_arm64_k419_sipeed_maixcam2/images/sd_boot_packto partition 1. - Copy
build/out/AX630C_emmc_arm64_k419_sipeed_maixcam2/images/spl_AX630C_emmc_arm64_k419_sipeed_maixcam2_sd_signed.binto partition 1 and rename it toboot.bin. - Copy all contents of
build/out/AX630C_emmc_arm64_k419_sipeed_maixcam2/objs/ubuntu_rootfsto partition 2. - Insert the SD card, hold down boot, then press rst. The bootrom will attempt to load boot.bin from the FAT32 partition of the SD card and start it. boot.bin will then launch atf.img and uboot.bin.uboot.bin will load kernel.img and dtb.img, and boot into the Linux system. The U-Boot startup logic can be found in
boot/uboot/u-boot-2020.04/cmd/axera/sd_boot/sd_boot.c.
All code changes are marked with:
### SIPEED EDIT ###
modified content
### SIPEED EDIT END ###Pay attention to spaces. You can locate all changes by performing a global search.
Modifications related to CMM and SYSTEM memory allocation:
- Default configuration: modify the
BOARD_xxx_OS_MEM_SIZEvalue inpartition.mak/partition_ab.mak. - After flashing: modify the
maix_memory_cmm sizein/boot/configs. This value will be automatically read by U-Boot and during driver loading at boot time.