V831 芯片介绍
参考Maix-II-Dock(M2dock) 介绍 - Sipeed Wiki
全志 V831, 单核 Cortex-A7 800MHz, 64MiB 片内 DDR2 内存, 高性价比能跑 Linux 的SOC,同时支持硬件 AI 加速(0.2Tops 算力)(yolov2 45 ms ~ 60 ms),可以当成普通 Linux SOC 使用, 也可以用于边缘 AI 应用
拉取V831 SDK仓库
git clone https://github.com/lyk125/tina-V83x.git
softwinner
git clone https://github.com/amartol/tina-v83x-softwinner.git
建议使用gcc 9
sudo apt-get install gcc-9
sudo apt-get install g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 50 --slave /usr/bin/g++ g++ /usr/bin/g++-9
linux-4.9和u-boot-2018
这两个都要拉到对应位置
安装依赖
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lib32z1 lib32z1-dev lib32stdc++6 libstdc++6 -y
要下载dl压缩包并把内容放在dl目录里面
第一次制作镜像
先用source build/envsetup.sh去构造lunch
运行lunch这里我是直接选2
make -j1 V=s
进行编译第一次编译都建议j1
编译完成后用pack进行打包
遇到的问题以及解决方法
*** [tools/Makefile:137: /you/path/tina-V83x/out/v831-MaixII_Dock/staging_dir/target/stamp/.tools_install_yyyynyyynyyyyyynnnyyyyyyyyyynnyyyyyyynynyyynnyyyy] Error 2
第一次碰到这种乱码问题一头雾水,每次都会出现这种错误
解决方法:
由于开启了多个线程编译较快导致没有找到无法编译通过的根本原因,因此使用一个线程进行编译
make -j1 V=s
就能找到报错原因了
error: missing binary operator before token "(" 55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
解决方法:
使用补丁
cd tools/m4/patches
wget https://raw.githubusercontent.com/keyfour/openwrt/2722d51c5cf6a296b8ecf7ae09e46690403a6c3d/tools/m4/patches/011-fix-sigstksz.patch
#error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
解决方法:
解决编译中遇到的问题:Please port gnulib freadahead.c to your platform_please port gnulib freadahead.c to your platform! -优快云博客这是网上找到的方法但是是针对于他那个包的 不能苟同,输入以下指令即可解决问题
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
不过在那之前要先找对对应的,我们目前正在编译的包才行
先看到了stdio-impl.h关键词
我就用find . -name "stdio-impl.h"进行查找
然后就再往上翻了下
发现是在这个位置报错的
/you/path/tina-V83x/out/v831-MaixII_Dock/compile_dir/host/m4-1.4.17/lib
所以就cd 到/you/path/tina-V83x/out/v831-MaixII_Dock/compile_dir/host/m4-1.4.17去执行
cd /you/path/tina-V83x/out/v831-MaixII_Dock/compile_dir/host/m4-1.4.17
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
后续也会出现很多这个同类型问题,可以用相同方法解决
undefined reference to major
minor
解决方法:
find去查找报错的contents.c
在里面加入#include <sys/sysmacros.h>
后面遇到类似都可以这样解决
find libubi.c后直接加入头文件
elf.hpp:52:56: error: ISO C++17 does not allow dynamic exception specifications 52 | const section &get_section(unsigned int i) const throw (std::out_of_range) { return *sections.at(i); };
提示C++17不支持动态异常规格。
解决方法:
D1tina2.0编译_elf.hpp:52:56: error: iso c++17 does not allow dyn-优快云博客
按照这个
加入这行
error: conflicting types for 'u64' 31 | extension__ typedef unsigned long long __u64;
主要是因为OpenWrt 19.07 不在对其支持
解决方法:
vim out/v831-MaixII_Dock/compile_dir/host/u-boot-2018.03/include/compiler.h
出现问题findutils
freadahead.c: In function 'freadahead':
freadahead.c:92:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
92 | #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
make[9]: *** [Makefile:2225: freadahead.o] Error 1
编译某基于openwrt的sdk_gdbusmessage.c:2698:30: error: ‘%s’ directive argu-优快云博客这个文章有做不错的解释
cd findutils-4.6.0的位置写入以下代码
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h
sed -i '/unistd/a #include <sys/sysmacros.h>' gl/lib/mountlist.c
V831提供的是findutils-4.4.2的我最终解决方法就是升级了版本
如何升级findutils-4.4.2版本?
我这边提供一个新手的方式,勿喷
先去下载findutils-4.6.0,放在dl的目录下
之后改动更改对应的Makefile
vim tools/findutils/Makefile
版本改为4.6.0
再把补丁删了
rm tools/findutils/patches/21-Fix-time_t-vs-long-int-mismatches.patch
然后就可以继续编译了
ps:要是不放心补丁内容可以先备份,目前我是没出现问题
unsquashfs.c:(.text+0x25f4): undefined reference to `makedev'
解决方法:
加入#include<sys/sysmacros.h>