<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Alex's Adventures on the Infobahn - gentoo</title><link href="https://www.bennee.com/~alex/" rel="alternate"></link><link href="https://www.bennee.com/~alex/blog/tag/gentoo/feed" rel="self"></link><id>https://www.bennee.com/~alex/</id><updated>2011-04-18T13:43:00+01:00</updated><subtitle>the wanderings of a supposed digital native</subtitle><entry><title>Playing Blu-Ray under Linux</title><link href="https://www.bennee.com/~alex/blog/2011/04/18/playing-blu-ray-under-linux/" rel="alternate"></link><published>2011-04-18T13:43:00+01:00</published><updated>2011-04-18T13:43:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2011-04-18:/~alex/blog/2011/04/18/playing-blu-ray-under-linux/</id><summary type="html">&lt;p&gt;One of the many deficiencies of &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Digital_rights_management"&gt;Digital Restrictions Management&lt;/a&gt; is the fact it makes doing legal authorised things hard for paying customers. For example my brother still can't play Blu-Ray disks on his laptop despite it having the requisite a) drive, b) power and c) display resolution. Because the OS …&lt;/p&gt;</summary><content type="html">&lt;p&gt;One of the many deficiencies of &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Digital_rights_management"&gt;Digital Restrictions Management&lt;/a&gt; is the fact it makes doing legal authorised things hard for paying customers. For example my brother still can't play Blu-Ray disks on his laptop despite it having the requisite a) drive, b) power and c) display resolution. Because the OS on his machine (Vista?) can't see a verifiable encrypted path to his big screen display it refuses to play his legally purchased disks.&lt;/p&gt;
&lt;p&gt;This is one reason why I haven't brought any Blu-Ray disks since the couple I got with my PS3 (to test the Hi-Def goodness). I refuse to buy them while I have no devices under my control* that can play them. Still the conversation with my brother and the fact I had a Blu-Ray drive in my desktop prompted me to see if it was indeed now possible.&lt;/p&gt;
&lt;p&gt;My desktop system runs &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Gentoo_Linux"&gt;Gentoo&lt;/a&gt; which makes running bleeding edge code very easy. I duly enabled the &amp;quot;bluray&amp;quot; and &amp;quot;aacs&amp;quot; &lt;a class="reference external" href="http://www.gentoo.org/dyn/use-index.xml"&gt;use flags&lt;/a&gt; and recompiled mplayer. This brought in libbluray and the command line utility aacskeys. Unfortunately mplayer was still unable to play the disk, complaining the disk was still encrypted.&lt;/p&gt;
&lt;p&gt;After a bunch of searching the interwebs and drawing blanks on finding any explicit &amp;quot;HOWTO&amp;quot; instructions I resorted to running mplayer through a debugger (one advantage of an Open Source system is there are no &amp;quot;black boxes&amp;quot; to reverse engineer) to see how libbluray was being invoked. It turned out it attempts to &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Dynamic_loading"&gt;dlopen&lt;/a&gt; another library &lt;a class="reference external" href="http://www.videolan.org/developers/libaacs.html"&gt;libaacs&lt;/a&gt; which wasn't on my system. Once I added its &lt;a class="reference external" href="http://bugs.gentoo.org/show_bug.cgi?id=352031"&gt;ebuild&lt;/a&gt; to my overlay I was one step closer.&lt;/p&gt;
&lt;p&gt;Unlike the libdecss (which works around the rather anaemic crypto on plain old DVDs) the libaacs library doesn't crack the considerably stronger keys used on BluRay. It relies on a database of Volume keys which can be placed in &lt;em&gt;~/.config/aacs/KEYDB.CFG&lt;/em&gt; which are used to calculate the final decryption keys for the content. Confusingly the format is different from the key databases &lt;a class="reference external" href="http://www.google.co.uk/search?q=KEYDB.CFG"&gt;you may find searching&lt;/a&gt; the internet. However the &lt;a class="reference external" href="https://code.videolan.org/videolan/libaacs/-/blob/master/KEYDB.cfg?ref_type=heads"&gt;libaacs file format documentation&lt;/a&gt; provides instruction on convert the old format into a new format file.&lt;/p&gt;
&lt;p&gt;With all of this in-place I was finally able to play my legally owned copy of Black Hawk Down. Yay!&lt;/p&gt;
&lt;p&gt;Of course this does require having the appropriate keys for the disc you want to play in your key database. This is where aacskeys comes in. This program allows you to extract the appropriate volume ID key from the disc you want to play. However there are some potential caveats. For starters the program is a little unfriendly to use as it requires certain files to be in the directory your running from. Also some BluRay drive firmwares will refuse to supply the needed keys if the disks are a newer generation than the drive (due to the AACS key revocation model). I'm not sure if a drive will self revoke under Linux if presented with a newer disk but this is the reason there are patched drive firmwares out there.&lt;/p&gt;
&lt;p&gt;In the event I was able to verify that aacskeys generates the same volume ID for my copy of Blackhawk Down as was in the KEYDB.CFG database so I know it works for now.&lt;/p&gt;
&lt;p&gt;In summary this does show it is possible to play a Blu-Ray disk on a Linux system however there was a fair bit of hoop jumping involved. If I can find a source repository for aacskeys I might start by cleaning it up and making the process of updating the key database a little less painful. I doubt I'll be buying any more Blu-Ray disks until the process of playback is a lot simpler.&lt;/p&gt;
&lt;p&gt;* My PS3 is very much Sony's device, a Faustian bargain I accept because I like playing games every now and again. Witness the removal of &lt;a class="reference external" href="http://en.wikipedia.org/wiki/OtherOS"&gt;OtherOS&lt;/a&gt; from working systems in the wild by a mandatory firmware update.&lt;/p&gt;
</content><category term="geek"></category><category term="blu-ray"></category><category term="defective-by-design"></category><category term="drm"></category><category term="gentoo"></category><category term="linux"></category></entry><entry><title>Gentoo USE flags</title><link href="https://www.bennee.com/~alex/blog/2008/07/02/gentoo-use-flags/" rel="alternate"></link><published>2008-07-02T12:12:00+01:00</published><updated>2008-07-02T12:12:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2008-07-02:/~alex/blog/2008/07/02/gentoo-use-flags/</id><summary type="html">&lt;p&gt;I run three distributions most of the time. My servers all run &lt;a class="reference external" href="http://www.debian.org/"&gt;Debian&lt;/a&gt; which despite recent &lt;a class="reference external" href="http://www.bennee.com/~alex/news.php?wl_mode=more&amp;amp;wl_eid=1031"&gt;cock-ups&lt;/a&gt; is a stable, unsurprising distribution. Exactly what you want from a server OS. My work desktop runs &lt;a class="reference external" href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt; which is regularly updated, runs pretty much the latest Gnome, Firefox etc and is simple …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I run three distributions most of the time. My servers all run &lt;a class="reference external" href="http://www.debian.org/"&gt;Debian&lt;/a&gt; which despite recent &lt;a class="reference external" href="http://www.bennee.com/~alex/news.php?wl_mode=more&amp;amp;wl_eid=1031"&gt;cock-ups&lt;/a&gt; is a stable, unsurprising distribution. Exactly what you want from a server OS. My work desktop runs &lt;a class="reference external" href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt; which is regularly updated, runs pretty much the latest Gnome, Firefox etc and is simple to administer. However for the last 3 and a bit years I've been running &lt;a class="reference external" href="http://www.gentoo.org/"&gt;Gentoo&lt;/a&gt; on my desktop at home. When I recently upgraded my desktop machine I considered other options but decided to stick to Gentoo for the main reason it is incredibly flexible.&lt;/p&gt;
&lt;p&gt;Gentoo is a source based distribution. This means instead of downloading binary packages with pre-compiled images it downloads &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Source_code"&gt;source code&lt;/a&gt; and compiles it on your machine before installing it. This has many benefits, none of which involve running silly compiler optimisations to get an extra 2% performance out of the applications. However for a developer there it is inherently useful to have all the headers for your libraries by default - and by implication every package you compile is linked against the right library. The result of this is it's very easy to run bleeding edge applications alongside a stable base system, something that quite often doesn't work with a binary distributions which make assumptions about what is actually installed on you machine.&lt;/p&gt;
&lt;p&gt;The principle control for all of this is &lt;em&gt;/etc/portage/package.keywords&lt;/em&gt; for which a portion of mine looks like this:&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;# KVM, bleeding edge&amp;nbsp; &lt;span class="pre"&gt;app-emulation/kvm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~amd64&amp;nbsp; # Flash support (bit flakey)&amp;nbsp; &lt;span class="pre"&gt;net-www/gnash&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~amd64&amp;nbsp; # Kernel&amp;nbsp; &lt;span class="pre"&gt;sys-kernel/kerneloops&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~amd64&amp;nbsp; # Firefox&amp;nbsp; &lt;span class="pre"&gt;www-client/mozilla-firefox&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~amd64&amp;nbsp; &lt;span class="pre"&gt;dev-libs/nss&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~amd64&amp;nbsp; &lt;span class="pre"&gt;dev-libs/nspr&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~amd64&amp;nbsp; &lt;span class="pre"&gt;net-libs/xulrunner&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~amd64&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;This allows me to run the latest KVM, Firefox and gnash without having to sacrifice the stability of my base-system.&lt;/p&gt;
&lt;p&gt;Another feature of the compiling by source is you don't need to enable every feature in the world. For example my &lt;em&gt;/etc/make.conf&lt;/em&gt; is contains things like:&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;USE=&amp;quot;$USE&lt;/span&gt; &lt;span class="pre"&gt;-kde&lt;/span&gt; &lt;span class="pre"&gt;-qt&lt;/span&gt; gnome gtk2&amp;quot;&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;Which disables all KDE and QT stuff (seeing as I don't run KDE) while enabling any gnome support an app my have. You can see the use flags that packages respect by running &lt;em&gt;emerge -p -v&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;danny ~ # emerge &lt;span class="pre"&gt;-p&lt;/span&gt; &lt;span class="pre"&gt;-v&lt;/span&gt; emacs&amp;nbsp; [ebuild&amp;nbsp;&amp;nbsp; R&amp;nbsp;&amp;nbsp; ] &lt;span class="pre"&gt;app-editors/emacs-22.2-r2&lt;/span&gt;&amp;nbsp; &lt;span class="pre"&gt;USE=&amp;quot;X&lt;/span&gt; alsa gif gtk jpeg&amp;nbsp; kerberos png spell tiff xpm &lt;span class="pre"&gt;-Xaw3d&lt;/span&gt; &lt;span class="pre"&gt;-gzip-el&lt;/span&gt; &lt;span class="pre"&gt;-hesiod&lt;/span&gt; &lt;span class="pre"&gt;-motif&lt;/span&gt; &lt;span class="pre"&gt;-sound&lt;/span&gt;&amp;nbsp; &lt;span class="pre"&gt;-source&lt;/span&gt; &lt;span class="pre"&gt;-toolkit-scroll-bars&amp;quot;&lt;/span&gt; 0 kB&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;So my emacs automatically picks up X and GTK support (my make.conf is a little bigger than alluded to above ;-). However you may not want to build every application with support for everything. &lt;a class="reference external" href="http://en.wikipedia.org/wiki/AAlib"&gt;aalib&lt;/a&gt; is very handy on mplayer for checking encodes over a shell, but I don't want every application to link against it. Enter &lt;em&gt;/etc/portage/package.use&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;# KVM&amp;nbsp; #&amp;nbsp; # Disable kvm module (we have our own)&amp;nbsp; # Explicitly enable gcc4 support.&amp;nbsp; &lt;span class="pre"&gt;app-emulation/kvm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="pre"&gt;-kvm&lt;/span&gt; ncurses sdl gcc4&amp;nbsp; # Firefox needs Java support&amp;nbsp; &lt;span class="pre"&gt;www-client/mozilla-firefox&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; java&amp;nbsp; &lt;span class="pre"&gt;dev-java/blackdown-jre&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nsplugin&amp;nbsp;&amp;nbsp; # I hate totem but it's needed for other apps&amp;nbsp; # disable nsplugin so it doesn't drag firefox down&amp;nbsp; # disable dvd so doesn't have to pull in &lt;span class="pre"&gt;gst-plugins-ugly&lt;/span&gt;&amp;nbsp; &lt;span class="pre"&gt;media-video/totem&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="pre"&gt;-nsplugin&lt;/span&gt; &lt;span class="pre"&gt;-dvd&lt;/span&gt;&amp;nbsp; # mplayer needs aalib &lt;span class="pre"&gt;:-)&lt;/span&gt;&amp;nbsp; &lt;span class="pre"&gt;media-video/mplayer&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aalib&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;So here I stop kvm from building it's own kernel module (as I run my own kernels), enable java on Firefox (where it's useful, but I don't want it everywhere), disable totem plugins and dvd support (but keeping the library which other apps use), and explicitly enable aalib for mplayer (but not anyone else).&lt;/p&gt;
&lt;p&gt;This is the sort of fine grained control I really appreciate for my home machine. And my compile flags, the rather sedentary &lt;em&gt;CFLAGS=&amp;quot;-O2 -pipe&amp;quot;&lt;/em&gt; ;-)&lt;/p&gt;
</content><category term="geek"></category><category term="gentoo"></category></entry><entry><title>Gratuitous Code Post</title><link href="https://www.bennee.com/~alex/blog/2005/05/24/gratuitous-code-post/" rel="alternate"></link><published>2005-05-24T23:58:00+01:00</published><updated>2005-05-24T23:58:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2005-05-24:/~alex/blog/2005/05/24/gratuitous-code-post/</id><summary type="html">&lt;p&gt;I got home today and had a sudden urge to run. I think this is because I've been cooped up in an office all day and needed some physical exertion. I didn't run far, but I did run hard (so to speak).&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;I think it cleared my mind enough that …&lt;/div&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;I got home today and had a sudden urge to run. I think this is because I've been cooped up in an office all day and needed some physical exertion. I didn't run far, but I did run hard (so to speak).&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;I think it cleared my mind enough that I could face adding the following code to my &lt;a class="reference external" href="http://www.bennee.com/cgi-bin/viewcvs.cgi/src/dotfiles/dotbashrc"&gt;.bashrc&lt;/a&gt;&lt;/div&gt;
&lt;div class="line"&gt;to make working with gentoo overlays a little easier. Basically it allows me to hack around with ebuilds without doing my editing as root.&lt;/div&gt;
&lt;div class="line"&gt;&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class="literal-block"&gt;
#
# Gentoo Related Macros
#
# These are various tools for manipulating a local
# portage structure (which can be part of an overlay)
#
# These functions allow you to list, clone, delete and diff ebuilds
#

