准备环境
ubuntu22.04主机一台
安装git,repo
sudo apt install git
sudo apt install repo
生成ssh-key
一路回车生成key
fuqiang@fuqiang-VivoBook:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/fuqiang/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/fuqiang/.ssh/id_rsa
Your public key has been saved in /home/fuqiang/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:uyjmaQFLiQWenmqqDFQ4IdxUCRel0AUy7Dt+s3as9nw fuqiang@fuqiang-VivoBook
The key's randomart image is:
+---[RSA 3072]----+
|+o+*+=*o |
|o.=o=o. |
| B.o . |
|o B. |
| = o. S |
|o .o. . |
|o.. ... . |
|= .+*.+ E |
|+. +*+Boo |
+----[SHA256]-----+
生成key的结构如下,id_ras.pub为公钥,需要上传全志的客户服务系统->资源下载->公钥管理
fuqiang@fuqiang-VivoBook:~$ tree .ssh
.ssh
├── id_rsa
├── id_rsa.pub
├── known_hosts
└── known_hosts.old
0 directories, 4 files
fuqiang@fuqiang-VivoBook:~$
注册账号
注册“全志在线开发者社区”和“全志客户服务平台”的账号,并记住这个账号
配置git
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
下载代码
下面的fooddelivery是根据我的账号自动生成的,不能直接copy使用,使用“服务平台”上面根据你的账号提供的链接
$ mkdir tina-d1-h
$ cd tina-d1-h
$ repo init -u ssh://fooddelivery@sdk.allwinnertech.com/git_repo/D1_Tina_Open/manifest.git -b master -m tina-d1-h.xml
$ repo sync
$ repo start product-smartx-d1-h-tina-stable-v2.0 --all # 全部下载完成之后,创建分支
安装依赖
sudo apt install -y gcc binutils bzip2 flex perl make python3 python-is-python3 lib32z1 gawk subversion libz-dev build-essential git-core libncurses5-dev zlig1g-dev quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lib32z1-dev lib32stdc++6 libstdc++6 libc6:i386 libstdc++6:i386
编译
fuqiang@fuqiang-VivoBook:~/workspace/tina-d1-h$ source build/envsetup.sh
Setup env done! Please run lunch next.
fuqiang@fuqiang-VivoBook:~/workspace/tina-d1-h$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. d1-h_nezha_min-tina
2. d1-h_nezha-tina
3. d1s_nezha-tina
Which would you like?: 2
============================================
TINA_BUILD_TOP=/home/fuqiang/workspace/tina-d1-h
TINA_TARGET_ARCH=riscv
TARGET_PRODUCT=d1-h_nezha
TARGET_PLATFORM=d1-h
TARGET_BOARD=d1-h-nezha
TARGET_PLAN=nezha
TARGET_BUILD_VARIANT=tina
TARGET_BUILD_TYPE=release
TARGET_KERNEL_VERSION=5.4
TARGET_UBOOT=u-boot-2018
TARGET_CHIP=sun20iw1p1
============================================
no buildserver to clean
[1] 19947
fuqiang@fuqiang-VivoBook:~/workspace/tina-d1-h$ make -j4
...
fuqiang@fuqiang-VivoBook:~/workspace/tina-d1-h$ pack
异常处理
异常1
In file included from /usr/include/signal.h:328,
from ./signal.h:52,
from c-stack.c:49:
c-stack.c:55:27: error: missing binary operator before token "("
55 | #elif HAVE_LIBSIGSEGV && (SIGSTKSZ < 16384)
临时解决方案
先找到文件
fuqiang@fuqiang-virtual:~/workspace/tina-d1-h$ find . -name c-stack.c
./out/d1-h-nezha/compile_dir/host/m4-1.4.18/lib/c-stack.c
./out/d1-h-nezha_min/compile_dir/host/m4-1.4.18/lib/c-stack.c
注释掉部分内容:
//#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
more than the Linux default of an 8k alternate stack when deciding
if a fault was caused by stack overflow. */
//# undef SIGSTKSZ
//# define SIGSTKSZ 16384
彻底解决方案
https://git.buildroot.org/buildroot/tree/package/m4/0003-c-stack-stop-using-SIGSTKSZ.patch?id=5a9504831f3fa1ef3be334036c93da30150fde55
接复制里面的patch的内容放入tools/m4/patch/目录下,目前还没有找到怎么直接下载patch地方法
异常2
elf.cpp:435:42: error: ISO C++17 does not allow dynamic exception specifications
435 | std::string symbol::get_version () const throw (std::bad_alloc)
| ^~~~~
elf.cpp:445:47: error: ISO C++17 does not allow dynamic exception specifications
445 | std::string symbol::get_version_file () const throw (std::bad_alloc)
| ^~~~~
elf.cpp:453:47: error: ISO C++17 does not allow dynamic exception specifications
453 | std::string symbol::get_name_version () const throw (std::bad_alloc)
临时解决方案
找到出现异常的文件夹
fuqiang@fuqiang-virtual:~/workspace/tina-d1-h$ find . -name elf.cpp
./out/d1-h-nezha/compile_dir/host/mklibs-0.1.35/src/mklibs-readelf/elf.cpp
fuqiang@fuqiang-virtual:~/workspace/tina-d1-h$ cd ./out/d1-h-nezha/compile_dir/host/mklibs-0.1.35/src/mklibs-readelf
fuqiang@fuqiang-virtual:~/workspace/tina-d1-h/out/d1-h-nezha/compile_dir/host/mklibs-0.1.35/src/mklibs-readelf$
c++17中不再支持异常规格,异常规格部分删除
sed -i "s/\ throw\ (std::bad_alloc)//g" `grep "throw (std::bad_alloc)" -rl ./`
sed -i "s/\ throw\ (std::bad_alloc,\ std::runtime_error)//g" `grep "throw (std::bad_alloc, std::runtime_error)" -rl ./`
sed -i "s/\ throw\ (std::out_of_range)//g" `grep "throw (std::out_of_range)" -rl ./`
根本解决方案
https://git.freifunk-franken.de/mirror/openwrt/commit/a1ee0ebbd8e9927a65c5d1e0db497dd118d559a6
异常3
Unable to find a Python 2.x interpreter for executing xxx
解决方案:安装python2.7版本
sudo apt install -y python2.7
异常4
libfakeroot.c:99:40: error: '_STAT_VER' undeclared (first use in this function)
99 | #define INT_NEXT_STAT(a,b) NEXT_STAT64(_STAT_VER,a,b)
根本解决方案
https://bugs.archlinux.org/task/69572
具体如下:
diff --git a/libfakeroot.c b/libfakeroot.c
index 3e80e38..14e56bc 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -90,6 +90,10 @@
#define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
#endif
+#ifndef _STAT_VER
+#define _STAT_VER 0
+#endif
+
/*
These INT_* (which stands for internal) macros should always be used when
the fakeroot library owns the storage of the stat variable.
异常5
/usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x0): first defined here
根本解决方案
https://gitce.net/mirrors/openwrt/commit/be4ed1db18e68cc57f03788b4529afbbf629411c