跳到主要内容

Ubuntu系统编译

电脑硬件配置

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

  • 64 位 CPU
  • Ubuntu18.04系统,不要使用 Windows 子系统 (WSL)
  • 16GB 内存
  • 250GB 空闲空间用来编译
  • 普通用户编译,不要使用 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 hi3403_linux4.19
cd hi3403_linux4.19

初始化并同步 SDK

repo init --no-clone-bundle \
--repo-url=http://git.neardi.com/repo-release/tools/repo.git \
--repo-rev=master \
-u http://git.neardi.com/hisilicon/manifests.git \
-b hi3403 \
-m neardi_3403_linux4.19_release.xml

然后执行以下命令同步完整的 SDK:

.repo/repo/repo sync

编译 SDK

选择配置

default ddr:4G

Modifying ddr size:
++/osdrv/Makefile
ifeq ($(BOOT_MEDIA), emmc)
MEDIUM_FLAG = _emmc_
ifeq ($(CHIP),ss928v100)
-REGBIN_XLSM ?= SS928V100_demo_8L_LPDDR4x_3733M-4GB_32bitx2-A55_1400M-emmc.xlsm
+REGBIN_XLSM ?= SS928V100_demo_8L_LPDDR4x_3733M-8GB_32bitx2-A55_1400M-emmc.xlsm
endif

全自动编译

osdrv 顶层 Makefile 使用说明 注意:1.由于Makefile中文件系统编译依赖组件较多,不能保证单独编译的文件系统可用,建议采用make all编译

cd osdrv
make all

具体见 osdrv/readme_cn.txt

编译Ubuntu 22.04

注:

cd ../open_source/linux/linux-4.19.y/
make ARCH=arm64 CROSS_COMPILE=aarch64-mix210-linux- modules -j 8
cd ../../../ubuntu
./mk-rootfs.sh jammy

fastboot、kernel、rootfs文件位置

fastboot:/SDK/osdrv/pub/ss928v100_emmc_image_glibc/boot_image.bin
kernel:/SDK/osdrv/pub/ss928v100_emmc_image_glibc/uImage_ss928v100
rootfs:/SDK/ubuntu/ubuntu-base-jammy.img