Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2116331
  • 博文数量: 438
  • 博客积分: 3871
  • 博客等级: 中校
  • 技术积分: 6075
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-10 00:11
个人简介

邮箱: wangcong02345@163.com

文章分类

全部博文(438)

文章存档

2017年(15)

2016年(119)

2015年(91)

2014年(62)

2013年(56)

2012年(79)

2011年(16)

分类: LINUX

2013-04-10 12:26:33

# insmod g_file_storage.ko file=/dev/mtdblock2 stall=0 removable=1
    g_file_storage: unknown relocation: 40
    insmod: cannot insert 'g_file_storage': invalid module format

    网上查资料,发现是由于EABI-4.3.3的编译器比2.6.26.5新,在编译连接程序时两者的有些参数不兼容导致的问题。

    修改include/asm-arm/elf.h:

    ....

    #define R_ARM_JUMP24    29
    #define R_ARM_V4BX      40  /* Jasper add */

    修改arch/arm/kernel/module.c中 apply_relocate()函数实现:

    switch (ELF32_R_TYPE(rel->r_info)) {

    ....

    case R_ARM_V4BX:  /* Jasper add */

        /* Preserve Rm and the condition code. Alter

         * other bits to re-code instruction as

         * MOV PC,Rm.
         */
        *(u32 *)loc &= 0xf000000f;
        *(u32 *)loc |= 0x01a0f000;
        break;

    default:

         ....

    }

    完成修改后,重编内核和模块,成功加载。


[参]http://jasperzhang.i.sohu.com/blog/view/162926832.htm
阅读(4549) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~