EABI和OABI
作者:曹忠明,华清远见嵌入式学院讲师。
相信很多学习嵌入式linux的人都碰到过这样一个问题:
初学linux的时候大家都用的工具链版本多是3.4.5或3.4.2,名字为arm-linux-gcc或arm-softfloat-linux-gnu-gcc,可突然有一天发现这几个版本的编译器无法编译最新的内核了,并且发现人们都换了工具链了(arm-none-linux-gnueabi-gcc),怎么办,换呗。于是也都换成了这个工具链,编译内核,制作跟文件系统,按部就班的做,和以前没什么区别,很多人甚至想这些操作我都做烂了,闭着眼睛都能完成,一切和以前也没什么区别。可是紧接着问题来了,当内核启动到最后阶段挂载文件系统是出现如下错误:
kernel panic:attempted to kill init
或者什么错误都不提示,只是永远进入不了终端。
这是什么问题呢,答案是大家需要在内核配置的时候选择上如下内容:
make menuconfig
Kernel Features --->
[*] Use the ARM EABI to compile the kernel
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)
选上这两项重新编译内核,发现上面提到的问题就解决了,为什么呢,这两个选项是什么东西呢。在这里得提到几个概念:
ABI:application binary interface
OABI:old application binary interface
EABI:extended application binary interface
但上面两项选中后在内核的配置文件.config中CONFIG_AEABI和CONFIG_OABI_COMPAT会被设置为“y”,CONFIG_AEABI表示现在内核为EABI,CONFIG_OABI_COMPAT表示兼容OABI。
为什么这两个选项会影响到我们的系统启动呢。
这两个选项可以选择任意一个也可以都选。这里涉及到两个结构sys_call_table和sys_oabi_call_table,这两个表是一个内核的跳转表,存放的是系统调用的指针。当CONFIG_AEABI和CONFIG_OABI_COMPAT都选中的时候,当应用程序使用OABI的是时候调用sys_oabi_call_table中的系统调用,应用程序使用EABI时使用sys_call_table中的系统调用。而如果只选CONFIG_AEABI则使用sys_call_table。两个都不选则使用sys_call_table。应为CONFIG_OABI_COMPAT对CONFIG_AEABI有依赖关系所以不能只选择CONFIG_OABI_COMPAT。
可以参考如下代码
arch/arm/kernel/entry-common.S
#if defined(CONFIG_OABI_COMPAT)
/*
* If we have CONFIG_OABI_COMPAT then we need to look at the swi
* value to determine if it is an EABI or an old ABI call.
*/
#ifdef CONFIG_ARM_THUMB
tst r8, #PSR_T_BIT
movner10, #0 @ no thumb OABI emulation
ldreqr10, [lr, #-4]@ get SWI instruction
#else
ldrr10, [lr, #-4]@ get SWI instruction
A710( and ip, r10, #0x0f000000@ check for SWI )
A710( teq ip, #0x0f000000 )
A710( bne .Larm710bug )
#endif
#ifdef CONFIG_CPU_ENDIAN_BE8
revr10, r10@ little endian instruction
#endif
#elif defined(CONFIG_AEABI)
/*
* Pure EABI user space always put syscall number into scno (r7).
*/
A710( ldrip, [lr, #-4]@ get SWI instruction )
A710( andip, ip, #0x0f000000@ check for SWI )
A710( teqip, #0x0f000000 )
A710( bne.Larm710bug )
#elif defined(CONFIG_ARM_THUMB)
/* Legacy ABI only, possibly thumb mode. */
tst r8, #PSR_T_BIT@ this is SPSR from save_user_regs
addnescno, r7, #__NR_SYSCALL_BASE@ put OS number in
ldreqscno, [lr, #-4]
#else
/* Legacy ABI only. */
ldrscno, [lr, #-4] @ get SWI instruction
A710( andip, scno, #0x0f000000@ check for SWI )
A710( teqip, #0x0f000000 )
A710( bne.Larm710bug )
#endif
#ifdef CONFIG_ALIGNMENT_TRAP
ldrip, __cr_alignment
ldrip, [ip]
mcrp15, 0, ip, c1, c0@ update control register
#endif
enable_irq
get_thread_info tsk
adr tbl, sys_call_table@ load syscall table pointer
ldrip, [tsk, #TI_FLAGS]@ check for syscall tracing
#if defined(CONFIG_OABI_COMPAT)
/*
* If the swi argument is zero, this is an EABI call and we do nothing.
*
* If this is an old ABI call, get the syscall number into scno and
* get the old ABI syscall table address.
*/
bics r10, r10, #0xff000000
eornescno, r10, #__NR_OABI_SYSCALL_BASE
ldrnetbl, =sys_oabi_call_table
#elif !defined(CONFIG_AEABI)
bicscno, scno, #0xff000000@ mask off SWI op-code
eorscno, scno, #__NR_SYSCALL_BASE @ check OS number
#endif
分享到:
相关推荐
powerpc-eabi-gcc4.9.0 powerpc 工具链
该工具是用在linux平台编译嵌入式arm平台代码的,可以编译简单的单片机程序,还可以编译uboot等,目前已经用了很久,编译器是arm-none-eabi的,以前用arm-linux编译总是用问题,换成这个版本的就好了,在此献上。
arm-none-eabi-arm-2010-09-51-for-linux是另一种交叉工具链,安装之后可以使用anm-none-eabi-gcc等命令。 #mkdir /usr/local/arm #cp /mnt/hgxxx/arm-none-eabi-arm-2010-09-51-for-linux.tar.bz2 / #tar xvfj arm...
arm-eabi-4.4.0.tgz arm-eabi-4.4.0.tgz
gcc-arm-none-eabi-10-2020-q4-major-win32.exe
windows win7 32bit 的gcc-arm-none-eabi-5和 gcc-arm-none-eabi-6交叉编译工具链,DFU必备
arm-linux-androideabi-addr2line.exe -e libunity.sym.so -C -p -i -s -f 00111088
GDB图像界面调试器insight编译出来的二进制包(主机为ubuntu16.04上编译,目标平台arm-none-eabi),由于需要外部依赖下载使用需谨慎,强烈建议按照博客说明自行编译。详细编译过程见博客...
EABI工具链,嵌入式开发工具链(arm-linux-)
centos gcc-arm-none-eabi
gcc-arm-none-eabi-6-2017-q2-update-win32.exe windows 编译工具
Windows平台下Android C的交叉编译工具链。arm-linux-androideabi-4.9.7z
gcc-arm-none-eabi编译链,包含windows下以及linux环境下的
gcc-arm-none-eabi 交叉编译器,本人主要用于编译STM32CubeMX生成的makefile工程,win10环境下运行。
gcc编译器20220506 082534 版本为:gcc-arm-none-eabi-10.3-2021.10-win32 配合文章:nordic52832 nordic使用gcc编译环境搭建和使用说明
ndk 编译环境cpu架构库
Sourcery CodeBench Lite Edition for ARM EABI hosted on IA32 Windows, IA32 GNU/Linux,Sourcery CodeBench Lite 2014.05-28
亲测可用!!! 用于ARM嵌入式 程序编译 Sourcery CodeBench Lite for arm eabi 支持win10系统
windows最新版的gcc-arm-none-eabi-9-2020-q2-update-win32,外网下非常慢,不也不想收分,但是我需要分下载别的东西
gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2(102.28 MB) GNU Embedded Toolchain for Arm是一个即用型开源工具套件,适用于针对Arm Cortex-M和Cortex-R系列处理器的C,C ++和汇编编程。它包括GNU编译(GCC)...