Basic UVD support v2 for Radeon on Gentoo

April 07, 2013 at 08:53 AM | categories: linux | View Comments

Here's a simple step-by-step guide for Gentoo users to start testing the newly released UVD support in the open source Radeon driver:

  1. Buy something from AMD/ATI. Be a good open source citizen and vote with your wallet! Some good candidates include this and this.
  2. Feel good about yourself.
  3. Wait several years for AMD developers and lawyers to get their collective shit together. Use the shitty proprietary Catalyst driver in the meantime.
  4. emerge --sync.
  5. Say goodbye to x11-drivers/ati-drivers, replacing it with x11-drivers/xf86-video-ati. Make sure it says "radeon" instead of "fglrx" in the VIDEO_CARDS flag.
  6. Install media-libs/mesa-9.2_pre20130404 and x11-drivers/radeon-ucode-20130402 kindly and promptly prepared by chithanh. All hail chithanh.
  7. Grab the latest kernel source from the drm-fixes-3.9 branch. This tarball should work.
  8. Apply all 11 patches from patchset v2 posted in the mailing list. Alternatively, apply this rolled-up patch.
  9. Build kernel. Make sure to set CONFIG_DRM_RADEON and add the relevant firmwares to CONFIG_EXTRA_FIRMWARE (e.g. "radeon/PALM_me.bin radeon/PALM_pfp.bin radeon/SUMO_rlc.bin radeon/SUMO_uvd.bin" for E-350).
  10. Add "vdpau" to the USE flags and recompile packages that make use of it.
  11. Reboot. Join forums / IRC / mailing lists for group hug.

UPDATE: Patchset v3 is out in the mailing list. Essentially the same as v2, with one change moved from 02 to 03.

OpenVPN on OpenWrt for iptables noob

November 09, 2010 at 08:43 AM | categories: linux | View Comments

OpenWrt is a sweet distro for wireless routers. However, doing certain stuffs with it, e.g. setting up OpenVPN, is not an easy task. There are many wiki pages, forum threads, and blog posts to help us mortal to get OpenVPN running, but most of them involves a blood sacrifice to the God of Iptables as the mandatory first step. Iptables?? Surely there must be a less painful way?