LOCAL_PORTAGE=$HOME/portage
MASTER_PORTAGE=/usr/portage

alias ls_le=&amp;quot;find $LOCAL_PORTAGE -xtype d -mindepth 2 -maxdepth 2 | sed s#$LOCAL_PORTAGE##&amp;quot;
alias ls_me=&amp;quot;find $MASTER_PORTAGE -xtype d -mindepth 2 -maxdepth 2 | sed s#$MASTER_PORTAGE##&amp;quot;

#
# guess_ebuild
#
# Take a string, possibly partial and match it a proper group/ebuild
#
function guess_ebuild()
{
    tmp=`ls_me | grep $1`
    group=`echo $tmp | perl -ne 'm#/([^/]*)#; print &amp;quot;$1&amp;quot;'`
    ebuild=`echo $tmp | perl -ne 'm#/([^/]*)/(\w*)#; print &amp;quot;$2&amp;quot;'`
}


#
# diff ebuild
#
# Do a diff for a given ebuild
#
function diff_ebuild()
{
    result=0

    if [ &amp;quot;$1&amp;quot; ]
    then
    guess_ebuild $1
    if [[ &amp;quot;$group&amp;quot; &amp;amp;&amp;amp; &amp;quot;$ebuild&amp;quot; ]]
    then
        diff -ub $MASTER_PORTAGE/$group/$ebuild $LOCAL_PORTAGE/$group/$ebuild
    fi
    else
    for ebuild in `ls_le`
    do
      diff -ub $MASTER_PORTAGE/$ebuild $LOCAL_PORTAGE/$ebuild
    done
    fi
}

