(OK) 编译batman-adv.ko—成功—android—cm11源码—下载


cm11开发者源码.tar
文件大小:9.8G
http://pan.baidu.com/share/link?uk=1663710139&shareid=3849829323

cm11源码
http://pan.baidu.com/s/1i3LzjFZ


++++++++++++++++

点击(此处)折叠或打开

  1. ?说明

  2. 0 android4.7z.001 通过7zip将此分卷解开,得到一个android4文件,然后改名成android4.tar.gz
  3. 1 把文件名后面的gzip后缀去掉,这不是一个压缩文件

  4. 2 在源码下建立kernel目录
  5. 3 解压kernel.tar,然后把内容拷贝到源码的kernel目录中。
  6. 4 要看kernel的内容的话,必须进入msm或common或goldfish下,通过git branch -avl查看分支
  7.    然后通过git branch xxx remote分支来释放代码

  8. //ztg add
  9. //通过git branch -r或-a查询,选项r只能查远程版本,选项a会把本地和远程的版本都列出
  10. [root@localhost common]# git branch -a
  11. * (分离自 origin/android-2.6.39)
  12.   master
  13.   remotes/origin/HEAD -> origin/master
  14.   remotes/origin/android-2.6.39
  15.   remotes/origin/android-3.0
  16.   remotes/origin/android-3.10
  17.   remotes/origin/android-3.10-adf
  18.   remotes/origin/android-3.3
  19.   remotes/origin/android-3.4
  20.   remotes/origin/android-3.4-compat
  21.   remotes/origin/bcmdhd-3.10
  22.   remotes/origin/coupled-cpuidle
  23.   remotes/origin/experimental/android-3.10
  24.   remotes/origin/experimental/android-3.10-rc5
  25.   remotes/origin/experimental/android-3.8
  26.   remotes/origin/experimental/android-3.9
  27.   remotes/origin/experimental/android-3.9-rc2
  28.   remotes/origin/experimental/android-3.9-rc7
  29.   remotes/origin/linux-bcm43xx-2.6.39
  30.   remotes/origin/master

  31. //删除分支
  32. [root@localhost common]# git branch -d remotes/origin/android-3.10

  33. //提取内核源代码到当前目录
  34. //When you're done, you should get source code in 'pwd'
  35. [root@localhost common]# git checkout -t remotes/origin/android-3.10
  36. [root@localhost common]# git checkout -t remotes/origin/android-3.10 -b android-3.10

  37. [root@localhost common]# git checkout remotes/origin/android-3.10
  38. +++++++++++++++++++++++++++++++++++++++++

  39. export PATH=/opt/android-on-linux/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/:$PATH

  40. export PATH=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/:$PATH

  41. export PATH=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/:$PATH

  42. export PATH=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/:$PATH

  43. export CROSS_COMPILE=arm-linux-androideabi-
  44. export ARCH=arm
  45. make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- menuconfig

  46. make mrproper

  47. make ARCH=arm -j4
  48. make ARCH=arm modules -j4

  49. make ARCH=arm modules -j4
  50. make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- modules -j4
  51. make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- -j4

  52. make ARCH=arm CROSS_COMPILE=/your/cross/compile/prefix M=path/to/module/directory O=/home/name/build/kernel

  53. make O=/home/name/build/kernel modules_install install

  54. make -j4 zImage
  55. make -j4 modules



  56. make clean && make mrproper
  57. make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- menuconfig
  58. ----------------------------------
  59. make menuconfig
  60.         Kernel Features --->
  61.                 [*] Use the ARM EABI to compile the kernel
  62.                 [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)
  63. -------------该设置解决如下问题:
  64. arm-linux-androideabi-ld: internal error in relocate_special_relocatable, at /s/ndk-toolchain/src/build/../binutils/binutils-2.24/gold/arm.cc:9904
  65. make[2]: *** [sound/core/pcm_native.o] 错误 1
  66. make[1]: *** [sound/core] 错误 2
  67. make: *** [sound] 错误 2
  68. ----------------------------------
  69. Device Drivers --->
  70.     <*> MMC/SD card support --->
  71.         -*- MMC/SD card support
  72.         <*> MMC block device driver
  73.         [*] Use bounce buffer for simple hosts
  74. -------------该设置解决如下问题:
  75. ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
  76. ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
  77. ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
  78. ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
  79. make[1]: *** [__modpost] 错误 1
  80. make: *** [modules] 错误 2

  81. ----------------------------------解决了上面两个问题后,如下版本的编译器应该都能正常编译内核(没有再次依次验证,因为费时)
  82. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-

  83. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-

  84. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- modules

  85. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-


  1. 编译batman-adv.ko—成功
  2. [root@localhost android-3.10]# ll -h net/batman-adv/batman-adv.ko
    -rw-r--r--. 1 root root 4.0M 1月   8 11:26 net/batman-adv/batman-adv.ko
    [root@localhost android-3.10]#



  3. ----------------------------------
  4. 指定ko安装路径
  5. make modules_install INSTALL_MOD_PATH=/run/media/root/11fb38b3-24ee-4306-b554-40aaeae1a204/android/Android4.4-with-kernel/kernel/common/android-3.10/out_modules
  6. ----------------------------------


  1. ----------------------------------+++++++++++++++++++++++++++++++++++++++++++++++++
  2. 查看手机 内核 使用的 编译器:
  3. shell@hwCHM-H:/storage/sdcard1 $ cat /proc/version
  4. Linux version 3.10.49-g28addc2 (android@localhost) (gcc version 4.7.3 20121205 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2012.12-20121214 - Linaro GCC 2012.12) ) #1 SMP PREEMPT Tue Nov 10 04:10:35 CST 2015
  5. 下载编译器:
  6. wget http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz
  7. tar xvf gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz -C gcc-linaro

  8. ----------------------------------
  9. make clean && make mrproper
  10. make ARCH=arm CROSS_COMPILE=arm-none-eabi- menuconfig
  11. ----------------------------------
  12. make menuconfig
  13.         Kernel Features --->
  14.                 [*] Use the ARM EABI to compile the kernel
  15.                 [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)

  16. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi-
  17. --------
  18.   Kernel: arch/arm/boot/zImage is ready
  19. ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
  20. ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
  21. ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
  22. ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
  23. make[1]: *** [__modpost] 错误 1
  24. make: *** [modules] 错误 2
  25. [root@localhost android-3.10]#

  26. ----------------------------------
  27. http://www.veryarm.com/arm-linux-gnueabihf-gcc
  28. 下载编译器:gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.bz2

  29. make clean && make mrproper
  30. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
  31. ----------------------------------
  32. make menuconfig
  33.         Kernel Features --->
  34.                 [*] Use the ARM EABI to compile the kernel
  35.                 [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)

  36. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf-
  37. ------
  38.   Kernel: arch/arm/boot/zImage is ready
  39. ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
  40. ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
  41. ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
  42. ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
  43. make[1]: *** [__modpost] 错误 1
  44. make: *** [modules] 错误 2
  45. [root@localhost android-3.10]#

  46. ----------------------------------+++++++++++++++++++++++++++++++++++++++++++++++++

  47. [root@localhost android-3.10]# make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
  48. --------
  49. : unwinding may not work because EXIDX input section 905 of net/built-in.o is not in EXIDX output section
  50.   SORTEX vmlinux
  51.   SYSMAP System.map
  52.   OBJCOPY arch/arm/boot/Image
  53.   Building modules, stage 2.
  54.   MODPOST 1840 modules
  55.   Kernel: arch/arm/boot/Image is ready
  56.   AS arch/arm/boot/compressed/head.o
  57.   GZIP arch/arm/boot/compressed/piggy.gzip
  58.   CC arch/arm/boot/compressed/misc.o
  59.   CC arch/arm/boot/compressed/decompress.o
  60.   CC arch/arm/boot/compressed/string.o
  61.   SHIPPED arch/arm/boot/compressed/hyp-stub.S
  62.   SHIPPED arch/arm/boot/compressed/lib1funcs.S
  63.   SHIPPED arch/arm/boot/compressed/ashldi3.S
  64.   AS arch/arm/boot/compressed/hyp-stub.o
  65.   AS arch/arm/boot/compressed/lib1funcs.o
  66.   AS arch/arm/boot/compressed/ashldi3.o
  67.   AS arch/arm/boot/compressed/piggy.gzip.o
  68.   LD arch/arm/boot/compressed/vmlinux
  69.   OBJCOPY arch/arm/boot/zImage
  70.   Kernel: arch/arm/boot/zImage is ready
  71. ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
  72. ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
  73. ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
  74. ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
  75. make[1]: *** [__modpost] 错误 1
  76. make: *** [modules] 错误 2
  77. [root@localhost android-3.10]#

  78. ----------------------------------
  79. [root@localhost android-3.10]# make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- modules
  80. ------
  81.   Building modules, stage 2.
  82.   MODPOST 1837 modules
  83. ERROR: "__audit_inode_child" [net/sunrpc/sunrpc.ko] undefined!
  84. ERROR: "xfrm_audit_state_delete" [net/key/af_key.ko] undefined!
  85. ERROR: "xfrm_audit_state_add" [net/key/af_key.ko] undefined!
  86. ERROR: "xfrm_audit_policy_add" [net/key/af_key.ko] undefined!
  87. ERROR: "xfrm_audit_policy_delete" [net/key/af_key.ko] undefined!
  88. ERROR: "__audit_inode_child" [fs/btrfs/btrfs.ko] undefined!
  89. ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
  90. ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
  91. ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
  92. ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
  93. make[1]: *** [__modpost] 错误 1
  94. make: *** [modules] 错误 2
  95. [root@localhost android-3.10]#

  96. ----------------------------------
  97. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
  98. ------
  99.   Kernel: arch/arm/boot/zImage is ready
  100. ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
  101. ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
  102. ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
  103. ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
  104. ERROR: "__aeabi_uldivmod" [drivers/md/dm-cache.ko] undefined!
  105. make[1]: *** [__modpost] 错误 1
  106. make: *** [modules] 错误 2
  107. ----------------------------------

  108. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  109. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi- CONFIG_AEABI=y

  110. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  111. 在交叉编译或编译Linux内核的时候需要把,内核或内核的模块安装到指定的目录。
  112. 可使用命令: make install 和make modules_install 。
  113. 同时指定路径分别为,INSTALL_PATH和INSTALL_MOD_PATH。
  114. 不过在指定路径的时候可得要注意了,一定要为绝对路径而非相对路径。

  115. ----------------------------------
  116. [root@localhost android-3.10]# mkdir out_modules
  117. [root@localhost android-3.10]# pwd
  118. /run/media/root/11fb38b3-24ee-4306-b554-40aaeae1a204/android/Android4.4-with-kernel/kernel/common/android-3.10

  119. 指定ko安装路径
  120. make modules_install INSTALL_MOD_PATH=/run/media/root/11fb38b3-24ee-4306-b554-40aaeae1a204/android/Android4.4-with-kernel/kernel/common/android-3.10/out_modules
  121. ----------------------------------

  122. 应用安装指定
  123. make install DESTDIR=/home/luther/gliethttp_dir
  124. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  125.  内核开发基础——make mrproper及mrproper的含义

  126.  Linux下面去编译项目之前,一般常会用make mrproper去先删除之前编译所生成的文件和配置文件,备份文件等,其中,mrproper和distclean,clean之间的区别,Linux内核源码根目录下面的makefile中,有很清晰的解释:
  127. help:
  128.  @echo 'Cleaning targets:'
  129.  @echo ' clean - Remove most generated files but keep the config and'
  130.  @echo ' enough build support to build external modules'
  131.  @echo ' mrproper - Remove all generated files + config + various backup files'
  132.  @echo ' distclean - mrproper + remove editor backup and patch files'
  133. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  134. arm-eabi, arm-linux-androideabi, arm-linux-gnueabi, arm-none-linux-gnueabi工具链的区别

  135. 链接工具命名方式为:
  136.     arch-vendor-os-abi , 即cpu构架, 供应商, 操作系统, abi类型

  137. 例如:
  138. 1、arm-none-linux-gnueabi
  139.      (ARM architecture, no vendor, linux OS, and the gnueabi ABI)
  140.         用于编译ARM架构的u-boot、linux内核、linux应用等
  141. 2、arm-none-eabi
  142.         用于编译ARM架构的裸机系统(包括linux的 boot、kernel)
  143. 3、arm-eabi
  144.         Android ARM 编译器

  145. 所以标题中提到的工具链表示的含义是:
  146. arm-eabi: (ARM architecture and the EABI)
  147. arm-linux-androideabi: (ARM architecture, linux OS, and the androideabi ABI)
  148. arm-linux-guneabi: (ARM architecture, linux OS, and the gnueabi ABI)
  149. arm-none-linux-gnueabi: (ARM architecture, no vendor, linux OS, and the gnueabi ABI)

  150. 工具链的工具通常有:
  151. add2line:将你要找的地址转成文件和行号,它要使用 debug 信息。
  152. ar:产生、修改和解开一个存档文件
  153. as:gnu的汇编器
  154. c++filt:C++ 和 java 中有一种重载函数,所用的重载函数最后会被编译转化成汇编的标,c++filt 就是实现这种反向的转化,根据标号得到函数名
  155. gprof:gnu 汇编器预编译器
  156. ld:gnu 的连接器
  157. nm:列出目标文件的符号和对应的地址
  158. objcopy:将某种格式的目标文件转化成另外格式的目标文件
  159. objdump:显示目标文件的信息
  160. ranlib:为一个存档文件产生一个索引,并将这个索引存入存档文件中
  161. readelf:显示 elf 格式的目标文件的信息
  162. size:显示目标文件各个节的大小和目标文件的大小
  163. strings:打印出目标文件中可以打印的字符串,有个默认的长度,为4
  164. strip:剥掉目标文件的所有的符号信息

  165. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  166. 编译错误,用了arm-linux-androideabi-4.6、arm-linux-androideabi-4.7、arm-linux-androideabi-4.9,同样错误
  167. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  168.   CC [M] drivers/w1/slaves/w1_ds2781.o
  169.   CC [M] drivers/watchdog/pcwd_usb.o
  170.   CC [M] drivers/watchdog/softdog.o
  171.   CC [M] sound/sound_core.o
  172.   LD [M] sound/soundcore.o
  173.   CC [M] sound/ac97_bus.o
  174.   CC [M] sound/core/compress_offload.o
  175.   CC [M] sound/core/hwdep.o
  176.   CC [M] sound/core/memalloc.o
  177.   CC [M] sound/core/pcm.o
  178.   CC [M] sound/core/pcm_native.o
  179. arm-linux-androideabi-ld: internal error in relocate_special_relocatable, at /s/ndk-toolchain/src/build/../binutils/binutils-2.24/gold/arm.cc:9904
  180. make[2]: *** [sound/core/pcm_native.o] 错误 1
  181. make[1]: *** [sound/core] 错误 2
  182. make: *** [sound] 错误 2

  183. ------------------解决方法
  184. 在内核配置的时候选择上如下内容:

  185. 方法一:
  186. make menuconfig
  187.         Kernel Features --->
  188.                 [*] Use the ARM EABI to compile the kernel
  189.                 [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)

  190. 方法二:
  191. make -j4 ARCH=arm CROSS_COMPILE=/opt/android-on-linux/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi- CONFIG_AEABI=y


  192. 参考:http://blog.chinaunix.net/uid-14735472-id-5593127.html

  193. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  194. Looks like some kernel config settings are missing (noch sure which ones).
  195. Instead of copying the kernel config do a "make bcmrpi_defconfig" in the cirrus tree. Just tried it here and it worked fine.
  196. +++++++++
  197. 默认配置文件
  198. +++++++++++
  199. [root@localhost android-3.10]# ls ./arch/arm/configs/

  200. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  201. https://github.com/m-stein/linux/issues/1

  202. ### Get toolchain ###
  203. wget http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz
  204. tar xvf gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz -C $MY_GCC_DIR

  205. ### Build ###
  206. make -C $MY_LX_SRC_DIR ARCH=arm CROSS_COMPILE=$MY_GCC_DIR/bin/arm-none-eabi- O=$MY_LX_BUILD_DIR imx_v53_usb_armory_defconfig &&
  207. make -C $MY_LX_BUILD_DIR ARCH=arm CROSS_COMPILE=$MY_GCC_DIR/bin/arm-none-eabi- -j$MY_CPUS zImage LOADADDR=0x80008000 &&
  208. make -C $MY_LX_BUILD_DIR ARCH=arm CROSS_COMPILE=$MY_GCC_DIR/bin/arm-none-eabi- dtbs

  209. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++










<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(208) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
posted @ 2016-02-01 00:00  张同光  阅读(166)  评论(0编辑  收藏  举报