Skip to main content

Buidlroot系统编译

电脑硬件配置

编译 Ubuntu 开发环境电脑硬件配置建议:

  • 64 位 CPU
  • Ubuntu18.04系统,不要使用 Windows 子系统 (WSL)
  • 16GB 内存
  • 80GB 空闲空间用来编译
  • 普通用户编译,不要使用 root 用户编译

电脑软件配置

安装环境包

aarch64-mix210-linux.tgz

apt-get update && \
apt-get install -y apt-utils autoconf bash-completion bc bison build-essential ccache cmake curl cpio debootstrap \
device-tree-compiler dosfstools flex git gperf gnupg libncurses5-dev libgl1-mesa-dev libxml2-utils libssl-dev locales lunzip mtools net-tools parted pkg-config pxz rsync sudo unzip vim wget zip zlib1g-dev \
crossbuild-essential-armhf crossbuild-essential-arm64 python qemu-user-static live-build gcc-arm-none-eabi python-pyelftools liblz4-tool liblz4-dev python3 gawk time texinfo expect \
uuid-dev u-boot-tools && \
apt-get autoclean

mkdir -p /opt/linux && \
chmod 777 /opt/linux && \
chown -R root:root /opt/linux

copy aarch64-mix210-linux.tgz .
tar -xvf aarch64-mix210-linux.tgz && \
cd aarch64-mix210-linux && \
chmod +x aarch64-mix210-linux.install && \
./aarch64-mix210-linux.install && \
echo 'export PATH="/opt/linux/x86-arm/aarch64-mix210-linux/bin:$PATH"' >> ~/.profile && \
. ~/.profile; \
env PATH="/opt/linux/x86-arm/aarch64-mix210-linux/bin:$PATH"
sudo dpkg-reconfigure dash && \
sudo ln -sf /bin/bash /bin/sh &&\
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O get-pip.py && \
sudo python2 get-pip.py &&\
sudo pip2 install pycryptodome

SDK获取

创建 SDK 工作目录

mkdir neardi-hi3516-dv500-linux-5.10

cd neardi-hi3516-dv500-linux-5.10

git reset --hard

编译 SDK

环境依赖 docker 18.04

sudo apt-get install -y make libc6-i386 lib32z1 lib32stdc++6 libncurses5-devncurses-term libncursesw5-dev g++ u-boot-tools texinfo gawk libssl-dev opensslbc p7zip-full gperf bison flex diffutils git unzip libffi-dev libtool libfreetype6fakeroot autopoint po4a zlib1g-dev liblzo2-dev uuid-dev pkg-config automake texlive
sudo apt install -y libc6-i386 libncursesw5-dev lib32z1 lib32stdc++6 ncurses-term libncursesw5-dev libffi-dev libtool autopoint po4a p7zip-full texlive liblzo2-dev python3-pip && pip3 install pyelftools pycryptodome
cd /mnt/data/sundongya/3519/linux/gcc-20231123-aarch64-v01c01-linux-musl

sudo ./install_gcc_toolchain.sh && source /etc/profile

编译

LKD3516DV500 和 LKD3519DV500 共用同一份 SDK,因此在编译时需配置对应型号

1. buildroot 选择

cd Hi3519DV500_SDK_V1.0.1.1/open_source/buildroot/buildroot-2022.02.11
sudo make menuconfig
System configuration --->
(neardi/rootfs/hi3519dv500/overlay/) Root filesystem overlay directories # 此处改为neardi/rootfs/hi3519dv500/overlay/

保存退出

2. 切换分支

执行以下命令查看分支:

git branch -a

执行以下命令切换分支:

git checkout 3519

3. 修改 DDR 大小

cd SDK/smp/a55_linux/source/bsp

vi Makefile

ifeq ($(CHIP),hi3519dv500)
#REGBIN_XLSM ?=Hi3519DV500-DMEBPLUS_6L_T_LPDDR4X_2933M-2GB_32bit-A55_1G.xlsm
REGBIN_XLSM ?=Hi3519DV500-DMEBPLUS_6L_T_LPDDR4X_2933M-1GB_32bit-A55_1G.xlsm
else ifeq ($(CHIP),hi3516dv500)
REGBIN_XLSM ?=Hi3516DV500-DMEBPLUS_6L_T_LPDDR4X_2400M-1GB_32bit-A55_850M.xlsm
else
$(error you must set valid CHIP: hi3519dv500 | hi3516dv500)
endif

DDR文件位于:SDK/smp/a55_linux/source/bsp/tools/pc/boot_tools/*

4. 编译

cd smp/a55_linux/source/bsp/

# 整体编译:
make all

# 单独编译 uboot:
make gslboot_build

# 单独编译 kernel:
make kernel

# 单独编译 rootfs:
# a.编译 busybox
make rootfs

# b.编译 buildroot:
cd open_source/buildroot/buildroot-2022.02.11/
sudo make -j 99

# 编译 sample
cd ./smp/a55_linux/source/mpp/sample
make -j 99

具体见 sdk/readme_en.txt