<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>G-Loaded Journal &#187; Compiling</title>
	<atom:link href="http://www.g-loaded.eu/tag/compiling/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.g-loaded.eu</link>
	<description>An open-source software and technology related journal</description>
	<lastBuildDate>Thu, 02 Sep 2010 17:01:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Manually Prepare the RPM Building Environment</title>
		<link>http://www.g-loaded.eu/2009/04/24/manually-prepare-the-rpm-building-environment/</link>
		<comments>http://www.g-loaded.eu/2009/04/24/manually-prepare-the-rpm-building-environment/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 09:43:48 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[RPM]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1088</guid>
		<description><![CDATA[About three years ago I had posted a general guide on how to create RPM packages. According to that guide the RPM building environment was prepared using the handy utility rpmdev-setuptree (part of the rpmdevtools package in Fedora). This post describes the manual preparation of the RPM building environment. As an unprivileged user create the [...]]]></description>
			<content:encoded><![CDATA[<p>About three years ago I had posted a general guide on <a href="http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/">how to create RPM packages</a>. According to that guide the RPM building environment was prepared using the handy utility <strong>rpmdev-setuptree</strong> (part of the <strong>rpmdevtools</strong> package in Fedora). This post describes the <strong>manual preparation</strong> of the RPM building environment.<br />
<span id="more-1088"></span><br />
As an <strong>unprivileged user</strong> create the following directory tree:</p>
<pre class="console">
mkdir ~/rpmbuild \
    ~/rpmbuild/BUILD \
    ~/rpmbuild/RPMS \
    ~/rpmbuild/SOURCES \
    ~/rpmbuild/SPECS \
    ~/rpmbuild/SRPMS
</pre>
<p>Now, create the file <strong>~/.rpmmacros</strong> and put the following <strong>basic macros</strong> in it:</p>
<pre class="codesnp">
%_topdir      %(echo $HOME)/rpmbuild
%_smp_mflags  -j3
%__arch_install_post   /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot
</pre>
<p>The <strong>%_topdir</strong> macro is set to the path of the root directory of your RPM building environment, <code>/home/[user]/rpmbuild</code> in this case.</p>
<p>The <strong>%_smp_mflags</strong> macro usually contains only the <strong>-j</strong> (<strong>&#8211;jobs</strong>) option for the <strong>make</strong> command, which defines the number of jobs (<em>make</em> commands) that may run simultaneously. Usually, this is set to the number of CPU cores plus one. So, on a dual core CPU, the smp flags are set to <strong>-j3</strong>.</p>
<p>The <strong>%__arch_install_post</strong> macro contains various checks that should be run on the files in the BUILDROOT location. I trust Fedora guys and use the defaults <em>check-rpaths</em> and <em>check-buildroot</em> on Fedora and CentOS. This macro is optional.</p>
<p>All macros that are set in <strong>~/.rpmmacros</strong> <em>override</em> the <strong>system-wide macros</strong> that have been set in other locations. To check which paths are checked for macro files, enter the following command:</p>
<pre class="console">
rpm --showrc | grep macrofiles
</pre>
<p>The following command shows the current configuration for RPM building:</p>
<pre class="console">
rpm --showrc
</pre>
<p>All the available macros can be found in <strong>/usr/lib/rpm/macros</strong>.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/04/24/manually-prepare-the-rpm-building-environment/">Manually Prepare the RPM Building Environment</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/" rel="bookmark">How To Build RPM Packages on Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/21/chroot-environment-howto/" rel="bookmark">chroot Environment Howto</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/" rel="bookmark">Build a single native kernel module</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/15/get-my-kernel-headers-script/" rel="bookmark">Get my kernel headers script</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/10/spec-file-directory/" rel="bookmark">SPEC File Directory</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/04/24/manually-prepare-the-rpm-building-environment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</title>
		<link>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/</link>
		<comments>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 05:35:49 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/</guid>
		<description><![CDATA[This article describes how to implement SSL-enabled name-based vhosts &#8211; that is secure virtual hosts which share the same IP address and port &#8211; with the SNI-capable mod_gnutls module for Apache&#8217;s httpd web server. Server Name Indication (SNI), as described in section 3.1 of the RFC3546, is a TLS extension which makes the configuration of [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes how to implement SSL-enabled name-based vhosts &#8211; that is secure virtual hosts which share the same IP address and port &#8211; with the <strong>SNI</strong>-capable <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/">mod_gnutls</a> module for Apache&#8217;s httpd web server.<br />
<span id="more-438"></span><br />
<em>Server Name Indication</em> (<strong>SNI</strong>), as described in section 3.1 of the <a href="http://www.ietf.org/rfc/rfc3546.txt">RFC3546</a>, is a TLS extension which makes the configuration of SSL-enabled name-based virtual hosts possible. This extention eliminates the need for the assignment of one IP address per secure virtual host, therefore the cost for secure web hosting is greatly reduced, as all secure virtual hosts can share the same IP address and port combination. SNI is a huge step forward as it promotes security by making secure web services easier and cheaper to implement. The current version of <a href="http://www.openssl.org/">OpenSSL</a> &#8211; 0.98 at the time of writing &#8211; does not support SNI yet, but this is planned for the upcoming 0.99 release. On the other hand, <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/">mod_gnutls</a>, an experimental module for Apache&#8217;s <a href="http://httpd.apache.org/">httpd</a> which has been around for 2+ years, includes support for <strong>SNI</strong>.</p>
<h4>Introduction</h4>
<p>Searching the web for mod_gnutls binary distribution packages or information on how to set it up returned very few relevant results. This was a surprise, as, at this moment, the only implementation that supports SNI is mod_gnutls. So, I decided to write a tutorial on how to set things up for a test. I hope you find it useful.</p>
<p>The test that is described in this guide includes:</p>
<ol>
<li>The compilation of the mod_gnutls module.</li>
<li>The generation of SSL certificates.</li>
<li>The configuration of the SSL-enabled name-based virtual hosts.</li>
</ol>
<p>This test was performed on a server that runs <a href="http://fedoraproject.org/">Fedora</a> 7.</p>
<h4>Installation</h4>
<p>In order to compile mod_gnutls, you will need the development tools for Fedora:</p>
<pre class="console"># yum groupinstall "Development Tools"</pre>
<p>Install the mod_gnutls dependencies:</p>
<pre class="console"># yum install httpd-devel gnutls-devel</pre>
<p>As an unprivileged user, download the mod_gnutls distribution and compile it.</p>
<pre class="console">
$ wget http://www.outoforder.cc/downloads/mod_gnutls/mod_gnutls-0.2.0.tar.bz2
$ tar -xjvf mod_gnutls-0.2.0.tar.bz2
$ cd mod_gnutls-0.2.0
$ ./configure --prefix=/usr
$ make
</pre>
<p>Do not use the &#8216;<code>make install</code>&#8216; script, but perform the installation manually &#8211; it is only one library.</p>
<p>As root, copy <strong>libmod_gnutls.so</strong> to the directory that holds the Apache modules (usually <code>/usr/lib/httpd/modules</code>) and rename it to <strong>mod_gnutls.so</strong> for consistency:</p>
<pre class="console"># cp mod_gnutls-0.2.0/src/.libs/libmod_gnutls.so /usr/lib/httpd/modules/mod_gnutls.so</pre>
<p>During the compilation, two keys, <code>dhfile</code> and <code>rsafile</code>, have been generated in the <code>mod_gnutls-0.2.0/data/</code> directory. It is absolutely important to copy these files in httpd&#8217;s configuration directory (usually <code>/etc/httpd/conf/</code>), otherwise mod_gnutls will never work. This is undocumented, and I found out about it after some trial&#038;error.</p>
<p>As root:</p>
<pre class="console"># cp mod_gnutls-0.2.0/data/{dh,rsa}file /etc/httpd/conf/</pre>
<p>Installation is complete.</p>
<h4>SSL certificates</h4>
<p>In this test installation, two virtual hosts will be used. Thus, two SSL certificates will be required. Please read my article on how to <a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">generate SSL certificates</a> for your servers, as this information is beyond the scope of this document. Alternatively, you may use a ready-made <strong>script</strong> which will create those certificates for you quickly. Such scripts are shipped will almost all Linux distributions. Please consult your distribution&#8217;s documentation for more information.</p>
<h4>HTTPd Configuration</h4>
<p>The configuration of the Apache web server includes two phases:</p>
<ol>
<li>The configuration of the main server.</li>
<li>The configuration of the virtual hosts.</li>
</ol>
<p>In the following instructions, some brief notes about what each directive does is included. For more detailed information, please consult the <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/docs/">mod_gnutls documentation</a>.</p>
<h5>Main Server Configuration</h5>
<p>This includes setting some general mod_gnutls options, which will be inherited by all virtual hosts.</p>
<p>But, first of all, httpd needs to be set to listen on port 443 (in addition to port 80). Instead of specifying the SSL port only (<code>Listen 443</code>) which will lead httpd to listen to all the available network interfaces, you may specify the exact network interface on which the server will listen. For example:</p>
<pre class="codesnp">Listen 192.168.0.1:443</pre>
<p>Next, load mod_gnutls:</p>
<pre class="codesnp">LoadModule gnutls_module modules/mod_gnutls.so</pre>
<p>Add some MIME-types for downloading Certificates and CRLs from your web sites (taken from the <code>mod_ssl</code> configuration):</p>
<pre class="codesnp">
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
</pre>
<p>It is suggested that you use a session cache for mod_gnutls. This will increase its performance. In this example, the <strong>dbm</strong> cache type is used. This cache type requires a directory where mod_gnutls will actually save SSL session data. So, creating a directory for this purpose and giving ownership to the user that runs Apache (usually <code>apache</code> or <code>www-data</code>) is needed. Assuming that the Apache user is <code>apache</code>, as root issue the commands:</p>
<pre class="console">
# mkdir -m 0700 /var/cache/mod_gnutls_cache
# chown apache:apache /var/cache/mod_gnutls_cache
</pre>
<p>Now, back to the Apache configuration. The following directive sets the <strong>dbm</strong> SSL Session Cache for mod_gnutls:</p>
<pre class="codesnp">
GnuTLSCache dbm "/var/cache/mod_gnutls_cache"
</pre>
<p>Set a timeout for the SSL Session Cache entries. Usually, this is set to 300 seconds:</p>
<pre class="codesnp">
GnuTLSCacheTimeout 300
</pre>
<p>Finally, specify that on the <code>192.168.0.1:443</code> interface and port there will be name-based virtual hosts; that is vhosts that <em>share</em> the specified interface and port:</p>
<pre class="codesnp">
NameVirtualHost 192.168.0.1:443
</pre>
<h5>Virtual Host Configuration</h5>
<p>The example virtual hosts are: <code>v1.example.org</code> and <code>v2.example.org</code>. It is assumed that two SSL certificates with the canonical name (CN) correctly set to each of the aforementioned vhost domains have been generated.</p>
<p>In the following vhost configs, only the absolutely required directives have been used. The rest of the options are inherited from the main server.</p>
<pre class="codesnp">
&lt;VirtualHost 192.168.0.1:443&gt;
    ServerName v1.example.org:443
    GnuTLSEnable on
    GnuTLSCertificateFile /etc/pki_custom/certs/v1.example.org.crt
    GnuTLSKeyFile /etc/pki_custom/private/v1.example.org.key
    DocumentRoot "/var/www/v1/public_html"
&lt;/VirtualHost&gt;

&lt;VirtualHost 192.168.0.1:443&gt;
    ServerName v2.example.org:443
    GnuTLSEnable on
    GnuTLSCertificateFile /etc/pki_custom/certs/v2.example.org.crt
    GnuTLSKeyFile /etc/pki_custom/private/v2.example.org.key
    DocumentRoot "/var/www/v2/public_html"
&lt;/VirtualHost&gt;
</pre>
<h4>Testing the setup</h4>
<p>Having finished with the configuration, <strong>review</strong> the changes, <strong>restart</strong> the server and <strong>check</strong> the error logs for any errors.</p>
<p>Use a <em>web browser</em> to visit each of the virtual hosts by using the HTTPS protocol:</p>
<pre class="codesnp">

https://v1.example.org/

https://v2.example.org/
</pre>
<p>Until now, the web server did not support the SNI TLS extension. Therefore, when visiting the <code>v2.example.org</code> virtual host, you would see <strong>two</strong> warnings in your browser. The first one would be because the vhost&#8217;s certificate has not been issued by a trusted Certificate Authority &#8211; this is normal as it was you who issued that certificate &#8211; and the other one because on a server without SNI support it is actually the V1 vhost&#8217;s certificate that is used when visiting V2 vhost over https. Remember the <a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#vhosts2">limitation</a> with SSL and name-based virtual hosts?</p>
<p>With mod_gnutls, the server supports the SNI TLS extension. Although the virtual hosts are name-based, no matter which one you visit, the relevant certificate for each vhost is used and the only warning you see is the one about the certificates being self-signed. You can get rid of these by purchasing a certificate that is issued by a trusted Certificate Authority.</p>
<h4>Conclusion</h4>
<p><strong>mod_gnutls</strong> works. Actually, it was a real pleasure to see SNI work!</p>
<p>It is important to note though that mod_gnutls is still in <em>experimental</em> phase. Therefore, performance issues should be considered as normal when using it.</p>
<p>At the moment of writing, my server uses Fedora 7 as an operating system. As I haven&#8217;t upgraded my desktop to F7 yet and my server does not have any development tools installed, I compiled mod_gnutls on a Fedora 6 system and used it on Fedora 7. I do not know if that was the reason &#8211; and I did not have the necessary free time to investigate &#8211; or anything else, but, during the use of mod_gnutls, my server&#8217;s load average increased significantly.</p>
<p><a href="http://www.flickr.com/photos/maxshots/1067120133/" title="Load Average increase during mod_gnutls testing on a production web server"><img src="http://farm2.static.flickr.com/1198/1067120133_38398a4fe8_o.png" width="597" height="255" alt="Load average increase during mod_gnutls testing" /></a></p>
<p>I will test mod_gnutls again soon and post the new results, if they are different than the ones I present in this article. I highly recommend that you try it, as it is currently the only way to easily achieve SSL-enabled name-based virtual hosts using the SNI TLS extension. Note, that this extension will be supported by openssl 0.99, so the moment that SNI goes mainstream and such a setup becomes easy and cheap to implement with any Linux distribution is close.</p>
<p>One last thing that has not been mentioned at all is about SNI support in <strong>web browsers</strong>. Currently, with the exception of Safari (this is unconfirmed, please correct me if I am wrong), the latest versions of all major web browsers, Firefox and other Mozilla-based browsers, Internet Explorer, Opera, support SNI.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/" rel="bookmark">mod_gnutls binary for Apache</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/" rel="bookmark">Use mod_deflate to Compress Web Content delivered by Apache</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/" rel="bookmark">Be your own Certificate Authority (CA)</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>TrueCrypt on 2.6.18 kernels</title>
		<link>http://www.g-loaded.eu/2006/11/05/truecrypt-on-2618-kernels/</link>
		<comments>http://www.g-loaded.eu/2006/11/05/truecrypt-on-2618-kernels/#comments</comments>
		<pubDate>Sun, 05 Nov 2006 03:52:40 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/2006/11/05/truecrypt-on-2618-kernels/</guid>
		<description><![CDATA[It seems that there is a problem compiling the Linux version of Truecrypt v4.2a on the 2.6.18 series of kernels. A patch has been posted in the Truecrypt forums (you need to be logged-in to read), but, although this patch resolves the compilation error, there have been reports that the program has problems unmounting the [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that there is a problem compiling the Linux version of <a href="http://www.truecrypt.org/">Truecrypt</a> v4.2a on the 2.6.18 series of kernels. A <a href="http://forums.truecrypt.org/viewtopic.php?t=4155">patch</a> has been posted in the Truecrypt forums (you need to be logged-in to read), but, although this patch resolves the compilation error, there have been reports that the program has problems unmounting the encrypted volumes and releasing the loop devices. So, truecrypt is a no-go for Fedora 6 at the moment, at least until a new version that works flawlessly is released. An alternative way to create encrypted file containers pretty much like Truecrypt is by using dm-crypt and LUKS. More information about this method, can be found in another <a href="http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/">article</a> of mine.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/11/05/truecrypt-on-2618-kernels/">TrueCrypt on 2.6.18 kernels</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/" rel="bookmark">Encrypt devices using dm-crypt and LUKS</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/24/creative-commons-v30-licenses-launched/" rel="bookmark">Creative Commons v3.0 Licenses Launched</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/" rel="bookmark">The Complete Fedora Kernel Headers</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/16/using-ssh-for-networking/" rel="bookmark">Using SSH for networking</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/29/best-practices-of-software-licensing/" rel="bookmark">Best Practices of Software Licensing</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/11/05/truecrypt-on-2618-kernels/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>SPEC File Directory</title>
		<link>http://www.g-loaded.eu/2006/09/10/spec-file-directory/</link>
		<comments>http://www.g-loaded.eu/2006/09/10/spec-file-directory/#comments</comments>
		<pubDate>Sat, 09 Sep 2006 22:45:47 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Packaging]]></category>
		<category><![CDATA[RPM]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/2006/09/10/spec-file-directory/</guid>
		<description><![CDATA[I started packaging linux software for my Fedora machines from the time I was using Fedora Rawhide (development version) as my primary system. There is no repository that is synced with Rawhide, so there was a huge amount of software I had to compile (mostly multimedia related). This is a very time-consuming task, so I [...]]]></description>
			<content:encoded><![CDATA[<p>I started packaging linux software for my Fedora machines from the time I was using Fedora Rawhide (development version) as my primary system. There is no repository that is synced with Rawhide, so there was a huge amount of software I had to compile (mostly multimedia related). This is a very time-consuming task, so I decided to end it. Now, I use Base, Extras and Livna repos for my system updates and I vowed never to use a development distro release as my primary system again (mainly because of lack of free time and performance issues).</p>
<p>Anyway, I still package a bunch of RPMs for my systems. I decided to upload some of the spec files. These are available in <a href="http://www.g-loaded.eu/packages/specs/">this directory</a>. There are many more, but they need a bit of polishing.</p>
<p>Some notes:</p>
<ul>
<li>The nvidia-legacy spec file generates RPMs for the OpenGL libraries and the NVidia Legacy driver (for GF2 for example). These packages <strong>do not</strong> replace any core Fedora files. The official installation script from NVidia replaces some files and it should not be used.</li>
<li>These spec files are completely unsupported. Don&#8217;t send me emails about them, unless you find any mistakes in them. For information about building RPMs on Fedora refer to my relevant <a href="http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/">small article</a>.</li>
<li>The spec files are for software that does not exist in the repos mentioned above (except for kernel modules, for which I don&#8217;t wish to wait until Livna releases new versions). I haven&#8217;t submitted any of them to Extras or Livna because I don&#8217;t have the time to update them in time. The files comply with the Fedora packaging guidelines and naming schemes.</li>
<li>Dependencies in the alexandria and ruby-related spec files were updated by Leeksoup for FC5. I don&#8217;t use this software anymore, so I appreciate it :-)</li>
</ul>
<p>Packaging is art :-)</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/09/10/spec-file-directory/">SPEC File Directory</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2006/04/02/fedora-core-5/" rel="bookmark">Fedora Core 5</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/06/file-and-directory-diff-in-color-in-midnight-commander/" rel="bookmark">File and Directory diff in color in Midnight Commander</a></li>
<li><a href="http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/" rel="bookmark">How To Build RPM Packages on Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2006/02/20/gnome-214-rawhide-suse-and-more/" rel="bookmark">GNOME 2.14, Rawhide, SUSE and more&#8230;</a></li>
<li><a href="http://www.g-loaded.eu/2005/10/11/the-road-to-alexandria/" rel="bookmark">The road to Alexandria&#8230;</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/09/10/spec-file-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Kernel 2.6.17 and lirc_gpio driver</title>
		<link>http://www.g-loaded.eu/2006/09/09/kernel-2617-and-lirc_gpio-driver/</link>
		<comments>http://www.g-loaded.eu/2006/09/09/kernel-2617-and-lirc_gpio-driver/#comments</comments>
		<pubDate>Sat, 09 Sep 2006 21:29:32 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/2006/09/09/kernel-2617-and-lirc_gpio-driver/</guid>
		<description><![CDATA[I use an old bt878-based TV capture card, whose remote control needs the lirc_gpio driver in order to work. I remember that this specific LIRC driver could not be compiled after upgrading to kernel 2.6.17. I investigated this problem a couple of days ago and it seems that the cause of this issue is the [...]]]></description>
			<content:encoded><![CDATA[<p>I use an old bt878-based TV capture card, whose remote control needs the <code>lirc_gpio</code> driver in order to work. I remember that this specific LIRC driver could not be compiled after upgrading to kernel 2.6.17. I investigated this problem a couple of days ago and it seems that the cause of this issue is the fact that the location of the bt848/bt878 related kernel headers has changed.<br />
<span id="more-252"></span><br />
The needed headers, bttv.h and bttvp.h, now exist in the <code>drivers/media/video/bt8xx/</code> directory. Their old location was <code>drivers/media/video/</code>. So, compiling <code>lirc_gpio</code> requires the following small patch:</p>
<pre class="codesnp">
--- drivers/lirc_gpio/lirc_gpio.c.original      2006-01-01 15:43:46.000000000 +0200
+++ drivers/lirc_gpio/lirc_gpio.c       2006-09-08 20:03:34.000000000 +0300
@@ -49,8 +49,8 @@
 #include "../drivers/char/bttv.h"
 #include "../drivers/char/bttvp.h"
 #else
-#include "../drivers/media/video/bttv.h"
-#include "../drivers/media/video/bttvp.h"
+#include "../drivers/media/video/bt8xx/bttv.h"
+#include "../drivers/media/video/bt8xx/bttvp.h"
 #endif

 #if BTTV_VERSION_CODE &lt; KERNEL_VERSION(0,7,45)
</pre>
<p>While <code>lirc_gpio</code> should now be compiled without problems, there is one more issue, which seems to be a kernel-source bug. The <code>bttvp.h</code> &#8220;includes&#8221; another header (<code>btcx-risc.h</code>), which should exist in the same directory. But, this file actually exists in the parent directory (<code>drivers/media/video/</code>). So, until this kernel source issue is resolved, the only way to build <code>lirc_gpio</code> succesfully is to:</p>
<ol>
<li>patch LIRC sources with the above patch,</li>
<li>copy the <code>btcx-risc.h</code> kernel header from location: <code>drivers/media/video/</code> to location: <code>drivers/media/video/bt8xx/</code> within the kernel source tree.</li>
</ol>
<p>I have already filed a bug about this in the Fedora Bugzilla. If there is anything I have missed, drop me a line.</p>
<h4>Further Reading</h4>
<ul>
<li><a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/">The Complete Fedora Kernel Headers</a> &#8211; all the required actions in order to compile lirc_gpio in Fedora.</li>
<li><a href="http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/">How to configure and use LIRC</a></li>
</ul>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/09/09/kernel-2617-and-lirc_gpio-driver/">Kernel 2.6.17 and lirc_gpio driver</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/" rel="bookmark">Build a single native kernel module</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/" rel="bookmark">The Complete Fedora Kernel Headers</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/15/get-my-kernel-headers-script/" rel="bookmark">Get my kernel headers script</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/" rel="bookmark">How to configure and use LIRC</a></li>
<li><a href="http://www.g-loaded.eu/2005/10/30/creative-pc-cam-750/" rel="bookmark">Creative PC-CAM Series webcams in linux</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/09/09/kernel-2617-and-lirc_gpio-driver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>A Note About The Epiphany Extensions on Fedora</title>
		<link>http://www.g-loaded.eu/2006/05/06/a-note-about-the-epiphany-extensions-on-fedora/</link>
		<comments>http://www.g-loaded.eu/2006/05/06/a-note-about-the-epiphany-extensions-on-fedora/#comments</comments>
		<pubDate>Sat, 06 May 2006 07:57:39 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Epiphany]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/2006/05/06/a-note-about-the-epiphany-extensions-on-fedora/</guid>
		<description><![CDATA[This is just a quick note for Fedora users who use Epiphany as their main web browser. As you have probably noticed, there is an epiphany-extensions package in Fedora-Extras. These extensions add some more functionality to Epiphany. If I recall correctly, this package does not contain all of the extensions that are available for this [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick note for Fedora users who use <a href="http://www.gnome.org/projects/epiphany/">Epiphany</a> as their main web browser. As you have probably noticed, there is an <code>epiphany-extensions</code> package in Fedora-Extras. These extensions add some more functionality to Epiphany. If I recall correctly, this package does not contain all of the extensions that are available for this browser and, for sure, it does not contain the sample extensions, which can help you write a small extension to satisfy your needs.</p>
<p>So, a custom compilation of the extensions is needed. Just keep in mind that in order to also compile the sample plugins you &#8216;ll need to add the following option when configuring:</p>
<pre class="codesnp">--with-extensions=really-all</pre>
<p>The <code>--with-extensions</code> option can take a comma separated list of the extentions that will be built, or the value &#8220;<code>all</code>&#8220;, which is supposed to build all the available extentions except for the samples, or it can be &#8220;<code>really_all</code>&#8221; which builds everything. Finally, this option can be completely omitted, which leads to the compilation of the default extentions.</p>
<p>Some of the extensions that do not exist in the default RPM package and I definitely wish they were there, are a feed subscription extension, an almost efficient ad-blocker and of course a Python Console. I do not really know why they are missing, perhaps due to some bugs, but I use them for a long time now and they seem to work fine.</p>
<p>PS: And, by the way, non Epiphany users, just give this browser a shot.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/05/06/a-note-about-the-epiphany-extensions-on-fedora/">A Note About The Epiphany Extensions on Fedora</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2007/05/16/some-thoughts-about-epiphany-extensions/" rel="bookmark">Some thoughts about Epiphany extensions</a></li>
<li><a href="http://www.g-loaded.eu/2007/09/14/featured-epiphany-plugins/" rel="bookmark">Featured Epiphany Plugins</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/16/tab-session-management-extension-for-epiphany/" rel="bookmark">Tab Session Management extension for Epiphany</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/28/tab-links-extension-for-the-epiphany-browser/" rel="bookmark">Tab Links extension for the Epiphany browser</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/17/epiphany-python-console-documentation/" rel="bookmark">Epiphany Python Console &#8211; Documentation</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/05/06/a-note-about-the-epiphany-extensions-on-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>How To Build RPM Packages on Fedora</title>
		<link>http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/</link>
		<comments>http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/#comments</comments>
		<pubDate>Wed, 05 Apr 2006 00:37:42 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Packaging]]></category>
		<category><![CDATA[RPM]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/</guid>
		<description><![CDATA[These are some general guidelines and notes in order to assist the adventurous first-time Fedora user to get started with RPM package building on Fedora Core.]]></description>
			<content:encoded><![CDATA[<p>These are some general guidelines and notes in order to assist the adventurous first-time Fedora user to get started with RPM package building.<br />
<span id="more-182"></span></p>
<h4>What Is An RPM Package?</h4>
<p>In simple terms, an <abbr title="Red Hat Package Manager">RPM</abbr> package is an advanced form of a container for other files. Generally, it includes:</p>
<ol>
<li>The program to be installed plus all the necessary files that accompany this program.</li>
<li>Information about the program and the RPM package itself.</li>
<li>Information about the program&#8217;s dependencies, which means info about what other software needs to be installed, so your program to function correctly in the system.</li>
<li>Information about potential conflicts between the program and other software that is currently installed in the system.</li>
<li>Actions that need to be performed when the program is installed/upgraded/removed.</li>
</ol>
<p>But, this is enough with the theory. For more information, refer to the links at the <em>Further Reading</em> section of this article.</p>
<h4>Prerequisites</h4>
<p>The following are needed in order to build RPM Packages.</p>
<ul>
<li>The development tools. All the utilities that are needed to compile a program, including the compiler itself.</li>
<li>A <abbr title="Specification File">SPEC</abbr> file for the particular program you want to create an RPM package for. A SPEC file contains all the information regarding the program&#8217;s details, its dependencies, the compilation options etc. For more info on writing SPEC files, refer to the links at the <em>Further Reading</em> section of this article.</li>
</ul>
<h4>Things You Need To Do Once</h4>
<p>There are a couple of thing you need to do before starting building your RPMs. These mainly include the installation of the core development tools and the creation of the building environment for your <em>user</em>.</p>
<p>Install the core development tools using <abbr title="YellowDog Updater Modified">YUM</abbr>. As <em>root</em>:</p>
<pre class="console"># yum groupinstall "Development Tools"</pre>
<p>Next, create the building environment for your user. Fortunately, Fedora includes some neat utilities that greatly simplify this procedure. First, use YUM to install them (as <em>root</em>):</p>
<pre class="console"># yum install rpmdevtools</pre>
<p>Then, create the directory structure in your home directory by issuing the command (as a user):</p>
<pre class="console">$ rpmdev-setuptree</pre>
<p>That&#8217;s it.</p>
<h4>Build That RPM!</h4>
<p>Provided that you have a SPEC file for your program, you can build the binary RPM package by issuing the command:</p>
<pre class="console">$ rpmbuild -bb --clean myprogram.spec</pre>
<p>If you need to build the package for a different architecture, you can set the <code>--target</code> option, like in the example below:</p>
<pre class="console">$ rpmbuild -bb --clean --target i686 myprogram.spec</pre>
<p>Please note that you should never build RPM packages using <em>root</em>.</p>
<h5>Dependencies</h5>
<p>Some programs may need additional development libraries in order to be compiled. You can use YUM to install these needed libraries (<code>-devel</code> packages) or programs. If the operation finishes succesfully, you&#8217;ll find your RPM package in the <code>~/rpmbuild/RPMS/</code> directory.</p>
<h4>Further Reading</h4>
<p>This small article&#8217;s goal was to get you started with art of RPM packaging by setting up the environment for RPM building. It&#8217;s a &quot;<em>Batteries Not Included!</em>&quot; article though. Information about how to write SPEC files is not available here. It would be pointless, as there are some excellent resources for this purpose. So, prepare for some real reading ladies and gentlemen:</p>
<ol>
<li><a href="http://fedora.redhat.com/docs/developers-guide/ch-rpm-building.html">Chapter 4. Building RPM Packages</a> of the <a href="http://fedora.redhat.com/docs/developers-guide/index.html">Fedora Core Developer&#8217;s Guide</a> by Tammy Fox, Havoc Pennington &#8211; General information about the SPEC file sections.</li>
<li><a href="http://fedora.redhat.com/docs/drafts/rpm-guide-en/ch-creating-rpms.html">Chapter 8. Creating RPMs: An Overview</a> of the <a href="http://fedora.redhat.com/docs/drafts/rpm-guide-en/index.html">RPM Guide</a> by Eric Foster-Johnson &#8211; In depth information about SPEC files.</li>
<li><a href="http://fedoraproject.org/wiki/Packaging/Guidelines">Packaging Guidelines</a> by <a href="http://fedoraproject.org/wiki/TomCallaway">Tom &#8216;spot&#8217; Callaway</a> &#8211; Information specific to writing SPEC files for Fedora Core.</li>
<li><a href="http://fedoraproject.org/wiki/Packaging/NamingGuidelines">Package Naming Guidelines</a> by <a href="http://fedoraproject.org/wiki/TomCallaway">Tom &#8216;spot&#8217; Callaway</a> &#8211; Information specific to Fedora RPM naming scheme.</li>
<li><a href="http://fedoraproject.org/wiki/Packaging/ScriptletSnippets">RPM scriptlet recipes</a> &#8211; Some extremely useful notes regarding the actions that need to be performed when a package is installed/upgraded/removed from the system, which should be included in the relevant sections of the SPEC file.</li>
<li><a href="http://www.rpm.org/max-rpm-snapshot/">Maximum RPM &#8211; Taking the RPM Package Manager to the Limit</a> &#8211; An excellent book about the RPM Package Manager, by Edward C. Bailey, Paul Nasrat, Matthias Saou, Ville Skyttä.</li>
</ol>
<h4>Changes</h4>
<dl>
<dt>Wed 23 Jan, 2008</dt>
<dd>This article has been updated to reflect the changes in the package names for rpmdevtools. The old package, named <code>fedora-rpmdevtools</code>, is now known as <code>rpmdevtools</code>. Also, the utility that sets up the initial rpmbuild directory tree is now called <code>rpmdev-setuptree</code> (old name was: <code>fedora-buildrpmtree</code>).</dd>
</dl>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/">How To Build RPM Packages on Fedora</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/" rel="bookmark">Build a single native kernel module</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/10/spec-file-directory/" rel="bookmark">SPEC File Directory</a></li>
<li><a href="http://www.g-loaded.eu/2005/10/11/the-road-to-alexandria/" rel="bookmark">The road to Alexandria&#8230;</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/" rel="bookmark">The Complete Fedora Kernel Headers</a></li>
<li><a href="http://www.g-loaded.eu/2009/04/24/manually-prepare-the-rpm-building-environment/" rel="bookmark">Manually Prepare the RPM Building Environment</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>How to configure and use LIRC</title>
		<link>http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/</link>
		<comments>http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/#comments</comments>
		<pubDate>Tue, 10 Jan 2006 13:58:34 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[LIRC]]></category>
		<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/</guid>
		<description><![CDATA[<abbr title="Linux Infrared Remote Control">LIRC</abbr> is basically a small server which can decode or transmit infra-red signals. This is a tutorial about how to set up the LIRC server and how to use it in order to control your system or specific LIRC-enabled applications with a remote control. Examples of simple or more complicated setups are also provided.]]></description>
			<content:encoded><![CDATA[<p><abbr title="Linux Infrared Remote Control">LIRC</abbr> is basically a small server which can decode or transmit infra-red signals. This is a tutorial about how to set up the LIRC server and how to use it in order to control your system or specific LIRC-enabled applications with a remote control. Examples of simple or more complicated setups are also provided.<br />
<span id="more-156"></span></p>
<h4>Prerequisites</h4>
<p>In order to use LIRC you will need the necessary hardware components, a remote control and an infrared receiver. LIRC supports a lengthy list of such devices. You can check if your equipment is supported at <a href="http://lirc.sourceforge.net/remotes/" title="Remote Controls supported by LIRC">this page</a>.</p>
<p>Next thing is to download the latest stable LIRC package from the <a href="http://www.lirc.org/" title="LIRC homepage">project page</a> and configure it properly for your equipment. For this article I&#8217;ll use the traditional way of compiling and installing software, so some such experience is required from your part. Of course, if you are into package building, you can build your own RPM or DEB package.</p>
<h4>Configure, Compile, Install</h4>
<p>Extract the LIRC package in a temporary directory (<code>~/tmp/</code>):</p>
<pre class="console"># tar -xzvf lirc-X.X.X.tar.gz -C ~/tmp/</pre>
<p>The most important part of the LIRC pre-compilation configuration is the choice of the appropriate driver for your hardware. For more info check the <a href="http://www.lirc.org/html/index.html">LIRC Documentation</a>. Normally, if you <em>know your hardware</em>, change to the directory where you have extracted the LIRC package and issue the following command in order to check which driver name you should use:</p>
<pre class="console"># ./configure --help</pre>
<p>Next, configure the package for your system. Because some kernel modules are built together with LIRC, you will need to have the <em>kernel development</em> package (eg <code>kernel-devel</code>) for your running kernel installed. To configure LIRC issue the command:</p>
<pre class="console"># ./configure &#92;
--prefix=/usr &#92;
--with-x &#92;
--with-transmitter &#92;
--enable-sandboxed &#92;
--with-moduledir=/lib/modules/$(uname -r)/extra/lirc &#92;
--with-kerneldir=/path/to/kernel/headers &#92;
--with-driver=DRIVER
</pre>
<p>Substitute <code>DRIVER</code> with the appropriate driver name and edit the path to your kernel headers/sources in the <code>--with-kerneldir</code> option. Note that the <code>--with-kerneldir</code> option can be safely omitted.<br />
We use the <code>--enable-sandboxed</code> option, so that the installation script does not try to create any device nodes for LIRC. An UDEV rule, that we will create later on, will take care of this.</p>
<p>If the configuration script fails due to missing dependencies, make sure you have all the necessary development tools, libraries and kernel headers installed in your system. Just read carefully the on-screen error messages to see what is missing.</p>
<p>After this configuration is finished, you will see a message in your terminal about which LIRC module will be used. <strong>Take a note</strong> of the module name, as you will need it later on.</p>
<p><em>NOTE</em>: On Fedora, I was not able to build the required <code>lirc_gpio</code> module. My IR receiver is attached on my KWorld TV tuner card, so this module was absolutely needed. In such a case you will probably want to read my post about the <a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/">The Complete Fedora Kernel Headers</a>.</p>
<p>Next, proceed to the LIRC compilation:</p>
<pre class="console"># make</pre>
<p>and installation. This step is needed to be done as <strong>root</strong>:</p>
<pre class="console"># make install</pre>
<p>If for any reason you want to uninstall all LIRC files, from within our current directory, issue the command:</p>
<pre class="console"># make uninstall</pre>
<p><strong>Special Note</strong>: Before you update your system kernel at some later time, you will need to uninstall LIRC. After the kernel upgrade, you will have to repeat the previous configuration, compilation and installation steps, so that the LIRC module is built for your new kernel.</p>
<p>The final step is to create an UDEV rule, so that the LIRC devices are created properly and with appropriate permissions.</p>
<p>Create a text file, named <code>10-lirc.rules</code>, in the <code>/etc/udev/rules.d/</code> directory and add the following to it:</p>
<pre class="codesnp">KERNEL=="lirc[0-9]*", NAME=="lirc%n", GROUP=="disk", MODE=="0660"
KERNEL=="lirc0", SYMLINK=="lirc"</pre>
<p>Finally, make sure you add the users you want to have access to the LIRC server to the group <code>disk</code>. Alternatively, if you want all the users to be able to access LIRC, then modify the <code>MODE</code> in the UDEV rule above from <code>MODE==&quot;0660&quot;</code> to <code>MODE==&quot;0666&quot;</code>.</p>
<p>That&#8217;s it.</p>
<h4>The LIRC Server Configuration</h4>
<p>It seems that the LIRC daemon (<code>lircd</code>) does not load the default module (driver) automatically when it starts, so this module should be loaded manually.</p>
<p>To load the appropriate module and the LIRC server at boot time, all you have to do is to add the following lines to the <code>/etc/rc.d/rc.local</code> file. As <strong>root</strong>:</p>
<pre class="codesnp">modprobe MODULE_NAME
lircd</pre>
<p>Substitute <code>MODULE_NAME</code> with the module name you had taken a note of when configuring LIRC. For me, it would be <code>lirc_gpio</code>. The LIRC daemon, by default, uses the driver that was defined during the LIRC pre-compilation configuration.</p>
<p>The LIRC daemon also needs a configuration file (<code>/etc/lircd.conf</code>), which contains the proper addresses of your remote control&#8217;s buttons. The LIRC package contains some ready made remote configs, but I suggest you create your own. Read on&#8230;</p>
<h4>The Remote Control Configuration file</h4>
<p>In this section we will create a configuration file for our remote control by using an utility named <code>irrecord</code>, which was built together with the rest of the LIRC components. Since irrecord is a <code>lircd client</code>, the LIRC daemon needs to be running prior to using this tool.</p>
<p>So, as <strong>root</strong>, load the appropriate LIRC module and start the daemon:</p>
<pre class="console"># modprobe MODULE_NAME
# lircd</pre>
<p>Now, change to a temporary directory and start irrecord:</p>
<pre class="console"># irrecord REMOTE_NAME</pre>
<p><code>REMOTE_NAME</code> is the remote control config file that will be created in the current directory. This will also be the name of your remote control that will be used within the created file. If you need to change it, do it by hand after this operation is finished. All you have to do is to follow the on-screen instructions. Generally, you will be asked to give names for the remote control buttons and to press each one of them.</p>
<p>After you are finished, copy the <code>REMOTE_NAME</code> file into <code>/etc/</code>, naming it <code>lircd.conf</code>. As <strong>root</strong>:</p>
<pre class="console"># cp REMOTE_NAME /etc/lircd.conf</pre>
<p>Kill the running lircd instance and start the daemon again, so that it uses the new configuration:</p>
<pre class="console"># killall lircd
# lircd</pre>
<h4>Applications and LIRC Support</h4>
<p>There are three kinds of applications:</p>
<ol>
<li>Those which could and actually have been built with LIRC support. These act as LIRC clients when there is a running LIRC daemon.</li>
<li>Those which do support LIRC, but have not been compiled with the LIRC support enabled.</li>
<li>Those which do not support LIRC at all.</li>
</ol>
<p>Generally, most multimedia applications, video and audio players, TV viewers and FM tuner applications, support LIRC. Also, many applications provide a method (separate utility or options) to send commands to a running instance of the application. This is particularly useful for programs that belong to the 2nd and 3rd categories. LIRC provides an utility, called <code>irexec</code> (LIRC client), which can be used to execute any command we want. This way, those applications can be controlled with the remote control through LIRC.</p>
<p>In order to use our remote control with a certain application, we have to create a configuration file that contains the mappings between the remote control&#8217;s buttons and the commands that will be executed when each button is pressed.</p>
<p>This file can be:</p>
<ul>
<li>named <code>.lircrc</code> and placed in the user&#8217;s home directory.</li>
<li>named <code>lircrc</code> (without the period in front of the name) and placed in the <code>/etc/</code> directory for system-wide configuration.</li>
</ul>
<p>Information about this file&#8217;s format can be found in the relevant section of the <a href="http://www.lirc.org/html/configure.html#lircrc_format">LIRC Documentation</a>.</p>
<h4>Quick Tests</h4>
<p>Here are some sample <code>.lircrc</code> files, so that you can test your installation. Make sure you have loaded the proper LIRC module and you have started the LIRC daemon. Save one of them as <code>.lircrc</code> and place it in your home directory.</p>
<p><strong>Special Note</strong>: In the following sample config files, substitute the remote control name with the name you have used for your own remote control and the button name with a name of any of your own remote control&#8217;s buttons.</p>
<p>The first two samples will work with Xine and MPlayer respectively. These two players are usually built with LIRC support and, when launched, they act as LIRC clients.</p>
<p>Load Xine and press the specified button on your remote control. It should toggle between full-screen and window-mode.</p>
<pre class="codesnp">
# .lircrc - XINE sample test
begin
    prog = xine
    remote = KWTV878RF
    button = ZOOM
    config = ToggleFullscreen
    repeat = 0
end
</pre>
<p>Use the following config with MPlayer.</p>
<pre class="codesnp">
# .lircrc - MPLAYER sample test
begin
    prog = mplayer
    remote = KWTV878RF
    button = ZOOM
    config = vo_fullscreen
    repeat = 0
end
</pre>
<p>For applications that are not LIRC clients themselves, but which provide a method to send commands to a running instance of the application, the configuration is a bit different. The LIRC client <code>irexec</code> is used in these cases. When you press a button on the remote control, <code>irexec</code> executes the specified command. This requires that <code>irexec</code> is running. Start it as a user:</p>
<pre class="console"># irexec</pre>
<p>Save the following as <code>.lircrc</code> and launch TVtime. The specified button on the remote control should toggle between full-screen and window-mode.</p>
<pre class="codesnp">
# .lircrc - TVtime sample test
begin
    prog = irexec
    remote = KWTV878RF
    button = ZOOM
    config = tvtime-command TOGGLE_FULLSCREEN
    repeat = 0
end
</pre>
<p>To start <code>irexec</code> and have it run in the background, start it as shown below:</p>
<pre class="console"># irexec &#038;</pre>
<p>To kill it:</p>
<pre class="console"># killall irexec</pre>
<h4>Some hints for more complicated configurations</h4>
<p>Here are some hints for those of you who need complicated setups.</p>
<h5>Toggle Buttons</h5>
<p>You can create <strong>toggle buttons</strong>, for example you can set the same button to <em>Play</em> or <em>Pause</em> a video stream, by setting two <code>config = command</code> directives. They will be executed in turns. For example:</p>
<pre class="codesnp">
# Toggle button example
begin
    prog = irexec
    remote = remoteA
    button = buttonA
    config = play_command
    config = pause_command
    repeat = 0
end
</pre>
<p>Using this configuration, when <code>buttonA</code> is pressed for the first time, the <code>play_command</code> is executed. The second time <code>buttonA</code> is pressed, the <code>pause_command</code> is executed.</p>
<h5>Modes</h5>
<p>Let&#8217;s assume that you want to control many applications with your remote control. Some of them are LIRC clients and some are controlled through <code>irexec</code>. You can define various <strong>modes</strong> (groups of button to command mappings), one for each application.</p>
<p>First of all, read the <code>.lircrc</code> format page from the <a href="http://www.lirc.org/html/configure.html#lircrc_format">LIRC Documentation</a> very carefully.</p>
<p>Keep in mind the following rule:</p>
<blockquote><p>Each time you start a LIRC client and there is a mode within your configuration with a name equal to the application&#8217;s name, then this mode is automatically entered.</p></blockquote>
<p>This means that if there is a mode named <em>mplayer</em> inside <code>.lircrc</code> and you start the mplayer program, which is a LIRC client, then the mplayer mode is automatically entered and only the button mappings that exist within this mode are functional.</p>
<p>Save the following as <code>~/.lircrc</code>, substitute the remote control name and button names with your own, and start irexec:</p>
<pre class="codesnp">
# Example with modes

# MAIN BEGIN (irexec mode) - Application Selection Mode
# ---------------

begin irexec

    begin
        prog   = irexec
        remote = KWTV878RF
        button = 1
        # Start TVtime
        config = tvtime --window &#038;
        # Enter tvtime mode
        mode = tvtime
    end

    begin
        prog   = irexec
        remote = KWTV878RF
        button = 2
        # Start Totem player and play DVD
        config = totem dvd:/ &#038;
        # Enter totem mode
        mode = totem
    end

    begin
        prog   = irexec
        remote = KWTV878RF
        button = 3
        # Start Xine and play DVD
        config = xine dvd:/ --hide-gui &#038;
        # Enter xine mode
        mode = xine
    end

end irexec

# ---------------
# MAIN END (irexec mode end)

# APP MODES BEGIN
# ---------------

# tvtime mode
begin tvtime
    begin
        prog = irexec
        button = POWER
        config = tvtime-command QUIT
        # Enter irexec mode
        mode = irexec
    end
    begin
        prog = irexec
        button = ZOOM
        config = tvtime-command TOGGLE_FULLSCREEN
    end
end tvtime

# totem mode
begin totem
    begin
        prog = irexec
        button = POWER
        config = totem --quit
        # Enter irexec mode
        mode = irexec
    end
    begin
        prog = irexec
        button = ZOOM
        config = totem --fullscreen
    end
end totem

# xine mode
begin xine
    begin
        prog = xine
        button = POWER
        config = Quit
        # Enter irexec mode
        mode = irexec
    end
    begin
        prog = xine
        button = ZOOM
        config = ToggleFullscreen
    end
end xine

# ---------------
# APP MODES END
</pre>
<p>I hope this example is clear enough. What is going on here is that when <code>irexec</code> (LIRC client) is executed, then the <em>irexec mode</em> is entered. When you press button &quot;1&quot;, then TVtime is launched and the <em>tvtime mode</em> is entered. When you press the &quot;POWER&quot; button, TVtime quits and the <em>irexec mode</em> is entered etc. etc.</p>
<p>Furthermore, even if you do not start <code>irexec</code>, when you launch any LIRC enabled application, like Xine, MPlayer, Gnomeradio etc, then the appropriate mode will be entered automatically and you will be able to control this application remotely.</p>
<p>As you have probably already read in the <a href="http://www.lirc.org/html/configure.html#lircrc_format">LIRC Documentation</a>, you can modularize this configuration by keeping each application mode in a separate file. Just don&#8217;t forget to include those separate files by adding a line like the following in <code>~/.lircrc</code>. For example:</p>
<pre class="codesnp">include ~/.lirc/tvtime.lircrc</pre>
<h4>Final Notes</h4>
<p>Maybe you will need some time to familiarize yourself with the <code>.lircrc</code> format and probably more time reading the LIRC documentation, but you will be satisfied with the result.</p>
<p>For information about what commands are available for each application, please refer to the application&#8217;s documentation, project web site or support forum.</p>
<p>Also, if you need more information or support for LIRC, please ask your questions in relevant web forums. I have written all I know in this guide, so I am afraid I cannot help you more.</p>
<p>LIRC can do more things, for example it can be used to transmit IR signals or to connect to other LIRC servers accross the network. These have not been covered, not only because I consider such info as &quot;too much&quot; for a new user, but also because I have not been able to devote any time to experiment with these features.</p>
<p>This guide was written while using a Fedora 4 system.</p>
<h4>Further Reading</h4>
<p>You should read:</p>
<ol>
<li><a href="http://www.lirc.org/html/index.html">The LIRC Manual</a> (Documentation)</li>
</ol>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/">How to configure and use LIRC</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2006/09/09/kernel-2617-and-lirc_gpio-driver/" rel="bookmark">Kernel 2.6.17 and lirc_gpio driver</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/12/how-to-disable-ipv6-in-fedora-and-centos/" rel="bookmark">How to Disable IPv6 in Fedora and CentOS</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/" rel="bookmark">Build a single native kernel module</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/" rel="bookmark">The Complete Fedora Kernel Headers</a></li>
<li><a href="http://www.g-loaded.eu/2005/10/30/creative-pc-cam-750/" rel="bookmark">Creative PC-CAM Series webcams in linux</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Build a single native kernel module</title>
		<link>http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/</link>
		<comments>http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/#comments</comments>
		<pubDate>Tue, 20 Dec 2005 02:00:31 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.g-loaded.eu/?p=125</guid>
		<description><![CDATA[I was wondering how it would be possible to build a native kernel module, which is not enabled in the kernel configuration, and use it in order to add support for a certain feature to the system. This idea came to me while I was examining the kernel-module-ntfs SRPM package from the Livna repository. This [...]]]></description>
			<content:encoded><![CDATA[<p>I was wondering how it would be possible to build a native kernel module, which is not enabled in the kernel configuration, and use it in order to add support for a certain feature to the system. This idea came to me while I was examining the <code>kernel-module-ntfs</code> SRPM package from the <a href="http://rpm.livna.org/" title="Link to the Livna.org Repository homepage">Livna</a> repository. This package adds support for the <code>ntfs</code> filesystem and contains a <code>spec</code> file and an archive with the linux ntfs driver source code. This is the same driver as the one that is included in the kernel sources. So, how could I build just this driver as a module directly from the kernel sources, without modifying the default kernel configuration?<br />
<span id="more-125"></span><br />
After spending some time searching the internet for this info, the answer came from an <a href="http://www.linux-ntfs.org/content/view/126/62/">article</a>, titled &quot;<em>How To build your own NTFS RPMs</em>&quot; at the official linux ntfs driver <a href="http://www.linux-ntfs.org/">homepage</a>. Actually, the information I was looking for exists in a <a href="http://data.linux-ntfs.org/rpm/build-2.6">script</a> that is provided through this page.</p>
<h4>Prerequisites</h4>
<p>In order to build a module this way, you will need two things:</p>
<ol>
<li>The complete Fedora kernel sources, which are provided by the kernel SRPM.</li>
<li>Knowledge of the module&#8217;s configuration options.</li>
</ol>
<p>The &quot;<em>Qconf Graphical Kernel Configuration Tool</em>&quot; can be of great help in determining which are the configuration options for a certain module. You can launch this tool, by issuing the following command in the root directory of your kernel sources:</p>
<pre class="console"># make xconfig</pre>
<p>Furthermore, this article assumes that we want to keep the default kernel configuration.</p>
<p>I would also recommend that you read another <a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/">document</a> of mine, named &quot;<em>The Complete Fedora Kernel Headers</em>&quot; or the Fedora Core <a href="http://fedora.redhat.com/docs/release-notes/fc4/errata/">Release Notes</a>, which describe among other things how to get the fedora kernel sources.</p>
<h4>Gathering the needed information</h4>
<p>I will use the linux ntfs driver as an example. This is not enabled in the default Fedora kernel configuration, but we want to create this module, so that our system can recognize NTFS volumes.</p>
<p>Using the &quot;<em>Qconf Graphical Kernel Configuration Tool</em>&quot;, we see that this module&#8217;s configuration options&#8217; names are the following:</p>
<ol>
<li><code>CONFIG_NTFS_FS</code></li>
<li><code>CONFIG_NTFS_DEBUG</code></li>
<li><code>CONFIG_NTFS_RW</code></li>
</ol>
<p>Actually, the previously mentioned tool omits the &quot;<code>CONFIG_</code>&quot; part of the option&#8217;s name. You should keep this in mind.</p>
<p>The first of these options, determins if the kernel will have support for this feature or not. The possible values are &quot;<code>y</code>&quot;, &quot;<code>m</code>&quot; or &quot;<code>n</code>&quot;. As we want to create a module, the proper value for this is the &quot;<code>m</code>&quot;.</p>
<p>The other two options are actually specific to the module itself. The values they can take are &quot;<code>y</code>&quot; or &quot;<code>n</code>&quot;. You decide which of these you want enabled. For this example, I&#8217;ll set both of these to &quot;<code>n</code>&quot;.</p>
<h4>Building the module</h4>
<p>In order to build this module, we change to the root directory of our kernel sources and issue the following command:</p>
<pre class="console"># make CONFIG_NTFS_FS=m CONFIG_NTFS_DEBUG=n CONFIG_NTFS_RW=n M=fs/ntfs</pre>
<p>We pass the proper kernel configuration options to <code>make</code>, but also specify the relative path to the module&#8217;s <code>Makefile</code> and source code with the <code>M</code> option.</p>
<p>This way, we can build a native kernel module which is not enabled in the kernel configuration. The compiled module, <code>ntfs.ko</code> in this case, can be perfectly added to our system&#8217;s kernel modules either manually or by using an RPM file, but this is beyond this article.</p>
<p>In order to clean the module&#8217;s directory from the compilation&#8217;s products, we can issue the following command:</p>
<pre class="console"># make M=fs/ntfs clean</pre>
<h4>Further Reading</h4>
<p>I strongly suggest that you create RPM packages to add or remove software from your system, so I recommend the <a href="http://fedora.redhat.com/participate/developers-guide/ch-rpm-building.html">Chapter 4. Building RPM Packages</a> from the <a href="http://fedora.redhat.com/docs/developers-guide/">Fedora Core Developer&#8217;s Guide</a>.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/">Build a single native kernel module</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>


<h4>Related Articles</h4>

<ul><li><a href="http://www.g-loaded.eu/2005/12/14/the-complete-fedora-kernel-headers/" rel="bookmark">The Complete Fedora Kernel Headers</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/09/kernel-2617-and-lirc_gpio-driver/" rel="bookmark">Kernel 2.6.17 and lirc_gpio driver</a></li>
<li><a href="http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/" rel="bookmark">How To Build RPM Packages on Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2005/10/30/creative-pc-cam-750/" rel="bookmark">Creative PC-CAM Series webcams in linux</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/15/get-my-kernel-headers-script/" rel="bookmark">Get my kernel headers script</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2005/12/20/build-a-single-native-kernel-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>
