发布时间:2025-12-10 19:24:52 浏览次数:10
Anycloud平台基于Ubuntu18.04编译环境搭建「建议收藏」0.下载安装Ubuntu18.04官网下载ubuntu18.04镜像(ubuntu-18.04.6-desktop-amd64.iso)基于Virtualbox安装系统进入系统后,打开命令行终端(ALT+CTRL+T),更新系统的相关环境:选择一个国内的更新源,运行:sudoupdate-manager[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ydh6qnQN-1635181911528)(C:\Users\xiaozijie\Deskt
官网下载ubuntu18.04镜像(ubuntu-18.04.6-desktop-amd64.iso)
基于Virtualbox安装系统
进入系统后,打开命令行终端(ALT+CTRL+T), 更新系统的相关环境:
选择一个国内的更新源,运行: sudo update-manager
选择更新源后,然后手动进行更新:
sudo apt-get updatesudo apt-get upgrade 是否还在为Ide开发工具频繁失效而烦恼,来吧关注以下公众号获取最新激活方式。亲测可用!
【正版授权,激活自己账号】:Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】:官方授权 正版激活 自己使用,支持Jetbrains家族下所有IDE…
Note:
由于新版本系统默认不带ifconfig命令,建议先运行安装sudo apt-get install net-tools. 为了后续步骤能够安装好相关库,必须要完成上面的步骤,否则可能存在依赖的缺漏. 环境适用于Anycloud37d、Anycloud37e、Anycloud39ev330等. sudo apt-get install sambasudo apt-get install sshsudo apt-get install net-toolssudo apt-get install vim 顺带贴上sambe配置(/etc/samba/smb.conf):
[anyka] comment = samba home directory path = /home/anyka/samba public = yes browseable = yes public = yes writeable = yes read only = no# valid users = anyka create mask = 0777 directory mask = 0777 #force user = nobody #force group = nogroup available = yes /home/anyka/samba目录需要可以简单配置为所有用户可读写(chmod 777 /home/anyka/samba).
下载SDK需要依赖的库:
sudo apt-get install makesudo apt-get install liblzo2-dev liblzo2-2 liblzo2-dev:i386sudo apt-get install libmpfr-dev libmpfr6 libmpfr6:i386sudo apt-get install zlib1g-dev lib32z1-devsudo apt-get install device-tree-compilersudo apt-get install u-boot-toolssudo apt-get install lib32ncurses5 libncurses5-dev 下载开发过程需要的工具:
sudo apt-get install pythonsudo apt-get install autoconfsudo apt-get install exuberant-ctags cscope sudo apt-get install gitsudo apt-get install unrarsudo apt-get install p7zip-fullsudo apt-get install ffmpegsudo apt-get install treesudo apt-get install bisonsudo apt-get install flexsudo apt-get install dos2unix 将tool目录下面的工具链拷贝到**/opt**目录下,然后解压(例如Anycloud37E):
tar xzf AK37E_SDK_V1.02.tar.gz
sudo tar xjf arm-anykav500-linux-uclibcgnueabi_V1.0.03.tar.bz2 -C /opt/
配置系统环境变量PATH, 打开~/.bashrc ,添加配置:
export PATH="${PATH}:/opt/arm-anykav500-linux-uclibcgnueabi/bin"
打开新的终端界面,确认PATH已经添加工具链路径,运行命令:
anyka@anyka-VirtualBox:~/project/AK37E_SDK_V1.02$ arm-anykav500-linux-uclibcgnueabi-gcc -vUsing built-in specs.COLLECT_GCC=/opt/arm-anykav500-linux-uclibcgnueabi/bin/arm-anykav500-linux-uclibcgnueabi-gcc.br_realCOLLECT_LTO_WRAPPER=/opt/arm-anykav500-linux-uclibcgnueabi/bin/../libexec/gcc/arm-anykav500-linux-uclibcgnueabi/4.9.4/lto-wrapperTarget: arm-anykav500-linux-uclibcgnueabiConfigured with: ./configure --prefix=/home/chehongfeng/toolchain_release --sysconfdir=/home/chehongfeng/toolchain_release/etc --enable-static --target=arm-anykav500-linux-uclibcgnueabi --with-sysroot=/home/chehongfeng/toolchain_release/arm-anykav500-linux-uclibcgnueabi/sysroot --disable-__cxa_atexit --with-gnu-ld --disable-multilib --with-gmp=/home/chehongfeng/toolchain_release --with-mpc=/home/chehongfeng/toolchain_release --with-mpfr=/home/chehongfeng/toolchain_release --with-pkgversion='Buildroot 2018.02.7_V1.0.03-g9ff3371' --with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath --disable-libsanitizer --enable-tls --disable-libmudflap --enable-threads --without-isl --without-cloog --with-float=soft --disable-decimal-float --with-abi=aapcs-linux --with-cpu=arm926ej-s --with-float=soft --with-mode=arm --enable-languages=c,c++ --with-build-time-tools=/home/chehongfeng/toolchain_release/arm-anykav500-linux-uclibcgnueabi/bin --enable-shared --disable-libgomp --enable-libsspThread model: posixgcc version 4.9.4 (Buildroot 2018.02.7_V1.0.03-g9ff3371) 能够正常运行arm-anykav500-linux-uclibcgnueabi-gcc -v即可.
在编译内核时,会出现以下错误:
libmpfr链接异常
anyka@anyka-VirtualBox:~/project/AK37E_SDK_V1.02/os$ ./build_kernel.shCROSS_COMPILE : arm-anykav500-linux-uclibcgnueabi-make[1]: Entering directory '/home/anyka/project/AK37E_SDK_V1.02/os/bd' GEN ./Makefile## configuration written to .config#make[1]: Leaving directory '/home/anyka/project/AK37E_SDK_V1.02/os/bd'make[1]: Entering directory '/home/anyka/project/AK37E_SDK_V1.02/os/bd' GEN ./Makefilescripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release Using /home/anyka/project/AK37E_SDK_V1.02/os/kernel as source for kernel GEN ./Makefile CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.hmake[2]: 'include/generated/mach-types.h' is up to date. CC kernel/bounds.s/opt/arm-anykav500-linux-uclibcgnueabi/bin/../libexec/gcc/arm-anykav500-linux-uclibcgnueabi/4.9.4/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directorymake[2]: *** [/home/anyka/project/AK37E_SDK_V1.02/os/kernel/./Kbuild:20: kernel/bounds.s] Error 1make[1]: *** [/home/anyka/project/AK37E_SDK_V1.02/os/kernel/Makefile:1040: prepare0] Error 2make[1]: Leaving directory '/home/anyka/project/AK37E_SDK_V1.02/os/bd'make: *** [Makefile:152: sub-make] Error 2 解决方法:
sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
在顶层目录运行:./auto_build.sh
此脚本默认只支持第一次拿到SDK编译,因为默认会重新解压Kernel、uboot代码.
所以,第一次编译完后,可以修改脚本:
6 # 检查是否有残留的kernel目录 7 #if test -d kernel ; then 8 # rm -rf kernel 9 #fi 10 11 # 解压缩内核,并进行编译 12 #tar xvfz linux.tar.gz 13 ./build_kernel.sh 14 ./build_kernel.sh -i 15 16 # 检查是否存在编译错误 17 if test $? -ne 0 ; then 18 echo "Kernel build failed!" 19 exit 20 fi 21 22 # 检查是否有残留的uboot目录 23 #if test -d uboot ; then 24 # rm -rf uboot 25 #fi 26 27 # 解压缩uboot,并进行编译 28 #tar xvfz uboot.tar.gz 29 ./build_uboot.sh 30 ./build_uboot.sh -i 去掉删除旧目录,重新解压的动作.
跳转到os目录,直接运行脚本:
./build_kernel.sh./build_kernel.sh -i 同样在os目录下,运行脚本:
./build_uboot.sh./build_uboot.sh -i 在顶层目录下,运行默认脚本:./make_image.sh
默认需要手动拷贝对应dtb到烧录工具目录下,如使用norflash的rgb核心板(例如Anycloud37E):
cp image/EVB_CBDR_AK3760E_V1.0.1.dtb tools/burntool/cloudOS.dtb
打开tool/burntool下面的烧录工具,选择对应的nor、芯片类型,然后进行烧录.