官网下载ubuntu22.04镜像(ubuntu-22.04-desktop-amd64.iso)
基于Virtualbox安装系统
进入系统后,打开命令行终端(ALT+CTRL+T), 配置系统更新源:
选择一个国内的更新源,运行: sudo update-manager
选择更新源后,然后手动进行更新:
sudo apt-get update
sudo apt-get upgrade
Note:
sudo apt-get install net-tools
sudo apt-get install net-tools
sudo apt-get install samba ssh
安装sambe server,用于将SDK传输到Ubuntu中.
samba配置如下(/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 make
sudo apt-get install liblzo2-dev liblzo2-2 liblzo2-dev:i386
sudo apt-get install libmpfr-dev libmpfr6 libmpfr6:i386
sudo apt-get install zlib1g-dev lib32z1-dev
sudo apt-get install device-tree-compiler
sudo apt-get install u-boot-tools
sudo apt-get install lib32ncurses5 libncurses5-dev
下载开发过程需要的工具:
sudo apt-get install python
sudo apt-get install autoconf
sudo apt-get install vim exuberant-ctags cscope
sudo apt-get install git gitk
sudo apt-get install unrar
sudo apt-get install p7zip-full
sudo apt-get install ffmpeg
sudo apt-get install tree
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install dos2unix
sudo apt-get install cmake
本次使用Anyclod37e平台搭建:
将SDK 中tool目录下面的工具解压到**/opt**目录下:
sudo tar xjf arm-anykav500-linux-uclibcgnueabi_V1.0.05.tar.bz2 -C /opt/
配置系统环境变量PATH, 打开~/.bashrc ,添加配置:
export PATH="${PATH}:/opt/arm-anykav500-linux-uclibcgnueabi/bin"
打开新的终端界面,确认PATH已经添加工具链路径,运行命令:
anyka@anyka-VirtualBox:~/samba/AK37E_SDK_V1.05$ arm-anykav500-linux-uclibcgnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/opt/arm-anykav500-linux-uclibcgnueabi/bin/arm-anykav500-linux-uclibcgnueabi-gcc.br_real
COLLECT_LTO_WRAPPER=/opt/arm-anykav500-linux-uclibcgnueabi/bin/../libexec/gcc/arm-anykav500-linux-uclibcgnueabi/4.9.4/lto-wrapper
Target: arm-anykav500-linux-uclibcgnueabi
Configured with: ./configure --prefix=/home/leihaitao/nfs/project/buildroot/buildroot.stable/arm-anykav500-linux-uclibcgnueabi --sysconfdir=/home/leihaitao/nfs/project/buildroot/buildroot.stable/arm-anykav500-linux-uclibcgnueabi/etc --enable-static --target=arm-anykav500-linux-uclibcgnueabi --with-sysroot=/home/leihaitao/nfs/project/buildroot/buildroot.stable/arm-anykav500-linux-uclibcgnueabi/arm-anykav500-linux-uclibcgnueabi/sysroot --disable-__cxa_atexit --with-gnu-ld --disable-multilib --with-gmp=/home/leihaitao/nfs/project/buildroot/buildroot.stable/arm-anykav500-linux-uclibcgnueabi --with-mpc=/home/leihaitao/nfs/project/buildroot/buildroot.stable/arm-anykav500-linux-uclibcgnueabi --with-mpfr=/home/leihaitao/nfs/project/buildroot/buildroot.stable/arm-anykav500-linux-uclibcgnueabi --with-pkgversion='Buildroot 2018.02.7_V1.0.05-gec2d034' --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/leihaitao/nfs/project/buildroot/buildroot.stable/arm-anykav500-linux-uclibcgnueabi/arm-anykav500-linux-uclibcgnueabi/bin --enable-shared --disable-libgomp --enable-libssp
Thread model: posix
gcc version 4.9.4 (Buildroot 2018.02.7_V1.0.05-gec2d034)
能够正常运行arm-anykav500-linux-uclibcgnueabi-gcc -v
即可.
在编译内核时,会出现以下错误:
libmpfr链接异常
anyka@anyka-VirtualBox:~/samba/AK37E_SDK_V1.05/os$ ./build_kernel.sh
CROSS_COMPILE : arm-anykav500-linux-uclibcgnueabi-
make[1]: Entering directory '/home/anyka/samba/AK37E_SDK_V1.05/os/bd'
HOSTCC scripts/basic/fixdep
GEN ./Makefile
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
make[1]: Leaving directory '/home/anyka/samba/AK37E_SDK_V1.05/os/bd'
make[1]: Entering directory '/home/anyka/samba/AK37E_SDK_V1.05/os/bd'
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config/kernel.release
UPD include/config/kernel.release
Using /home/anyka/samba/AK37E_SDK_V1.05/os/kernel as source for kernel
GEN ./Makefile
WRAP arch/arm/include/generated/asm/bitsperlong.h
WRAP arch/arm/include/generated/asm/cputime.h
WRAP arch/arm/include/generated/asm/current.h
WRAP arch/arm/include/generated/asm/emergency-restart.h
WRAP arch/arm/include/generated/asm/errno.h
WRAP arch/arm/include/generated/asm/exec.h
WRAP arch/arm/include/generated/asm/ioctl.h
WRAP arch/arm/include/generated/asm/ipcbuf.h
WRAP arch/arm/include/generated/asm/irq_regs.h
WRAP arch/arm/include/generated/asm/kdebug.h
WRAP arch/arm/include/generated/asm/local.h
WRAP arch/arm/include/generated/asm/local64.h
WRAP arch/arm/include/generated/asm/mm-arch-hooks.h
WRAP arch/arm/include/generated/asm/msgbuf.h
WRAP arch/arm/include/generated/asm/msi.h
WRAP arch/arm/include/generated/asm/param.h
WRAP arch/arm/include/generated/asm/parport.h
WRAP arch/arm/include/generated/asm/poll.h
WRAP arch/arm/include/generated/asm/preempt.h
WRAP arch/arm/include/generated/asm/resource.h
WRAP arch/arm/include/generated/asm/rwsem.h
WRAP arch/arm/include/generated/asm/seccomp.h
WRAP arch/arm/include/generated/asm/sections.h
WRAP arch/arm/include/generated/asm/segment.h
WRAP arch/arm/include/generated/asm/sembuf.h
WRAP arch/arm/include/generated/asm/serial.h
WRAP arch/arm/include/generated/asm/shmbuf.h
WRAP arch/arm/include/generated/asm/siginfo.h
WRAP arch/arm/include/generated/asm/simd.h
WRAP arch/arm/include/generated/asm/sizes.h
WRAP arch/arm/include/generated/asm/socket.h
WRAP arch/arm/include/generated/asm/sockios.h
WRAP arch/arm/include/generated/asm/termbits.h
WRAP arch/arm/include/generated/asm/termios.h
WRAP arch/arm/include/generated/asm/timex.h
WRAP arch/arm/include/generated/asm/trace_clock.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
Generating include/generated/mach-types.h
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 directory
make[2]: *** [/home/anyka/samba/AK37E_SDK_V1.05/os/kernel/./Kbuild:20: kernel/bounds.s] Error 1
make[1]: *** [/home/anyka/samba/AK37E_SDK_V1.05/os/kernel/Makefile:1040: prepare0] Error 2
make[1]: Leaving directory '/home/anyka/samba/AK37E_SDK_V1.05/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
yylloc符号错误
anyka@anyka-VirtualBox:~/samba/AK37E_SDK_V1.05/os$ ./build_kernel.sh
CROSS_COMPILE : arm-anykav500-linux-uclibcgnueabi-
make[1]: Entering directory '/home/anyka/samba/AK37E_SDK_V1.05/os/bd'
GEN ./Makefile
#
# configuration written to .config
#
make[1]: Leaving directory '/home/anyka/samba/AK37E_SDK_V1.05/os/bd'
make[1]: Entering directory '/home/anyka/samba/AK37E_SDK_V1.05/os/bd'
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config/kernel.release
Using /home/anyka/samba/AK37E_SDK_V1.05/os/kernel as source for kernel
GEN ./Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[2]: 'include/generated/mach-types.h' is up to date.
CC kernel/bounds.s
CHK include/generated/bounds.h
UPD include/generated/bounds.h
CHK include/generated/timeconst.h
UPD include/generated/timeconst.h
CC arch/arm/kernel/asm-offsets.s
CHK include/generated/asm-offsets.h
UPD include/generated/asm-offsets.h
CALL /home/anyka/samba/AK37E_SDK_V1.05/os/kernel/scripts/checksyscalls.sh
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
SHIPPED scripts/dtc/dtc-lexer.lex.c
SHIPPED scripts/dtc/dtc-parser.tab.h
HOSTCC scripts/dtc/dtc-lexer.lex.o
SHIPPED scripts/dtc/dtc-parser.tab.c
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
/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
make[3]: *** [scripts/Makefile.host:100: scripts/dtc/dtc] Error 1
make[2]: *** [/home/anyka/samba/AK37E_SDK_V1.05/os/kernel/scripts/Makefile.build:484: scripts/dtc] Error 2
make[1]: *** [/home/anyka/samba/AK37E_SDK_V1.05/os/kernel/Makefile:558: scripts] Error 2
make[1]: Leaving directory '/home/anyka/samba/AK37E_SDK_V1.05/os/bd'
make: *** [Makefile:152: sub-make] Error 2
解决方法(scripts/dtc/dtc-parser.tab.c_shipped):
......
186
187 extern YYSTYPE yylval;
188 //extern YYLTYPE yylloc;
189 int yyparse (void);
......
1193 /* The lookahead symbol. */
1194 int yychar;
1195
1196 /* The semantic value of the lookahead symbol. */
1197 YYSTYPE yylval;
1198 /* Location data for the lookahead symbol. */
1199 static YYLTYPE yylloc
1200 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1201 = { 1, 1, 1, 1 }
1202 # endif
1203 ;
1204 /* Number of syntax errors so far. */
1205 int yynerrs;
1206
......
调整yylloc
为局部符号.
在顶层目录运行:./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
以上步骤完成后,需要手动拷贝相关镜像到烧录目录:cp -rf image/* tools/burntool
默认需要手动拷贝对应dtb到烧录工具目录下,如使用norflash的rgb核心板(例如Anycloud37E):
cp image/EVB_CBDR_AK3760E_V1.0.1.dtb tools/burntool/cloudOS.dtb
打开tool/burntool下面的烧录工具,选择对应的nor、芯片类型,然后进行烧录.