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

原创
2020/03/14 10:46
阅读数 215
cm11开发者源码.tar
文件大小:9.8G
http://pan.baidu.com/share/link?uk=1663710139&shareid=3849829323

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


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

?说明

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

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

//ztg add
//通过git branch -r或-a查询,选项r只能查远程版本,选项a会把本地和远程的版本都列出
[root@localhost common]# git branch -a
* (分离自 origin/android-2.6.39)
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/android-2.6.39
  remotes/origin/android-3.0
  remotes/origin/android-3.10
  remotes/origin/android-3.10-adf
  remotes/origin/android-3.3
  remotes/origin/android-3.4
  remotes/origin/android-3.4-compat
  remotes/origin/bcmdhd-3.10
  remotes/origin/coupled-cpuidle
  remotes/origin/experimental/android-3.10
  remotes/origin/experimental/android-3.10-rc5
  remotes/origin/experimental/android-3.8
  remotes/origin/experimental/android-3.9
  remotes/origin/experimental/android-3.9-rc2
  remotes/origin/experimental/android-3.9-rc7
  remotes/origin/linux-bcm43xx-2.6.39
  remotes/origin/master

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

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

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

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

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

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

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

export CROSS_COMPILE=arm-linux-androideabi-
export ARCH=arm
make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- menuconfig

make mrproper

make ARCH=arm -j4
make ARCH=arm modules -j4

make ARCH=arm modules -j4
make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- modules -j4
make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- -j4

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

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

make -j4 zImage
make -j4 modules



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

----------------------------------解决了上面两个问题后,如下版本的编译器应该都能正常编译内核(没有再次依次验证,因为费时)
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-

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-

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

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-


    编译batman-adv.ko—成功
    [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]#




    ----------------------------------
    指定ko安装路径
    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
    ----------------------------------


----------------------------------+++++++++++++++++++++++++++++++++++++++++++++++++
    查看手机 内核 使用的 编译器:
    shell@hwCHM-H:/storage/sdcard1 $ cat /proc/version
    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
    下载编译器:
    wget http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz
    tar xvf gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz -C gcc-linaro

    ----------------------------------
    make clean && make mrproper
    make ARCH=arm CROSS_COMPILE=arm-none-eabi- menuconfig
    ----------------------------------
    make menuconfig
            Kernel Features --->
                    [*] Use the ARM EABI to compile the kernel
                    [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)

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

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

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

    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-
    ------
      Kernel: arch/arm/boot/zImage is ready
    ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
    make[1]: *** [__modpost] 错误 1
    make: *** [modules] 错误 2
    [root@localhost android-3.10]#

    ----------------------------------+++++++++++++++++++++++++++++++++++++++++++++++++

    [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-
    --------
    : unwinding may not work because EXIDX input section 905 of net/built-in.o is not in EXIDX output section
      SORTEX vmlinux
      SYSMAP System.map
      OBJCOPY arch/arm/boot/Image
      Building modules, stage 2.
      MODPOST 1840 modules
      Kernel: arch/arm/boot/Image is ready
      AS arch/arm/boot/compressed/head.o
      GZIP arch/arm/boot/compressed/piggy.gzip
      CC arch/arm/boot/compressed/misc.o
      CC arch/arm/boot/compressed/decompress.o
      CC arch/arm/boot/compressed/string.o
      SHIPPED arch/arm/boot/compressed/hyp-stub.S
      SHIPPED arch/arm/boot/compressed/lib1funcs.S
      SHIPPED arch/arm/boot/compressed/ashldi3.S
      AS arch/arm/boot/compressed/hyp-stub.o
      AS arch/arm/boot/compressed/lib1funcs.o
      AS arch/arm/boot/compressed/ashldi3.o
      AS arch/arm/boot/compressed/piggy.gzip.o
      LD arch/arm/boot/compressed/vmlinux
      OBJCOPY arch/arm/boot/zImage
      Kernel: arch/arm/boot/zImage is ready
    ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
    make[1]: *** [__modpost] 错误 1
    make: *** [modules] 错误 2
    [root@localhost android-3.10]#

    ----------------------------------
    [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
    ------
      Building modules, stage 2.
      MODPOST 1837 modules
    ERROR: "__audit_inode_child" [net/sunrpc/sunrpc.ko] undefined!
    ERROR: "xfrm_audit_state_delete" [net/key/af_key.ko] undefined!
    ERROR: "xfrm_audit_state_add" [net/key/af_key.ko] undefined!
    ERROR: "xfrm_audit_policy_add" [net/key/af_key.ko] undefined!
    ERROR: "xfrm_audit_policy_delete" [net/key/af_key.ko] undefined!
    ERROR: "__audit_inode_child" [fs/btrfs/btrfs.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
    make[1]: *** [__modpost] 错误 1
    make: *** [modules] 错误 2
    [root@localhost android-3.10]#

    ----------------------------------
    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-
    ------
      Kernel: arch/arm/boot/zImage is ready
    ERROR: "__tracepoint_mmc_blk_rw_start" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_erase_end" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_erase_start" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__tracepoint_mmc_blk_rw_end" [drivers/mmc/core/mmc_core.ko] undefined!
    ERROR: "__aeabi_uldivmod" [drivers/md/dm-cache.ko] undefined!
    make[1]: *** [__modpost] 错误 1
    make: *** [modules] 错误 2
    ----------------------------------

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    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

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

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

    指定ko安装路径
    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
    ----------------------------------

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

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

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

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

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

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

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    编译错误,用了arm-linux-androideabi-4.6、arm-linux-androideabi-4.7、arm-linux-androideabi-4.9,同样错误
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      CC [M] drivers/w1/slaves/w1_ds2781.o
      CC [M] drivers/watchdog/pcwd_usb.o
      CC [M] drivers/watchdog/softdog.o
      CC [M] sound/sound_core.o
      LD [M] sound/soundcore.o
      CC [M] sound/ac97_bus.o
      CC [M] sound/core/compress_offload.o
      CC [M] sound/core/hwdep.o
      CC [M] sound/core/memalloc.o
      CC [M] sound/core/pcm.o
      CC [M] sound/core/pcm_native.o
    arm-linux-androideabi-ld: internal error in relocate_special_relocatable, at /s/ndk-toolchain/src/build/../binutils/binutils-2.24/gold/arm.cc:9904
    make[2]: *** [sound/core/pcm_native.o] 错误 1
    make[1]: *** [sound/core] 错误 2
    make: *** [sound] 错误 2

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

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

    方法二:
    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


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

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

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

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

    ### Build ###
    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 &&
    make -C $MY_LX_BUILD_DIR ARCH=arm CROSS_COMPILE=$MY_GCC_DIR/bin/arm-none-eabi- -j$MY_CPUS zImage LOADADDR=0x80008000 &&
    make -C $MY_LX_BUILD_DIR ARCH=arm CROSS_COMPILE=$MY_GCC_DIR/bin/arm-none-eabi- dtbs

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





展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部