Toxic Elephant

Don't bury it in your back yard!

How to compile TV output into the latest ati drivers on Ubuntu

Posted by matijs 21/06/2007 at 12h58

The Problem

You have built a home server slash PVR that you want to hook up to your twenty-year-old television. You have gone to several shops to buy a graphics card that actually has open-source drivers for its TV output functionality (i.e., the ATI Radeon A9250). You have dodged salesmen trying to sell you something else (“No, but here is its successor the NVidia so-and-so.” “Uhm, no thanks.”). You finally succeeded by ordering it over the Interweb (and probably should have done that in the first place). Now you want to patch the driver shipped by Ubuntu to actually get TV output working.

The Solution

You will need a patch based on the TV output module from the GATOS project. You can get the latest-but-not-late-enough patch from Before proceeding, edit the patch, removing the patches for Later in the process, you’ll have to deal with some rejected patches. Alternatively, you can download a cleaned-up version for driver version 6.6.3.

[Update Nov 13, 2007: The TV output module has been sort-of incorporated into the driver, and Ubuntu Gutsy ships that. The problem is, it does not yet automatically detect that you have a TV hooked up, so you need another monitor to let X start without erroring out and to type in some xrandr commands. Not ideal. You can however just recompile the driver-plus-patch from Feisty and it will work fine.]

Get the sources for the ati driver (currently, version 6.6.3):

apt-get source xserver-xorg-video-ati

Install the build dependencies. I always just consult the debian/control file, but you should be able to just go:

sudo apt-get build-dep xserver-xorg-video-ati

[Update Dec 26, 2007: You also need autoconf and libtool:

sudo apt-get install autoconf libtool

They are needed for the autoreconf step later in the process.]

Change into the directory just created:

cd xserver-xorg-video-ati-6.6.3

Prepare the quilt patch system:

fakeroot ./debian/rules prepare

Copy the patch into the patches directory:

cp /path/to/the/patch patches/200_tv_output.diff

Append the line


to the file patches/series.

Apply all the patches:

fakeroot ./debian/rules patch

At this point, if you’re using the original patch, it will not have applied cleanly. Run quilt push -f to force it to be applied. After fixing the rejections, run quilt refresh to make a new patch. You may also have to run quilt refresh if you’re patching a different version of the driver and the line numbers have changed.

Next, reconfigure, clean, build:

fakeroot ./debian/rules autoreconf
fakeroot ./debian/rules clean
fakeroot ./debian/rules binary

And of course, install the resulting package. All done.

