myoldman 发表于 2014-1-6 11:33:04

cubietruck lubuntu server v1.01 内核编译,并且驱动eth0心得

我想自己替换最新的8192cu驱动实现hostapd功能,一开始用自带内核编译8192cu.ko模块,换了n个内核source,insmod的死活报说disgree module_layout。
绝望的我只能想着自己编译替换内核解决。
于是尼玛发现更坑爹,编译出来的内核死活驱动不了eth0/
最后走了好多弯路(此处省略好几十万字!!!!)最后发现原来是编译器有问题!!!!!!
坑爹的文档!!!!!!!!!!!!!!!!!!!!!!!!!!
步骤如下
1.toolchain准备
参考如下文档
http://linux-sunxi.org/Toolchain
这里有个大坑,千万不能用下面这个编译器!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sudo add-apt-repository ppa:linaro-maintainers/toolchain
   sudo apt-get update
   sudo apt-get install gcc-arm-linux-gnueabi
这个编译器,编译出来的有问题,网卡绝对驱动不了。

我用的是gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz这个编译器,妥妥的。

2.准备linux-kernel
$git clone http://github.com/cubieboard/linux-sunxi.git.config我是在lubuntu server 1.01上的/proc/config.gz解压来的,绝对和板子上运行的一致
cd linux-sunxi
git checkout -b cubie-3.4 cubie/sunxi-3.4
3.编译内核
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install
漫长等待
然后打包out/lib/modules 上传到开发板替换开发板的/lib/modules目录
上传uImage到开发板子
sudo mount /dev/nanda /mnt
sudo cp uImage /mnt

最后重启如果看到
Linux version 3.4.61+ (liuhong@liuhong-SH560) (gcc version 4.7.3 20130328 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.04-20
130415 - Linaro GCC 2013.04) ) #2 SMP PREEMPT Mon Jan 6 10:50:10 CST 20这里的内容有变化了,并且eth0驱动起来了,就说明内核替换成功了。











wwuw 发表于 2014-1-6 15:08:22

本帖最后由 wwuw 于 2014-3-12 17:57 编辑

我一直用的是GNU的官方gcc,没有出现过问题。不过,编译cubian的内核时,发现eth0不能用,必须屏蔽一个device才能行,我用cubian img的时候也是eth0不能用,还真不知道是cubian本身问题还是我的环境问题。
----------------------------
原来问题是自己的fex文件没有配置对导致故障。

cubieplayer 发表于 2014-1-6 17:33:50

本帖最后由 cubieplayer 于 2014-1-6 17:36 编辑

wwuw 发表于 2014-1-6 15:08 static/image/common/back.gif
我一直用的是GNU的官方gcc,没有出现过问题。不过,编译cubian的内核时,发现eth0不能用,必须屏蔽一个devi ...
cubian的内核没有合入ct上的有线网卡驱动,不过马上就解决了,我在本地已经rebase了主流,还没有push到github上。toolchain建议使用 https://github.com/cubieplayer/toolchain 分支 arm-2010.09 没有任何问题

myoldman 发表于 2014-1-6 23:45:34

我擦,原来发的有问题,用4.7的gcc编译出来的网卡驱动,接收包没问题,一发送包就kernel panic。
后来采用如下gcc终于搞定了。不容易啊
liuhong@liuhong-SH560:~/Downloads/linux-sunxi/output/lib$ arm-linux-gnueabihf-gcc -v
使用内建 specs。
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
目标:arm-linux-gnueabihf
配置为:../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-8ubuntu1~ppa1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabihf/include/c++/4.6.3 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include --with-headers=/usr/arm-linux-gnueabihf/include --with-libs=/usr/arm-linux-gnueabihf/lib
线程模型:posix
gcc 版本 4.6.3 20120624 (prerelease) (Ubuntu/Linaro 4.6.3-8ubuntu1~ppa1)

myoldman 发表于 2014-1-6 23:47:52

在这里小吐槽一下,官网文档上完全没有提到4.7的gcc编译出来的内核会导致网络有问题,害得我走了这么大一段弯路,还请斑竹修改一下官网上文档以免继续误导后来人。
以上谢谢!!!!

wwuw 发表于 2014-1-10 15:33:18

我用4.6的不行,4.7的不行,4.8的也不行,关键是需要取消一个硬件设备,网卡和其它的都正常。显然不是因为4.7导致网卡不通。

myoldman 发表于 2014-1-12 13:02:00

wwuw 发表于 2014-1-10 15:33 static/image/common/back.gif
我用4.6的不行,4.7的不行,4.8的也不行,关键是需要取消一个硬件设备,网卡和其它的都正常。显然不是因为4 ...

不可能啊,我用4.6的一点问题没有,什么设备都没取消~~,用4.7,4.8的压根不行。
你是取消了什么设备?

关于这个4.6的可以编译的,你可以看看这个帖子,
http://www.cubieforumcs.com/index.php/topic,1059.15.html
里面得出的结论就是用4.6的编译器是没有问题的。

wwuw 发表于 2014-1-12 17:54:12

myoldman 发表于 2014-1-12 13:02 static/image/common/back.gif
不可能啊,我用4.6的一点问题没有,什么设备都没取消~~,用4.7,4.8的压根不行。
你是取消了什么设备?



也许你的配置中就根本没有选中那个设备,是soc声卡。
你给的那个链接不能连上。

myoldman 发表于 2014-1-12 23:31:13

wwuw 发表于 2014-1-12 17:54 static/image/common/back.gif
也许你的配置中就根本没有选中那个设备,是soc声卡。
你给的那个链接不能连上。 ...

CONFIG_SND_SOC=y
CONFIG_SOUND_SUNXI=y
CONFIG_SND_SUNXI_SOC_CODEC=y
CONFIG_SND_SUNXI_SOC_HDMIAUDIO=y
CONFIG_SND_SUNXI_SOC_SPDIF=m
CONFIG_SND_SOC_I2C_AND_SPI=y

你说的SOC是上面这写配置么?
我这边的config都是有勾上的。

wwuw 发表于 2014-1-13 11:47:10

myoldman 发表于 2014-1-12 23:31 static/image/common/back.gif
CONFIG_SND_SOC=y
CONFIG_SOUND_SUNXI=y
CONFIG_SND_SUNXI_SOC_CODEC=y


你的选项是都选上了的。
我试验一下4.6的版本。
页: [1] 2
查看完整版本: cubietruck lubuntu server v1.01 内核编译,并且驱动eth0心得