不知道啥时候变懒了,linux只想能用就行,不想去搞定驱动的事清,但是很不愿意装ubuntu,从它那里学不到linux的知识。于是ati的驱动就那么放着一直用vesa,反正9.3版本的fglrx安装不上。某天想将9.3的ati驱动装上,让mplayer更流畅一点,于是有了下面的经历。
1、阶段1
直接运行ati-driver-installer-9-3-x86.x86_64.run,编译失败,查看log是我的build和source指向的路径不对,于是从kernel.org下载来源码,放到/usr/src,又将build和source文件指向路径指对了,编译告警改变了,说找不到version.h,搜了一通走了些弯路,找到了生成version.h的办法:,运行modprobe oldconfig&&modprobe modules_prepare,生成了正确的versing.h和utsreleae.h。
2、阶段2
此时再运行ati-driver-installer-9-3-x86.x86_64.run,告警又变了,提示
they are versioned as ""
instead of "2.6.31.5my".
you might need to adjust your symlinks:
- /usr/include
- /usr/src/linux
[Error] Kernel Module : Failed to compile kernel module - please consult readme.
解决不了,于是解压出ati的源码,修改lib/modules/fglrx/build_mod/2.6.x/下的Makefile文件,给EXTRA_CFLAGS添加了当前内核的include路径
之后运行ati-driver-installer-9-3-x86.x86_64.run提示firegl_public.c编译有错,后来找到是内核文件变,task_struct结构变了,增加了cred来指向euid,在google搜搜到一篇文件章将task_struct更变的地方修改的方法,又查了内核源码,确实我用的版本也改了,之后有搜到一个fglrx的patch,根据patch的内容,修改了task_struct的指向,又修改了*(kernel_cap_t *)¤t->cred->cap_effective,屏蔽了#error unknown or undefined architecture configured,这部分终于能过了
3、阶段3
经过一行步骤已经能否生成fglrx的内核模块了,但是加载不进去,可能是由于我用的内核是先编译的,后来删掉了源码,而装驱动的时候用的源码是从kernel.org新下的,于是重新编译内核
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
以下是参考的网页:
http://hi.baidu.com/yinjianren/blog/item/bfd2e313cfedbe8c6438db07.html
如何配置内核
2010年04月23日 星期五 20:25
前提:
1. 运行良好的Linux 系统
2. pciutils 工具包
$lspci -k # 列举出您的Linux此时所必须的模块
......
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01) Kernel driver in use: i801_smbus Kernel modules: i2c-i801 # 内核对应选项是 CONFIG_I2C_I801 01:00.0 VGA compatible controller: ATI Technologies Inc RV610 video device [Radeon HD 2400 PRO] Kernel driver in use: fglrx_pci Kernel modules: fglrx 03:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8056 PCI-E Gigabit Ethernet Controller (rev 14) Kernel driver in use: sky2 Kernel modules: sky2 # 内核对应选项是 CONFIG_SKY2
$ ## 有一些模块要反着搜。如 intel-agp,就是 AGP_INTEL,多搞搞就熟悉了(减少字符也是办法)。 $ # 一般来说,make menuconfig 之前还是先搞一份一般配置。如x86 $ cp arch/x86/configs/i386_defconfig .config $ make menuconfig # 根据lspci -k 得到的信息 在配置的时候搜索: 按"/" 。 $ $ # 然后重要的一条是文件系统 $ cat /etc/fstab # 看看是啥文件系统,编译入内核(*)。 $ $ # 还有处理器芯片, 用hardinfo 查看吧,不懂就默认。 $ $ # 编译吧 $ make -j cpu_number*2 # 从gentoo 安装手册看到的,至于为啥。 $ make -j cpu_number*2 modules_install $ sudo cp arch/i386/boot/bzImage /
$ # 编辑引导程序的配置文件 (自理)
PS: 我的 ATI Radeon HD 2400,安装时使劲的报错: ---------------------------------错误的分割线-------------------------------------- [Message] Kernel Module : Trying to install a precompiled kernel module. [Message] Kernel Module : Precompiled kernel module version mismatched. [Message] Kernel Module : Found kernel module build environment, generating kernel module now. AMD kernel module generator version 2.1 Error: kernel includes at /lib/modules/2.6.33.2/build/include do not match current kernel. they are versioned as "" instead of "2.6.33.2". you might need to adjust your symlinks: - /usr/include - /usr/src/linux [Error] Kernel Module : Failed to compile kernel module - please consult readme.
其实,并不是我们的Linux kernel有问题,而是ATI的驱动并没有更新及时,详细的讨论在, ,。 。
jimi@debian20:09:25 ~/ati $ ls
ati-driver-installer-10-3-x86.x86_64.run fglrx-2.6.33.patch
jimi@debian20:09:26 ~/ati $ ./ati-driver-installer-10-3-x86.x86_64.run --extract .
Warning: target directory exists .
Verifying archive integrity... All good.
Uncompressing ATI Proprietary Linux Driver-8.712..................(...)
jimi@debian20:12:15 ~/ati $ patch -p1 < fglrx-2.6.33.patch
patching file common/lib/modules/fglrx/build_mod/drmP.h
patching file common/lib/modules/fglrx/build_mod/firegl_public.c
Hunk #3 succeeded at 1470 (offset -2 lines).
patching file common/lib/modules/fglrx/build_mod/kcl_acpi.c
patching file common/lib/modules/fglrx/build_mod/kcl_agp.c
patching file common/lib/modules/fglrx/build_mod/kcl_io.c
patching file common/lib/modules/fglrx/build_mod/kcl_osconfig.h
patching file common/lib/modules/fglrx/build_mod/kcl_pci.c
patching file common/lib/modules/fglrx/build_mod/kcl_str.c
patching file common/lib/modules/fglrx/build_mod/kcl_wait.c
patching file common/lib/modules/fglrx/build_mod/make.sh
jimi@debian20:14:46 ~/ati $ sudo ./ati-installer.sh . --install
jimi@debian20:14:46 ~/ati $ # 一路回车,好了,重启系统.
jimi@debian20:14:46 ~/ati $ # 没有声音? alsamixer 全部都调到最高吧, ^_^
jimi@debian20:14:46 ~/ati $ alsamixer
|
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
by » 3. Jan 2009, 16:27
Distro is openSUSE 11.2 Alpha0 x86_64.
Kernel 2.6.28 is OK, from 2.6.28-git1 errors:-
barrabas:/usr/src/vboxdrv-2.1.0 # make
*** Building 'vboxdrv' module ***
make[1]: Entering directory `/usr/share/virtualbox/src/vboxdrv'
make KBUILD_VERBOSE= -C /lib/modules/2.6.28-git5-smp/build
SUBDIRS=/usr/share/virtualbox/src/vboxdrv
SRCROOT=/usr/share/virtualbox/src/vboxdrv modules
make[2]: Entering directory `/usr/src/linux-2.6.28-git5'
CC [M] /usr/share/virtualbox/src/vboxdrv/linux/SUPDrv-linux.o
/usr/share/virtualbox/src/vboxdrv/linux/SUPDrv-linux.c: In function ‘VBoxDrvLinuxCreate’:
/usr/share/virtualbox/src/vboxdrv/linux/SUPDrv-linux.c:706: error: ‘struct task_struct’ has no member named ‘euid’
/usr/share/virtualbox/src/vboxdrv/linux/SUPDrv-linux.c:719: error: ‘struct task_struct’ has no member named ‘uid’
/usr/share/virtualbox/src/vboxdrv/linux/SUPDrv-linux.c:720: error: ‘struct task_struct’ has no member named ‘gid’
make[3]: *** [/usr/share/virtualbox/src/vboxdrv/linux/SUPDrv-linux.o] Error 1
make[2]: *** [_module_/usr/share/virtualbox/src/vboxdrv] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.28-git5'
make[1]: *** [vboxdrv] Error 2
make[1]: Leaving directory `/usr/share/virtualbox/src/vboxdrv'
make: *** [all] Error 2
-
-
- Posts: 10
- Joined: 10. Nov 2007, 02:47
- Location: Halesowen, W. Midlands, UK
by » 4. Jan 2009, 02:34
- Code:
--- a/vboxdrv/linux/SUPDrv-linux.c 2008-12-29 16:15:53.000000000 +0000
+++ b/vboxdrv/linux/SUPDrv-linux.c 2009-01-04 00:02:20.346070537 +0000
@@ -703,7 +703,7 @@
/*
* Only root is allowed to access the device, enforce it!
*/
- if (current->euid != 0 /* root */ )
+ if (current->cred->euid != 0 /* root */ )
{
Log(("VBoxDrvLinuxCreate: euid=%d, expected 0 (root)\n", current->euid));
return -EPERM;
@@ -716,8 +716,8 @@
rc = supdrvCreateSession(&g_DevExt, true /* fUser */, (PSUPDRVSESSION *)&pSession);
if (!rc)
{
- pSession->Uid = current->uid;
- pSession->Gid = current->gid;
+ pSession->Uid = current->cred->uid;
+ pSession->Gid = current->cred->gid;
}
pFilp->private_data = pSession;
-
-
- Posts: 2
- Joined: 4. Jan 2009, 02:03
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
I've made a quick fglrx 9.3 patch for 2.6.29 kernel, already tested under 2.6.29.2 kernel.
to install fglrx:
1. download and install ati 9.3 driver, you will see fglrx errors during "post processing kernel modules ..."
2. put install_patch.sh and 2.6.29.x_fglrx-9.3.patch somewhere in a diretory
3. sh install_patch.sh
2.6.29.x_fglrx-9.3.patch:
Code:
--- build_mod/firegl_public.c 2009-03-18 23:07:22.000000000 +0800
+++ build_mod_new/firegl_public.c 2009-05-01 12:21:32.000000000 +0800
@@ -225,7 +225,7 @@
#endif
#ifdef MODULE_LICENSE
-MODULE_LICENSE("Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY");
+MODULE_LICENSE("GPL");
#endif
#ifdef MODULE_DEVICE_TABLE
MODULE_DEVICE_TABLE(pci, fglrx_pci_table);
@@ -1402,7 +1402,7 @@
*/
KCL_TYPE_Uid ATI_API_CALL KCL_GetEffectiveUid(void)
{
- return current->euid;
+ return current->cred->euid;
}
/** /brief Delay execution for the specified number of microseconds
@@ -1776,11 +1776,11 @@
{
if (lock == 0 )
{
- cap_lower(current->cap_effective, CAP_IPC_LOCK);
+ cap_lower(*(kernel_cap_t *)¤t->cred->cap_effective, CAP_IPC_LOCK);
}
else
{
- cap_raise(current->cap_effective, CAP_IPC_LOCK);
+ cap_raise(*(kernel_cap_t *)¤t->cred->cap_effective, CAP_IPC_LOCK);
}
return;
}
--- build_mod/kcl_acpi.c 2009-03-18 23:07:22.000000000 +0800
+++ build_mod_new/kcl_acpi.c 2009-05-01 12:21:32.000000000 +0800
@@ -21,6 +21,9 @@
#include "kcl_config.h"
#include "kcl_type.h"
#include "kcl_acpi.h"
+#include "../acconfig.h"
+#include "../aclocal.h"
+#include "../acobject.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
install_patch.sh:
Code:
#!/bin/bash
PATCHPATH=$(pwd)
KERNV=$(uname -r)
MODPATH=/lib/modules
KERNPATH=/usr/src/linux
echo -e "Installing patch ..."
cd $MODPATH/fglrx
cp $KERNPATH/drivers/acpi/acpica/{acconfig.h,aclocal.h,acobject.h} build_mod/
patch -Np0 < $PATCHPATH/2.6.29.x_fglrx-9.3.patch
cd $MODPATH/fglrx/build_mod
sh make.sh
cd ..
sh make_install.sh
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
最佳答案 | |
|
我原来遇到过,记录到我blog的文章
软件环境:2.6.17.14内核版本,在kernel.org上下载后,开始制作arm和x86的交叉编译环境,最后写了一个驱动的demo测试,发现在进行编译驱动的demo的时候,一直报错:
Makefile:438: .config: No such file or directory
于是在内核里随便找了个缺少的文件cp arch/arm/configs/s3c2410_defconfig ./.config
然后再make,接着报错:
huyongfu@huyongfu-desktop:~/Develop_Src/char_dev/module$ make
make -C /home/huyongfu/cross_complie/linux-2.6.17.14 SUBDIRS=/home/huyongfu/Develop_Src/char_dev/module modules
make[1]: Entering directory `/home/huyongfu/cross_complie/linux-2.6.17.14'
WARNING: Symbol version dump /home/huyongfu/cross_complie/linux-2.6.17.14/Module.symvers
is missing; modules will have no dependencies and modversions.
Building modules, stage 2.
MODPOST
/bin/sh: scripts/mod/modpost: No such file or directory
make[2]: *** [__modpost] Error 127
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/huyongfu/cross_complie/linux-2.6.17.14'
make: *** [modules] Error 2
这个问题还从来没有遇到过,原来编译内核的时候也没有这种错误,有的网站上说:“在内核下,先执行make modules_prepare,执行完毕再进行make”
我认为这并不是解决该问题的本质原因,导致这个问题的原因是modpost这个可执行文件没有生成,到目录下
%linux/scripts/mod下查看并没有这个文件,所以错误提示:No such file or
directory,问题出在编译内核的过程中。因此把内核重新解包,修改makefile,然后重新进行编译,发现这次编译内核的时间明显比上次长,而
且生成zImage的文件也比上次的大,但是上次编译的时候makefile确实没有报错误,而且还提示zImage is
already,所以有时候不要相信编译器,编译器不报错不等于没错,最相信的还是自己,根据现象找出本质。这个问题也折磨了我两个小时。
编译完内核后再去make我的驱动demo:
huyongfu@huyongfu-desktop:~/Develop_Src/char_dev/module$ make
make -C /home/huyongfu/cross_complie/linux-2.6.17.14 SUBDIRS=/home/huyongfu/Develop_Src/char_dev/module modules
make[1]: Entering directory `/home/huyongfu/cross_complie/linux-2.6.17.14'
CC [M] /home/huyongfu/Develop_Src/char_dev/module/char_dev_example.o
Building modules, stage 2.
MODPOST
CC /home/huyongfu/Develop_Src/char_dev/module/char_dev_example.mod.o
LD [M] /home/huyongfu/Develop_Src/char_dev/module/char_dev_example.ko
make[1]: Leaving directory `/home/huyongfu/cross_complie/linux-2.6.17.14'
已经编译通过。
那么modpos这个文件缺少了,直接导致驱动编译失败,那么这个文件的作用是什么呢?从编译的过程日志中可以看到,他的作用应该是就爱嗯.o文件转成.ko文件的,这样我们用.ko文件才能去内核里insmod。 |
阅读(889) | 评论(0) | 转发(0) |