求解其他版本的A15MOD能放在A15.1284版本上面吗
答案:1 悬赏:50 手机版
解决时间 2021-04-14 07:36
- 提问者网友:半生酒醒
- 2021-04-14 02:15
求解其他版本的A15MOD能放在A15.1284版本上面吗
最佳答案
- 五星知识达人网友:青尢
- 2021-04-14 03:08
1、Uboot:每个arm芯片或者海斯芯片都有各自的uboot。
2、但他们的内核版本可以是一样的,主要是跟各自内核的进行的编译选项有关, 31的内核版本里加了版本检查选项“Kernel type->Symmetrical Multi-Processing”,而21的内核版本没有设置该选项。
在开发kernel driver时,总是会遇到讨人厌的vermagic检查,只要目前在run的kernel版本跟driver编译时用的kernel版本不一致,就没办法insmod。
bash-3.2# insmod sdio.ko
sdio: version magic '2.6.28-271-gec75a15 preempt mod_unload modversions ARMv7 '
should be '2.6.28 preempt mod_unload ARMv7 '
insmod: init_module 'sdio.ko' failed (Exec format error)
这大大降低了开发速度,尤其是当你拿不到客户在用的kernel时,又要开发driver给他用,真的是很麻烦……
那麼要怎麼利用恶心的方式绕过去呢???
一、先把 Moudle version 检查关掉。
user@host # ARCH=arm make menuconfig
--- Enable loadable module support │ │
│ │ [ ] Forced module loading │
│
│ │ [*] Module unloading ...1、Uboot:每个arm芯片或者海斯芯片都有各自的uboot。
2、但他们的内核版本可以是一样的,主要是跟各自内核的进行的编译选项有关, 31的内核版本里加了版本检查选项“Kernel type->Symmetrical Multi-Processing”,而21的内核版本没有设置该选项。
在开发kernel driver时,总是会遇到讨人厌的vermagic检查,只要目前在run的kernel版本跟driver编译时用的kernel版本不一致,就没办法insmod。
bash-3.2# insmod sdio.ko
sdio: version magic '2.6.28-271-gec75a15 preempt mod_unload modversions ARMv7 '
should be '2.6.28 preempt mod_unload ARMv7 '
insmod: init_module 'sdio.ko' failed (Exec format error)
这大大降低了开发速度,尤其是当你拿不到客户在用的kernel时,又要开发driver给他用,真的是很麻烦……
那麼要怎麼利用恶心的方式绕过去呢???
一、先把 Moudle version 检查关掉。
user@host # ARCH=arm make menuconfig
--- Enable loadable module support │ │
│ │ [ ] Forced module loading │
│
│ │ [*] Module unloading
│ │
│ │ [*] Forced module unloading │
│
│ │ [ ] Module versioning support │
│
│ │ [ ] Source checksum for all modules
二、 使用modinfo时,可以看到目前这driver的vermagic
filename: external_drivers/omap3530/Linux/sdio/sdio.ko
author: Texas Instruments Inc
alias: TIWLAN_SDIO
license: GPL
description: TI WLAN SDIO driver
depends:
vermagic: 2.6.28-271-gec75a15 preempt mod_unload ARMv7
parm: g_sdio_debug_level:debug level (int)
三、 修改 kernel 的 vermagic,再重新编译driver
vermagic 的第一个值 2.6.28-noneed 是由这 include/linux/utsrelease.h里的 UTS_RELEASE 所定义。
#define UTS_RELEASE "2.6.28-271-gec75a15"
之后再由 include/linux/vermagic.h 里的 macro
去组合出 VERMAGIC_STRING , 也就是 kernel 的vermagic。
#include
#include
#ifdef CONFIG_SMP
#define MODULE_VERMAGIC_SMP "SMP "
#else
#define MODULE_VERMAGIC_SMP ""
#endif
#ifdef CONFIG_PREEMPT
#define MODULE_VERMAGIC_PREEMPT "preempt "
#else
#define MODULE_VERMAGIC_PREEMPT ""
#endif完成编译后,你就可以得
#ifdef CONFIG_MODULE_UNLOAD
#define MODULE_VERMAGIC_MODULE_UNLOAD "mod_unload "
#else
#define MODULE_VERMAGIC_MODULE_UNLOAD ""
#endif
#ifndef CONFIG_MODVERSIONS
#define MODULE_VERMAGIC_MODVERSIONS "modversions "
#else
#define MODULE_VERMAGIC_MODVERSIONS ""
#endif
#ifndef MODULE_ARCH_VERMAGIC
#define MODULE_ARCH_VERMAGIC ""
#endif
#define VERMAGIC_STRING \
UTS_RELEASE " " \
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
MODULE_ARCH_VERMAGIC
所以, 我们只要把 UTS_RELEASE 改成我们的数字即可,当然若是懒得去try组合后的字串,也可以直接将VERMAGIC_STRING改成你要的字串
建议修改完 vermagic.h, utsrelease.h后,还是把kernel重编完再编kernel,比较保险。
以下是修改后,用modinfo看的结果
filename: external_drivers/omap3530/Linux/sdio/sdio.ko
author: Texas Instruments Inc
alias: TIWLAN_SDIO
license: GPL
description: TI WLAN SDIO driver
depends:
vermagic: 2.6.28 preempt mod_unload ARMv7
parm: g_sdio_debug_level:debug level (int)
------------------------------------------------------------------------------------------
另外若你是用git 做版本控制 , 那就会出现git的版本号在kernel 编号上
所以要把他关掉
General setup --->
[ ] Automatically append version information to the version strin
解释;
CONFIG_LOCALVERSION_AUTO:
│
│
│
│ This will try to automatically determine if the current tree is a │
│ release tree by looking for git tags that belong to the current │
│ top of tree revision.
│
│
│
│ A string of the format -gxxxxxxxx will be added to the localversion │
│ if a git-based tree is found. The string generated by this will be │
│ appended after any matching localversion* files, and after the value │
│ set in CONFIG_LOCALVERSION.
│
│
│
│ (The actual string used here is the first eight characters produced │
│ by running the command:
│
│
│ which is done within the script "scripts/setlocalversion".) │
│
│
│ Symbol: LOCALVERSION_AUTO [=y]
│
│ Prompt: Automatically append version information to the version string │
│ Defined at init/Kconfig:84
│
│ Location:
│
│ ingT
2、但他们的内核版本可以是一样的,主要是跟各自内核的进行的编译选项有关, 31的内核版本里加了版本检查选项“Kernel type->Symmetrical Multi-Processing”,而21的内核版本没有设置该选项。
在开发kernel driver时,总是会遇到讨人厌的vermagic检查,只要目前在run的kernel版本跟driver编译时用的kernel版本不一致,就没办法insmod。
bash-3.2# insmod sdio.ko
sdio: version magic '2.6.28-271-gec75a15 preempt mod_unload modversions ARMv7 '
should be '2.6.28 preempt mod_unload ARMv7 '
insmod: init_module 'sdio.ko' failed (Exec format error)
这大大降低了开发速度,尤其是当你拿不到客户在用的kernel时,又要开发driver给他用,真的是很麻烦……
那麼要怎麼利用恶心的方式绕过去呢???
一、先把 Moudle version 检查关掉。
user@host # ARCH=arm make menuconfig
--- Enable loadable module support │ │
│ │ [ ] Forced module loading │
│
│ │ [*] Module unloading ...1、Uboot:每个arm芯片或者海斯芯片都有各自的uboot。
2、但他们的内核版本可以是一样的,主要是跟各自内核的进行的编译选项有关, 31的内核版本里加了版本检查选项“Kernel type->Symmetrical Multi-Processing”,而21的内核版本没有设置该选项。
在开发kernel driver时,总是会遇到讨人厌的vermagic检查,只要目前在run的kernel版本跟driver编译时用的kernel版本不一致,就没办法insmod。
bash-3.2# insmod sdio.ko
sdio: version magic '2.6.28-271-gec75a15 preempt mod_unload modversions ARMv7 '
should be '2.6.28 preempt mod_unload ARMv7 '
insmod: init_module 'sdio.ko' failed (Exec format error)
这大大降低了开发速度,尤其是当你拿不到客户在用的kernel时,又要开发driver给他用,真的是很麻烦……
那麼要怎麼利用恶心的方式绕过去呢???
一、先把 Moudle version 检查关掉。
user@host # ARCH=arm make menuconfig
--- Enable loadable module support │ │
│ │ [ ] Forced module loading │
│
│ │ [*] Module unloading
│ │
│ │ [*] Forced module unloading │
│
│ │ [ ] Module versioning support │
│
│ │ [ ] Source checksum for all modules
二、 使用modinfo时,可以看到目前这driver的vermagic
filename: external_drivers/omap3530/Linux/sdio/sdio.ko
author: Texas Instruments Inc
alias: TIWLAN_SDIO
license: GPL
description: TI WLAN SDIO driver
depends:
vermagic: 2.6.28-271-gec75a15 preempt mod_unload ARMv7
parm: g_sdio_debug_level:debug level (int)
三、 修改 kernel 的 vermagic,再重新编译driver
vermagic 的第一个值 2.6.28-noneed 是由这 include/linux/utsrelease.h里的 UTS_RELEASE 所定义。
#define UTS_RELEASE "2.6.28-271-gec75a15"
之后再由 include/linux/vermagic.h 里的 macro
去组合出 VERMAGIC_STRING , 也就是 kernel 的vermagic。
#include
#include
#ifdef CONFIG_SMP
#define MODULE_VERMAGIC_SMP "SMP "
#else
#define MODULE_VERMAGIC_SMP ""
#endif
#ifdef CONFIG_PREEMPT
#define MODULE_VERMAGIC_PREEMPT "preempt "
#else
#define MODULE_VERMAGIC_PREEMPT ""
#endif完成编译后,你就可以得
#ifdef CONFIG_MODULE_UNLOAD
#define MODULE_VERMAGIC_MODULE_UNLOAD "mod_unload "
#else
#define MODULE_VERMAGIC_MODULE_UNLOAD ""
#endif
#ifndef CONFIG_MODVERSIONS
#define MODULE_VERMAGIC_MODVERSIONS "modversions "
#else
#define MODULE_VERMAGIC_MODVERSIONS ""
#endif
#ifndef MODULE_ARCH_VERMAGIC
#define MODULE_ARCH_VERMAGIC ""
#endif
#define VERMAGIC_STRING \
UTS_RELEASE " " \
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
MODULE_ARCH_VERMAGIC
所以, 我们只要把 UTS_RELEASE 改成我们的数字即可,当然若是懒得去try组合后的字串,也可以直接将VERMAGIC_STRING改成你要的字串
建议修改完 vermagic.h, utsrelease.h后,还是把kernel重编完再编kernel,比较保险。
以下是修改后,用modinfo看的结果
filename: external_drivers/omap3530/Linux/sdio/sdio.ko
author: Texas Instruments Inc
alias: TIWLAN_SDIO
license: GPL
description: TI WLAN SDIO driver
depends:
vermagic: 2.6.28 preempt mod_unload ARMv7
parm: g_sdio_debug_level:debug level (int)
------------------------------------------------------------------------------------------
另外若你是用git 做版本控制 , 那就会出现git的版本号在kernel 编号上
所以要把他关掉
General setup --->
[ ] Automatically append version information to the version strin
解释;
CONFIG_LOCALVERSION_AUTO:
│
│
│
│ This will try to automatically determine if the current tree is a │
│ release tree by looking for git tags that belong to the current │
│ top of tree revision.
│
│
│
│ A string of the format -gxxxxxxxx will be added to the localversion │
│ if a git-based tree is found. The string generated by this will be │
│ appended after any matching localversion* files, and after the value │
│ set in CONFIG_LOCALVERSION.
│
│
│
│ (The actual string used here is the first eight characters produced │
│ by running the command:
│
│
│ which is done within the script "scripts/setlocalversion".) │
│
│
│ Symbol: LOCALVERSION_AUTO [=y]
│
│ Prompt: Automatically append version information to the version string │
│ Defined at init/Kconfig:84
│
│ Location:
│
│ ingT
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