JunningWu / Learning-NVDLA-Notes

NVDLA is an Open source DL/ML accelerator, which is very suitable for individuals or college students. This is the NOTES when I learn and try. Hope THIS PAGE may Helps you a bit. Contact Me:junning.wu@ia.ac.cn
220 stars 66 forks source link

Building KMD and UMD for NVDLA on AArch64 #7

Closed JunningWu closed 6 years ago

JunningWu commented 6 years ago

目前公开的KMD是针对AArch64架构处理器的,使用的Linux Kernel是4.13.3。针对DMA传输,使用的协议是DRM和GEM PRIME。

在进行KMD编译的时候,需要准备好Linux Kernel源码和交叉编译器。在这里就是 交叉编译器:https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/gcc-linaro-7.2.1-2017.11-i686_aarch64-linux-gnu.tar.xz Linux Kernel源码:4.13.3

Compile Linux Kernel for arm64

cp arch/arm64/configs/defconfig .config

make ARCH=arm64 CROSS_COMPILE=~/Downloads/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- oldconfig

make ARCH=arm64 CROSS_COMPILE=~/Downloads/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- -k

在kmd目录下,编译KMD的命令如下:

make KDIR=<path_to_Linux_source> ARCH=arm64 CROSS_COMPILE=<path_to_toolchain>

示例:

make KDIR=your path/linux-4.13.3 ARCH=arm64 CROSS_COMPILE=your path/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/

编译之后,将会得到kmd/port/linux/opendla.ko文件

而编译UMD就方便很多,命令如下:

export TOP=<path_to_umd>
export TOOL_CHAIN_PREFIX=$(CROSS_COMPILE)/aarch64-linux-gnu-
make

编译之后,将会得到umd/out/runtime/nvdla_runtime/nvdla_runtime和umd/out/runtime/libnvdla_runtime/libnvdla_runtime.so。

当进行NV_SMALL编译的时候,需要在脚本中添加CFLAG_MODULE='-DDLA_SMALL_CONFIG'的选项.