Sky37E/D 基于Ubuntu21.04 编译环境搭建
0. 下载安装Ubuntu 21.04
-
官网下载ubuntu21.04镜像(ubuntu-21.04-desktop-amd64.iso) -
基于Virtualbox安装系统 -
进入系统后,打开命令行(ALT+CTRL+T), 更新系统的相关环境 选择一个国内的更新源,运行: sudo update-manager 选择一个国内的更新源后,然后进行更新: sudo apt-get update
sudo apt-get upgrade
Note: ? 由于新版本默认不带ifconfig命令,建议先运行安装 sudo apt-get install net-tools
1. 下载安装相关依赖库、工具
下载SDK需要依赖的库:
sudo apt-get install scons
sudo apt-get install gcc-multilib
sudo apt-get install make cmake
sudo apt-get install python
sudo apt-get install zlib1g-dev lib32z1-dev
sudo apt-get install liblzo2-dev liblzo2-2 liblzo2-dev:i386
sudo apt-get install u-boot-tools
sudo apt-get install lib32ncurses6 libncurses5-dev
sudo apt-get install bison
sudo apt-get install flex
下载开发过程需要的工具:
sudo apt-get install net-tools
sudo apt-get install mtd-utils
sudo apt-get install libtool
sudo apt-get install autoconf
sudo apt-get install libstdc++6
sudo apt-get install cpp g++
sudo apt-get install gawk
sudo apt-get install vim exuberant-ctags cscope
sudo apt-get install git gitk
sudo apt-get install ssh
sudo apt-get install samba
sudo apt-get install unrar
sudo apt-get install p7zip-full
sudo apt-get install meld
sudo apt-get install ffmpeg
sudo apt-get install tree
sudo apt-get install dos2unix
2. 调整SDK相关脚本配置
2.1 修改uboot编译脚本(build_uboot.sh):
# 先进行编译前的清理
make distclean
make clean
改为:
# 先进行编译前的清理
make distclean CROSS_COMPILE=arm-anykav500-eabi-
make clean CROSS_COMPILE=arm-anykav500-eabi-
添加指定工具链(如果是37E,编译spl、uboot都需要添加).
2.2 修改顶层编译脚本(auto_build.sh):
# 清理uboot
echo "****************Clean uboot******************"
cd os/uboot
echo "****************Clean uboot******************"
make clean
make distclean
echo "[ OK ]"
cd -
echo "[ OK ]"
修改为(添加工具链配置):
# 清理uboot
echo "****************Clean uboot******************"
cd os/uboot
echo "****************Clean uboot******************"
make clean CROSS_COMPILE=arm-anykav500-eabi-
make distclean CROSS_COMPILE=arm-anykav500-eabi-
echo "[ OK ]"
cd -
echo "[ OK ]"
Note:
? 在使用uboot 2013.10版本时,可以用sdk内脚本编译,如果不是(如37E的2019.10)就需要手动编译,看下面第四点。
3. 调整内核编译脚本
找到 bsp/anyka/rtconfig.py:
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
#EXEC_PATH = r'/opt/arm-anyka-crosstool/usr/bin/'
EXEC_PATH = r'/opt/arm-anykav500-eabi/bin/'
else:
#print 'Please make sure your toolchains is GNU GCC!'
exit(0)
去掉else部分的打印printk语句.
4. Sky37E 編譯uboot
由于系统GCC版本过高,会导致37E的uboot(2019.10)出错:
#
# configuration written to .config
#
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
解决方法:
-
修改scripts/dtc/dtc-parser.tab.c : 199
200 extern YYSTYPE yylval;
201 //extern YYLTYPE yylloc;
202 int yyparse (void);
203
......
1175 /* The semantic value of the lookahead symbol. */
1176 YYSTYPE yylval;
1177 /* Location data for the lookahead symbol. */
1178 static YYLTYPE yylloc
1179 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1180 = { 1, 1, 1, 1 }
1181 # endif
......
-
然后手动编译spl、uboot:
#编译spl
make ak37e_nor_spl_defconfig
make all -s DEVICE_TREE=EVB_CBDR_AK3760E_V1.0.1 CROSS_COMPILE=arm-anykav500-eabi-
#编译uboot
make ak37e_nor_defconfig
make all -s DEVICE_TREE=EVB_CBDR_AK3760E_V1.0.1 CROSS_COMPILE=arm-anykav500-eabi-
在编译完spl后如果使用make clean 清空代码,再编译uboot,则需要重新修改dtc-parser.tab.c .
|