After some trials and errors, I managed to get OpenVPN to work on OpenWrt, without typing any iptables command. Not everything can be done via the Luci web interface though, so expect to get your hands dirty with the command line. With that said, here are the steps for the typical road warrior setup (tested on Backfire 10.03).

  1. SSH into the router, and install the necessary packages

    opkg update
    opkg install openvpn luci-app-openvpn openvpn-easy-rsa
    
  2. Apply changeset 21641 manually. The change went in on 2010-05-31, so Backfire 10.03 doesn't have it. See this forum thread for more info.

    nano /etc/hotplug2-common.rules
    # remove the "next" line in the tun/tap section
    
  3. Generate the keys following [this excellent guide] (http://openvpn.net/index.php/open-source/documentation/miscellaneous/77-rsa-key-management.html) from OpenVPN.

    nano /etc/easy-rsa/vars
    # Scroll to the bottom and put in the country, province, city, organization, and email
    
    build-ca
    build-dh
    build-key-server server
    build-key-pkcs12 client1
    
  4. Copy the following files into /etc/openvpn/. This is the default location, so they will get picked up automatically later.

    cd /etc/easy-rsa/keys
    cp ca.crt ca.key dh1024.pem server.crt server.key /etc/openvpn/
    
  5. Copy client1.p12 to the client machine (i.e. the road warrior). The client config file should look like this:

    client
    dev tun
    proto udp
    
    remote <server address> 1194
    resolv-retry infinite
    nobind
    
    persist-key
    persist-tun
    
    pkcs12 client1.p12
    
    comp-lzo
    verb 3
    
    ns-cert-type server
    tls-client
    tls-remote <the common name during the build-key-server step>
    
  6. Open Luci web interface, go to Service -> OpenVPN, and enable sample_server. Click Save & Apply.

  7. Click the edit icon for sample_server. Click the Swith to advanced configuration link. Click the VPN options tab. Select Push options to peer from the Additional Field list, and click Add. Then, select custom and type route 192.168.1.0 255.255.255.0 (change this accordingly if lan is not on 192.168.1.0/24).

  8. Go to Network -> Interfaces. Type vpn in the box and click Add entry. Change Protocol to none, and change Interface to tun0. Click Save & Apply.

  9. Go to Network -> Firewall -> Zones. Click Add entry, and type vpn as the Name. Change Incoming Traffic and Outgoing Traffic to accept, and select vpn in the Networks list. Click Save & Apply.

  10. Go to Network -> Firewall -> Traffic Control. Click the upper Add entry button twice. Select lan as Source and vpn as Destination, and then reverse the order. Click Save & Apply.

  11. Go to Network -> Firewall -> Traffic Control again. Click the lower Add entry button. Type openvpn as the Name, and change Source to wan. Then, select Protocol from the Additional Field list, and click Add. Change Protocol to UDP, and type 1194 as the Destination Port. Click Save & Apply.

We are done. Once openvpn is started on the client machine, it should be able to access all the lan machines, and vice versa.

Screw Android, I am going Maemo

March 28, 2010 at 11:47 PM | categories: linux | View Comments

As the first and only Maemo 5 device, Nokia N900 is simply amazing. Unlike other smartphones that give you thousands of silly Apps, with N900 you can have real, actual, full-length Applications.

For example, this screenshot below shows a fully ajax web application rendered and functioning nicely in the N900's MicroB browser:

(Btw, that's our Business Intelligence Dashboards developed by my colleagues. Great work guys!)

Of course, this web application can certainly be rendered and functioning nicely with other smartphones also. What seperates N900 from the appsphones, however, is that it can actually host the backend of the web application, all by itself.

In this case, the backend uses these services:

along with apache modules mod_wsgi and mod_php.

The speed isn't great, since N900's hardware spec is comparable to the laptop I had 10 years ago. Nevertheless, it works. So, screw Android with its non-standard Java and tiny SQLite database, I am going Maemo with N900 :D

UPDATE: After installing build-essential, all the latest and greatest versions of httpd, postgresql, and python can be compiled and run natively on the phone, without the chroot.

Installing a contrib module for Greenplum

March 12, 2010 at 12:49 AM | categories: linux | View Comments

Installing a contrib module for Greenplum must be a dead simple task, because it was no where to be found in the otherwise comprehensive Greenplum Admin Guide.

However, google for "greenplum contrib" only returns one relevant result to a Chinese blog post, which despite best intention, only serves to discourage a newbie like me from ever trying to install a contrib. Recompiling postgresql and hand-editing Makefile just to install a small module? That just doesn't sound right, even for a Gentoo user.

After some messing around with a few contrib, I finally found the right way, which is indeed dead simple:

  1. Get any of the postgresql 8.2 source package from the official site
  2. su - gpadmin
  3. Unpack the source, then go to ~/postgresql-8.2.xx/contrib/xxx
  4. make USE_PGXS=1 COPT="-Wno-error" install
  5. (Optional for Greenplum MPP) Use gpssh to copy whatever .so file that just get installed under /usr/local/greenplum-db/lib/postgresql to other nodes
  6. psql -f xxx.sql [DBNAME]

There you have it. Simple, no fluff, even an Ubuntu user can get it to work (seriously, I am not joking).

Mythtv's xmltv grabber for Malaysia channels

December 30, 2008 at 11:08 PM | categories: python, boleh, linux | View Comments

Ever since I got mythtv up and running months ago, I have always wanted to use the Electronic Program Guide (EPG) feature. Unfortunately, getting tv schedules in a format understandable by mythtv (i.e. xmltv) is not so easy.

From a bit of googling, I found 2 (non-)solutions. The first one involves using tvxb through wine to grab tv schedules from Astro through screenscraping. Apparently, it doesn't work anymore, as the tvxb site is showing the following message:

All Astro satellite channels (No longer works - needs updating. 2008/10/12)

The other solution is a perl script written by Shahada Abubakar that also screenscrapes Astro listing. Like the first one, this solution has also ceased to be working, due to the flaky nature of screenscraping.

Of course, the googling and testing were just unnecessary foreplay. I was set at the beginning to come up with my own solution anyway. With the help of wonderful python libraries such as BeautifulSoup and lxml, I wrote a xmltv grabber that:

  • can screenscrape either Astro or The Star listings for channels rtm1, rtm2, tv3, ntv7, 8tv, and tv9

  • is functioning as of 2008-12-31 (UPDATE: broken as of 2013-01-27, ugh)

Here's the script: grabmy.py

To get it to work, install the requirements first:

easy_install BeautifulSoup lxml httplib2 python_dateutil

Then, run the script to generate a xmltv file:

python grabmy.py -f my.xml

Feed mythbackend with the file:

mythfilldatabase --file 1 my.xml

And finally, here's the EPG in its full glory if you channel-flip at 2am:

epg