1 基礎環境
1.1 解壓
tar xvf rv1126_rv1109_linux_release_20211022.tgz
1.2 安裝基礎依賴
sudo apt-get install repo git gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu mtools parted libudev-dev libusb-1.0-0-dev autoconf autotools-dev libsigsegv2 m4 intltool libdrm-dev curl sed make binutils build-essential gcc g++ bash patch gzip gawk bzip2 perl tar cpio unzip rsync file bc wget libncurses5 libglib2.0-dev libgtk2.0-dev libglade2-dev cvs git mercurial rsync openssh-client subversion asciidoc w3m dblatex graphviz libc6:i386 libssl-dev expect fakeroot cmake flex bison liblz4-tool libtool keychain
1.3 gcc-7安裝
vim /etc/apt/sources.list
最後一行加上
deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe
apt-get update
# 安裝gcc-7 g++-7
sudo apt-get install lib32gcc-7-dev g++-7 libstdc++-7-dev
# 與gcc-11 g++-11共存,版本切換
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11
sudo update-alternatives --config gcc
# 選擇gcc-7
sudo update-alternatives --config g++
# 選擇g++-7
1.4 析出SDK
.repo/repo/repo sync -l
安装python2.7并切换python版本为python2.7
出现python编码问题则:
sudo gedit /usr/lib/python2.7/sitecustomize.py
然后修改文件内容为
import sys
reload(sys)
sys.setdefaultencoding('utf8')
2 編譯
./build.sh device/rockchip/rv1126_rv1109/aio-rv1126-jd4.mk
./build.sh
3 錯誤解決
1 FATAL ERROR: Unable to parse input tree
arch/arm/dts/rk3128-evb.dtb: Warning (reg_format): Error: arch/arm/dts/.rk3188-radxarock.dtb.pre.tmp:383.1-10 syntax error
FATAL ERROR: Unable to parse input tree
"reg" property in /syscon@20008000/usb2-phy@17c has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
解决方法
修改Uboot路径下 scripts/Makefile.lib:
quiet_cmd_dtc = DTC $@
# Modified for U-Boot
# Bring in any U-Boot-specific include at the end of the file
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
---- (cat $<; $(if $(u_boot_dtsi),echo '\#include "$(u_boot_dtsi)"')) > $(pre-tmp); \
++++ (cat $<; $(if $(u_boot_dtsi),echo '#include "$(u_boot_dtsi)"')) > $(pre-tmp); \
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
$(DTC) -O dtb -o $@ -b 0 \
-i $(dir $<) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
2 [Makefile:83: _all] Error 2
make[1]: *** No rule to make target '/home/wzl/workspace/rv1126/rv1126_rv1109_linux_release_20211022/buildroot/output/firefly_rv1126_rv1109/.br-external.mk'. Stop.
make: *** [Makefile:83: _all] Error 2
make: Leaving directory '/home/wzl/workspace/rv1126/rv1126_rv1109_linux_release_20211022/buildroot'
cp: cannot stat '/home/wzl/workspace/rv1126/rv1126_rv1109_linux_release_20211022/buildroot/output/firefly_rv1126_rv1109/.config': No such file or directory
Done in 0s (error code: 2)
解決方法:
重新執行一次./build.sh
3 error: missing binary operator before token "("
2022-10-07T16:34:01 c-stack.c:55:26: error: missing binary operator before token "("
2022-10-07T16:34:01 #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
2022-10-07T16:34:01 ^
解決方法
修改buildroot/output/firefly_rv1126_rv1109/build/host-m4-1.4.18/lib/c-stack.c
# define SIGSTKSZ 16384
#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
#endif
改爲:
# define SIGSTKSZ 16384
// #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
#endif
4 error: stray '#' in program
2022-10-07T18:02:55 controller-enumtypes.c:6:1: error: stray '' in program
2022-10-07T18:02:55 #include "gstinterpolationcontrolsource.h"
2022-10-07T18:02:55 ^
2022-10-07T18:02:55 controller-enumtypes.c:6:2: error: stray '#' in program
2022-10-07T18:02:55 #include "gstinterpolationcontrolsource.h"
解決方法
將對應文件內“\#include”改爲"#include"
5 gawk: fatal: cannot use gawk builtin `namespace' as variable name
//1 修改 libgpg-error-1.25/src/mkstrtable.awk
105c105
< print "static const char " namespace "msgstr[] = ";
---
> print "static const char " pkg_namespace "msgstr[] = ";
113c113
< sub (/\#.+/, "");
---
> sub (/#.+/, "");
153c153
< print "static const int " namespace "msgidx[] =";
---
> print "static const int " pkg_namespace "msgidx[] =";
161c161
< print namespace "msgidxof (int code)";
---
> print pkg_namespace "msgidxof (int code)";
//2 修改对应src下面的Makefile Makfile.in Makefile.am
errnos-sym.h: Makefile mkstrtable.awk errnos.in
$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
-v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
$(srcdir)/errnos.in >$@
5 strerror-sym.c:47:9: error: 'errnos_msgstr' undeclared (first use in this function)
strerror-sym.c:47:9: error: 'errnos_msgstr' undeclared (first use in this function)
解決方法
修改./output/firefly_rv1126_rv1109/build/libgpg-error-1.27/src/errnos-sym.h
/* Output of mkstrtable.awk. DO NOT EDIT. */
/* errnos.in - List of system error values.
Copyright (C) 2003, 2004 g10 Code GmbH
This file is part of libgpg-error.
libgpg-error is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
libgpg-error is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with libgpg-error; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* The purpose of this complex string table is to produce
optimal code with a minimum of relocations. */
static const char errnos_msgstr[] =
"GPG_ERR_E2BIG" "\0"
"GPG_ERR_EACCES" "\0"
"GPG_ERR_EADDRINUSE" "\0"
"GPG_ERR_EADDRNOTAVAIL" "\0"
"GPG_ERR_EADV" "\0"
"GPG_ERR_EAFNOSUPPORT" "\0"
"GPG_ERR_EAGAIN" "\0"
"GPG_ERR_EALREADY" "\0"
"GPG_ERR_EAUTH" "\0"
"GPG_ERR_EBACKGROUND" "\0"
"GPG_ERR_EBADE" "\0"
"GPG_ERR_EBADF" "\0"
"GPG_ERR_EBADFD" "\0"
"GPG_ERR_EBADMSG" "\0"
"GPG_ERR_EBADR" "\0"
"GPG_ERR_EBADRPC" "\0"
"GPG_ERR_EBADRQC" "\0"
"GPG_ERR_EBADSLT" "\0"
"GPG_ERR_EBFONT" "\0"
"GPG_ERR_EBUSY" "\0"
"GPG_ERR_ECANCELED" "\0"
"GPG_ERR_ECHILD" "\0"
"GPG_ERR_ECHRNG" "\0"
"GPG_ERR_ECOMM" "\0"
"GPG_ERR_ECONNABORTED" "\0"
"GPG_ERR_ECONNREFUSED" "\0"
"GPG_ERR_ECONNRESET" "\0"
"GPG_ERR_ED" "\0"
"GPG_ERR_EDEADLK" "\0"
"GPG_ERR_EDEADLOCK" "\0"
"GPG_ERR_EDESTADDRREQ" "\0"
"GPG_ERR_EDIED" "\0"
"GPG_ERR_EDOM" "\0"
"GPG_ERR_EDOTDOT" "\0"
"GPG_ERR_EDQUOT" "\0"
"GPG_ERR_EEXIST" "\0"
"GPG_ERR_EFAULT" "\0"
"GPG_ERR_EFBIG" "\0"
"GPG_ERR_EFTYPE" "\0"
"GPG_ERR_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
"GPG_ERR_ETOOMANYREFS" "\0"
"GPG_ERR_ETXTBSY" "\0"
"GPG_ERR_EUCLEAN" "\0"
"GPG_ERR_EUNATCH" "\0"
"GPG_ERR_EUSERS" "\0"
"GPG_ERR_EWOULDBLOCK" "\0"
"GPG_ERR_EXDEV" "\0"
"GPG_ERR_EXFULL";
static const int errnos_msgidx[] =
{
0,
14,
29,
48,
70,
83,
104,
119,
136,
150,
170,
184,
198,
213,
229,
243,
259,
275,
291,
306,
320,
338,
353,
368,
382,
403,
424,
443,
454,
470,
488,
509,
523,
536,
552,
567,
582,
597,
611,
626,
646,
664,
682,
703,
717,
731,
746,
766,
780,
795,
807,
823,
838,
853,
868,
885,
900,
915,
931,
947,
964,
980,
996,
1011,
1025,
1045,
1060,
1075,
1092,
1110,
1131,
1147,
1165,
1182,
1200,
1220,
1235,
1250,
1266,
1281,
1297,
1312,
1327,
1343,
1358,
1374,
1392,
1407,
1422,
1437,
1452,
1472,
1487,
1501,
1516,
1531,
1547,
1564,
1580,
1598,
1614,
1631,
1647,
1662,
1679,
1693,
1712,
1730,
1744,
1765,
1779,
1796,
1817,
1839,
1860,
1875,
1899,
1918,
1933,
1949,
1965,
1983,
2000,
2014,
2035,
2053,
2077,
2092,
2106,
2121,
2136,
2153,
2167,
2185,
2206,
2222,
2238,
2254,
2269,
2289,
2303,
};
static GPG_ERR_INLINE int
errnos_msgidxof (int code)
{
return (0 ? 0
: ((code >= 0) && (code <= 140)) ? (code - 0)
: -1);
}
6 libfakeroot.c:99:40: error: '_STAT_VER' undeclared
libfakeroot.c:99:40: error: '_STAT_VER' undeclared
解決方法
在文件開頭加入
#ifndef _STAT_VER
#if defined (__aarch64__)
#define _STAT_VER 0
#elif defined (__x86_64__)
#define _STAT_VER 1
#else
#define _STAT_VER 3
#endif
#endif