#
# Clone an ebuild from the master tree into the local tree
#
#
function clone_ebuild()
{
    if [ &amp;quot;$1&amp;quot; ]
    then
    guess_ebuild $1
    if [[ &amp;quot;$group&amp;quot; &amp;amp;&amp;amp; &amp;quot;$ebuild&amp;quot; ]]
    then
        echo &amp;quot;Cloning ebuild $group/$ebuild&amp;quot;
        mkdir -p $LOCAL_PORTAGE/$group
        cp -aP $MASTER_PORTAGE/$group/$ebuild $LOCAL_PORTAGE/$group/
    else
        echo &amp;quot;$1 not in  Master Portage&amp;quot;
    fi
    else
        echo &amp;quot;No ebuild specified&amp;quot;
    fi
}


#
# Clean ebuilds
#
# Delete untouched ebuilds from local portage
#
function clean_ebuilds()
{
    for ebuild in `ls_le`
    do
      result=`diff -br --brief $MASTER_PORTAGE/$ebuild $LOCAL_PORTAGE/$ebuild`
      if [ &amp;quot;x$result&amp;quot; == &amp;quot;x&amp;quot; ]
      then
      echo &amp;quot;Removing local copy of $ebuild&amp;quot;
      rm -rf $LOCAL_PORTAGE/$ebuild
      fi
    done
}
&lt;/pre&gt;
</content><category term="geek"></category><category term="gentoo"></category></entry><entry><title>Many Threads</title><link href="https://www.bennee.com/~alex/blog/2005/05/21/many-threads/" rel="alternate"></link><published>2005-05-21T17:37:00+01:00</published><updated>2005-05-21T17:37:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2005-05-21:/~alex/blog/2005/05/21/many-threads/</id><summary type="html">&lt;p&gt;I've spent most of the morning trying to properly fix the &lt;a class="reference external" href="http://www.gnu.org/software/libc/libc.html"&gt;glibc&lt;/a&gt; on my Gentoo system. It appears after much analysis my problems stemmed from the backward compatibility to the old Linux Threads system (TLS). Once I specified &lt;em&gt;nptlonly&lt;/em&gt; in my USE flags and rebuilt glibc everything worked fine. I …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've spent most of the morning trying to properly fix the &lt;a class="reference external" href="http://www.gnu.org/software/libc/libc.html"&gt;glibc&lt;/a&gt; on my Gentoo system. It appears after much analysis my problems stemmed from the backward compatibility to the old Linux Threads system (TLS). Once I specified &lt;em&gt;nptlonly&lt;/em&gt; in my USE flags and rebuilt glibc everything worked fine. I now no longer need to keep the unmanaged tarball around to overwrite emerge's breakage.&lt;/p&gt;
&lt;p&gt;I was planning to write some letters to the Inland Revenue today but I've had an attack of the &amp;quot;it can wait for a week day&amp;quot;'s. I think I shall play on the PS2 whilst Carb Loading for the &lt;a class="reference external" href="http://www.greatrun.org/events/news.asp?id=17"&gt;race tomorrow&lt;/a&gt;. My wave (white) starts at 10.15 and hopefully I'll be finishing just as the pubs open. I'll have my phone on me after I've finished if anyone wants to join me in a celebratory pint before I go home to get ready for Sheila's birthday bash later in the day.&lt;/p&gt;
</content><category term="general"></category><category term="gentoo"></category><category term="running"></category></entry></feed>