Tags , 11 comments no trackbacks


  1. Sasa M said 24/12/2007 at 10h19:

    Hi... I done everything just like you said to the part "cp /path/to/the/patch patches/200_tv_output.diff". I can't find "200_tv_output.diff", and like i said, everything went without problems till that part?! Could you help me now? Thnak you
  2. Matijs said 24/12/2007 at 10h48:

    To help you, I need to know exactly what you typed, and exactly what the response was. Otherwise, I'm just guessing, like so: Did you replace @/path/to/the/patch@ with the actual path to the patch?
  3. Sasa M said 24/12/2007 at 14h23:

    Ok, this is what i done, and what to do now? Where is that file 200_tv_output.diff. i can't find it?!:
    root@luci:~# apt-get source xserver-xorg-video-ati
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Need to get 1010kB of source archives.
    Get:1 feisty/main xserver-xorg-video-ati 1:6.6.3-2ubuntu6 (dsc) [1218B]
    Get:2 feisty/main xserver-xorg-video-ati 1:6.6.3-2ubuntu6 (tar) [979kB]
    Get:3 feisty/main xserver-xorg-video-ati 1:6.6.3-2ubuntu6 (diff) [30.5kB]
    Fetched 1010kB in 34s (29.2kB/s)                                               
    gpg: can't open `/gnupg/options.skel': No such file or directory
    gpg: Signature made Wed 11 Apr 2007 10:53:25 AM CEST using DSA key ID 76682A37
    gpg: Can't check signature: public key not found
    dpkg-source: extracting xserver-xorg-video-ati in xserver-xorg-video-ati-6.6.3
    dpkg-source: unpacking xserver-xorg-video-ati_6.6.3.orig.tar.gz
    dpkg-source: applying ./xserver-xorg-video-ati_6.6.3-2ubuntu6.diff.gz
    root@luci:~# sudo apt-get build-dep xserver-xorg-video-ati
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 169 not upgraded.
    root@luci:~# cd xserver-xorg-video-ati-6.6.3
    root@luci:~/xserver-xorg-video-ati-6.6.3# fakeroot ./debian/rules prepare
    mkdir stampdir
    for FILE in debian/* \
    		    debian/* \
    		    debian/* \
    		    debian/* \
    		    debian/*; do \
    	  if [ -e "$FILE" ]; then \
    	    MAINTSCRIPT=$(echo $FILE | sed 's/.in$//'); \
    	    sed -n '1,/^#INCLUDE_SHELL_LIB#$/p' <$FILE \
    	      | sed -e '/^#INCLUDE_SHELL_LIB#$/d' >$MAINTSCRIPT.tmp; \
    	    cat debian/xsfbs/ >>$MAINTSCRIPT.tmp; \
    	    sed -n '/^#INCLUDE_SHELL_LIB#$/,$p' <$FILE \
    	      | sed -e '/^#INCLUDE_SHELL_LIB#$/d' >>$MAINTSCRIPT.tmp; \
    	    sed -e 's/@SOURCE_VERSION@/1:6.6.3-2ubuntu6/' \
    		-e 's/@OFFICIAL_BUILD@//' \
    		-e 's/@DEFAULT_DCRESOLUTIONS@//' \
    	      <$MAINTSCRIPT.tmp >$MAINTSCRIPT; \
    	    rm $MAINTSCRIPT.tmp; \
    	  fi; \
    # Validate syntax of generated shell scripts.
    #sh debian/scripts/validate-posix-sh debian/*.config \
    	#                                    debian/*.postinst \
    	#                                    debian/*.postrm \
    	#                                    debian/*.preinst \
    	#                                    debian/*.prerm
    if [ ! -e stampdir/patches ]; then \
    		mkdir stampdir/patches; \
    		ln -s stampdir/patches .pc; \
    		echo 2 >stampdir/patches/.version; \
    	fi; \
    	if [ ! -e stampdir/log ]; then \
    		mkdir stampdir/log; \
    	fi; \
    	if [ ! -e patches ]; then \
    		ln -s debian/patches patches; \
    	fi; \
  4. Matijs said 24/12/2007 at 16h17:

    Did you actually download the patch like it said in the first paragraph of the solution?
  5. Sasa M said 24/12/2007 at 16h56:

    Yes, i download xorg7-6.6.3-tv_output.patch but that is problem. Where to copy it? I download it on Desktop and after that i done that what you see in the list.
  6. Matijs said 24/12/2007 at 20h31:

    Ah, I see. Well, you need to copy the downloaded patch to the `patches` directory and name it `200_tv_output.diff`. Starting from the point where you left off in your comment, you would probably need to type: cp ~/Desktop/xorg7-6.6.3-tv_output.patch patches/200_tv_output.diff
  7. Sasa M said 24/12/2007 at 21h36:

    Ok, i done it and now, that pach is in the folder patches:
    luci@luci:~/xserver-xorg-video-ati-6.6.3/patches$ ls
    What next, i don't get your manual quite well??
  8. Matijs said 25/12/2007 at 11h10:

    Just use your favorite text editor to edit the file `patches/series`, and add the line
    at the end. Can you tell me why this was not clear? And also for the earlier step of copying the patch?
  9. Sasa M said 25/12/2007 at 15h45:

    I done all you said, and when I done: fakeroot ./debian/rules autoreconf I get:
    make[1]: *** [doautoreconf] Error 127
    make[1]: Leaving directory `/home/luci/xserver-xorg-video-ati-6.6.3'
    make: *** [debian/patches/patched.md5sum] Error 2
  10. Matijs said 26/12/2007 at 15h58:

    Well, Error 127 doesn't tell me much, but let me guess, just before those lines you get:
    /bin/sh: autoreconf: not found
    That line should have told you you're missing the `autoreconf` command. You will need to:
    sudo apt-get install autoconf libtool
    rm -r xsfautoreconf
    fakeroot ./debian/rules autoreconf
    I will add the `autoconf` and `libtool` requirements in the howto.
  11. Matijs said 26/12/2007 at 16h06:

    Oh, and the `autoreconf` part will fail, but it should fail with a message that says:
    This target is made to fail INTENTIONALLY. It should NEVER    
    be invoked during automatic builds.

Comments are disabled