<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alex&#039;s Adventures on the Infobahn &#187; gentoo</title>
	<atom:link href="http://www.bennee.com/~alex/blog/tag/gentoo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bennee.com/~alex/blog</link>
	<description>the wanderings of a supposed digital native</description>
	<lastBuildDate>Tue, 24 Jan 2012 08:38:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Playing Blu-Ray under Linux</title>
		<link>http://www.bennee.com/~alex/blog/2011/04/18/playing-blu-ray-under-linux/</link>
		<comments>http://www.bennee.com/~alex/blog/2011/04/18/playing-blu-ray-under-linux/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 12:43:29 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[blu-ray]]></category>
		<category><![CDATA[defective-by-design]]></category>
		<category><![CDATA[drm]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.bennee.com/~alex/blog/?p=2247</guid>
		<description><![CDATA[One of the many deficiencies of Digital Restrictions Management is the fact it makes doing legal authorised things hard for paying customers. For example my brother still can&#8217;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&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>One of the many deficiencies of <a href="http://en.wikipedia.org/wiki/Digital_rights_management">Digital Restrictions Management</a> is the fact it makes doing legal authorised things hard for paying customers. For example my brother still can&#8217;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&#8217;t see a verifiable encrypted path to his big screen display it refuses to play his legally purchased disks.</p>
<p>This is one reason why I haven&#8217;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.</p>
<p>My desktop system runs <a href="http://en.wikipedia.org/wiki/Gentoo_Linux">Gentoo</a> which makes running bleeding edge code very easy. I duly enabled the &#8220;bluray&#8221; and &#8220;aacs&#8221; <A href="http://www.gentoo.org/dyn/use-index.xml">use flags</a> 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.</p>
<p>After a bunch of searching the interwebs and drawing blanks on finding any explicit &#8220;HOWTO&#8221; instructions I resorted to running mplayer through a debugger (one advantage of an Open Source system is there are no &#8220;black boxes&#8221; to reverse engineer) to see how libbluray was being invoked. It turned out it attempts to <a href="http://en.wikipedia.org/wiki/Dynamic_loading">dlopen</a> another library <a href="http://www.videolan.org/developers/libaacs.html">libaacs</a> which wasn&#8217;t on my system. Once I added it&#8217;s <a href="http://bugs.gentoo.org/show_bug.cgi?id=352031">ebuild</a> to my overlay I was one step closer.</p>
<p>Unlike the libdecss (which works around the rather anaemic crypto on plain old DVDs) the libaacs library doesn&#8217;t crack the considerably stronger keys used on BluRay. It relies on a database of Volume keys which can be placed in <em>~/.config/aacs/KEYDB.CFG</em> which are  used to calculate the final decryption keys for the content. Confusingly the format is different from the key databases <a href="http://www.google.co.uk/search?q=KEYDB.CFG">you may find searching</a> the internet. However the <a href="http://git.videolan.org/?p=libaacs.git;a=blob;f=KEYDB.cfg;h=b3b1a7ec08d1964f215024c777e92e92e519dcc2;hb=HEAD">libaacs file format documentation</a> provides instruction on convert the old format into a new format file.</p>
<p>With all of this in-place I was finally able to play my legally owned copy of Black Hawk Down. Yay!</p>
<p>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&#8217;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.</p>
<p>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.</p>
<p>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&#8217;ll be buying any more Blu-Ray disks until the process of playback is a lot simpler.</p>
<p><small>* My PS3 is very much Sony&#8217;s device, a Faustian bargain I accept because I like playing games every now and again. Witness the removal of <a href="http://en.wikipedia.org/wiki/OtherOS">OtherOS</a> from working systems in the wild by a mandatory firmware update.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bennee.com/~alex/blog/2011/04/18/playing-blu-ray-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo USE flags</title>
		<link>http://www.bennee.com/~alex/blog/2008/07/02/gentoo-use-flags/</link>
		<comments>http://www.bennee.com/~alex/blog/2008/07/02/gentoo-use-flags/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 12:12:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[gentoo]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I run three distributions most of the time. My servers all run Debian which despite recent cock-ups is a stable, unsurprising distribution. Exactly what you want from a server OS. My work desktop runs Ubuntu which is regularly updated, runs pretty much the latest Gnome, Firefox etc and is simple to administer. However for the [...]]]></description>
			<content:encoded><![CDATA[<p>I run three distributions most of the time. My servers all run <a  href="http://www.debian.org/">Debian</a> which despite recent <a  href="http://www.bennee.com/~alex/news.php?wl_mode=more&#038;wl_eid=1031">cock-ups</a>  is a stable, unsurprising distribution. Exactly what you want from a  server OS. My work desktop runs <a  href="http://www.ubuntu.com/">Ubuntu</a> 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&#8217;ve been running  <a href="http://www.gentoo.org/">Gentoo</a> 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.
<p>  Gentoo is a source based distribution. This means instead of  downloading binary packages with pre-compiled images it downloads <a  href="http://en.wikipedia.org/wiki/Source_code">source code</a> 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 &#8211; and by implication every package you  compile is linked against the right library. The result of this is  it&#8217;s very easy to run bleeding edge applications alongside a stable  base system, something that quite often doesn&#8217;t work with a binary  distributions which make assumptions about what is actually installed  on you machine.
<p>  The principle control for all of this is  <em>/etc/portage/package.keywords</em> for which a portion of mine  looks like this:
<p>  <code>  # KVM, bleeding edge<br />  app-emulation/kvm       ~amd64<br />  # Flash support (bit flakey)<br />  net-www/gnash           ~amd64<br />  # Kernel<br />  sys-kernel/kerneloops           ~amd64<br />  # Firefox<br />  www-client/mozilla-firefox      ~amd64<br />  dev-libs/nss                    ~amd64<br />  dev-libs/nspr                   ~amd64<br />  net-libs/xulrunner              ~amd64<br />  </code>
<p>  This allows me to run the latest KVM, Firefox and gnash without having  to sacrifice the stability of my base-system.
<p>  Another feature of the compiling by source is you don&#8217;t need to enable  every feature in the world. For example my <em>/etc/make.conf</em> is  contains things like:
<p>  <code>  USE="$USE -kde -qt gnome gtk2"<br />  </code>
<p> Which disables all KDE and QT stuff (seeing as I don&#8217;t run KDE) while  enabling any gnome support an app my have. You can see the use flags  that packages respect by running <em>emerge -p -v</em>:
<p>  <code>  danny ~ # emerge -p -v emacs<br />  [ebuild   R   ] app-editors/emacs-22.2-r2  USE="X alsa gif gtk jpeg  kerberos png spell tiff xpm -Xaw3d -gzip-el -hesiod -motif -sound  -source -toolkit-scroll-bars" 0 kB <br />  </code>
<p> So my emacs automatically picks up X and GTK support (my make.conf is  a little bigger than alluded to above <img src='/~alex/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . However you may not want to  build every application with support for everything. <A  href="http://en.wikipedia.org/wiki/AAlib">aalib</a> is very handy on  mplayer for checking encodes over a shell, but I don&#8217;t want every  application to link against it. Enter  <em>/etc/portage/package.use</em>:
<p>  <code>  # KVM<br />  #<br />  # Disable kvm module (we have our own)<br />  # Explicitly enable gcc4 support.<br />  app-emulation/kvm       -kvm ncurses sdl gcc4<br />  # Firefox needs Java support<br />  www-client/mozilla-firefox      java<br />  dev-java/blackdown-jre          nsplugin <br />  # I hate totem but it's needed for other apps<br />  # disable nsplugin so it doesn't drag firefox down<br />  # disable dvd so doesn't have to pull in gst-plugins-ugly<br />  media-video/totem               -nsplugin -dvd<br />  # mplayer needs aalib <img src='/~alex/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> <br />  media-video/mplayer             aalib<br />  </code>
<p>  So here I stop kvm from building it&#8217;s own kernel module (as I run my  own kernels), enable java on Firefox (where it&#8217;s useful, but I don&#8217;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).
<p>  This is the sort of fine grained control I really appreciate for my  home machine. And my compile flags, the rather sedentary  <em>CFLAGS=&#8221;-O2 -pipe&#8221;</em> <img src='/~alex/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />    </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bennee.com/~alex/blog/2008/07/02/gentoo-use-flags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gratuitous Code Post</title>
		<link>http://www.bennee.com/~alex/blog/2005/05/24/gratuitous-code-post/</link>
		<comments>http://www.bennee.com/~alex/blog/2005/05/24/gratuitous-code-post/#comments</comments>
		<pubDate>Tue, 24 May 2005 23:58:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[gentoo]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I got home today and had a sudden urge to run. I think this is because I&#8217;ve been cooped up in an office all day and needed some physical exertion. I didn&#8217;t run far, but I did run hard (so to speak). I think it cleared my mind enough that I could face adding the [...]]]></description>
			<content:encoded><![CDATA[<p>I got home today and had a sudden urge to run. I think this is because I&#8217;ve been cooped up in an office all day and needed some physical exertion. I didn&#8217;t run far, but I did run hard (so to speak).</p>
<p>
I think it cleared my mind enough that I could face adding the following code to my <a href="http://www.bennee.com/cgi-bin/viewcvs.cgi/src/dotfiles/dotbashrc">.bashrc</a><br />
to make working with gentoo overlays a little easier. Basically it allows me to hack around with ebuilds without doing my editing as root.<br />
<lj-cut text="Code!"></p>
<pre>
#
# 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="find $LOCAL_PORTAGE -xtype d -mindepth 2 -maxdepth 2 | sed s#$LOCAL_PORTAGE##"
alias ls_me="find $MASTER_PORTAGE -xtype d -mindepth 2 -maxdepth 2 | sed s#$MASTER_PORTAGE##"

#
# 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 "$1"'`
    ebuild=`echo $tmp | perl -ne 'm#/([^/]*)/(\w*)#; print "$2"'`
}

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

    if [ "$1" ]
    then
	guess_ebuild $1
	if [[ "$group" &#038;&#038; "$ebuild" ]]
	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 [ "$1" ]
    then
	guess_ebuild $1
	if [[ "$group" &#038;&#038; "$ebuild" ]]
	then
	    echo "Cloning ebuild $group/$ebuild"
	    mkdir -p $LOCAL_PORTAGE/$group
	    cp -aP $MASTER_PORTAGE/$group/$ebuild $LOCAL_PORTAGE/$group/
	else
	    echo "$1 not in  Master Portage"
	fi
    else
        echo "No ebuild specified"
    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 [ "x$result" == "x" ]
      then
	  echo "Removing local copy of $ebuild"
	  rm -rf $LOCAL_PORTAGE/$ebuild
      fi
    done
}
</pre>
<p></lj-cut></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bennee.com/~alex/blog/2005/05/24/gratuitous-code-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Many Threads</title>
		<link>http://www.bennee.com/~alex/blog/2005/05/21/many-threads/</link>
		<comments>http://www.bennee.com/~alex/blog/2005/05/21/many-threads/#comments</comments>
		<pubDate>Sat, 21 May 2005 17:37:03 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[running]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I&#8217;ve spent most of the morning trying to properly fix the glibc 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 nptlonly in my USE flags and rebuilt glibc everything worked fine. I now no longer need to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent most of the morning trying to properly fix the <a  href="http://www.gnu.org/software/libc/libc.html">glibc</a> 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 <em>nptlonly</em> in my USE  flags and rebuilt glibc everything worked fine. I now no longer need  to keep the unmanaged tarball around to overwrite emerge&#8217;s breakage.
<p>  I was planning to write some letters to the Inland Revenue today but  I&#8217;ve had an attack of the &#8220;it can wait for a week day&#8221;&#8216;s. I think I  shall play on the PS2 whilst Carb Loading for the <a  href="http://www.greatrun.org/events/news.asp?id=17">race  tomorrow</a>. My wave (white) starts at 10.15 and hopefully I&#8217;ll be finishing just as the  pubs open. I&#8217;ll have my phone on me after I&#8217;ve finished if anyone  wants to join me in a celebratory pint before I go home to get ready  for Sheila&#8217;s birthday bash later in the day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bennee.com/~alex/blog/2005/05/21/many-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

