# rt-sources & ati-drivers

## darkmanPPT

Pare che sia un problema noto ma non capisco come applicare la soluzione.

versione del kernel in questione: 2.6.33.7-rt29[/code]

Pare che se si usa un kernel realtime, non sia possibile compilare i driver closed ati.

```
>>> Unpacking source...

>>> Source unpacked in /var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work

>>> Preparing source in /var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work ...

 * Applying ati-drivers-fix_compilation-bug-297322.patch ...                                                                                                           [ ok ]

 * Applying ati-drivers-CVE-2010-3081-fix.patch ...                                                                                                                    [ ok ]

 * Applying ati-powermode-opt-path-2.patch ...                                                                                                                         [ ok ]

 * Converting 2.6.x/Makefile to use M= instead of SUBDIRS= ...                                                                                                         [ ok ]

>>> Unpacking ./../common/usr/src/ati/fglrx_sample_source.tgz to /var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/extra

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work ...

 * Preparing fglrx module

make -j2 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS= GCC_VER_MAJ=4 KVER=2.6.33.7-rt291 KDIR=/usr/src/linux ARCH_COMPAT_ALLOC_USER_SPACE=0 kmod_build 

make -C /usr/src/linux M=/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x modules

make[1]: Entering directory `/usr/src/linux-2.6.33.7-rt29'

  CC [M]  /var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o

  CC [M]  /var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/kcl_acpi.o

/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘fglrx_pci_suspend’:

/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:841: error: implicit declaration of function ‘acquire_console_sem’

/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:863: error: implicit declaration of function ‘release_console_sem’

/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘firegl_init_module’:

/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:1036: error: expected expression before ‘{’ token

/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘KAS_Mutex_Initialize’:

/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:5099: error: implicit declaration of function ‘init_MUTEX’

make[2]: *** [/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [_module_/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work/common/lib/modules/fglrx/build_mod/2.6.x] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.33.7-rt29'

make: *** [kmod_build] Error 2

 * ERROR: x11-drivers/ati-drivers-10.9-r1 failed:

 *   Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS=  GCC_VER_MAJ=4 KVER=2.6.33.7-rt291 KDIR=/usr/src/linux ARCH_COMPAT_ALLOC_USER_SPACE=0 kmod_build

 * 

 * Call stack:

 *     ebuild.sh, line   54:  Called src_compile

 *   environment, line 3769:  Called linux-mod_src_compile

 *   environment, line 2905:  Called die

 * The specific snippet of code:

 *               eval "emake HOSTCC=\"$(tc-getBUILD_CC)\"                                               CROSS_COMPILE=${CHOST}-                                             LDFLAGS=\"$(get_abi_LDFLAGS)\"                                           ${BUILD_FIXES}                                          ${BUILD_PARAMS}                             ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";

 * 

 * If you need support, post the output of 'emerge --info =x11-drivers/ati-drivers-10.9-r1',

 * the complete build log and the output of 'emerge -pqv =x11-drivers/ati-drivers-10.9-r1'.

 * The complete build log is located at '/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/temp/environment'.

 * S: '/var/tmp/portage/x11-drivers/ati-drivers-10.9-r1/work'

```

su phoronix ho trovato la seguente patch:

http://www.phoronix.com/forums/showthread.php?t=24807

come la posso usare?

dove la devo mettere? 

scusate, ma è la prima volta che mi capita e non ho la più pallida idea di come fare

a dirla tutta, pare che la patch sia già presente nel portage.

dentro /usr/portage/x11-drivers/ati-drivers/files/ mi trovo ati-drivers-2.6.33.patch

ho provato ad aggiungere all'ebuild la seguente riga:

 epatch "${FILESDIR}"/ati-drivers-2.6.33.patch

ma non funziona, viene errore:

```
***** ati-drivers-2.6.33.patch *****

====================================

PATCH COMMAND:  patch -p0 -g0 -E --no-backup-if-mismatch < '/usr/portage/x11-drivers/ati-drivers/files/ati-drivers-2.6.33.patch'

====================================

can't find file to patch at input line 3

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:

--------------------------

|--- work.orig/common/lib/modules/fglrx/build_mod/drmP.h

|+++ work/common/lib/modules/fglrx/build_mod/drmP.h

--------------------------

No file to patch.  Skipping patch.

1 out of 1 hunk ignored

can't find file to patch at input line 17

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:

--------------------------

|--- work.orig/common/lib/modules/fglrx/build_mod/firegl_public.c

|+++ work/common/lib/modules/fglrx/build_mod/firegl_public.c

--------------------------

No file to patch.  Skipping patch.

2 out of 2 hunks ignored

can't find file to patch at input line 44

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:

--------------------------

|--- work.orig/common/lib/modules/fglrx/build_mod/kcl_acpi.c

|+++ work/common/lib/modules/fglrx/build_mod/kcl_acpi.c

--------------------------

No file to patch.  Skipping patch.

1 out of 1 hunk ignored

can't find file to patch at input line 58

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:

--------------------------

|--- work.orig/common/lib/modules/fglrx/build_mod/kcl_agp.c

|+++ work/common/lib/modules/fglrx/build_mod/kcl_agp.c

--------------------------

No file to patch.  Skipping patch.

<......................taglio qui................>

```

----------

## Enrico Tagliavini

Sicuramente è molto difficile (ammesso che sia possibile) far funzionare ati-drivers con un kernel rt.

Per quanto riguarda l'errore dell'init_MUTEX basta che applichi la sema_init patch, per gli altri non ne ho idea. devi controllare dove sono definite quelle funzioni, assicurarti che il tuo kernel abbia quelle funzioni abilitate e aggiungere eventuali header mancanti in firegl_public.c

Se posso darti un consiglio evita i kernel rt, tanto i kernel normali ormai sono anche rt, e usa schedtool per lanciare task realtime (è necessario anche configurare /etc/security/limits.conf in modo appropriato)

----------

## Enrico Tagliavini

ah dimenticavo, applicare la patch per il kernel 2.6.33 normale non serve a niente quel kernel non è un 2.6.33 normale (che è già supportato da ati-drivers 10.9 e seguenti)

----------

