<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-345118721724003954</id><updated>2011-11-07T09:55:31.327+01:00</updated><category term='PowerPC'/><category term='SLOF'/><category term='Fedora Core'/><category term='coreboot'/><category term='CMake'/><category term='gdb'/><category term='Subversion'/><category term='Cell SDK'/><category term='UEFI'/><category term='Binutils'/><category term='CVS'/><category term='FreeBSD'/><category term='Windows'/><category term='e2fsprogs'/><category term='Parallels'/><category term='Mercurial'/><category term='Open Firmware'/><category term='C++'/><category term='KVM'/><category term='GCC'/><category term='TianoCore'/><category term='ImageMagick'/><category term='dhcpd'/><category term='Linux'/><category term='Mac OS X'/><category term='QEMU'/><category term='iptables'/><category term='FPGA'/><category term='LaTeX'/><category term='named'/><category term='OpenBSD'/><title type='text'>My Notepad.</title><subtitle type='html'>Helps me remember stuff.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>67</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-3446710807167563528</id><published>2011-11-02T14:52:00.019+01:00</published><updated>2011-11-02T15:56:59.438+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CMake'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>CMake and C++ "Compile Time" Polymorphism</title><content type='html'>For a recent project of mine, I wanted to use what some people call "Compile Time Polymorphism" in C++. Here's how I implemented it.

&lt;br /&gt;
&lt;br /&gt;

Polymorphism in the context of programming computers usually refers to the ability to tread objects of a different data type through the same interface. In C++, this is often implemented through class inheritance and the use of virtual functions. The text book example of this concept is two classes, &lt;tt&gt;Cat&lt;/tt&gt; and &lt;tt&gt;Dog&lt;/tt&gt;, that inherit from a common super class &lt;tt&gt;Animal&lt;/tt&gt;. &lt;tt&gt;Animal&lt;/tt&gt; has a method &lt;tt&gt;makeSound()&lt;/tt&gt; that is implemented by each subclass accordingly. In real software projects, polymorphism is used to hide multiple implementations behind a uniform interface. Here's an example of how this concept is usually used in C++.

&lt;pre&gt;class Animal {
public:
 void makeSound(void) = 0;
};

class Cat : public Animal {
public:
 void makeSound(void);
};

class Dog : public Animal {
public:
 void makeSound(void);
};
&lt;/pre&gt;

The issue with this code is that it requires the use of virtual functions which means you need a &lt;tt&gt;vtable&lt;/tt&gt; for the concrete subclasses. Usually, as a programmer, you don't need to worry about &lt;tt&gt;vtable&lt;/tt&gt;s as the compiler takes care of that for you. But let's take a look at how this works anyways. A &lt;tt&gt;vtable&lt;/tt&gt; is basically a table of function pointers. For each of the concrete &lt;i&gt;classes&lt;/i&gt; shown above, the &lt;tt&gt;vtable&lt;/tt&gt; contains a pointer to the respective &lt;tt&gt;makeSound&lt;/tt&gt; method. Also, each &lt;i&gt;object&lt;/i&gt; carries a pointer to the &lt;tt&gt;vtable&lt;/tt&gt;. At runtime, when a virtual method of an object is called, the pointer to the &lt;tt&gt;vtable&lt;/tt&gt; is resolved to the actual &lt;tt&gt;vtable&lt;/tt&gt;. From there, the address of the method is loaded and the call to it is made indirectly. So the use of virtual methods not only increases the size of your code, but also the size of your objects. In addition to that, it forces the compiler to use indirect function calls through pointers which are usually slower than direct function calls. Again, the compiler takes care of all of that, so this is purely informational.

&lt;br /&gt;
&lt;br /&gt;

All of the above is okay and in fact required if you don't know the concrete type of an object until the software actually runs. Also, in most software projects, the drawbacks don't matter and aren't even noticeable. But there are situations where you may not want to pay the price of virtual methods, e.g. in a resource limited embedded system.

&lt;br /&gt;
&lt;br /&gt;

Also, there are situations where it is known at &lt;i&gt;compile time&lt;/i&gt; what the concrete implementation of an interface will be. This is true for example when you have an abstraction of an interface that is specific to a certain operating system: When you compile the software, you already know what the target operating system will be, so you can simply use and link to the right implementation of the interface, instead of post-poning the decision to runtime.

&lt;br /&gt;
&lt;br /&gt;

So how would you use polymorphism in C++ without the use of virtual methods?

&lt;br /&gt;
&lt;br /&gt;

Here's how you could do it:

&lt;pre&gt;typedef enum OperatingSystemImpl {
 Darwin,
 FreeBSD,
 Linux
} OperatingSystemImpl_t;

template&lt;operatingsystemimpl_t&gt; struct OperatingSystemChoice;

class DarwinImpl;
class FreeBSDImpl;
class LinuxImpl;

template&amp;lt;&amp;gt; struct OperatingSystemChoice&lt;darwin&gt; {
 typedef DarwinImpl m_type;
};

template&amp;lt;&amp;gt; struct OperatingSystemChoice&lt;freebsd&gt; {
 typedef FreeBSDImpl m_type;
};

template&amp;lt;&amp;gt; struct OperatingSystemChoice&lt;linux&gt; {
 typedef LinuxImpl m_type;
};


struct OperatingSystemService {
 typedef OperatingSystemChoice&amp;lt; ... &amp;gt;::m_type m_type;
};
&lt;/linux&gt;&lt;/freebsd&gt;&lt;/darwin&gt;&lt;/operatingsystemimpl_t&gt;&lt;/pre&gt;

Of course, the ellipsis must be expanded, but more on that later. What's important is how software using this construct would use the code:

&lt;pre&gt;
OperatingSystemService::m_type OsServiceObj;
&lt;/pre&gt;

The snipped above would create an object of the correct type, dependend on what the ellipsis expands to. The neat thing is that the template compiler ensures that the ellipsis is expanded to a valid "type" as defined in &lt;tt&gt;enum OperatingSystemImpl&lt;/tt&gt;. Also, it is made sure that the actual, underlying class is declared, e.g. &lt;tt&gt;class DarwinImpl&lt;/tt&gt;.

&lt;br /&gt;
&lt;br /&gt;

In other words: If you tried to &lt;i&gt;compile&lt;/i&gt; the software with the ellipsis expanded to &lt;tt&gt;Windows&lt;/tt&gt;, you'd get a compilation error. If you had implemented this using classic polymorphism, you'd probably have some code that dynamically created the right object depending on what input is given. That means, you have to test your compiled code, feeding it an invalid type. This mean you must &lt;i&gt;run&lt;/i&gt; your software. I'm convinced that finding problems earlier is better, so finding an issue when code is compiled is better than finding issues when code is run.

&lt;br /&gt;
&lt;br /&gt;

So back to how the ellipsis is expanded. Here's how CMake, a build system, comes into play. CMake uses input files that describe how the software needs to be compiled. Those input files, as with other build systems, are able to define compiler flags. Also, CMake defines a variable that contains the operating system's name. I suspect it's the output of &lt;tt&gt;uname&lt;/tt&gt;. So here's what I added to my top level &lt;tt&gt;CMakeList.txt&lt;/tt&gt; file:

&lt;pre&gt;
add_definitions("-DOPERATING_SYSTEM=${CMAKE_SYSTEM_NAME}")
&lt;/pre&gt;

This makes the &lt;tt&gt;OPERATING_SYSTEM&lt;/tt&gt; macro known to the pre-processor. So the code with the ellipsis can be re-written like this:

&lt;pre&gt;
struct OperatingSystemService {
 typedef OperatingSystemChoice&lt;operating_system&gt;::m_type m_type;
};
&lt;/operating_system&gt;&lt;/pre&gt;

Et voilà, the right type is picked when the code is compiled.

&lt;br /&gt;
&lt;br /&gt;

Here are the nice things about this: There is no need for virtual methods, eliminating the need for &lt;tt&gt;vtable&lt;/tt&gt;s. Also, invalid or unsupported operating system types will be found at compile time vs. at runtime while the code for all supported operating systems will still be always compiled (just not used).

&lt;br /&gt;
&lt;br /&gt;

One downside may seem that you no longer have an enforced interface like when using purely virtual classes, i.e. the compiler may not tell you that you forgot to implement a newly added method to one of your implementation classes. However, this is more of a minor issue: You will still get a compilation error in that case, but only if you're compiling for the target system where you forgot to implement the newly added method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-3446710807167563528?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/3446710807167563528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=3446710807167563528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3446710807167563528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3446710807167563528'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2011/11/cmake-and-c-compile-time-polymorphism.html' title='CMake and C++ &quot;Compile Time&quot; Polymorphism'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2832006240756039204</id><published>2011-03-05T12:38:00.003+01:00</published><updated>2011-03-05T12:43:01.202+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><title type='text'>Article about Interrupt Routing on x68</title><content type='html'>Here's a good article about how &lt;a href="http://people.freebsd.org/~jhb/papers/bsdcan/2007/article.pdf"&gt;PCI Interrupts for x86 Machines under FreeBSD&lt;/a&gt; are implemented. While the article is targeted at FreeBSD, it also looks into the various interrupt routing mechanisms on x86 which apply to all systems software such as firmware and operating systems.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2832006240756039204?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2832006240756039204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2832006240756039204' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2832006240756039204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2832006240756039204'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2011/03/article-about-interrupt-routing-on-x68.html' title='Article about Interrupt Routing on x68'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-3746317375954875205</id><published>2010-12-31T15:18:00.003+01:00</published><updated>2010-12-31T15:23:16.853+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='coreboot'/><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><category scheme='http://www.blogger.com/atom/ns#' term='UEFI'/><title type='text'>TianoCore and coreboot, again</title><content type='html'>It has been over two years since the &lt;a href="http://phisch.blogspot.com/2008/10/more-on-tianocore-for-coreboot.html"&gt;last time&lt;/a&gt; I worked on TianoCore for coreboot. These days I had some free time to spend and I used it to continue the project. I updated my code to the latest versions of coreboot and TianoCore and got it to work again in QEMU.

&lt;br /&gt;&lt;br /&gt;

Here's a &lt;a href="https://phs.phisch.org/website/efiboot/screenshot.txt"&gt;&amp;quot;screenshot&amp;quot;&lt;/a&gt; and &lt;a href="https://phs.phisch.org/website/efiboot/"&gt;a few words&lt;/a&gt; on what it's all about.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-3746317375954875205?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/3746317375954875205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=3746317375954875205' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3746317375954875205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3746317375954875205'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2010/12/tianocore-and-coreboot-again.html' title='TianoCore and coreboot, again'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-4070884946760987758</id><published>2010-10-19T21:29:00.017+02:00</published><updated>2010-10-20T21:14:56.436+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ImageMagick'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>ImageMagick, libjpeg, etc. on Mac OS X</title><content type='html'>Here's how I got ImageMagick with JPEG support to compile and run on Mac OS X 10.6 (Intel).

&lt;br /&gt;&lt;br /&gt;

First, I got the ImageMagick Source Code via Subversion, per the instructions from &lt;a href="http://www.imagemagick.org/script/subversion.php"&gt;http://www.imagemagick.org/script/subversion.php&lt;/a&gt;. Short version:

&lt;pre&gt;
$ svn co \ 
https://www.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6.6.5 \ 
ImageMagick-6.6.5
&lt;/pre&gt;

Then, I pulled &lt;a href="http://www.ijg.org/files/jpegsrc.v8b.tar.gz"&gt;libjpeg&lt;/a&gt; from the &lt;a href="http://www.ijg.org/"&gt;Independent JPEG Group&lt;/a&gt;. I had to extract the source code to a subdirectory of the ImageMagick directory called &lt;tt&gt;jpeg&lt;/tt&gt;, i.e. &lt;tt&gt;/path/to/ImageMagick-6.6.5/jpeg&lt;/tt&gt;.

&lt;br /&gt;&lt;br /&gt;

Before I could compile any of the source code, I had to set three environment variables per &lt;a href="http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&amp;t=13145"&gt;this thread&lt;/a&gt; on the ImageMagick forums:

&lt;pre&gt;
$  export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk \
  -arch ppc -arch i386"
$ export CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk \
  -arch ppc -arch i386"
$  export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk \
  -arch ppc -arch i386"
&lt;/pre&gt;

Then, I compiled &lt;tt&gt;libjpeg&lt;/tt&gt; via the via the standard &lt;tt&gt;./configure&lt;/tt&gt; and &lt;tt&gt;make&lt;/tt&gt; dance. I used these commands:

&lt;pre&gt;
$ cd jpeg
$ ./configure --prefix=/opt --disable-shared \
  --disable-dependency-tracking
$ make -j 16
&lt;/pre&gt;

Now, I was able to configure ImageMagick:

&lt;pre&gt;
&lt;/pre&gt;

Be aware that the LDFLAGS path is different than the include path! If everything went well, you can now go on to build the imagemagick suite:

&lt;pre&gt;
$ ./configure --prefix=/opt --without-x --without-perl --with-jpeg \
   --disable-shared --disable-dependency-tracking \
   --enable-delegate-build --enable-osx-universal-binary
$ make -j 16
&lt;/pre&gt;

This gave me statically linked binaries of the ImageMagick tools I was able to run on my Mac. I also tried to build dynamically linked binaries but failed. Because I don't need the dynamically linked version, I gave up after a while.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-4070884946760987758?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/4070884946760987758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=4070884946760987758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4070884946760987758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4070884946760987758'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2010/10/imagemagick-libjpeg-etc-on-mac-os-x.html' title='ImageMagick, libjpeg, etc. on Mac OS X'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-4583028407557356066</id><published>2010-09-24T10:26:00.007+02:00</published><updated>2010-10-19T22:12:53.987+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Testing with Google's C++ Test Framework (gtest)</title><content type='html'>The other day I was playing around with Google's C++ Testing Framework (a.k.a. &lt;a href="http://code.google.com/p/googletest/"&gt;gtest&lt;/a&gt;). I tried to build the Code with Visual Studio 2008 Express and got some strange linker errors. I was able to solve the errors thanks to &lt;a href="http://stackoverflow.com/questions/531941/how-to-setup-google-c-testing-framework-gtest-on-visual-studio-2005"&gt;this&lt;/a&gt; site. In essence, I had to change the "Runtime Library" Setting in the C/C++ Code Generation options to "Multi-Threaded" for a release build and to "Multi-Threaded Debug" for a debug build.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-4583028407557356066?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/4583028407557356066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=4583028407557356066' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4583028407557356066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4583028407557356066'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2010/09/testing-with-googles-c-test-framework.html' title='Testing with Google&apos;s C++ Test Framework (gtest)'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5871073790485670469</id><published>2010-08-25T15:00:00.005+02:00</published><updated>2010-08-27T09:48:25.687+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Binutils'/><category scheme='http://www.blogger.com/atom/ns#' term='GCC'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Linker Sets</title><content type='html'>Reminder: When placing something in a dedicated section using &lt;tt&gt;__attribute__((section("foobar")))&lt;/tt&gt;, the GNU toolchain will automatically add a symbol &lt;tt&gt;__start_foobar&lt;/tt&gt; at the beginning and a symbol &lt;tt&gt;__stop_foobar&lt;/tt&gt; at the end of the section.

&lt;br /&gt;&lt;br /&gt;
However, you will need a reference to that symbol in order to prevent the linker from optimizing the symbol away. In other words, you need to declare something like &lt;tt&gt;extern void *__start_foobar;&lt;/tt&gt; and use it.
&lt;br /&gt;&lt;br /&gt;

When using the Microsoft toolchain, the symbols need to be added explicitly. To do that, one can make use of the fact that when the Microsoft linker encounters several sections with a "$_" in their name, it will merge the contents into one final output section. The name of the output section will be the common prefix of the declared sections. The beauty is that the contents are in the order of the section names.
&lt;br /&gt;&lt;br /&gt;
Here's an example: Supposed you placed something into a section called "foobar$_something". You can then add a variable &lt;tt&gt;__start_foobar&lt;/tt&gt; into a section "foobar$_a" and a variable &lt;tt&gt;__stop_foobar&lt;/tt&gt; into a section "foobar$_z". The resulting binary will have one section "foobar" with the contents of variable &lt;tt&gt;__start_foobar&lt;/tt&gt; placed at the beginning, followed the contents of everything in section "foobar$_something" and the contents of the variable &lt;tt&gt;__stop_foobar&lt;/tt&gt; at the end.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5871073790485670469?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5871073790485670469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5871073790485670469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5871073790485670469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5871073790485670469'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2010/08/linker-sets.html' title='Linker Sets'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8400497909828615053</id><published>2010-03-22T15:18:00.004+01:00</published><updated>2010-03-22T15:22:36.776+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Fix Windows Full Text search</title><content type='html'>I've recently noticed that using the Windows full text search may not always turn up the expected results. Apparently, Windows requires a program to install a search filter for a given file type. There is some plain text filter available by default, but it's only registered for some endings. Source code files, e.g. Groovy files, will not be included, even though they contain nothing but plain ASCII text. Anyways, there's a &lt;a href="http://support.microsoft.com/kb/309173/EN-US/"&gt;fix&lt;/a&gt; available, but it's nowhere near intuitive...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8400497909828615053?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8400497909828615053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8400497909828615053' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8400497909828615053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8400497909828615053'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2010/03/fix-windows-full-text-search.html' title='Fix Windows Full Text search'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8422271219763036999</id><published>2009-11-26T18:32:00.006+01:00</published><updated>2009-11-26T18:40:55.024+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Building qfsm on Ubuntu 8.04</title><content type='html'>I just tried to build &lt;a href="http://qfsm.sourceforge.net/"&gt;qfsm&lt;/a&gt; on Ubuntu 8.04. The only dependencies listed by qfsm are CMake and Qt 4.3.x - both of which are available through the Ubuntu packet manager.

&lt;br/&gt;&lt;br/&gt;

However, when I followed the instructions provided along with the qfsm source code, I encountered this error message:

&lt;pre&gt;
[ 41%] Building CXX object CMakeFiles/qfsm.dir/src/ExportAHDLDlgImpl.o
In file included from qfsm-0.51.0-Source/src/ExportAHDLDlgImpl.h:21,
                 from qfsm-0.51.0-Source/src/ExportAHDLDlgImpl.cpp:21:
qfsm-0.51.0-Source/src/ui_ExportAHDLDlg.h:27: error: expected constructor, \
  destructor, or type conversion before ‘class’
make[2]: *** [CMakeFiles/qfsm.dir/src/ExportAHDLDlgImpl.o] Error 1
make[1]: *** [CMakeFiles/qfsm.dir/all] Error 2
make: *** [all] Error 2
&lt;/pre&gt;

It turns out that the definition of the &lt;tt&gt;QT_BEGIN_NAMESPACE&lt;/tt&gt; macro was nowhere to be found on my system. Luckily, removing the corresponding lines in the qfsm source code allowed me to build the code just fine. I used this one-liner to remove the offending lines:

&lt;pre&gt;
$ for file in `grep -R QT_BEGIN_NAMESPACE * | awk -F : '{ print $1; }'` ; \
  do sed -i -e '/QT_.*NAMESPACE/d' $file ; done
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8422271219763036999?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8422271219763036999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8422271219763036999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8422271219763036999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8422271219763036999'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/11/building-qfsm-on-ubuntu-804.html' title='Building qfsm on Ubuntu 8.04'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5187565536480915879</id><published>2009-09-18T13:11:00.002+02:00</published><updated>2009-09-18T13:12:53.812+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Graphics Card</title><content type='html'>For some reason I have to look up the model of the graphics adapter in my thinkpad everytime I do an update... so here it goes: My T61p has a Quadro FX 570M in it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5187565536480915879?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5187565536480915879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5187565536480915879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5187565536480915879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5187565536480915879'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/09/for-some-reason-i-have-to-look-up-model.html' title='Graphics Card'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-3340822951785674779</id><published>2009-07-24T15:25:00.003+02:00</published><updated>2009-07-30T12:59:44.574+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KVM'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Follow-Up</title><content type='html'>A quick follow-up to &lt;a href="http://phisch.blogspot.com/2008/10/parallels-for-linux.html"&gt;&amp;quot;Parallels&amp;quot; for Linux&lt;/a&gt;. I've managed to run the Windows XP Partition on my Laptop inside KVM-88 like this:

&lt;pre&gt;
#!/bin/sh

export SDL_VIDEO_X11_DGAMOUSE=0
sudo qemu-system-x86_64 -hda /dev/sda -net nic -net user -m 1024 -cdrom fixntldr.iso -boot d -usb -usbdevice tablet -monitor stdio
&lt;/pre&gt;

To send Ctrl+Alt+Del, I needed to enter this at the QEMU shell:

&lt;pre&gt;
sendkey ctrl-alt-delete
&lt;/pre&gt;

&lt;br /&gt;

&lt;i&gt;Edit (Jul 30th, 2009):&lt;/i&gt; Here is a link to the &lt;a href="http://en.wikibooks.org/wiki/QEMU/Monitor"&gt;QEMU console commands&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-3340822951785674779?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/3340822951785674779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=3340822951785674779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3340822951785674779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3340822951785674779'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/07/follow-up.html' title='Follow-Up'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-3905678309811128112</id><published>2009-04-28T21:29:00.003+02:00</published><updated>2009-04-28T21:33:08.283+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='coreboot'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><title type='text'>Flashrom, Alix 1.C and FreeBSD</title><content type='html'>I'm quite surprised that &lt;a href="http://www.coreboot.org/Flashrom"&gt;flashrom&lt;/a&gt; works pretty much out of the box on FreeBSD running on my Alix 1.C board. All I needed to do was comment out the code in the &lt;tt&gt;enable_flash_cs5536()&lt;/tt&gt; function part of the &lt;tt&gt;chipset_enable.c&lt;/tt&gt; file. Then, this simple command let me read out the BIOS image:

&lt;pre&gt;
$ flashrom -f -r -c "SST49LF040" bios.bin
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-3905678309811128112?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/3905678309811128112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=3905678309811128112' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3905678309811128112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3905678309811128112'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/04/flashrom-alix-1c-and-freebsd.html' title='Flashrom, Alix 1.C and FreeBSD'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1813214655580761872</id><published>2009-04-21T00:38:00.003+02:00</published><updated>2009-04-21T00:54:51.227+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FPGA'/><title type='text'>Avnet Spartan-3A Eval Board</title><content type='html'>So I got this &lt;a href="http://www.em.avnet.com/spartan3a-evl"&gt;Xilinx Spartan-3A Board by Avnet&lt;/a&gt; recently. I bought it because it features a fairly large parallel flash chip (32 MBit) and an even larger SPI flash (128 Mbit).

&lt;br /&gt;&lt;br /&gt;

The board also features three clocks. One 16MHz clock is driven by an on-board oscillator while the other two (12 MHz and 32 kHz) are derived from a small controller.

&lt;br /&gt;&lt;br /&gt;

For the last few evenings, I tried to get the parallel flash to work. Since a single cycle of the slow 32 kHz clock meets the timing requirements of the parallel flash chip, I thought I'd try to use that before enhancing the design to also work w/ the faster clock(s).

&lt;br /&gt;&lt;br /&gt;

Unfortunately, that didn't work. When using the slow clock, mapping a signal directly to an output (LED) worked just fine, but routing the signal through more than few flip-flops didn't work at all. Apparently, the FPGA didn't like the slow clock too much.

&lt;br /&gt;&lt;br /&gt;

Bottom line: Took me three days to figure out that the board doesn't work with the slow 32 kHz clock. Oh well, at least I learned something new...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1813214655580761872?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1813214655580761872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1813214655580761872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1813214655580761872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1813214655580761872'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/04/avnet-spartan-3a-eval-board.html' title='Avnet Spartan-3A Eval Board'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1173448438846700603</id><published>2009-02-26T22:13:00.009+01:00</published><updated>2009-02-26T22:52:51.947+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>SSH Tricks</title><content type='html'>My shell scripting skills suck. So it comes naturally that I learn a lot every time I need to write a script. The trick I'm about to describe is so neat that I want to share it.

&lt;br /&gt;&lt;br /&gt;

Assume for a second that you need to execute a series of commands on a remote machine, but you can't pass them to SSH at once. Or consider that you might need to transfer a file over to a remote host and then extract it there. Normally, you'd need to create several SSH connections for this. In the "transfer, then extract" scenario, you need one connection for &lt;tt&gt;scp(1)&lt;/tt&gt; and another one to extract the file on the remote host. Unless you have your public key in the remote host's &lt;tt&gt;~/.ssh/authorized_keys&lt;/tt&gt; file, you need to enter your password for the remote host twice. It's probably not a big deal for most, but it's annoying at times. 

&lt;br /&gt;&lt;br /&gt;

It might be obvious for some, but I recently found out that &lt;tt&gt;ssh(1)&lt;/tt&gt; offers a solution for the problem described above. It allows you to open one connection in &amp;quot;master&amp;quot; mode to which other SSH processes can connect through a socket. The options for the &amp;quot;master&amp;quot; connection are:

&lt;pre&gt;
$ ssh -M -S /path/to/socket user@rhost
&lt;/pre&gt;

Alternatively, the &lt;tt&gt;ControlPath&lt;/tt&gt; and &lt;tt&gt;ControlMaster&lt;/tt&gt; options can be set in the appropriate SSH configuration files. Other SSH processes that want to connect to the &amp;quot;master&amp;quot; connection only need to use the &lt;tt&gt;-S&lt;/tt&gt; option. The authentication of the &amp;quot;master&amp;quot; connection will be re-used for all other connections that go through the socket. I'm not sure if SSH even opens a separate TCP connection.

&lt;br /&gt;&lt;br /&gt;

Going further, this can be used in scripts to save the user a lot of password typing, especially if the execution flow switches between local and remote commands a lot. At the beginning of the script, simply create a &amp;qout;master&amp;quot; connection like this:

&lt;pre&gt;
$ ssh -M -S /path/to/socket -f user@rhost \
    "while true ; do sleep 3600 ; done"
&lt;/pre&gt;

It should be noted that the path to the socket can be made unique by using a combination of the placeholders &lt;tt&gt;%l&lt;/tt&gt;, &lt;tt&gt;%h&lt;/tt&gt;, &lt;tt&gt;%p&lt;/tt&gt;, &lt;tt&gt;%r&lt;/tt&gt; for the local host, remote host, port and remote username, respectively. The &lt;tt&gt;-f&lt;/tt&gt; parameter makes SSH go into the background just before command execution. However, it requires that a command is specified, hence an endless loop of &lt;tt&gt;sleep(1)&lt;/tt&gt; calls is added to the command line. Other SSH connections can be opened like this, not requiring any further user input (for authentication):

&lt;pre&gt;
$ ssh -S /path/to/socket user@rhost
&lt;/pre&gt;

 This leaves the problem of how the &amp;quot;master&amp;quot; process can be terminated when the script has finished. Some versions of SSH offer the &lt;tt&gt;-O&lt;/tt&gt; parameter which can be used to &lt;tt&gt;check&lt;/tt&gt; if the &amp;quot;master&amp;quot; is still running and, more importantly, to tell the &amp;quot;master&amp;quot; to &lt;tt&gt;exit&lt;/tt&gt;. Note that in addition to the socket, the remote user and host need to be specified.

&lt;pre&gt;
$ ssh -S /path/to/socket -O check user@rhost
$ ssh -S /path/to/socket -O exit user@rhost
&lt;/pre&gt;

However, there are still two problems to be solved. First, when the &amp;quot;master&amp;quot; quits, the dummy sleep loop continues to run. And second, how can the &amp;quot;master&amp;quot; be terminated if the given SSH version doesn't offer the &lt;tt&gt;-O&lt;/tt&gt; parameter (short of killing the process by its PID)?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1173448438846700603?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1173448438846700603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1173448438846700603' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1173448438846700603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1173448438846700603'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/02/my-shell-scripting-skills-suck.html' title='SSH Tricks'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-7917258597944291257</id><published>2009-02-04T11:35:00.002+01:00</published><updated>2009-02-04T11:38:03.279+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>brctl(8) and tunctl</title><content type='html'>&lt;tt&gt;brctl&lt;/tt&gt; is part of the &lt;i&gt;bridge-utils&lt;/i&gt; package. Source code is available on &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=26089"&gt;Sourceforge&lt;/a&gt;.

&lt;br /&gt;&lt;br /&gt;

&lt;tt&gt;tunctl&lt;/tt&gt; is part of the User Mode Linux (UML) utilities available at the &lt;a href="http://user-mode-linux.sourceforge.net/downloads.html"&gt;UML web site&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-7917258597944291257?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/7917258597944291257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=7917258597944291257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7917258597944291257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7917258597944291257'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/02/brctl8-and-tunctl.html' title='brctl(8) and tunctl'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-7619502624060499277</id><published>2009-01-30T11:11:00.003+01:00</published><updated>2009-01-30T11:25:02.608+01:00</updated><title type='text'>hexdump(1) lies!</title><content type='html'>This week I found out that &lt;tt&gt;hexdump(1)&lt;/tt&gt; on Linux doesn't seem to work with bytes but with half-words. I found out because I compared a byte-by-byte binary dump (output of a separate program) to the output of &lt;tt&gt;hexdump(1)&lt;/tt&gt; (dumping the same data) and noticed that &lt;tt&gt;hexdump(1)&lt;/tt&gt;'s output always swapped two adjacent bytes.

&lt;br /&gt;&lt;br /&gt;

Maybe I haven't found the right parameters, though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-7619502624060499277?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/7619502624060499277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=7619502624060499277' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7619502624060499277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7619502624060499277'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2009/01/hexdump1-lies.html' title='hexdump(1) lies!'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6820330178951681878</id><published>2008-12-16T20:41:00.024+01:00</published><updated>2008-12-17T23:26:04.963+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><title type='text'>An Encrypted File-backed File System on FreeBSD</title><content type='html'>The following is a compilation of information, largely based on the FreeBSD Handbook, &lt;a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-virtual.html"&gt;Section 18.13&lt;/a&gt; and &lt;a href="http://www.freebsd.org/doc/en/books/handbook/disks-encrypting.html"&gt;Section 18.16&lt;/a&gt;. This post describes how a file-backed, encrypted file system can be built and used on FreeBSD.

&lt;h2&gt;Prerequisites&lt;/h2&gt;
In order to follow the steps below, the following prerequisites must be met:

&lt;ul&gt;
&lt;li&gt;&lt;tt&gt;md(4)&lt;/tt&gt; in the Kernel&lt;/li&gt;
&lt;li&gt;&lt;tt&gt;gbde(4)&lt;/tt&gt; in the Kernel, i.e. &lt;tt&gt;kldload geom_bde&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;The &lt;tt&gt;/etc/gbde&lt;/tt&gt; directory must exist&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;First time installation&lt;/h2&gt;
After those requirements are fullfilled, it's time to take the first step which is creating a file that will serve as the basis for the file system. There is no support for growing images so you need to allocate all space now. This command creates a 128 MByte file filled with zeros:

&lt;pre&gt;
$ dd if=/dev/zero of=encrypted.img bs=4k count=32768
&lt;/pre&gt;

Next, create a memory disk which is based on the the image file created above. As root, do: 

&lt;pre&gt;
# mdconfig -a -t vnode -f encrypted.img -u &amp;lt;unit&amp;gt;
&lt;/pre&gt;

In the example above, the parametr &lt;tt&gt;-u &amp;lt;unit&amp;gt;&lt;/tt&gt; is optional and specifies a number which determines the number of the &lt;tt&gt;md(4)&lt;/tt&gt; device. For example, if you use 4, then &lt;tt&gt;md4&lt;/tt&gt; will be created.

&lt;br /&gt;&lt;br /&gt;

Now create a partition table which, e.g. one with an automatic layout:

&lt;pre&gt;
# bsdlabel -w md&amp;lt;unit&amp;gt; auto
&lt;/pre&gt;

At this point, you have the equivalent of a hard disk w/ one or more FreeBSD partitions on it. Note that there is no filesystem, yet. In order to create an encrypted file system, an initialization step must be performed:

&lt;pre&gt;
# gbde init /dev/md0c -i -L /etc/gbde/encrypted.lock
&lt;/pre&gt;

The initialization step opens an editor where the user is asked to enter a few parameters. Most notably it is probably sensible to change the &lt;tt&gt;sector_size&lt;/tt&gt; to 4096, i.e. the page size on i386. When the editor is closed, the &lt;tt&gt;gbde(8)&lt;/tt&gt; program asks for a password. This password will be used to encrypt the disk, so do not lose it. Note that the &lt;tt&gt;/dev/md0c&lt;/tt&gt; parameter corresponds to the &lt;tt&gt;md(4)&lt;/tt&gt; device which was previously created. The file of the lock name can be arbitrarily named as long as its ending is &lt;tt&gt;.lock&lt;/tt&gt;. Also note that the lock file must be backed up as the file system cannot be easily accessed without the file.

&lt;br /&gt;&lt;br /&gt;

Now the encrypted device can be attached by running

&lt;pre&gt;
# gbde attach /dev/md0c -l /etc/gbde/encrypted.lock
&lt;/pre&gt;

You'll be prompted for the password set in the previous step. If the password is accepted, you'll end up with a new disk device at &lt;tt&gt;/dev/md0c.bde&lt;/tt&gt; on which you can operate the same way as on a regular disk. That means you'll need to create a file system, first.

&lt;pre&gt;
# newfs -U -O2 /dev/md0c.bde
&lt;/pre&gt;

Make sure you use the &lt;tt&gt;.bde&lt;/tt&gt; device node and not the raw memory disk as you'd end up without encryption. When you're done, it's time to mount the file system:

&lt;pre&gt;
# mkdir /encrypted
# mount /dev/md0c.bde /encrypted
&lt;/pre&gt;

&lt;h2&gt;Unmounting the encrypted file system&lt;/h2&gt;
Unmounting the file system is easy, but the  &lt;tt&gt;gbde(4)&lt;/tt&gt; device needs to be detached before the &lt;tt&gt;md(4)&lt;/tt&gt; device can be destroyed.

&lt;pre&gt;
# umount /encrypted
# gbde detach /dev/md0c
# mdconfig -d -u 0
&lt;/pre&gt;

&lt;h2&gt;Re-mounting an encrypted file system&lt;/h2&gt;
Re-mounting is simple, but note that the FreeBSD handbook suggests that the file system be checked for errors before mounting:

&lt;pre&gt;
# mdconfig -a -t vnode -f encrypted.img
md0
# gbde attach /dev/md0c -l /etc/gbde/encrypted.lock
# fsck -p -t ffs /dev/md0c.bde
# mount /dev/md0c.bde encrypted
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6820330178951681878?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6820330178951681878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6820330178951681878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6820330178951681878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6820330178951681878'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/12/encrypted-file-backed-file-system-on.html' title='An Encrypted File-backed File System on FreeBSD'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-7183520377322042243</id><published>2008-11-22T21:27:00.003+01:00</published><updated>2008-12-11T09:51:35.689+01:00</updated><title type='text'>Generating random passwords</title><content type='html'>Here are a couple of ways of generating random passwords without using a &amp;quot;password generator&amp;quot;. First, generate a random string like this:

&lt;pre&gt;
$ dd if=/dev/urandom count=500 bs=1 | tr "\n" " " | sed 's/[^a-zA-Z0-9]//g'
&lt;/pre&gt;

or like this

&lt;pre&gt;
$ dd if=/dev/urandom count=500 bs=1 | md5
&lt;/pre&gt;

Then adjust the length by piping the output through &lt;tt&gt;cut(1)&lt;/tt&gt;:

&lt;pre&gt;
... | cut -c-8
&lt;/pre&gt;

While the first option is more to type, it generates lower and upper case letters. The second option is easier to type but only generates lower-case passwords.

&lt;br /&gt;&lt;br /&gt;

&lt;i&gt;Update (Dec 12th, 2008)&lt;/i&gt;: Fixed error. &lt;tt&gt;cut(1)&lt;/tt&gt; must be used, not &lt;tt&gt;cat(1)&lt;/tt&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-7183520377322042243?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/7183520377322042243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=7183520377322042243' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7183520377322042243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7183520377322042243'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/11/generating-random-passwords.html' title='Generating random passwords'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8709584505938923587</id><published>2008-11-13T10:48:00.001+01:00</published><updated>2008-11-13T10:50:31.938+01:00</updated><title type='text'>Big R Radio 90's Alternative</title><content type='html'>Just to save the link somewhere... This command tunes in on the Big R Radio 90's Alternative station.

&lt;pre&gt;
mplayer http://livestream2.bigrradio.com/90salt
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8709584505938923587?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8709584505938923587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8709584505938923587' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8709584505938923587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8709584505938923587'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/11/big-r-radio-90s-alternative.html' title='Big R Radio 90&apos;s Alternative'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8796843234778577383</id><published>2008-11-07T22:00:00.005+01:00</published><updated>2008-12-03T20:38:00.213+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>The new GenFw Tool</title><content type='html'>I've re-written the &lt;tt&gt;GenFw&lt;/tt&gt; tool part of the TianoCore BaseTools project. The source code can be found &lt;a href="https://phs.subgra.de/~phs/files/GenFw.c"&gt;here&lt;/a&gt;. In order to use the tool, the file &lt;tt&gt;Source/C/GenFw/GenFw.c&lt;/tt&gt; must be replaced with the re-written one. Then, the base tools must be re-built. After that, the EDK2 build process can be started. It will automatically pick up the new tool which will brand an ELF file with an UEFI file type.

&lt;br /&gt;&lt;br /&gt;

Currently, the re-written tool will not compile on Linux. The reason is that Linux lacks implementations of &lt;tt&gt;err(3)&lt;/tt&gt;, &lt;tt&gt;errx(3)&lt;/tt&gt;, &lt;tt&gt;warn(3)&lt;/tt&gt;, etc. library functions which the BSDs have. It should be easy to add some compatibility macros using a combination of &lt;tt&gt;fprintf(3)&lt;/tt&gt;, &lt;tt&gt;strerror(3)&lt;/tt&gt; and &lt;tt&gt;exit(3)&lt;/tt&gt;. I might add those should the need arise.

&lt;br /&gt;&lt;br /&gt;

&lt;i&gt;&lt;b&gt;Update&lt;/b&gt; (Dec 3rd, 2008)&lt;/i&gt;: I've added the compatibility macros for Linux. An updated version of the source code can be downloaded &lt;a href="https://phs.subgra.de/~phs/files/GenFw-Linux.c"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8796843234778577383?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8796843234778577383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8796843234778577383' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8796843234778577383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8796843234778577383'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/11/new-genfw-tool.html' title='The new GenFw Tool'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6583573909600775802</id><published>2008-10-31T20:58:00.005+01:00</published><updated>2008-10-31T21:16:51.680+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>More on TianoCore for coreboot</title><content type='html'>It's been a while since I &lt;a href="http://phisch.blogspot.com/2008/09/beginnings-of-coreboot-and-tianocore.html"&gt;last worked&lt;/a&gt; on combining TianoCore and coreboot. Tonight I had some spare time and tried to pursue the project.

&lt;br /&gt;&lt;br /&gt;

The previously mentioned build failure does indeed stem from the fact that the build tools cannot cope with ELF binaries. Especially problematic is the &lt;tt&gt;GenFw&lt;/tt&gt; tool which is supposed to convert the binary file into an UEFI firmware volume file. In order to do that, it parses the header information of the input binary executable file and encodes the type of file (in UEFI terms) in a spare header field. The tool expects to work on PE32 files but the TianoCore developers have added code which converts an ELF image into a PE32 image internally if the tool is pointed at an ELF file. However, this facility is only compiled in if &lt;tt&gt;#defined(Linux)&lt;/tt&gt; is true. Of course, that won't work on FreeBSD but changing the relevant pre-processor condition allowed me to produce an UEFI firmware volume without any further changes to the code.

&lt;br /&gt;&lt;br /&gt;

However, this shortcut will only work on x86 and only if the target platform is x86, too. The real solution is to avoid the conversion and instead encode the UEFI file type directly into the ELF header. I've already done this for my thesis project (*) and back then it seemed that re-writing the &lt;tt&gt;GenFw&lt;/tt&gt; tool was easier than fixing the existing implementation. Well, here's the next item on the ToDo list...

&lt;br /&gt;&lt;br /&gt;

&lt;font size="-2"&gt;(*) I used the Java-based tools for the thesis project which means that a different tool with essentially the same functionality was the culprit.&lt;/font&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6583573909600775802?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6583573909600775802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6583573909600775802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6583573909600775802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6583573909600775802'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/10/more-on-tianocore-for-coreboot.html' title='More on TianoCore for coreboot'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5655522318620022748</id><published>2008-10-24T10:58:00.007+02:00</published><updated>2008-10-28T16:09:12.363+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='QEMU'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>"Parallels" for Linux</title><content type='html'>&lt;a href="http://un.codiert.org/"&gt;Ben&lt;/a&gt; has an interesting post on how to &lt;a href="http://un.codiert.org/2008/09/booting-windows-xp-from-raw-disk-with-linux-kvm/"&gt;boot Windows XP using KVM&lt;/a&gt; on Fedora Core 9. The interesting part is that Windows XP is installed on the host's hard disk. His instructions almost work verbatim, but there's one exception. Since I'm using KVM-73, the QEMU command is:

&lt;pre&gt;
$ qemu-system-x86_64 -hda /dev/sda -net nic -net user -m 1024 \
    -cdrom fixntldr.iso -boot d -std-vga 
&lt;/pre&gt;

This will also give the guest system access to the network.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5655522318620022748?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5655522318620022748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5655522318620022748' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5655522318620022748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5655522318620022748'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/10/parallels-for-linux.html' title='&quot;Parallels&quot; for Linux'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2339470785605886126</id><published>2008-10-23T10:55:00.006+02:00</published><updated>2008-10-23T12:00:39.604+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Encrypted Devices/Filesystems on Linux</title><content type='html'>Yesterday I tried to encrypt a complete USB Stick under Linux. I followed &lt;a href="http://www.saout.de/tikiwiki/tiki-index.php?page=EncryptedDevice"&gt;this tutorial&lt;/a&gt; and it worked quite well.

&lt;br /&gt;&lt;br /&gt;

Mounting the encrypted device isn't as obvious as could be, so here it goes:

&lt;pre&gt;
$ cryptsetup create &amp;lt;symbolic name&amp;gt; &amp;lt;device name&amp;gt;
$ mount /dev/mapper/&amp;lt;symbolic name&amp;gt; &amp;lt;mountpoint&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2339470785605886126?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2339470785605886126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2339470785605886126' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2339470785605886126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2339470785605886126'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/10/encrypted-devicesfilesystems-on-linux.html' title='Encrypted Devices/Filesystems on Linux'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5656925875356187966</id><published>2008-09-24T22:56:00.002+02:00</published><updated>2008-09-24T23:06:02.563+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>The beginnings of coreboot and TianoCore</title><content type='html'>In order to create a UEFI payload for coreboot, I've started a coreboot platform as part of the TianoCore EDK II. The sources for the platform can be obtained &lt;a href="https://phs.subgra.de/hg/CorebootPkg"&gt;here&lt;/a&gt;. Note that the &lt;tt&gt;CorebootPkg&lt;/tt&gt; directory must be placed in the TianoCore $WORKSPACE directory.

&lt;br /&gt;&lt;br /&gt;

To build the package on FreeBSD, a GNU toolchain from vendor sources must be used. This is because the TianoCore tools use some compiler/linker flags unknown to the toolchain included in the FreeBSD base system. The path as well as the names of the toolchain binaries must be adjusted in &lt;tt&gt;Conf/tools_def.txt&lt;/tt&gt;. Because I built the toolchain according to &lt;a href="http://phisch.blogspot.com/2008/06/building-powerpc-cross-compiler.html"&gt;these instructions&lt;/a&gt;, the preprocessor will not look in &lt;tt&gt;/usr/include&lt;/tt&gt; for headers which causes errors in the &lt;tt&gt;ProcessorBind.h&lt;/tt&gt; header when it attempts to include &lt;tt&gt;stdint.h&lt;/tt&gt;. &lt;a href="https://phs.subgra.de/~phs/files/edk2_processorbind.diff"&gt;This patch&lt;/a&gt; can be applied to fix this.

&lt;br /&gt;&lt;br /&gt;

Note that the build process still cannot complete as the tools producing the final Firmware Volume (FV) cannot cope with the ELF binaries produced by the GNU toolchain.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5656925875356187966?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5656925875356187966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5656925875356187966' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5656925875356187966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5656925875356187966'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/09/beginnings-of-coreboot-and-tianocore.html' title='The beginnings of coreboot and TianoCore'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-9099091691274842057</id><published>2008-09-23T23:04:00.003+02:00</published><updated>2008-09-23T23:18:01.972+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore and the Python-based Build Process, Part 3</title><content type='html'>This is part III of my attempts to build the TianoCore EDK II with the Python-based tools. In order to circumvent the error that stopped me in &lt;a href="http://phisch.blogspot.com/2008/09/tianocore-and-python-based-build_20.html"&gt;part II&lt;/a&gt;, the build process needs to be taught to use GNU make, i.e. &lt;tt&gt;gmake&lt;/tt&gt;, on FreeBSD instead of &lt;tt&gt;make&lt;/tt&gt;, which is BSD make. This can be done by editing the &lt;tt&gt;*_ELFGCC_*_MAKE_PATH&lt;/tt&gt; variable in &lt;tt&gt;Conf/tools_def.txt&lt;/tt&gt;.

&lt;br /&gt;&lt;br /&gt;

The &lt;tt&gt;tools_def.txt&lt;/tt&gt; file is automatically copied from a template part of the BaseTools sources. &lt;a href="https://phs.subgra.de/~phs/files/basetools_tools.diff"&gt;This patch&lt;/a&gt; fixes the template so the changes described above do not have to be applied manually.

&lt;br /&gt;&lt;br /&gt;

At this point, the build process starts and does actually build some modules. However, the UnixPkg cannot be built completely on FreeBSD. This is because the code makes some assumptions only true on Linux, e.g. the presence of the &lt;tt&gt;sys/vfs.h&lt;/tt&gt; header.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-9099091691274842057?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/9099091691274842057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=9099091691274842057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/9099091691274842057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/9099091691274842057'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/09/tianocore-and-python-based-build_23.html' title='TianoCore and the Python-based Build Process, Part 3'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1141530450534873276</id><published>2008-09-20T23:37:00.014+02:00</published><updated>2008-12-03T21:05:48.305+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore and the Python-based Build Process, Part 2</title><content type='html'>So here's the &amp;quot;sequel&amp;quot; to &lt;a href="http://phisch.blogspot.com/2008/09/tianocore-and-python-based-build.html"&gt;Part One&lt;/a&gt;. This time I'm trying to actually build a Firmware Volume with the Python-based tools.

&lt;h2&gt;Prerequisites for build.py&lt;/h2&gt;
The core of the tools is &lt;tt&gt;build.py&lt;/tt&gt;, a Python script which invokes the tools in order to build a Firmware Volume (FV). On FreeBSD, &lt;tt&gt;build.py&lt;/tt&gt; cannot be run until the following requirements are met:

&lt;ul&gt;
&lt;li&gt;SQLite3 for Python, which can be installed through the &lt;tt&gt;databases/py-sqlite3&lt;/tt&gt; port.&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://www.antlr.org/wiki/display/ANTLR3/Python+runtime"&gt;Python module&lt;/a&gt; for &lt;a href="http://www.antlr.org/"&gt;ANTLR&lt;/a&gt;, a parser generator.&lt;/li&gt;
&lt;li&gt;Installing the module mentioned above requires &lt;i&gt;EasyInstall&lt;/i&gt;, or rather: I don't know how it can be done otherwise.&lt;/li&gt;
&lt;/ul&gt;

Because I could not find a port for &lt;i&gt;EasyInstall&lt;/i&gt;, I did this to install the script on FreeBSD:

&lt;pre&gt;
$ fetch http://peak.telecommunity.com/dist/ez_setup.py
$ chmod +x ez_setup.py
$ ./ez_setup.py
&lt;/pre&gt;

Note that this isn't the whole truth as the path to the interpreter in the script, i.e. the first line aka &amp;quot;shebang&amp;quot;, must be adjusted to &lt;tt&gt;/usr/local/bin/python&lt;/tt&gt; before the script can be executed.

&lt;br /&gt;

After that, the &lt;tt&gt;easy_install&lt;/tt&gt; command is available and the ANTLR module can be installed by running this:

&lt;pre&gt;
$ eazy_install \
  http://www.antlr.org/download/Python/antlr_python_runtime-3.0.1-py2.5.egg
&lt;/pre&gt;

&lt;h2&gt;Running build.py&lt;/h2&gt;
In theory, running &lt;tt&gt;build.py&lt;/tt&gt; and thus building a Firmware Volume should be as easy as this:

&lt;pre&gt;
$ cd path/to/edk2
$ export PYTHONPATH=/path/to/basetools/Source/Python
$ . edksetup.sh BaseTools
$ python $PYTHONPATH/build/build.py
&lt;/pre&gt;


Unfortunately, the last step initially aborted with this error:

&lt;pre&gt;
build...
 : error 5000: Please execute /home/phs/sandbox/basetools/Bin/FreeBSD-i386:/sbin: \
/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin: \
/home/phs/bin/edksetup.bat to set /home/phs/sandbox/basetools/Bin/Freebsd7 in \
environment variable: PATH!



- Failed -
&lt;/pre&gt;

After some try'n'error time, I think that the above error is caused by user error: I had previously copied the compiled C programs from &lt;tt&gt;Source/C/bin&lt;/tt&gt; to &lt;tt&gt;bin/FreeBSD-i386&lt;/tt&gt; (paths relative to &lt;tt&gt;/path/to/basetools&lt;/tt&gt;). After removing &lt;tt&gt;bin/FreeBSD-i386&lt;/tt&gt;, I created a link to &lt;tt&gt;BinWrappers/PosixLike&lt;/tt&gt; at the same location:

&lt;pre&gt;
$ cd /path/to/basetools
$ ln -s BinWrappers/PosixLike Bin/FreeBSD-i386
&lt;/pre&gt;

I then re-ran &lt;tt&gt;build.py&lt;/tt&gt; (see above) and it produced some output that didn't look like errors:

&lt;pre&gt;
00:44:09, Sep.21 2008 [FreeBSD-7.1-PRERELEASE-i386-32bit-ELF]

WORKSPACE                = /usr/home/phs/sandbox/edk2
EDK_SOURCE               = /usr/home/phs/sandbox/edk2/EdkCompatibilityPkg
EFI_SOURCE               = /usr/home/phs/sandbox/edk2/EdkCompatibilityPkg
EDK_TOOLS_PATH           = /home/phs/sandbox/basetools

TARGET_ARCH              = IA32
TARGET                   = DEBUG
TOOL_CHAIN_TAG           = ELFGCC

Active Platform          = UnixPkg/UnixPkg.dsc
Flash Image Definition   = UnixPkg/UnixPkg.fdf

Processing meta-data . . . . . . .
&lt;/pre&gt;

Unfortunately, though, right after the dots, an error occured:

&lt;pre&gt;
build...
UnixPkg/UnixPkg.dsc(...): error 4000: Instance of library class [NetLib] is not found
        in [MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf] [IA32]
        consumed by module [MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf]
 

- Failed -
00:44:17, Sep.21 2008 [00:08]
&lt;/pre&gt;

&lt;h2&gt;Fixing the UnixPkg&lt;/h2&gt;
The UnixPkg part of the EDK II seems to be broken as the error above indicates a dependency error between modules which is caused by an incorrect platform definition file (&lt;tt&gt;*.dsc&lt;/tt&gt;). Applying &lt;a href="https://phs.subgra.de/~phs/files/edk2_unixpkg.diff"&gt;this patch&lt;/a&gt; fixes the problem.

&lt;br /&gt;&lt;br /&gt;

The patch ensures that all dependencies are met, but the build process still fails with this error:

&lt;pre&gt;
Processing meta-data . . . . . . . . done!
make: don't know how to make pbuild. Stop


build...
 : error 7000: Failed to execute command
        make pbuild [/usr/home/phs/sandbox/edk2/Build/Unix/DEBUG_ELFGCC/IA32/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate]

Waiting for all build threads exit...
make: don't know how to make pbuild. Stop


build...
 : error 7000: Failed to execute command
        make pbuild [/usr/home/phs/sandbox/edk2/Build/Unix/DEBUG_ELFGCC/IA32/MdePkg/Library/BaseLib/BaseLib]


build...
 : error F002: Failed to build module
        MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf [IA32, ELFGCC, DEBUG]

- Failed -
01:01:43, Sep.21 2008 [00:09]
&lt;/pre&gt;

Oh, well, &lt;a href="http://phisch.blogspot.com/2008/09/tianocore-and-python-based-build_23.html"&gt;to be continued...&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1141530450534873276?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1141530450534873276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1141530450534873276' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1141530450534873276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1141530450534873276'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/09/tianocore-and-python-based-build_20.html' title='TianoCore and the Python-based Build Process, Part 2'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5282712113628239171</id><published>2008-09-14T00:19:00.012+02:00</published><updated>2008-09-21T00:26:56.223+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore and the Python-based Build Process</title><content type='html'>Now that I can use &lt;a href="http://phisch.blogspot.com/2008/09/hacking-coreboot-and-libpayload.html"&gt;coreboot and libpayload&lt;/a&gt; on FreeBSD, it's time to try the new Python-based build process for the TianoCore EDK II on FreeBSD.

&lt;br /&gt;&lt;br /&gt;

Prerequisites are:

&lt;ul&gt;
&lt;li&gt;A copy of the EDK II sources, available at &lt;a href="https://edk2.tianocore.org/svn/edk2/trunk/edk2"&gt;https://edk2.tianocore.org/svn/edk2/trunk/edk2&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The sources of the Python tools which can be obtained from &lt;a href="https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools"&gt;https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;tt&gt;misc/e2fs-libuuid&lt;/tt&gt; port.
&lt;li&gt;GNU Make, i.e. the &lt;tt&gt;devel/gmake&lt;/tt&gt; port.&lt;/li&gt;
&lt;/ul&gt;

Note that Subversion access requires a user account at the TianoCore project.

&lt;h2&gt;Installing the e2fs-libuuid port&lt;/h2&gt;
This is trivially easy, just do:

&lt;pre&gt;
$ cd /usr/ports/misc/e2fs-libuuid
$ sudo make install
&lt;/pre&gt;

That's all. The headers and libraries are installed under &lt;tt&gt;/usr/local&lt;/tt&gt;.

&lt;h2&gt;Building the Base Tools&lt;/h2&gt;
Compiling the Base Tools, i.e. the Python-based TianoCore build tools, isn't complicated but doesn't work out of the box, either. First, these two patches (&lt;a href="https://phs.subgra.de/~phs/files/basetools_include.diff"&gt;patch 1&lt;/a&gt;, &lt;a href="https://phs.subgra.de/~phs/files/basetools_make.diff"&gt;patch 2&lt;/a&gt;) must be applied:

&lt;pre&gt;
$ cd /path/to/basetools
$ patch -p0 &lt; basetools_include.diff
$ patch -p0 &lt; basetools_make.diff
&lt;/pre&gt;

The first patch adjusts some include paths so that &lt;tt&gt;/usr/local/include&lt;/tt&gt; is searched, too, which is required in order to find the &lt;tt&gt;uuid/uuid.h&lt;/tt&gt; header. The second patch replaces invocations of &lt;tt&gt;make&lt;/tt&gt; to use the &lt;tt&gt;$(MAKE)&lt;/tt&gt; variable which holds the name of invoked the &lt;tt&gt;make&lt;/tt&gt; binary. This is required as in FreeBSD (and other BSDs), &lt;tt&gt;make&lt;/tt&gt; is not GNU make, however the latter is required to build the Base Tools. Consequently, when building the project, make sure that &lt;tt&gt;gmake&lt;/tt&gt; is used:

&lt;pre&gt;
$ gmake
&lt;/pre&gt; 

&lt;h2&gt;Compiling the EDK II&lt;/h2&gt;
&lt;a href="http://phisch.blogspot.com/2008/09/tianocore-and-python-based-build_20.html"&gt;To be continued...&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5282712113628239171?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5282712113628239171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5282712113628239171' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5282712113628239171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5282712113628239171'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/09/tianocore-and-python-based-build.html' title='TianoCore and the Python-based Build Process'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2108203029937983432</id><published>2008-09-12T22:26:00.005+02:00</published><updated>2008-09-13T00:01:00.583+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='coreboot'/><title type='text'>Hacking coreboot and libpayload</title><content type='html'>After some quiet time, I picked up a project I started a while ago: Hacking coreboot and libpayload on FreeBSD.

&lt;h2&gt;Building coreboot&lt;/h2&gt;
On FreeBSD, building coreboot requires a toolchain built from the GNU sources. If the stock toolchain is used, the build process dies with this error:

&lt;pre&gt;
CC      build/stage0.init
/usr/home/phs/sandbox/coreboot-v3/build/arch/x86/stage0_i586.o(.text+0xf): In function `_stage0':
: relocation truncated to fit: R_386_16 gdtptr
gmake: *** [/usr/home/phs/sandbox/coreboot-v3/build/stage0.init] Error 1
&lt;/pre&gt;

The solution is to build a compiler as described &lt;a href="http://phisch.blogspot.com/2008/07/cross-compiling-freebsd.html"&gt;here&lt;/a&gt; and &lt;a href="http://phisch.blogspot.com/2008/06/building-powerpc-cross-compiler.html"&gt;here&lt;/a&gt; and then set the $CROSS environment variable accordingly, e.g. like this:

&lt;pre&gt;
$ export CROSS=/opt/bin/i386-unknown-linux-gnu-
&lt;/pre&gt;

Note that the above requires that &lt;a href="http://coreboot.org/pipermail/coreboot/2008-July/036942.html"&gt;this patch&lt;/a&gt; is applied. After that, build the bios.bin binary using GNU make.

&lt;pre&gt;
$ gmake menuconfig
$ gmake
&lt;/pre&gt;

&lt;h2&gt;Building libpayload&lt;/h2&gt;
Compiling libpayload is trickier than building coreboot as the build files assume that the world is Linux. First, sh is not always bash. Second, the header and library search paths are screwed up as they don't include /usr/local subdirectores. Third, the gettext library is installed as libgettextlib.so on FreeBSD and must be linked against the program explicitly. And finally, the install(1) tool has different parameters than on Linux. Oh, and there are no stdarg.h and stddef.h headers.

&lt;br /&gt;&lt;br/&gt;

I've hacked around those issues, the Mercurial repository is available at &lt;a href="https://phs.subgra.de/hg/libpayload"&gt;https://phs.subgra.de/hg/libpayload&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2108203029937983432?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2108203029937983432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2108203029937983432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2108203029937983432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2108203029937983432'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/09/hacking-coreboot-and-libpayload.html' title='Hacking coreboot and libpayload'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-7968273276364188910</id><published>2008-08-25T19:40:00.003+02:00</published><updated>2008-08-25T19:46:05.389+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SLOF'/><title type='text'>Hacking SLOF Clients</title><content type='html'>SLOF includes a few clients. Especially the &lt;tt&gt;net-snk&lt;/tt&gt; client is interesting as it allows one to add applications which can be started by specifying their name on the command line when booting the kernel.

&lt;br /&gt;&lt;br /&gt;

In order to hack SLOF client applications, the &lt;tt&gt;sec-client&lt;/tt&gt; target must be built in the &lt;i&gt;clients/net-snk&lt;/i&gt; subdirectory of the SLOF source tree. Before this can succeed, the CPUARCH environment variable must be set, like this:

&lt;pre&gt;
$ export CPUARCH=ppc970
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-7968273276364188910?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/7968273276364188910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=7968273276364188910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7968273276364188910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7968273276364188910'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/08/hacking-slof-clients.html' title='Hacking SLOF Clients'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6837058974513992233</id><published>2008-08-10T15:56:00.003+02:00</published><updated>2008-08-10T16:04:30.347+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='LaTeX'/><title type='text'>Latest Version of KOMAscript</title><content type='html'>The Tex Live distribution Mac OS X is getting more outdated by the day. Maybe there's a way to update it, but I didn't bother to check.

&lt;br /&gt;&lt;br /&gt;

For a reasonably good layout of letters without a footer I found that a recent version of KOMAscript is required. I'm using Version 2.98 obtained from &lt;a href="http://dante.ctan.org/CTAN/macros/latex/contrib/koma-script/komascript.tds.zip"&gt;http://dante.ctan.org/&lt;/a&gt;.

&lt;br /&gt;&lt;br /&gt;

Installing the new version proved to be quite easy:

&lt;pre&gt;
$ cd /usr/local/texlive/2007/texmf-dist
$ sudo unzip komascript.tds.zip
$ sudo texconfig rehash
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6837058974513992233?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6837058974513992233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6837058974513992233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6837058974513992233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6837058974513992233'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/08/latest-version-of-komascript.html' title='Latest Version of KOMAscript'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8679467302868809227</id><published>2008-07-10T14:28:00.010+02:00</published><updated>2008-07-11T13:51:20.496+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>Cross compiling the FreeBSD Kernel</title><content type='html'>Wow, two post in one day already ;-)

&lt;br /&gt;&lt;br /&gt;

There are two things I'd like to note. First, I noticed that cross-compiling seems a major issue for me. Don't know why that is.

&lt;br /&gt;&lt;br /&gt;

Second, I need to remember Warner Losh's post on &lt;a href="http://bsdimp.blogspot.com/2006/09/cross-building-freebsd.html"&gt;cross compiling FreeBSD&lt;/a&gt;. Essentialy, the procedure is:

&lt;pre&gt;
$ export TARGET=powerpc
$ export TARGET_ARCH=powerpc
$ make kernel-toolchain
$ make buildkernel
&lt;/pre&gt;

&lt;i&gt;Addendum:&lt;/i&gt; Unfortunately, this procedure works only on architectures already supported by FreeBSD and its build system. Therefore, it doesn't work for me. So here's the full story on how I got FreeBSD to at least &lt;i&gt;compile&lt;/i&gt;.

&lt;h2&gt;Building the Toolchain&lt;/h2&gt;
Building the toolchain is pretty straight forward. I've already written about &lt;a href="http://phisch.blogspot.com/2008/06/building-powerpc-cross-compiler.html"&gt;how to build a cross compiler&lt;/a&gt;. On FreeBSD however, four things are different.

&lt;ul&gt;
&lt;li&gt;The target is powerpc64-unknown-freebsd. I don't know if powerpc64-unknown-elf would have worked, too.&lt;/li&gt;
&lt;li&gt;The target is new, so a &lt;a href="https://phs.subgra.de/~phs/files/binutils-2.18.diff"&gt;patch&lt;/a&gt; to the binutils sources is required.&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://gmplib.org/"&gt;GNU MP Bignum Library&lt;/a&gt; (GMP) is required. I used version GMP 4.2.1 and installed it in $PREFIX&lt;/li&gt;
&lt;li&gt;Finally, the &lt;a href="http://www.mpfr.org/"&gt;MPFT Library&lt;/a&gt; needs to be built. I used version MPFT 2.3.0 and installed it in $PREFIX&lt;/li&gt;
&lt;/ul&gt;

Note that those steps have to be performed before the compiler is built. Since I didn't install the libraries in the standard locations, the LD_LIBRARY_PATH variable needs to be set before the compiler can be used:

&lt;pre&gt;
$ export LD_LIBRARY_PATH=$PREFIX/lib
&lt;/pre&gt;

&lt;h2&gt;Building the Kernel&lt;/h2&gt;
The basic procedure of building a kernel is outlined in the &lt;a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/kernelbuild.html#KERNELBUILD-TRADITIONAL"&gt;FreeBSD Developer's Handbook&lt;/a&gt;. Provided that the cross compiler has been installed in $PREFIX, these steps are required:

&lt;pre&gt;
$ export MACHINE=powerpc64
$ export MACHINE_ARCH=powerpc64
$ export CC=${PREFIX}/${TARGET_PREFIX}-gcc
$ export NM=${PREFIX}/${TARGET_PREFIX}-nm
$ export LD=${PREFIX}/${TARGET_PREFIX}-ld
$ export SYSTEM_LD=${LD}
$ export OBJCOPY=${PREFIX}/${TARGET_PREFIX}-objcopy
$ cd /usr/src/sys/powerpc64/conf
$ config KERNCONF
$ cd ../compile/KERNCONF
$ make cleandepend &amp;&amp; make depend
$ make kernel
&lt;/pre&gt;

Oh, of course this doesn't work with the stock FreeBSD sources. Instead, my &lt;a href="https://phs.subgra.de/hgwebdir.py/fbsd-ppc64/"&gt;FreeBSD 64-Bit PowerPC&lt;/a&gt; Mercurial repository needs to be used. Note that for convenience reasons, that tree includes a &lt;i&gt;crossenv&lt;/i&gt; script which, when sourced, sets up the required environment variables.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8679467302868809227?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8679467302868809227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8679467302868809227' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8679467302868809227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8679467302868809227'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/07/cross-compiling-freebsd.html' title='Cross compiling the FreeBSD Kernel'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-266258724679155634</id><published>2008-07-10T11:38:00.010+02:00</published><updated>2008-07-10T20:58:39.209+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KVM'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Linux KVM (kvm-70) on IBM Open Client 2.2</title><content type='html'>The Linux kernel-based virtual machine (KVM) is a great way for virtualization on computers running Linux. It requires virtualization support by the host processor (most modern x86 CPUs have this) and a kernel module. The kernel module can be built from the &lt;a href="http://downloads.sourceforge.net/kvm/kvm-70.tar.gz"&gt;KVM sources&lt;/a&gt;.

&lt;br /&gt;&lt;br /&gt;

Unfortunately, compiling the module on the IBM Open Client 2.2 distribution doesn't work out of the box. Instead, a &lt;a href="https://phs.subgra.de/~phs/files/kvm.diff"&gt;patch&lt;/a&gt; is required. The patch is an extended version of &lt;a href="http://git.kernel.org/?p=virt/kvm/kvm-userspace.git;a=commit;h=a0c397996e22eeceedcb23b6d3f2c883c4f09766"&gt;this commit&lt;/a&gt; to the KVM repository and applies against the KVM-70 release tar ball.

&lt;h2&gt;Networking&lt;/h2&gt;
The &lt;a href="http://kvm.qumranet.com/kvmwiki/Networking"&gt;KVM networking&lt;/a&gt; documentation lists &lt;i&gt;brctl(8)&lt;/i&gt; and &lt;i&gt;tunctl(8)&lt;/i&gt; as requirements for a bridge between the host and the guest. On the Open Client distribution, the &lt;i&gt;brctl&lt;/i&gt; utility is part of the &lt;i&gt;bridge-utils&lt;/i&gt; package whereas the &lt;i&gt;tunctl&lt;/i&gt; tool is part of &lt;i&gt;uml-utils&lt;/i&gt; - on other distributions, that is. However, there is a &lt;a href="http://download.fedora.redhat.com/pub/fedora/linux/development/i386/os/Packages/tunctl-1.4-2.fc9.i386.rpm"&gt;Fedora Core 9 package&lt;/a&gt; available which seems to work.
&lt;br /&gt;&lt;br /&gt;
Before starting the KVM guest, make sure that the &lt;i&gt;tun&lt;/i&gt; kernel module is loaded. These are the steps I use to start the guest:
&lt;pre&gt;
$ sudo modprobe tun
$ MACADDR=`genmac`
$ sudo qemu-system-x86_64 -hda freebsd-7.0.img \
   -net nic,macaddr=$MACADDR -net tap,script=qemu-ifup
&lt;/pre&gt;

Note that the &lt;i&gt;genmac&lt;/i&gt; and &lt;i&gt;qemu-ifup&lt;/i&gt; scripts are the examples from the KVM documentation.

&lt;h2&gt;NAT on the bridge&lt;/h2&gt;
Because I cannot put the KVM guest on the host network, I need to do NAT on the host. I've found this quick tutorial on &lt;a href="http://www.revsys.com/writings/quicktips/nat.html"&gt;NAT with iptables&lt;/a&gt;. The four steps are:

&lt;pre&gt;
# echo 1 &gt; /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# iptables -A FORWARD -i eth0 -o tap0 -m state \
     --state RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i tap0 -o eth0 -j ACCEPT
&lt;/pre&gt;

Also, make sure the &lt;i&gt;tap0&lt;/i&gt; interface has an IP address:

&lt;pre&gt;
$ sudo ifconfig tap0 192.168.0.1/24
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-266258724679155634?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/266258724679155634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=266258724679155634' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/266258724679155634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/266258724679155634'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/07/linux-kvm-kvm-70-on-ibm-open-client-22.html' title='Linux KVM (kvm-70) on IBM Open Client 2.2'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2030528348739854754</id><published>2008-07-02T09:34:00.003+02:00</published><updated>2008-07-11T00:13:29.244+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>PowerPC Device Tree Compiler</title><content type='html'>The Device Tree Compiler (DTC) project is hosted at OzLabs. The &lt;a href="http://dtc.ozlabs.org/"&gt;website&lt;/a&gt; seems to be unavailable at the moment, but the git repository at &lt;a href="git://ozlabs.org/srv/projects/dtc/dtc.git"&gt;git://ozlabs.org/srv/projects/dtc/dtc.git&lt;/a&gt; seems to work.

&lt;br /&gt;&lt;br /&gt;

Cross-building the tools works fine. This is what I did:

&lt;pre&gt;
$ export CC=ppu-gcc
$ make
&lt;/pre&gt;

This will create the &lt;i&gt;dtc&lt;/i&gt; and &lt;i&gt;ftdump&lt;/i&gt; tools which can then be copied to the target machine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2030528348739854754?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2030528348739854754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2030528348739854754' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2030528348739854754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2030528348739854754'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/07/powerpc-device-tree-compiler.html' title='PowerPC Device Tree Compiler'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2271948656833169618</id><published>2008-07-01T10:04:00.001+02:00</published><updated>2008-07-11T00:13:01.730+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>Cross-compiling the Linux kernel</title><content type='html'>I need to cross-compile a PowerPC Linux kernel on an x86 laptop. I've found instructions on how to &lt;i&gt;compile&lt;/i&gt; (not cross-compile) the Linux kernel at &lt;a href="http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html"&gt;this website&lt;/a&gt;. Further, there is a post to a mailing list &lt;a href="http://ozlabs.org/pipermail/ccontrol/2005-December/000008.html"&gt;here&lt;/a&gt; which shows how to cros-compile the kernel. The mailing list post mentions a &lt;i&gt;ccontrol&lt;/i&gt; file, but I have no clue what that is. Luckily I've found &lt;a href="http://michael-prokop.at/blog/2007/01/21/cross-compile-the-linux-kernel-on-debian/"&gt;this&lt;/a&gt; blog post, which seems to be more accurate.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2271948656833169618?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2271948656833169618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2271948656833169618' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2271948656833169618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2271948656833169618'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/07/cross-compiling-linux-kernel.html' title='Cross-compiling the Linux kernel'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8770206128696168643</id><published>2008-06-26T20:27:00.018+02:00</published><updated>2008-07-11T00:11:46.648+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Binutils'/><category scheme='http://www.blogger.com/atom/ns#' term='GCC'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>Building a PowerPC Cross Compiler</title><content type='html'>I need to build my own cross compiler which will run on i386 and produce 64-Bit PowerPC Binaries. I've found a pretty neat introduction to &lt;a href="http://www.ibm.com/developerworks/edu/l-dw-l-cross-i.html"&gt;building a cross compiler&lt;/a&gt; on IBM's developerWorks site (registration required). The tutorial isn't a step-by-step guide, but it helped me a lot.

&lt;br /&gt;&lt;br /&gt;

The basic procedure for building a cross-compiler is:

&lt;ul&gt;
&lt;li&gt;Obtain headers specific to the operating system&lt;/li&gt;
&lt;li&gt;Build binutils for the target platform&lt;/li&gt;
&lt;li&gt;Build a bootstrap compiler&lt;/li&gt;
&lt;li&gt;Build a standard C library for the target&lt;/li&gt;
&lt;li&gt;Build the final cross-compiler, using the C library just built&lt;/li&gt;
&lt;/ul&gt;

The developerWorks tutorial doesn't mention this, but the first three steps can easily be run in parallel. Anyways, before starting, I've set these environment variables:

&lt;pre&gt;
$ export TARGET=powerpc64-unknown-linux-gnu
$ export PREFIX=/opt/crosscompiler
$ export TARGET_PREFIX=$PREFIX/$TARGET
$ export PATH=$PATH:$PREFIX/bin
&lt;/pre&gt;

&lt;h2&gt;Obtaining Linux-specific Headers&lt;/h2&gt;
I've followed the developerWorks tutorial on this one: Downloaded and extracting the Linux kernel sources, then copied the relevant files. Here are the commands I ran:

&lt;pre&gt;
$ wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.9.tar.bz2
$ tar xvjf linux-2.6.25.9.tar.bz2
$ cd linux-2.6.25.9
$ make ARCH=powerpc CROSS_COMPILE=powerpc64-linux- menuconfig
(configure options, but tweaking isn't neccessary)
$ mkdir -p $TARGET_PREFIX/include
$ cp -r include/linux $TARGET_PREFIX/include
$ cp -r include/asm-powerpc $TARGET_PRFIX/include/asm
$ cp -r include/asm-generic $TARGET_PREFIX/include
&lt;/pre&gt;

If you read to the end of this post, then you'll realize that this step wouldn't be required (for now).

&lt;h2&gt;Building GNU binutils&lt;/h2&gt;
I'm using GNU binutils 2.18, available from the &lt;a href="http://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.bz2"&gt;GNU website&lt;/a&gt;. These are the steps required to build binutils.

&lt;pre&gt;
$ wget 
$ tar xjvf
$ ./configure --prefix=$PREFIX --target=$TARGET --disable-nls -v
$ make all
$ make install
&lt;/pre&gt;

While building binutils did take a while, it wasn't as long as the tutorial makes you believe. On a IBM Thinkpad T60p built around a Centrino Duo CPU running at 2.16 MHz it took less than 10 minutes. Also note the last command (&amp;quot;make install&amp;quot;), which is missing from the developerWorks tutorial.

&lt;h2&gt;Building a bootstrap compiler&lt;/h2&gt;

For my project I need GCC 4.x, the latest version at the time of writing is 4.3.1 which is available from a &lt;a href="ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.3.1/gcc-4.3.1.tar.bz2"&gt;GNU mirror&lt;/a&gt; near you. Downloading and extracting is easy:

&lt;pre&gt;
$ wget ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.3.1/gcc-4.3.1.tar.bz2
$ tar xjvf gcc-4.3.1.tar.bz2
$ cd gcc-4.3.1
&lt;/pre&gt;

Here are the steps required to build a bootstrap compiler.

&lt;pre&gt;
$ ./configure --prefix=$PREFIX --target=$TARGET --without-headers \
  --with-newlib -v
$ make all-gcc
$ make install-gcc
&lt;/pre&gt;

This took longer than building binutils, however it took less than 30 minutes (as opposed to the hours the tutorial talks about).

&lt;h2&gt;Building the GNU C Library (glibc)&lt;/h2&gt;

&lt;pre&gt;
&lt;/pre&gt;

&lt;pre&gt;
$ CC=${TARGET}-gcc ./configure --target=$TARGET --prefix=$PREFIX \
  --with-headers=${TARGET_PREFIX}/include
&lt;/pre&gt;

Unfortunately, this command failed with the following error:

&lt;pre&gt;
(...)
checking whether __attribute__((visibility())) is supported... no
configure: error: compiler support for visibility attribute is required
&lt;/pre&gt;

However, this isn't important as I won't need a standard C library for now - I'm building with &lt;i&gt;-ffreestanding&lt;/i&gt; and &lt;i&gt;-nostdlib&lt;/i&gt; anyways. Therefore I've decided that I won't pursue this futher but may come back later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8770206128696168643?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8770206128696168643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8770206128696168643' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8770206128696168643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8770206128696168643'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/06/building-powerpc-cross-compiler.html' title='Building a PowerPC Cross Compiler'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5882474932178358232</id><published>2008-06-26T14:10:00.003+02:00</published><updated>2008-06-26T14:12:19.983+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UEFI'/><title type='text'>UEFI Adoption</title><content type='html'>As a note to myself: There is a &lt;a href="http://www.uefi.org/news/UEFI_Media_Advisory_May_20_08_FINAL.pdf"&gt;press release&lt;/a&gt; of the UEFI forum available which shows which vendors already have adopted UEFI or will in the near future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5882474932178358232?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5882474932178358232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5882474932178358232' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5882474932178358232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5882474932178358232'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/06/uefi-adoption.html' title='UEFI Adoption'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8678071936380217497</id><published>2008-06-22T22:03:00.005+02:00</published><updated>2008-06-22T22:26:26.549+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='QEMU'/><title type='text'>Qemu, FreeBSD and coreboot</title><content type='html'>Since my attempts at &lt;a href="http://phisch.blogspot.com/2008/06/gcc-33-on-mac-os-x.html"&gt;getting Qemu running on Mac OS X&lt;/a&gt; were unsuccessfull, I've decided to go a different route. I'm now trying to build it on FreeBSD again.

&lt;br /&gt;&lt;br /&gt;

Some time ago, I took some notes on how to get Qemu running on FreeBSD and added them to the &lt;a href="http://www.coreboot.org/QEMU_Build_Tutorial#Building_Qemu_on_FreeBSD"&gt;coreboot wiki&lt;/a&gt;. Then some time later, I tried to build Qemu per those instructions, but had to discover that the port had been updated to a newer version of Qemu and no longer works.

&lt;br /&gt;&lt;br /&gt;

So I've decided so maintain my own copy of the Qemu sources. The goal is to have a working version of Qemu which can be built on FreeBSD and can run coreboot. The repository is at &lt;a href="svn+ssh://phs.subgra.de/usr/svnroot/qemu"&gt;svn+ssh://phs.subgra.de/usr/svnroot/qemu&lt;/a&gt;, a web frontend is available at &lt;a href="https://phs.subgra.de/svnweb/index.cgi/qemu"&gt;https://phs.subgra.de/svnweb/index.cgi/qemu&lt;/a&gt;. Since the repository is not (yet?) public, &lt;a href="https://phs.subgra.de/qemu-0.9.0-freebsd.tar.gz"&gt;here&lt;/a&gt; is a tar-ball of the latest version.

&lt;br /&gt;&lt;br /&gt;

Building Qemu for FreeBSD from "my" sources is pretty straight forward. However, it's not as straight forward as building from Linux or from a FreeBSD port, so here are the full instructions ;-)

&lt;pre&gt;
$ export BSD_MAKE=`which make`
$ ./configure (your options here)
$ gmake
$ gmake install
&lt;/pre&gt;

Have fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8678071936380217497?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8678071936380217497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8678071936380217497' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8678071936380217497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8678071936380217497'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/06/qemu-freebsd-and-coreboot.html' title='Qemu, FreeBSD and coreboot'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5973968413365852879</id><published>2008-06-15T17:50:00.006+02:00</published><updated>2008-07-11T00:12:31.010+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>GCC 3.3 on Mac OS X</title><content type='html'>I just tried to build Qemu on an Intel Mac. Qemu needs GCC 3.x and won't compile with GCC 4.x. The configure script for Qemu automatically detects that the GCC 3.x is installed as &lt;i&gt;/usr/bin/gcc-3.3&lt;/i&gt; and tries to use that. The problem is that the compiler is actually a cross-compiler for PowerPC and that it cannot produce x86 binaries. Per &lt;a href="http://lists.macosforge.org/pipermail/macports-users/2007-February/001599.html"&gt;this post&lt;/a&gt; I found out that using the &lt;i&gt;-arch ppc&lt;/i&gt; flag allows the compiler to be used on an Intel machine. Obviously the resulting binary will be a PowerPC binary, but should run under Rosetta on an Intel machine.

&lt;br /&gt;&lt;br /&gt;

Note that I still don't have a solution for building Qemu on Mac OS X. This post is just a note about &lt;i&gt;one&lt;/i&gt; aspect of the whole problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5973968413365852879?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5973968413365852879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5973968413365852879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5973968413365852879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5973968413365852879'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/06/gcc-33-on-mac-os-x.html' title='GCC 3.3 on Mac OS X'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2144825970444648395</id><published>2008-06-11T15:49:00.002+02:00</published><updated>2008-06-11T15:53:19.965+02:00</updated><title type='text'>Leaky Abstractions</title><content type='html'>Today I came across &lt;a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html"&gt;an interesting article&lt;/a&gt; that sums up why abstractions still require one to know the lower levels. In essence, the author claims that abstractions are good and help us build complex systems, but are a great burden if something fails in the lower levels. I couldn't agree more, especially when I think of the TianoCore code and the UEFI software model.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2144825970444648395?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2144825970444648395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2144825970444648395' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2144825970444648395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2144825970444648395'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/06/leaky-abstractions.html' title='Leaky Abstractions'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1578964731374116047</id><published>2008-06-06T20:22:00.002+02:00</published><updated>2008-06-06T20:29:00.006+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>Profiling Tools for Mac OS X</title><content type='html'>I came accross &lt;a href="http://www.kernelthread.com/mac/apme/optimizations/"&gt;this&lt;/a&gt; page today, where Amit Singh talks about some profiling tools for Mac OS X. Particularily interesting seem to be the &lt;a href="http://developer.apple.com/tools/download/"&gt;Computer Hardware Understanding Development (CHUD) Tools&lt;/a&gt;. I haven't used them yet, but will check them out soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1578964731374116047?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1578964731374116047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1578964731374116047' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1578964731374116047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1578964731374116047'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/06/profiling-tools-for-mac-os-x.html' title='Profiling Tools for Mac OS X'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6746747854643455215</id><published>2008-05-29T19:21:00.006+02:00</published><updated>2008-07-11T00:12:05.168+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>The infamous memory hole</title><content type='html'>Ok, so I've always suspected it, i.e. had a theory, but the &lt;a href="http://www-01.ibm.com/chips/techlib/techlib.nsf/products/CPC945_Bridge_and_Memory_Controller"&gt;CPC945&lt;/a&gt; manual (section 7.2) confirms it.

&lt;br /&gt;&lt;br /&gt;

If a machine has 4 GBytes of memory installed, and say, 1 GByte of I/O Memory is mapped at 0x80000000 (2 GBytes) upwards, then the physical memory will still be fully accessible. It will respond to read requests in the region 0x0 thru 0x7fffffff (i.e. 0 thru 2 GBytes - 1) and to the region 0xC0000000 thru 0x140000000 (i.e. 3 GBytes thru 5 GBytes).

&lt;br /&gt;&lt;br /&gt;

This will of course only work if the CPU can make requests in that range, i.e. has a large enough address bus. Hence there is an actual hole that shadows physical memory when installing 4 GBytes in a x86-based System.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6746747854643455215?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6746747854643455215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6746747854643455215' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6746747854643455215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6746747854643455215'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/infamous-memory-hole.html' title='The infamous memory hole'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-7762953421934096990</id><published>2008-05-29T18:08:00.005+02:00</published><updated>2008-05-30T08:19:13.059+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Dual Monitor on T60 (Internal + DVI)</title><content type='html'>I think I've found a way to make my T60p use the internal display and also drive an external monitor via the DVI port (on Linux). For some reason, this does not work automatically upon reboot, but has to be done from the command line.

&lt;pre&gt;
aticonfig --dtop=horizontal --screen-layout=left --enable-monitor=lvds,tmds1
&lt;/pre&gt;

Now restart the X server and you should see video output on both monitors. I have the external monitor left of the laptop, so I need to run this command as well:

&lt;pre&gt;
aticonfig --swap-monitor
&lt;/pre&gt;

Then, both monitors work. Unfortunately, I seem to have broken suspend/resume somewhere along the way. It seems that a combination of the things listed below make suspend/resume work again. I don't know if both are required or if either helps.

&lt;ul&gt;
&lt;li&gt;Update the fglrx driver. I'm using the &lt;i&gt;kernel-module-ATI-upstream-fglrx&lt;/i&gt; (carries version numbers 8.452.1 and 2.6.18_53.1) as well as the &lt;i&gt;ATI-upstream-fglrx&lt;/i&gt; package (version number 8.452.1-3.oc2) from the repository the IBM Open Client uses by default.&lt;/li&gt;
&lt;li&gt;Disable the AIGLX extension&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-7762953421934096990?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/7762953421934096990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=7762953421934096990' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7762953421934096990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7762953421934096990'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/dual-monitor-on-t60-internal-dvi.html' title='Dual Monitor on T60 (Internal + DVI)'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-3313983565685025358</id><published>2008-05-23T01:01:00.010+02:00</published><updated>2008-06-26T20:48:25.991+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CVS'/><category scheme='http://www.blogger.com/atom/ns#' term='Subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='Mercurial'/><title type='text'>On some revision control systems</title><content type='html'>&lt;p&gt;
So I've long wondered about the advantages of those shiny, modern (distributed) revision control systems that have seemingly become quite fashionable these days. I started with CVS and liked it, but once I moved to Subversion I have started to feel a dissatisfaction with my version control system, the kind that would not go away if I went back to CVS. It's like driving a car. Once you drive a faster car, you realize the faster car is not fast enough. Obviously, going back to the original car is a step in the wrong direction.
&lt;/p&gt;

&lt;h1&gt;CVS&lt;/h1&gt;
&lt;p&gt;
The first revision control system I used was CVS. I liked it when I got used to it. It let me keep track of my files, was easy to back up and was fast enough for my little projects. There were good workarounds for CVS' limitations such as "renaming" files by performing an explicit add and then remove operation or by doing a "repo-copy" (i.e. copying the files in the repository itself). Empty directories could be pruned on updates. What else would one want?
&lt;/p&gt;

&lt;h1&gt;Subversion&lt;/h1&gt;
&lt;p&gt;
Well, I have long wondered why I should be using Subversion instead of CVS. After all, CVS has worked well for me in the past and simply &amp;quot;because it can rename files&amp;quot; hasn't been too convincing. In fact, I have heard that argument so often and from so many people, it started to become a reason &lt;i&gt;not&lt;/i&gt; to switch to Subversion. Well, then I gave Subversion a shot and I have to say, I like it - with some limitations.
&lt;/p&gt;
&lt;p&gt;
But let me first say what I think is good about Subversion. I like Subversion's speed advantage over CVS. The reason I started using Subversion was that I wanted a way to track my own changes to a rather large source tree that is kept in CVS. I wanted to make periodic imports of snapshots and merge my local changes - similar to how vendor branches work in CVS. When trying to accomplish this with CVS, it became apparent that it would be very time consuming: An import and merge session could take several hours. Doing the same thing with Subversion accellerated the process quite a bit - an update session would still take about an hour, but mostly because I had to download the updated source tree from the net.
&lt;/p&gt;
&lt;p&gt;
Ok, that's about it when it comes to subversion's advantages. What I don't like is subversion's poor handling of branches. I don't think a branch is another directory, I think a branch is a branch. The same holds true for a tag. Also, merging branches is a major pain - while simple at first, it will get to the point where keeping track of what has been merged and what needs merging is a complex task . Granted, CVS isn't a whole lot better at that.
&lt;/p&gt;
&lt;p&gt;
To set things straight: I'm not saying Subversion is bad. All I'm saying is that it isn't a lot better than CVS &lt;u&gt;for my purposes&lt;/u&gt;.
&lt;/p&gt;
&lt;h1&gt;Mercurial&lt;/h1&gt;
&lt;p&gt;
So now on to the reason I started this post. I realize, it has become a lot longer than anticipated, but who cares?! I've read about the advantages that distributed revision controls offer some time ago. Having all the history available in with every working copy is one of them. The ability to keep track of merges between branches is another one. It's the latter that got me interested in Mercurial. While I realize that upcoming versions of Subversion will support merge tracking as well, the version(s) installed on my various computers don't support it - and I don't want to compile some development branch of a critical (to me) piece of software.
&lt;/p&gt;
&lt;p&gt;
So I looked at other choices, e.g. git and Mercurial. To be honest, I haven't looked at git because I heard it is supposed to be hard to use with more than 100 commands. So I started to look at Mercurial and played around with it. I like it, so I don't think I'll look at git anytime soon.
&lt;/p&gt;
&lt;p&gt;
Mercurial has (almost) everythig I need: It's fast, it's easy to use and it handles merges between branches well. I'm the &amp;quot;almost&amp;quot can be erased as soon as I dig further. What's still missing is an easy setup for a permanent, central &amp;quot;master&amp;quot; repository (short of the &amp;quot;hg serve&amp;quot; command which starts a minimal HTTP server). I'm also missing a web frontent similar to CVSWeb and SVNWeb - I'm sure such thing does exist, but I haven't found it yet. The third thing I haven't figured out yet is how to do backups.
&lt;/p&gt;
&lt;p&gt;
I'd like to write a bit about the differences between Mercurial and the other systems I've used. First, a revision of a file has up to two &lt;i&gt;parents&lt;/i&gt;. Actually, it always has two parents, but one may be the &lt;i&gt;null&lt;/i&gt; parent, and that doesn't count. You start out with a file that has two &lt;i&gt;null&lt;/i&gt; parents. Once you commit a change to the file, the file's parent becomes the previous revision, and so on. If a revision has only one parent, and no other revision uses it as it's parent, then that revision is called a &lt;i&gt;head&lt;/i&gt;.
&lt;/p&gt;
&lt;p&gt;
The second parent comes in the play, when you have multiple branches. Creating a branch is also different from other systems. You first switch a working copy to a new branch by issuing &lt;i&gt;hg branch &amp;lt;name&amp;lt;&lt;/i&gt;. The default branch, i.e. what's called &amp;quot;HEAD&amp;quot; in CVS and &amp;quot;trunk&amp;quot; in Subversion is called &amp;quot;default&amp;quot; in Mercurial. The default branch always exists. Switching a working copy to a new branch does not create the branch, yet. Only commiting a first change in that working copy does. Note that the first revision's parent will be the branchpoint revision.
&lt;/p&gt;
&lt;p&gt;
So what happens when you merge between branches? When you merge and commit, the current branch will contain all changes of the original branch since the last merge (or the branchpoint). You don't need to remember which changes you need to merge into the current branch - Mercurial does that automatically for you. This is possible because when merging, a file's second parent is filled in with the &lt;i&gt;head&lt;/i&gt; revision of the originating branch. That also means, that when you merge changes from branch A into branch B, the &lt;i&gt;head&lt;/i&gt; revision of branch A is no longer a &lt;i&gt;head&lt;/i&gt;. Don't worry, though, once you commit something on branch A again, it will have a &lt;i&gt;head&lt;/i&gt; again.
&lt;/p&gt;
&lt;p&gt;
Now on to the distributed part. The concept of branches is taken further in a distributed revision control system. Multiple instances of the repository can have dependencies between each other. A new copy of a repository is created by running the &amp;quot;hg clone&amp;quot; command. Then, changes to that repository copy can be made as if the original never existed. But, if you want to, you can also pull any changes the original repository has incorporated. Do this by running &amp;quot;hg pull&amp;quot; - it's really just merging all changes from your master repository into your copy. It also works the other way around: You can push your changes upstream by running &amp;quot;hg push&amp;quot; (if the upstream repository allows it).
&lt;/p&gt;

&lt;p&gt;All in all, I find Mercurial very easy to use once the basic concepts have been understood. I'm not sure yet whether I'll convert any of my Subversion repositories to Mercurial or if I'll use seriously at all. But for future reference, here's a link to a free &lt;a href="http://hgbook.red-bean.com/hgbook.html"&gt;book on Mercurial&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-3313983565685025358?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/3313983565685025358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=3313983565685025358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3313983565685025358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3313983565685025358'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/on-some-revision-control-systems.html' title='On some revision control systems'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1343570448754506219</id><published>2008-05-20T14:36:00.004+02:00</published><updated>2008-05-20T15:07:30.219+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Open Firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='SLOF'/><title type='text'>Why Open Firmware is pretty neat</title><content type='html'>I've just been impressed by the power of Open Firmware again. I'm currently tinkering with the decrementer and time base registers on a PowerPC processor and I need to find out if some of my assumptions are correct.

&lt;br /&gt;&lt;br /&gt;

One way to do that is to compile my C code, load and start it over the network and see if things work the way I think they should work. While this works, it's somewhat time consuming.

&lt;br /&gt;&lt;br /&gt;

Another way of doing this is to use the Open Firmware user interface - a full featured Forth system. As such, it offers very powerful features during development. In fact, everything entered at the client interface could also be compiled into a forth word, which could even be included in the firmware's dictionary.

&lt;br /&gt;&lt;br /&gt;

So let's take a look at the base conversion features Forth offers.

&lt;pre&gt;
0&gt; decimal
OK
0&gt; 63 19 - dup .
44 OK
1&gt; hex .
2c OK
&lt;/pre&gt;

The code above switches the default number base to decimal. Then the (decimal) numbers 63 and 19 are placed on the stack and a subtraction (63 - 19) is performed. What ends up on the stack is the result of the math operation. We duplicate the item (basically saving a copy for later use) and then pop and display the top value. The result is 44, i.e. the result of the subtraction when calculating with decimal numbers.
&lt;br /&gt;
Now we're switching the number base to hexadecimal again, and display the stack's topmost value (we saved the calculation result before). The result is 2c, i.e. 44 displayed as a hexadecimal number.

&lt;br /&gt;&lt;br /&gt;

Next up, logical operations. A left shift is defined as

&lt;pre&gt;
lshift (value count -- value)
&lt;/pre&gt;

meaning you place &lt;i&gt;value&lt;/i&gt; on the stack, place the amount of bits you want it to be shifted (&lt;i&gt;count&lt;/i&gt;) on the stack and when the &lt;i&gt;lshift&lt;/i&gt; word returns, the shifted value will be on the stack. So take a look at this:

&lt;pre&gt;
o&gt; decimal 63 19 - hex
OK
1&gt; 1 swap lshift
OK
1&gt; dup .
100000000000  OK
&lt;/pre&gt;

The first line is the subtraction explained above. Then, we push a 1 on the stack and &lt;i&gt;swap&lt;/i&gt; the two top most items. The stack now looks like ( 1 2c ) which we'll feed the &lt;i&gt;lshift&lt;/i&gt; operator. We &lt;i&gt;dup&lt;/i&gt;licate the result and display one copy. And there's bitmask, where the 44th bit is set.

&lt;br /&gt;&lt;br /&gt;

Going further to the more firmware specific parts. The Open Firmware implementation I'm using right now offers a word that let's me read the boot processor's HID0 register. The word is &lt;i&gt;hid0@&lt;/i&gt;, it takes no input and places the register's value on the stack. Similarily, there's a word that let's me write the register, it's &lt;i&gt;hid0!&lt;/i&gt;. It takes one argument from the stack and doesn't place anything on the stack.
 
&lt;br /&gt;

So take the next sequence. I'm assuming it's executed right after the previously quoted sequence, so the calculated bitmask should be on the stack.

&lt;pre&gt;
1&gt;hid0@
OK
2&gt; dup .
100080000000 OK
2&gt; or dup .
100080000000 OK
1&gt;hid0!
OK
0&gt;
&lt;/pre&gt;
1&gt; 

First, we read the HID0's value and display it in a non-destructive manner. Then we &lt;i&gt;or&lt;/i&gt; the bitmask and the register value and display it's result. Note that the result is the same, meaning the 44th bit was already set. Then, we write the value back to the register.

&lt;br /&gt;&lt;br /&gt;

This is just an example of the power of Open Firmware. I'm going to play some other tricks right now, but I wanted this to be written down first so I can look it up again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1343570448754506219?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1343570448754506219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1343570448754506219' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1343570448754506219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1343570448754506219'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/why-open-firmware-is-pretty-neat.html' title='Why Open Firmware is pretty neat'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1201280475339990340</id><published>2008-05-19T21:09:00.007+02:00</published><updated>2008-05-19T22:14:10.421+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>The TianoCore Contributor's Agreement</title><content type='html'>So, I finally found some time to crawl through the &lt;a href="https://www.tianocore.org/contributor_agreement.html"&gt;TianoCore project's Contributor's Agreement&lt;/a&gt;. Here's what I think it means.

&lt;br /&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;i&gt;Preample:&lt;/i&gt; So Intel has decided to release some code under what it calls the &lt;a href="http://opensource.org/licenses/bsd-license.php"&gt;&amp;quot;BSD license&amp;quot;&lt;/a&gt;. Personally, I have think the BSD license is &lt;a href="http://www.freebsd.org/cgi/cvsweb.cgi/src/COPYRIGHT?rev=1.6.2.2.2.1;content-type=text%2Fx-cvsweb-markup"&gt;something&lt;/a&gt; &lt;a href="http://www.netbsd.org/about/redistribution.html"&gt;else&lt;/a&gt; or maybe even something like &lt;a href="http://www.openbsd.org/cgi-bin/cvsweb/src/share/misc/license.template?rev=1.2&amp;content-type=text/x-cvsweb-markup"&gt;this&lt;/a&gt;. I don't think a link to an incomplete license stub is enough, though. But enough of the ranting.
&lt;br /&gt;
Just to be clear here, I think it is safe to assume that Intel released their code under the following license (note that it's just the stub they provide a link to, filled in with some meaningful values):

&lt;pre&gt;
Copyright (c) 2006-2008, Intel Corp.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

* Neither the name of Intel Corp. nor the names of its contributors may be
  used to endorse or promote products derived from this software without
  specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
&lt;/pre&gt;

In addition to their own code which they release under the &amp;quot;BSD license&amp;quot;, there is some code in the TianoCore tree that is released under other licenses. Specifically the FAT32 code, which is apparently covered by some patents. If other licenses apply, and that's the key point here, the license is either in the source files themselves or packaged with the source files.
&lt;/li&gt;

&lt;li&gt;&lt;i&gt;Definitions:&lt;/i&gt; I'm a &lt;u&gt;&amp;quot;contributor&amp;quot;&lt;/u&gt; if I hold the copyright on some code that I contribute to the TianoCore project. If I represent a company, all my employees are considered part of my company and not separate contributors. A &lt;u&gt;&amp;quot;contribution&amp;quot;&lt;/u&gt; is anything I sent to the TianoCore project, e.g. via mail, snail mail, telephone, etc. as long as I don't explicitly mark it as &amp;quot;not a contribution&amp;quot;.
&lt;/li&gt;

&lt;li&gt;&lt;i&gt;License for Contributions:&lt;/i&gt; So when I decide to contribute something to the TianoCore project, I automatically agree to provide it under a license. That can be found in the contributor's agreement. The bullet points a) and b) are pretty clear: The permisssion to use and redistribute my contributions, provided that the three conditions laid out in the &amp;quot;BSD license&amp;quot; quoted above are met.

&lt;br /&gt;
The next bullet point, c), is somewhat harder to understand. I interpret is as: If I hold a patent on something, and my contribution infringes that patent, I automatically grant a patent license. I grant it to everybody, who wants to exercise his rights I granted him with the copyrigth license mentioned above. However, here's the catch: That patent license applies only to my unmodified contribution.

&lt;br /&gt;
I'm not sure what to think about that. I think, Intel is trying to protect their own patents. So if they release some code to the TianoCore project which is covered by a patent they own, the only grant a minimum patent license. What remains unclear is whether the patent license is still valid, even if I modify their code as permitted by the copyright license they granted.

&lt;br /&gt;
The last bullet point, d), is an easy one again. It's simply the &amp;quot;provided 'as is'&amp;quot; part in the copyright license cited above.
&lt;/li&gt;

&lt;li&gt;&lt;i&gt;Representations:&lt;/i&gt; By signing the agreement, I promise that I created the code myself. If my employer does have any rights, I promise that it explicitly permitted me to contribute my code.
&lt;/li&gt;

&lt;li&gt;&lt;i&gt;Third Party Contributions:&lt;/i&gt; If I chose to contribute third party code, I need to explicitly mark it as such. It also must be separate from my own contributions.
&lt;/li&gt;

&lt;li&gt;&lt;i&gt;Miscellaneous.&lt;/i&gt; The agreement is in English and translation are not authorative. If I want to take the whole thing to court, I need to to it in Delaware (US).
&lt;/li&gt;
&lt;/ul&gt;

So what's the conclusion here? I think Intel is pretty open about releasing their code. However, they are not so open about creating an open source project around their code. What I mean is that there are quite some legal hurdles one has to pass when contributing code to the TianoCore project. In effect, they force the BSD license on any code I contribute and I think that's OK. On the other hand, however, they prevent me from forking the project by introducing that stupid patent clause since I have no easy way of checking whether a specific piece of code infringes one of their patents.
&lt;br /&gt;
I really wonder if they only want to protect themselves from getting sued over some code contributed the project from non-Intel employees. Or are they really trying to create an impression of an Open Source project when it's really not?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1201280475339990340?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1201280475339990340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1201280475339990340' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1201280475339990340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1201280475339990340'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/tianocore-contributors-agreement.html' title='The TianoCore Contributor&apos;s Agreement'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-4828230583290825122</id><published>2008-05-17T18:11:00.002+02:00</published><updated>2008-05-17T18:20:10.150+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Parallels'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>What to do when Parallels brings the System to a halt</title><content type='html'>I don't know when this started, but recently whenever I try to start Parallels (which admittedly doesn't happen very often), my whole System comes down to a halt. Well, not completely, the system is still running, but it won't even let me switch between applications in a responsive manner. Even the mouse movement isn't smooth anymore.

&lt;br /&gt;&lt;br /&gt;
Note that this is with Parallels 2 on Mac OS X 10.5. The system is a first generation Mac Pro w/ two 2.66 GHz Core 2 CPUs and 3 GBytes of RAM. So the system could use a little more RAM, but apart from that it shouldn't have any issues running Parallels. And in fact, things used to work just fine.

&lt;br /&gt;&lt;br /&gt;

Anyways, here's a workaround I've discovered today:

&lt;pre&gt;
$ sudo /Library/StartupItems/Parallels/Parallels stop
$ sudo /Library/StartupItems/Parallels/Parallels start
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-4828230583290825122?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/4828230583290825122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=4828230583290825122' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4828230583290825122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4828230583290825122'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/what-to-do-when-parallels-brings-system.html' title='What to do when Parallels brings the System to a halt'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-3844570440291722942</id><published>2008-05-13T18:44:00.002+02:00</published><updated>2008-05-13T18:49:53.313+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>Porting TianoCore to a new platform, part 2</title><content type='html'>So it took me exactly one day to start the TianoCore DXE Core on a new platform. Of course, this doesn't count the roughly 10 weeks it took me to understand how the TianoCore Codebase works ;-) Also, it took me a fair amount of work to fix one thing or the other.

&lt;br /&gt;&lt;br /&gt;

Anyways, I wanted to take a note that the generic memory test module included in the TianoCore Codebase is nowhere near &amp;quot;quick&amp;quot;, despite the fact that it has a mode called &lt;i&gt;QuickMode&lt;/i&gt;, when you attempt to throw it at a 8 GByte memory range.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-3844570440291722942?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/3844570440291722942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=3844570440291722942' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3844570440291722942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3844570440291722942'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/porting-tianocore-to-new-platform-part.html' title='Porting TianoCore to a new platform, part 2'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1049752816511067117</id><published>2008-05-13T10:29:00.002+02:00</published><updated>2008-05-13T10:32:05.839+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>Reminder about porting TianoCore to a new Platform</title><content type='html'>Just a quick note to remind myself that when porting the TianoCore stack to a new platform, the PEI needs an implementation of the PEI_LOAD_FILE_PPI before it can load any PEIMs from the FV.

&lt;br /&gt;&lt;br /&gt;

For the platforms I have worked with so far, the PPI was implemented in the SEC.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1049752816511067117?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1049752816511067117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1049752816511067117' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1049752816511067117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1049752816511067117'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/reminder-about-porting-tianocore-to-new.html' title='Reminder about porting TianoCore to a new Platform'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-439839216431341830</id><published>2008-05-11T01:52:00.005+02:00</published><updated>2008-07-11T00:11:04.842+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>The beauty of security extensions</title><content type='html'>I just spent a good day debugging a problem that eventually turned out to be (most likely) caused by some Linux security extensions deployed on the machine I test my code on.

&lt;br /&gt;&lt;br /&gt;

The code loads an ELF image at runtime and then transfers control to it. Previously, I have worked with 32-Bit PowerPC executables that I ran on a 64-Bit PowerPC host. I recently changed this so that my code (as well as the ELF images it loads) would be a 64-Bit PowerPC executables.

&lt;br /&gt;&lt;br /&gt;


In order to obtain memory where the ELF image could be loaded into, I previously used the malloc(3) call. I didn't want to use mmap(2) since I was going to port the code to an environment where mmap(2) would not be available. That worked fine in the 32-Bit case.

&lt;br /&gt;&lt;br /&gt;


Anyways, it turns out that, in the 64-Bit case, trying to execute code in a malloc(3)-ed buffer instantly results in a segmentation fault. Using a mmap(2)-ed buffer (with the PROT_EXEC flag) fixes the issue.

&lt;br /&gt;&lt;br /&gt;

I would still like to know why there is a difference between the 32-Bit and the 64-Bit case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-439839216431341830?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/439839216431341830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=439839216431341830' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/439839216431341830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/439839216431341830'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/beauty-of-security-extensions.html' title='The beauty of security extensions'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-7800105900590380333</id><published>2008-05-08T09:30:00.004+02:00</published><updated>2008-05-08T09:41:33.250+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='e2fsprogs'/><title type='text'>Building e2fsprogs shared libraries</title><content type='html'>I found myself in need to build the e2fsprogs package (again) and found out that it doesn't build shared libraries by default. However, I need shared libraries, so this is what it takes to build the package:

&lt;pre&gt;
$ ./configure --prefix=/opt --enable-elf-shlibs
$ make
$ make install
$ make install-libraries
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-7800105900590380333?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/7800105900590380333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=7800105900590380333' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7800105900590380333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/7800105900590380333'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/building-e2fsprogs-shared-libraries.html' title='Building e2fsprogs shared libraries'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-4473030204219522033</id><published>2008-05-07T15:40:00.006+02:00</published><updated>2008-07-11T00:11:25.017+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Open Firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='SLOF'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>Open Source SLOF</title><content type='html'>I just tried to download and build the SLOF open source release. The SLOF release itself can be downloaded &lt;a href="http://www.ibm.com/developerworks/power/pa-slof/"&gt;here&lt;/a&gt; (note that an IBM ID, aka registration, is required). Let me just say that is has been a very pleasant experience - everything worked out of the box!

&lt;br /&gt;&lt;br /&gt;

The release tar ball contains a file &lt;i&gt;INSTALL&lt;/i&gt; with pretty good instructions on what needs to be done to compile the code. What's missing is a link to the required &lt;a href="http://www.ibm.com/developerworks/power/pa-slof-js20/?S_TACT=105AGX16&amp;S_CMP=DWPA"&gt;JS20/JS21/Bimini System-Interface Code&lt;/a&gt;. It's on the SLOF download page but it took me a moment to realize it's there.

&lt;br /&gt;&lt;br /&gt;

Once the system interface code has been downloaded and extracted, run the &lt;i&gt;install-oco.sh&lt;/i&gt; script that's included in the tar ball. It takes one parameter, the path to the extracted SLOF source code.

&lt;br /&gt;&lt;br /&gt;

Also, the x86emu code needs to be pulled from the coreboot subversion repository. Execute the &lt;i&gt;x86emu_download.sh&lt;/i&gt; script in &lt;i&gt;other-licence/x86emu/&lt;/i&gt; and it will do that for you.

&lt;br /&gt;&lt;br /&gt;

Finally, export the CROSS environment variable. In my case I had to set it to &amp;quot;ppu-&amp;quot; by running

&lt;pre&gt;
export CROSS=ppu-
&lt;/pre&gt;

Then, just run this command to compile the code:

&lt;pre&gt;
make js2x
&lt;/pre&gt;

Almost all of the information above is included in the &lt;i&gt;INSTALL&lt;/i&gt; file with the exception of the missing link. Again, this is a very pleasant surprise to me. There are other vendors where Open Source does not work so flawlessly. Hey there, Intel ;-).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-4473030204219522033?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/4473030204219522033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=4473030204219522033' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4473030204219522033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4473030204219522033'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/05/open-source-slof.html' title='Open Source SLOF'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2332143647376328772</id><published>2008-04-20T18:06:00.002+02:00</published><updated>2008-04-20T18:09:09.006+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Fedora Core'/><category scheme='http://www.blogger.com/atom/ns#' term='iptables'/><title type='text'>Fedora Firewall Management 101</title><content type='html'>On Fedora Core, the iptables rules are stored in &lt;i&gt;/etc/sysconfig/iptables&lt;/i&gt;. To change the rules, the &lt;i&gt;iptables(8)&lt;/i&gt; utility is used. When done, store the updated rules in &lt;i&gt;/etc/sysconfig/iptables&lt;/i&gt; by running the following as root:

&lt;pre&gt;
# /sbin/iptables-save &gt; /etc/sysconfig/iptables
&lt;/pre&gt;

I'm sure I'll need this again, and I'm sure I'll have forgotten all of it by then.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2332143647376328772?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2332143647376328772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2332143647376328772' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2332143647376328772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2332143647376328772'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/04/fedora-firewall-management-101.html' title='Fedora Firewall Management 101'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1516299921910081935</id><published>2008-04-17T13:41:00.004+02:00</published><updated>2008-04-17T13:45:49.614+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gdb'/><title type='text'>D'oh! Stepping over functions in gdb</title><content type='html'>I feel really dumb at the moment.

While debugging, I frequently find myself in need of a "step over function call" functionality. It has always bothered me that the gdb command "step" steps into functions, while I wasn't interested at all in what was happening inside the function. It turns out that gdb has the command I've always wanted, and it is:

&lt;pre&gt;
(gdb) next
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1516299921910081935?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1516299921910081935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1516299921910081935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1516299921910081935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1516299921910081935'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/04/doh-stepping-over-functions-in-gdb.html' title='D&apos;oh! Stepping over functions in gdb'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-4933851637355031767</id><published>2008-04-11T13:26:00.005+02:00</published><updated>2008-04-16T09:48:11.230+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gdb'/><title type='text'>The GNU Debugger (gdb) and Files loaded at Runtime</title><content type='html'>I'm working on a project where one program loads an ELF file at runtime and then transfers control to that dynamically loaded file. The file will be loaded at an address obtained by malloc(3), so the address will be arbitrary (from a user perspective).

&lt;br /&gt;&lt;br /&gt;

Normally, if a crash occurs while a program is being run under a debugger, the debugger automatically shows you where in the source code the crash occurred. This works only if the debugged program includes debug information. That debug information is stored in the executable file itself. It is ignored by the operating system, but the debugger can use it to resolve addresses to symbols, i.e. to variable and function names.

&lt;br /&gt;&lt;br /&gt;

In my case, if a crash is caused by the dynamically loaded file, then all I see is the register contents and maybe a plain stack trace. That's because the debugger does not know where to find the debug information. Seeing the addresses is useful as it can be used to look up the problematic instruction with objdump. However, debugging would be a lot easier if the addresses could be automatically resolved to symbols by the debugger.

&lt;br /&gt;&lt;br /&gt;

The GNU Debugger (gdb), my debugger of choice, has a &lt;i&gt;add-symbol-file&lt;/i&gt; command that instructs the debugger to load symbol information from a file on disk. This command can be issued before the program to be debugged is started, while it's running or even after it has crashed. There are two parameters required by the command. The first one will tell it where to load the debug information from, i.e. the path to the ELF file on disk. The other one will tell it at what address the ELF .text section of the ELF file has been loaded. So the syntax is:

&lt;pre&gt;
(gdb) add-symbol-file file.elf &amp;lt;address&amp;gt;
&lt;/pre&gt;

For my project, I'm expecting frequent crashes in the dynamically loaded program. So in order to make debugging less time consuming, I created a little &lt;i&gt;.gdbinit&lt;/i&gt; file in my home directory that does these things:

&lt;ul&gt;
&lt;li&gt;Tell gdb which program is being debugged. This is the program that will load another one at runtime.&lt;/li&gt;
&lt;li&gt;Set a breakpoint in that first stage program. The breakpoint needs to be somewhere where the address of the .text section of the dynamically loaded file can be determined.&lt;/li&gt;
&lt;li&gt;Then start the program.&lt;/li&gt;
&lt;li&gt;When the breakpoint is hit, print the address of the .text section of the dynamically loaded ELF file.&lt;/li&gt;
&lt;/ul&gt;

My &lt;i&gt;.gdbinit&lt;/i&gt; file that does the above looks like this:

&lt;pre&gt;
file primary_stage
break jump_to_second_stage
run
p/x entry_point
&lt;/pre&gt;

Now anytime the debugger is started, it will automatically load the primary stage ELF file, set a breakpoint and start the program. As soon as the breakpoint is hit, the address of the .text section will be printed. Since that's the first print instruction in the debug session, it can now be accessed through the use of a placeholder: $1.

&lt;br /&gt;&lt;br /&gt;

&lt;strike&gt;
Unfortunately, automatically loading the second stage ELF program from the &lt;i&gt;.gdbinit&lt;/i&gt; file does not work. So I then need to manually enter this command:

&lt;pre&gt;
(gdb) add-symbol-file second_stage $1
&lt;/pre&gt;
&lt;/strike&gt;

Well, it turns out that you can add the above command to the &lt;i&gt;.gdbinit&lt;/i&gt; and it will work just fine. I have no idea why that did not work the last time I tried it.

Now, a crash in the second_stage program will be reported with full symbol information available to the debugger.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-4933851637355031767?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/4933851637355031767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=4933851637355031767' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4933851637355031767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4933851637355031767'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/04/gnu-debugger-gdb-and-files-loaded-at.html' title='The GNU Debugger (gdb) and Files loaded at Runtime'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6578104777677886763</id><published>2008-04-04T21:35:00.008+02:00</published><updated>2008-04-04T22:11:03.130+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='named'/><category scheme='http://www.blogger.com/atom/ns#' term='dhcpd'/><title type='text'>DHCP, DNS and dynamic updates</title><content type='html'>Today I updated my router, a Soekris net4801 (I think), to OpenBSD 4.2. I know it's dumb to upgrade to OpenBSD 4.2 about three weeks before OpenBSD 4.3 is officially released, but today I actually had time and the box was in desperate need of an update. Also, I have recently moved and the network changed. I used to have a designated server running FreeBSD that also handled DNS and DHCP. When I moved, I shut the server down, and so for the last few weeks I had only very basic DHCP services running and no local DNS at all. Anyways, to make the long story short, I needed a DNS server that would resolve local names as well as a DHCP server that does dynamic DNS upates.

&lt;br /&gt;&lt;br /&gt;

First, I installed OpenBSD 4.2 by netbooting the Soekris box from another OpenBSD "box" running inside Parallels. The instructions for that can be found in the &lt;a href="http://www.openbsd.org/faq/faq6.html#PXE"&gt;OpenBSD FAQ&lt;/a&gt;. There is one thing to remember, though: The Soekris doesn't have a VGA console but only serial, so the PXE-booted kernel needs to be told that it should only use the serial console for output. So the &lt;i&gt;boot.conf&lt;/i&gt; file the FAQ mentions needs to look like this:

&lt;pre&gt;
set tty com0
set stty 9600
boot bsd.rd
&lt;/pre&gt;

Now on to the DHCP and DNS installation. The DHCP server included with OpenBSD will not do dynamic DNS updates, so the ISC DHCP Server is needed. It can be installed by running (as root):

&lt;pre&gt;
# ftp ftp://ftp.de.openbsd.org/pub/OpenBSD/4.2/packages/i386/isc-dhcp-server-3.0.4p0.tgz
# pkg_add -v isc-dhcp-server-3.0.4p0.tgz
&lt;/pre&gt;

The dhcpd binary will be installed in &lt;i&gt;/usr/local/sbin&lt;/i&gt;. Be aware that the base dhcpd included in OpenBSD lives in &lt;i&gt;/usr/sbin&lt;/i&gt;, so simply typing "dhcpd" at the command line will most certainly start the OpenBSD DHCP Server! In order to automatically start the DHCP server on boot, these lines need to be added to &lt;i&gt;/etc/rc.local&lt;/i&gt;:

&lt;pre&gt;
if [ -x /usr/local/sbin/dhcpd ] ; then
        echo -n ' dhcpd' ; /usr/local/sbin/dhcpd
fi
&lt;/pre&gt;

Next, before the Server can be fully configured, a key that will be shared between DHCP and DNS server needs to be created:

&lt;pre&gt;
$ dnssec-keygen -a HMAC-MD5 -b 128 -n USER &amp;lt;name&amp;gt;
&lt;/pre&gt;

This command generates to files in the current working directory. The file with the extension &lt;i&gt;*.private&lt;/i&gt; will include the key required later. Wherever the configuration files include a "secret" statement, that value needs to be inserted. The parameter &lt;i&gt;&amp;lt;name&amp;gt;&lt;/i&gt; determines the name of the key. This will be used later, but I don't know if the name actually has to be reused. For the rest of this posting, we'll use &lt;i&gt;key_name&lt;/i&gt; to represent the generated key's name.

&lt;br /&gt;&lt;br /&gt;

So now on to the DHCP Server configuration. My &lt;i&gt;/etc/dhcpd.conf&lt;/i&gt; now looks like this:

&lt;pre&gt;
option  domain-name "local.deadc0.de";

ddns-update-style ad-hoc;

key key_name {
        algorithm       hmac-md5;
        secret          "...";
}

zone local.deadc0.de. {
        primary 127.0.0.1;
        key key_name;
}

zone 1.168.192.in-addr.arpa. {
        primary 127.0.0.1;
        key key_name;
}

zone 2.168.192.in-addr.arpa. {
        primary 127.0.0.1;
        key key_name;
}

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.1 192.168.1.127;
        
        option domain-name-servers 192.168.1.254;
        option routers 192.168.1.254;
}
        
subnet 192.168.2.0 netmask 255.255.255.0 {
        range 192.168.2.1 192.168.2.127;

        option domain-name-servers 192.168.2.254;
        option routers 192.168.2.254;
}
&lt;/pre&gt;

Now that the DHCP server is configured, the DNS server needs configuration. In OpenBSD, the DNS Server is BIND, but it's started in a chroot environment, so its configuration files live under &lt;i&gt;/var/named&lt;/i&gt;. The server configuration file is &lt;i&gt;/var/named/etc/named.conf&lt;/i&gt; and looks like this on my system:

&lt;pre&gt;
include "etc/rndc.key";

controls {
        inet 127.0.0.1 allow {
                localhost;
        } keys {
                key_name;
        };
};

acl clients {
        localnets;
        ::1;
};

options {
        listen-on    { any; };
        listen-on-v6 { any; };

        allow-recursion { clients; };
};

// Standard zones ommited.

zone "local.deadc0.de" {
        type master;
        file "master/local.deadc0.de";
        
        allow-update {
                key     "key_name";
        };
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "master/1.168.192.in-addr.arpa";

        allow-update {
                key     "key_name";
        };
};

zone "2.168.192.in-addr.arpa" {
        type master;
        file "master/2.168.192.in-addr.arpa";

        allow-update {
                key     "key_name";
        };
};
&lt;/pre&gt;

The actual zone files will not be posted, they are just standard zone declarations, nothing special. However, notice the include statement at top of the file. It includes the key declaration file &lt;i&gt;/var/named/etc/rndc.key&lt;/i&gt; that looks like this:

&lt;pre&gt;
key key_name {
        algorithm hmac-md5;
        secret "...";
};
&lt;/pre&gt;

In order to supress some warning when the DNS server starts, the file &lt;i&gt;/var/named/etc/rndc.conf&lt;/i&gt; needs to be created. It should look like this:

&lt;pre&gt;
options {
        default-server  localhost;
        default-key     "key_name";
};

server localhost {
        key     "key_name";
};

include "rndc.key";
&lt;/pre&gt;

Finally, everything under &lt;i&gt;/var/named/etc&lt;/i&gt; and &lt;i&gt;/var/named/master&lt;/i&gt; needs to be owned by the user "named", so as root run this:

&lt;pre&gt;
# chown -R named:named /var/named/etc
# chown -R named:named /var/named/master
&lt;/pre&gt;

Now make sure that the DNS server is enabled by including this line in &lt;i&gt;/etc/rc.conf.local&lt;/i&gt;:

&lt;pre&gt;
named_flags=""
&lt;/pre&gt;

Then reboot the box and that should be it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6578104777677886763?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6578104777677886763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6578104777677886763' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6578104777677886763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6578104777677886763'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/04/dhcp-dns-and-dynamic-updates.html' title='DHCP, DNS and dynamic updates'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6044276704513784557</id><published>2008-03-12T09:14:00.004+01:00</published><updated>2008-07-07T16:06:29.122+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Binutils'/><category scheme='http://www.blogger.com/atom/ns#' term='GCC'/><title type='text'>Embedding binary BLOBs into an ELF file</title><content type='html'>I needed this yesterday, found &lt;a href="http://burtonini.com/blog/computers/ld-blobs-2007-07-13-15-50"&gt;a link describing it&lt;/a&gt; - and forgot it by today :-(

&lt;br /&gt;&lt;br /&gt;

For a project I'm working on, I need to embed a file into an ELF executable. The executable then needs to do things with the embedded file, i.e. it has to know where in memory the file resides and how large it is.

&lt;br /&gt;&lt;br /&gt;

So here it goes, largely copied from the link mentioned above.

&lt;ul&gt;
&lt;li&gt;Create an object file from the binary blob:
&lt;pre&gt;$ ld -r -b binary -o example.o example.bin&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;In the sources, declare the symbols:
&lt;pre&gt;
extern char _binary_example_bin_start[];
extern char _binary_example_bin_end[];
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Make sure the object file is linked with the other sources:
&lt;pre&gt;
$ gcc -o example example.c example.o
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6044276704513784557?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6044276704513784557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6044276704513784557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6044276704513784557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6044276704513784557'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/03/embedding-binary-blobs-into-elf-file.html' title='Embedding binary BLOBs into an ELF file'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6361853166166586559</id><published>2008-03-11T13:36:00.008+01:00</published><updated>2008-03-11T13:45:26.578+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='QEMU'/><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore on QEMU</title><content type='html'>There is a &lt;i&gt;bios.bin&lt;/i&gt; binary file for use with QEMU available at &lt;a href="http://fabrice.bellard.free.fr/qemu/efi-bios.tar.bz2"&gt;http://fabrice.bellard.free.fr/qemu/efi-bios.tar.bz2&lt;/a&gt;. It is meant to be used as a BIOS replacement for QEMU and provides an EFI interface. It is compiled from the TianoCore sources, at least that's what the QEMU homepage suggests.

&lt;br /&gt;&lt;br /&gt;

The problem with this file is that it can only be used with very few versions of QEMU, that's why I'm writing this.


&lt;br /&gt;&lt;br /&gt;

I've had success with version 0.9.0 when the patches linked from the &lt;a href="http://www.coreboot.org/QEMU_Build_Tutorial#Building_Qemu"&gt;coreboot wiki&lt;/a&gt; were applied. I've also had success with a CVS snapshot from July 3rd, 2007. Version 0.9.1 or the stock 0.9.0 do not work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6361853166166586559?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6361853166166586559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6361853166166586559' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6361853166166586559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6361853166166586559'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/03/tianocore-on-qemu.html' title='TianoCore on QEMU'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8210609512874870902</id><published>2008-03-11T13:09:00.007+01:00</published><updated>2008-03-11T14:05:38.082+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='QEMU'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>QEMU and kqemu on IBM's OpenClient</title><content type='html'>Today I wanted to try QEMU on IBM's OpenClient Linux distribution. Unfortunately, I was unable to install a binary package through yum because the default package repositories don't provide one. So I ended up installing QEMU from the sources.

&lt;br /&gt;&lt;br /&gt;

Getting the sources is easy. To fetch the latest sources (i.e. CVS HEAD), just run:

&lt;pre&gt;
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/qemu \
 co qemu
&lt;/pre&gt;

In my case, I wanted version QEMU version 0.9.1, so I did this:

&lt;pre&gt;
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/qemu \
 co -rrelease_0_9_1 qemu
&lt;/pre&gt;

Building the sources is trivial as well. The usual three step process (configure, make, make install) works like a charm. If PREFIX isn't set, QEMU installs in &lt;i&gt;/usr/local&lt;/i&gt;, but I want it in &lt;i&gt;/opt&lt;/i&gt;. So here's what I did:

&lt;pre&gt;
$ ./configure --prefix=/opt
$ make
$ sudo make install
&lt;/pre&gt;

Now I had a bunch of QEMU executables in &lt;i&gt;/opt/bin&lt;/i&gt;, each one for a different architecture. But I wanted kqemu, the kernel accellerator for QEMU, as well. Through the QEMU home page, I found &lt;a href="http://atrpms.net/dist/el5/kqemu/"&gt;this site&lt;/a&gt; which provides kqemu RPMs for RHEL and Fedora.

&lt;br /&gt;&lt;br /&gt;

For the IBM OpenClient distribution, I had to do this:

&lt;pre&gt;
$ wget http://dl.atrpms.net/all/kqemu-1.3.0-2.el5.i386.rpm
$ wget http://dl.atrpms.net/all/kqemu-kmdl-2.6.18-53.1.13.el5-1.3.0-2.el5.i686.rpm
$ sudo rpm -iv kqemu-1.3.0-2.el5.i386.rpm kqemu-kmdl-2.6.18-53.1.13.el5-1.3.0-2.el5.i686.rpm
&lt;/pre&gt;

In case the links to the RPMs are truncated, there is a &lt;a href="http://dl.atrpms.net/all/kqemu-1.3.0-2.el5.i386.rpm"&gt;kqemu RPM&lt;/a&gt; and a &lt;a href="http://dl.atrpms.net/all/kqemu-kmdl-2.6.18-53.1.13.el5-1.3.0-2.el5.i686.rpm"&gt;kqemu-kmdl RPM&lt;/a&gt;.

&lt;br /&gt;&lt;br /&gt;

Finally, in order to actually load the kernel module, I did this:

&lt;pre&gt;
$ sudo modprobe kqemu
&lt;/pre&gt;

Everything described here is pretty straight forward, but I wanted to make sure I document the installation of the kqemu module somwhere, hence this post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8210609512874870902?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8210609512874870902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8210609512874870902' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8210609512874870902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8210609512874870902'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/03/qemu-and-kqemu-on-ibms-openclient.html' title='QEMU and kqemu on IBM&apos;s OpenClient'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5994928215030441176</id><published>2008-03-07T14:11:00.006+01:00</published><updated>2008-07-11T00:10:45.104+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Binutils'/><category scheme='http://www.blogger.com/atom/ns#' term='Cell SDK'/><category scheme='http://www.blogger.com/atom/ns#' term='GCC'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerPC'/><title type='text'>Cell SDK 3.0 on IBM's OpenClient Distribution</title><content type='html'>Today I was finally able to build a simple HelloWorld-Application with and within the TianoCore build environment. This is good news, as it leads me to the next task: Building the same HelloWorld-Application, but this time for Linux on 64-Bit PowerPC.

&lt;br /&gt;&lt;br /&gt;

Since I do not yet have access to a 64-Bit PowerPC machine running Linux, I'm going to use the Cell SDK 3.0 for now. It can be used from an i386 machine and includes a toolchain as well as the full system simulator. The toolchain includes a cross-compiler that is cabable of producing binaries for the Cell BE's PPU, which is essentially a 64-Bit PowerPC processor. The system simulator simulates a Linux-installation running on Cell.

&lt;br /&gt;&lt;br /&gt;

I'm still on IBM's OpenClient Linux distribution, which is apparently based on RHEL 5.1, at least according to &lt;i&gt;/etc/redhat-release&lt;/i&gt;

&lt;pre&gt;
Red Hat Enterprise Linux Client release 5.1 (Tikanga)
&lt;/pre&gt;

This is good on one hand, but made things slightly more complicated on the other hand. But first things first. Here's what I did to prepare the Cell SDK installation:

&lt;ul&gt;
&lt;li&gt;I went to the &lt;a href="http://www.ibm.com/developerworks/power/cell/pkgdownloads.html"&gt;developerWorks download page&lt;/a&gt; for the Cell SDK 3.0 and downloaded the RHEL 5.1 packages.&lt;/li&gt;
&lt;li&gt;I had to download the &amp;quot;basic libraries and headers for cross-compiling to Cell Broadband Engine's PPU&amp;quot;, both the &lt;a href="http://www.bsc.es/projects/deepcomputing/linuxoncell/cellsimulator/sdk3.0/CellSDK-Open-Fedora/x86/ppu-sysroot-f7-2.noarch.rpm"&gt;32-Bit version&lt;/a&gt; and the &lt;a href="http://www.bsc.es/projects/deepcomputing/linuxoncell/cellsimulator/sdk3.0/CellSDK-Open-Fedora/x86/ppu-sysroot64-f7-2.noarch.rpm"&gt;64-Bit version&lt;/a&gt;, from the &lt;a href="http://www.bsc.es/projects/deepcomputing/linuxoncell/"&gt;Barcelona Supercomputer Center&lt;/a&gt; (BSC). Note that I could have built those RPMs myself, but only if I had a few other required RPMs like e.g. a glibc for PowerPC. Apparently those required RPMs are provided on the RHEL installation CDs, however, I'm on IBM's OpenClient and thus do not have access to the installation CDs. The good thing is, the Fedora RPMs provided by the BSC turned out to work just fine.&lt;/li&gt;
&lt;li&gt;For the full system simulator, I had to download the &lt;a href="http://www.bsc.es/projects/deepcomputing/linuxoncell/cellsimulator/sdk3.0/CellSDK-Open-Fedora/cbea/sysroot_image-3.0-7.noarch.rpm"&gt;sysroot image&lt;/a&gt; from the BSC website.&lt;/li&gt;
&lt;/ul&gt;

So that's it for the preparation part, now to actually installing the SDK.

&lt;ul&gt;
&lt;li&gt;I installed the installer RPM like this:
&lt;pre&gt;# rpm -ivh cell-install-3.0.0-1.0.noarch.rpm&lt;/pre&gt;
This installs the installer to &lt;i&gt;/opt/cell&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;Now I needed to install the cross-compilation libraries and headers:
# rpm -ivh ppu-sysroot-f7-2.noarch.rpm
# rpm -ivh ppu-sysroot64-f7-2.noarch.rpm
&lt;/li&gt;
&lt;li&gt;Next I ran the installer as instructed by the installation manual:
# cd /opt/cell
# ./cellskd --iso /home/phs/Downloads install
&lt;/li&gt;
&lt;/ul&gt;

After successfully running the installer, I found a functioning cross-compiler in &lt;i&gt;/opt/cell/toolchain/bin&lt;/i&gt;.

&lt;br /&gt;&lt;br /&gt;

For the system simulator, I had to install the sysroot imae RPM like this:

&lt;pre&gt;# rpm -ivh sysroot_image-3.0-7.noarch.rpm&lt;/pre&gt;

Unfortunately, I wasn't able to make the system simulator work because of a missing dependency on a simulation library.
&lt;br /&gt;&lt;br /&gt;

By the way, there's also official documentation available &lt;a href="http://www.ibm.com/developerworks/power/cell/documents.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5994928215030441176?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5994928215030441176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5994928215030441176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5994928215030441176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5994928215030441176'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/03/cell-sdk-30-on-ibms-openclient.html' title='Cell SDK 3.0 on IBM&apos;s OpenClient Distribution'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-5596903359228650977</id><published>2008-03-06T15:14:00.007+01:00</published><updated>2008-05-23T02:12:31.567+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Setting up a Subversion Server</title><content type='html'>Ok, there's probably a million Blog posts, tutorials and HowTos on how to do this already. Yet I still find it hard to find short instructions on how to set up a subversion server quickly. I just had to do it again, and it took me longer than expected, so here it goes.

&lt;br /&gt;&lt;br /&gt;

My requirements are pretty basic:

&lt;ul&gt;
&lt;li&gt;WebDAV so I can access the repository over HTTP.&lt;/li&gt;
&lt;li&gt;I don't need too much security, so SSL won't be needed.&lt;/li&gt;
&lt;li&gt;I want SVN:Web, a web front end to the repositories.&lt;/li&gt;
&lt;/ul&gt;

Here's what I did for the Subversion+WebDAV part. Note that I'm currently on IBM's OpenClient Linux Distribution which is based on RedHat.

&lt;ul&gt;
&lt;li&gt;I made sure that the &lt;i&gt;httpd&lt;/i&gt; package is installed. I didn't have to install it, so I guess it's installed by default.&lt;/li&gt;
&lt;li&gt;I had to install the &lt;i&gt;mod_dav_svn&lt;/i&gt; package with yum:
&lt;pre&gt;$ sudo yum install mod_dav_svn&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;The package installs a config file at &lt;i&gt;/etc/httpd/conf.d/subversion.conf&lt;/i&gt;. By default, the &amp;lt;Location&amp;gt; tag is commented out. I just copied it, removed the comment signs and adjusted the values to my needs. This is what it now looks like:
&lt;pre&gt;
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

&amp;lt;Location /repos&amp;gt;
   DAV svn
   SVNParentPath /var/www/svn

   &amp;lt;LimitExcept GET PROPFIND OPTIONS REPORT&amp;gt;
      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /var/www/passwd
      Require valid-user
   &amp;lt;/LimitExcept&amp;gt;
&amp;lt;/Location&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;Now the Apache HTTP Server will serve the contents of &lt;i&gt;/var/www/svn&lt;/i&gt; via WebDAV (I think), but it will query for a valid user entry. The entry must be created as follows:
&lt;pre&gt;
# cd /var/www
# htpasswd -c passwd &amp;lt;username&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;Next, I created the direcories for the repositories. As root, I ran these commands:
&lt;pre&gt;
# cd /var/www
# mkdir svn
# cd svn
# svnadmin create &amp;lt;name of repository&amp;gt;
# chown -R apache:apache &amp;lt;name of repository&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;I then activated the HTTP service so the Apache Web Server would be started at boot time. I did this using a GUI tool called &lt;i&gt;system-config-services&lt;/i&gt;. I had to check the box next to the httpd entry. I didn't want to reboot right aways, so I clicked &lt;i&gt;Start&lt;/i&gt; in the toolbar. The tool told me that the service would now be running and I could verify this by going to &lt;a href="http://localhost/"&gt;http://localhost/&lt;/a&gt;. Testing the Subversion part was easy, too. Navigating to &lt;a href="http://localhost/repos/example"&gt;http://localhost/repos/example&lt;/a&gt; did the trick. Note that the actual repository name must be used instead of &amp;quot;example&amp;quot;.&lt;/li&gt;

&lt;li&gt;Oh, and I want at least minimal security. That is, I want the HTTP Server to serve pages only to the local machine. Therefore, I changed the &lt;i&gt;Listen&lt;/i&gt; directive in the server config uration file to this:
&lt;pre&gt;
Listen 127.0.0.1:80
&lt;/pre&gt;
&lt;/ul&gt;

The second part was installing the SVN::Web CGI Script. Here's what I did to do it.

&lt;ul&gt;
&lt;li&gt;First, I had to install the &lt;i&gt;subversion-perl&lt;/i&gt; package with yum. As root, I ran
&lt;pre&gt;# yum install subversion-perl&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Second, I installed the actuall SVN::Web script through CPAN. Again as root, I did
&lt;pre&gt;# cpan install SVN::Web&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;I then created a directory that would hold all the SVN::Web files:
&lt;pre&gt;
#cd /var/www
#mkdir svnweb
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;In that directory, I let the Perl script set itself up using default values:
&lt;pre&gt;
# cd /var/www/svnweb
# svnweb-install
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;The last step created a file called &lt;i&gt;config.yaml&lt;/i&gt;. It must be edited so the CGI script finds the repositories. Near the end, I edited the &lt;i&gt;reposparent&lt;/i&gt; value:
&lt;pre&gt;reposparent: '/var/www/svn'&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Now, as the final step, the script needs to be introduced to the Apache Server. I created a file &lt;i&gt;svnweb.conf&lt;/i&gt; in &lt;i&gt;/etc/httpd/conf.d&lt;/i&gt; with the following contents:
&lt;pre&gt;
Alias /svnweb /var/www/svnweb

AddHandler cgi-script .cgi

&amp;lt;Directory /var/www/svnweb&amp;gt;
        Options All ExecCGI
        DirectoryIndex index.cgi
&amp;lt;/Directory&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

After restarting the Apache HTTP Server, I could access &lt;a href="http://localhost/svnweb/"&gt;http://localhost/svnweb&lt;/a&gt; and see the repositories.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-5596903359228650977?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/5596903359228650977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=5596903359228650977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5596903359228650977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/5596903359228650977'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/03/setting-up-subversion-server.html' title='Setting up a Subversion Server'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1310219504049442737</id><published>2008-03-04T14:40:00.009+01:00</published><updated>2008-03-28T10:32:58.571+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore on IBM's OpenClient</title><content type='html'>I've started work at IBM yesterday. Today I found a room and got all my user accounts and passwords set up so I can actually start to work.

&lt;br /&gt;&lt;br /&gt;

I'm trying to build the TianoCore EDKII (SVN Revision 4792) on IBM's own Linux distribution, called OpenClient. The distribution sucks but it's the only kind of Linux we're allowed to use around here. It's based on Red Hat (I think), but it feels &amp;quot;different&amp;quot;.

&lt;br /&gt;&lt;br /&gt;

To bootstrap the TianoCore Build Environment, I sort of followed my &lt;a href="http://phisch.blogspot.com/2008/02/tianocore-on-freebsdamd64.html"&gt;FreeBSD&lt;/a&gt; and &lt;a href="http://phisch.blogspot.com/2008/02/tianocore-on-fredora-core-8.html"&gt;Fedora Core&lt;/a&gt; notes. Here's what I did:

&lt;br /&gt;&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Installed Java JDK 6 Update 4 (JDK 1.6.0_04) for Linux through the self-extracting binary file (not the RPM) that Sun &lt;a href="http://java.sun.com/javase/downloads/index.jsp"&gt;provides&lt;/a&gt;. I placed the JDK in /opt.&lt;/li&gt;

&lt;li&gt;Installed the binary distribution of Apache Ant 1.7.0, Saxon 8.1.1, XMLBeans 2.1.0 as well as ant-contrib 1.0b3 and placed all of them in /opt.&lt;/li&gt;

&lt;li&gt;Created the symlinks:
&lt;pre&gt;
$ cd /opt/apache-ant-1.7.0/lib
$ sudo ln -s /opt/ant-contrib/ant-contrib-1.0b3.jar ant-contrib.jar
$ sudo ln -sf /opt/saxonb8.1.1/saxon8.jar /opt/xmlbeans-2.1.0/lib/saxon8.jar
&lt;/pre&gt;
&lt;/li&gt; 
&lt;/ul&gt;

I then created a small script that automates the build tool bootstrapping process:

&lt;pre&gt;
export JAVA_HOME=/opt/jdk1.6.0_04
export XMLBEANS_HOME=/opt/xmlbeans-2.1.0
export ANT_HOME=/opt/apache-ant-1.7.0
export WORKSPACE=/home/phs/Sources/edk2
export PATH=$PATH:$XMLBEANS_HOME/bin:$ANT_HOME/bin
. edksetup.sh ForceRebuild
&lt;/pre&gt;

Sourcing the script successfully builds the build tools. Then, in the file $WORKSPACE/Tools/Conf/target.txt, two settings need to be adjusted:

&lt;pre&gt;
ACTIVE_PLATFORM=EdkUnixPkg/Unix.fpd
TOOL_CHAIN_TAG=ELFGCC
&lt;/pre&gt;

Of course, the &lt;a href="http://phisch.blogspot.com/2008/02/tianocore-on-fredora-core-8.html"&gt;previously mentioned patch&lt;/a&gt; needs to be applied. After that, the EDKII Unix Emulation Package can be built and run as described in the &lt;a href="http://www.cs.ucl.ac.uk/staff/t.schooley/dev_config.pdf"&gt;tutorial&lt;/a&gt;:

&lt;pre&gt;
$ cd $WORKSPACE/
$ build
$ cd Build/Unix
$ . run.cmd
&lt;/pre&gt;

I found that the IBM OpenClient distribution already includes the e2fsprogs-devel package as well as the relevant X11 development packages. Please also note that it is not neccessary to build an PE32+ cross compiler on Linux.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1310219504049442737?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1310219504049442737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1310219504049442737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1310219504049442737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1310219504049442737'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/03/tianocore-on-ibms-openclient.html' title='TianoCore on IBM&apos;s OpenClient'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-2724185858493779472</id><published>2008-02-07T14:06:00.001+01:00</published><updated>2008-03-04T14:07:30.238+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore on Fredora Core 8</title><content type='html'>My attempts building &lt;i&gt;anything&lt;/i&gt; of the TianoCore EDK2 codebase on FreeBSD/amd64 have been extremely frustrating so far. I guess trying to build on an unsupported operating system and on an unsupported architecture may have been too much of a hurdle for the beginning. So I figured I'd try building the EDK Unix Simulator (Trunk Revision 4679) on Fredora Core 8. Here's what I've done.

&lt;br /&gt;&lt;br /&gt;

I pretty much followed &lt;a href="http://www.cs.ucl.ac.uk/staff/t.schooley/dev_config.pdf"&gt;this tutorial&lt;/a&gt;. It's for Gentoo, so a little tweaking was needed.

&lt;br /&gt;&lt;br /&gt;

First, I downloaded and installed the JDK 6 from &lt;a href="http://java.sun.com/javase/downloads/index.jsp"&gt;SUN&lt;/a&gt; via the RPMs they provide. The JDK ends up in /usr/java/jdk1.6.0_04, so the JAVA_HOME environment variable needs to be set to that.

&lt;br /&gt;&lt;br /&gt;

Second, I didn't bother installing the needed (Java) tools through the Fedora Package Manager but instead downloaded the files manually and placed them under /opt. This is similar to what I did for my &lt;a href="http://phisch.blogspot.com/2008/02/tianocore-on-freebsdamd64.html"&gt;FreeBSD attempts&lt;/a&gt;. I needed two symlinks like the tutorial says:

&lt;pre&gt;
$ cd /opt/apache-ant-1.7.0/lib
$ sudo ln -s /opt/ant-contrib/ant-contrib-1.0b3.jar ant-contrib.jar
$ sudo ln -sf /opt/saxonb8.1.1/saxon8.jar /opt/xmlbeans-2.1.0/lib/saxon8.jar
&lt;/pre&gt;

Third, I needed to install the e2fsprogs-devel package. The e2fsprogs package (without the "-devel" suffix) isn't enough. Also, I had to install the X development packages. I don't know what exact package was needed, but the Fedora Core 8 package manager has this option that lets you install some pre-selected packages related to X development.

&lt;br /&gt;&lt;br /&gt;

Forth, I had to apply the following patch (the tutorial mentions this):

&lt;pre&gt;
Index: EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c
===================================================================
--- EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c (Revision 4679)
+++ EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c (Arbeitskopie)
@@ -21,7 +21,7 @@

 --*/

-#include "Pcibus.h"
+#include "pcibus.h"
 #include "PciHotPlugSupport.h"

 EFI_PCI_HOT_PLUG_INIT_PROTOCOL  *gPciHotPlugInit;
&lt;/pre&gt;

Finally, contrary to what the tutorial says, I used the following script to set up the environment. Note that I didn't include the TOOL_CHAIN line and that I didn't build the PE/COFF capable GCC.

&lt;pre&gt;
export JAVA_HOME=/usr/java/jdk1.6.0_04
export XMLBEANS_HOME=/opt/xmlbeans-2.1.0 
export ANT_HOME=/opt/apache-ant-1.7.0
export WORKSPACE=/home/phs/edk2/edk2
export PATH="$PATH:$XMLBEANS_HOME/bin:$ANT_HOME/bin" 
&lt;/pre&gt;

The build went smoothly after that and I was able to use the EDK Unix environment. Note that the thing should not be called "Unix" Package, since it heavily assumes that it runs on Linux in some areas.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-2724185858493779472?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/2724185858493779472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=2724185858493779472' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2724185858493779472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/2724185858493779472'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/02/tianocore-on-fredora-core-8.html' title='TianoCore on Fredora Core 8'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-6773504904619314754</id><published>2008-02-06T12:06:00.000+01:00</published><updated>2008-02-07T14:06:14.541+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore on FreeBSD/amd64, Take 2</title><content type='html'>Now that I have build a cross compiler, I'm trying to build the TianoCore EDK again.

&lt;br /&gt;&lt;br /&gt;

In &lt;a href="http://phisch.blogspot.com/2008/02/tianocore-on-freebsdamd64.html"&gt;this post&lt;/a&gt; I list a few environment variables that need to be set in order to build the EDK. Because the build process needs to use the cross compiler, another environment variable is needed:

&lt;pre&gt;
$ export CC=/opt/i386-tiano-pe/bin/gcc
&lt;/pre&gt;

Since I'm lazy and all, I put everything in a little script called &lt;i&gt;env.sh&lt;/i&gt;:

&lt;pre&gt;
export WORKSPACE=/home/phs/edk2
export JAVA_HOME=/usr/local/diablo-jdk1.5.0
export ANT_HOME=/opt/apache-ant-1.6.5
export XMLBEANS_HOME=/opt/xmlbeans-2.1.0
export PATH=$PATH:$ANT_HOME/bin:$XMLBEANS_HOME/bin
export CC=/opt/i386-tiano-pe/bin/gcc
&lt;/pre&gt;

Also, the EDK build notes mention that the default build target is the Windows NT Emulation environment. However, that target cannot be built using GCC, so I needed to edit the file Tools/Conf/target.txt and change the ACTIVE_PLATFORM to:

&lt;pre&gt;
ACTIVE_PLATFORM       = EdkUnixPkg/Unix.fpd
&lt;/pre&gt;

Now, I can tip of the build process as follows:

&lt;pre&gt;
$ cd ~/edk2
$ . env.sh
$ . edksetup.sh newbuild
&lt;/pre&gt;

Note that the build script must be "sourced", not executed. Unfortunately, the build process still fails, but now with a different error:

&lt;pre&gt;
       [cc] 1 total files to be compiled.
       [cc] In file included from /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.h:3,
       [cc]                  from /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.c:17:
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:27:20: error: jni_md.h: No such file or directory
       [cc] In file included from /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.h:3,
       [cc]                  from /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.c:17:
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jsize'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:104: error: expected specifier-qualifier-list before 'jbyte'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:193: error: expected specifier-qualifier-list before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1834: error: expected specifier-qualifier-list before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1842: error: expected specifier-qualifier-list before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1851: error: expected specifier-qualifier-list before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1888: error: expected specifier-qualifier-list before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1927: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1930: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1933: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1937: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jint'
       [cc] /usr/local/diablo-jdk1.5.0/include/jni.h:1940: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
       [cc] In file included from /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.c:17:
       [cc] /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.h:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jbyteArray'
       [cc] /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jbyteArray'

BUILD FAILED
/home/phs/edk2/Tools/build.xml:22: The following error occurred while executing this line:
/home/phs/edk2/Tools/CCode/Source/build.xml:254: The following error occurred while executing this line:
/home/phs/edk2/Tools/CCode/Source/CompressDll/build.xml:45: gcc failed with return code 1
&lt;/pre&gt;

The root cause of this is that the compiler can't find the jni_md.h header which is located in $JAVA_HOME/include/freebsd (at least on my system). I worked around this problem by editing $JAVA_HOME/include/jni.h as follows:

&lt;pre&gt;
--- jni.h.orig  2008-02-06 11:50:05.000000000 +0100
+++ jni.h       2008-02-06 11:50:16.000000000 +0100
@@ -24,7 +24,7 @@
 /* jni_md.h contains the machine-dependent typedefs for jbyte, jint
    and jlong */
 
-#include "jni_md.h"
+#include "freebsd/jni_md.h"
 
 #ifdef __cplusplus
 extern "C" {
&lt;/pre&gt;

Now I'm stuck with yet another compilation error:

&lt;pre&gt;
init:
     [echo] Building the EDK Tool Library: CompressDll

Lib:
       [cc] 1 total files to be compiled.
       [cc] /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.c: In function 'Java_org_tianocore_framework_tasks_Compress_CallCompress':
       [cc] /home/phs/edk2/Tools/CCode/Source/CompressDll/CompressDll.c:57: warning: overflow in implicit constant conversion
       [cc] Starting link
       [cc] /usr/bin/ld: /home/phs/edk2/Tools/CCode/Source/Library/libCommonTools.a(EfiCompress.o): relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC
       [cc] /home/phs/edk2/Tools/CCode/Source/Library/libCommonTools.a: could not read symbols: Bad value

BUILD FAILED
/home/phs/edk2/Tools/build.xml:22: The following error occurred while executing this line:
/home/phs/edk2/Tools/CCode/Source/build.xml:254: The following error occurred while executing this line:
/home/phs/edk2/Tools/CCode/Source/CompressDll/build.xml:45: gcc failed with return code 1
&lt;/pre&gt;

Well, I guess we'll see where this ends...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-6773504904619314754?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/6773504904619314754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=6773504904619314754' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6773504904619314754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/6773504904619314754'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/02/tianocore-on-freebsdamd64-take-2.html' title='TianoCore on FreeBSD/amd64, Take 2'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-4911881595484570277</id><published>2008-02-04T20:12:00.000+01:00</published><updated>2008-02-05T16:16:23.948+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Binutils'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='GCC'/><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>Building a Cross Compiler on FreeBSD</title><content type='html'>I'm currently trying to build a cross compiler (and other required tools) on FreeBSD. The compiler will run on FreeBSD/amd64 and should produce i386 binaries. This wouldn't be too hard since that task can easily be accomplished by using the FreeBSD source tree. However, I need the toolchain to produce binaries in the PE/COFF format instead of the default ELF format.

&lt;br /&gt;&lt;br /&gt;

Building the toolchain is somewhat tricky, at least I found it to be poorly documented. But maybe I just looked in the wrong places. Building the toolchain requires:
&lt;ul&gt;
&lt;li&gt;Building binutils.&lt;/li&gt;
&lt;li&gt;Locating some header files.&lt;/li&gt;
&lt;li&gt;Building the compiler.&lt;/li&gt;
&lt;li&gt;Building a C Library.&lt;/li&gt;
&lt;li&gt;Building the compiler again so it uses the C library that was just built.&lt;/li&gt;
&lt;/ul&gt;

&lt;br /&gt;&lt;br /&gt;

For my needs, I found that the last two steps weren't needed. I wrote a script that downloads the sources, extracts the archives and builds the toolchain. Here's the script in full quote (I really wish there was a way to upload files to this thing):

&lt;pre&gt;
#/bin/sh

#
# Copyright (c) 2008 Philip Schulz &lt;phs@deadc0.de&gt;
#

#
# This script downloads, builds and installs GCC and GNU Binutils that can
# produce x86 binaries in PE/COFF Format. The cross toolchain needs some headers
# that aren't usually present on the host system. However, those headers can be
# obtained from the cygwin sources, that's why a snapshot of the cygwin sources
# is downloaded.
#
# After the script finishes, the tools will be located at
# ${PREFIX}/${TARGET_ARCH}/bin. Some other binaries will be installed in
# ${PREFIX}/bin with their own prefix of ${TARGET_ARCH} but I don't know that
# they are for.
#

# Prefix where the Cross-Tools will live
PREFIX="${PREFIX:-/opt}"

# Target architecture.
TARGET_CPU="${TARGET_CPU:-i386}"
TARGET_ARCH=${TARGET_CPU}-tiano-pe

# Program that can fetch the files.
FETCH_COMMAND="/usr/bin/ftp -V"

# GNU Make
GNU_MAKE=`which gmake`

################################################################################
#
# GCC settings.
#
################################################################################
# What version of GCC will be fetched, built and installed 
GCC_VERSION=gcc-4.2.3
# What mirror to use.
GCC_MIRROR=ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/ftp.gnu.org
# File name of the GCC sources. Should probably not be changed.
GCC_ARCHIVE=$GCC_VERSION.tar.bz2
# Where the GCC Sources can be fetched from. Should probably not be changed.
GCC_URL=$GCC_MIRROR/gcc/$GCC_VERSION/$GCC_ARCHIVE
# Arguments for the GCC configure script. Should probably not be changed.
GCC_CONFIGURE_ARGS="--prefix=${PREFIX} --target=${TARGET_ARCH} "
GCC_CONFIGURE_ARGS+="--with-gnu-as --with-gnu-ld --with-newlib "
GCC_CONFIGURE_ARGS+="--disable-libssp --disable-nls --enable-languages=c "
GCC_CONFIGURE_ARGS+="--program-prefix=${TARGET_ARCH}- "
GCC_CONFIGURE_ARGS+="--program-suffix=-4.2.3 "


################################################################################
#
# Binutils settings.
#
################################################################################
# What version of the GNU binutils will be fetched, build and installed
BINUTILS_VERSION=binutils-2.18
# What mirror to use.
BINUTILS_MIRROR=ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/ftp.gnu.org
# File name of the binutils sources. Should probably not be changed.
BINUTILS_ARCHIVE=$BINUTILS_VERSION.tar.gz
# Where the GCC Sources can be fetched from. Should probably not be changed.
BINUTILS_URL=$BINUTILS_MIRROR/binutils/$BINUTILS_ARCHIVE
# Arguments for the GCC configure script. Should probably not be changed.
BINUTILS_CONFIGURE_ARGS="--prefix=${PREFIX} --target=${TARGET_ARCH} "
BINUTILS_CONFIGURE_ARGS+="--disable-nls "

################################################################################
#
# Cygwin settings.
#
################################################################################
CYGWIN_SNAPSHOT=20080129
CYGWIN_ARCHIVE=cygwin-src-${CYGWIN_SNAPSHOT}.tar.bz2
CYGWIN_MIRROR=http://cygwin.com/
CYGWIN_URL=${CYGWIN_MIRROR}snapshots/${CYGWIN_ARCHIVE}
CYGWIN_DIR=cygwin-snapshot-${CYGWIN_SNAPSHOT}-1

################################################################################
#
# Batch code.
#
################################################################################
#
# Fetches the files.
#
do_fetch() {
        if [ \! \( -f $GCC_ARCHIVE \) ] ; then
                echo "Fetching ${GCC_URL}"
                ${FETCH_COMMAND} ${GCC_URL}
        else
                echo $GCC_ARCHIVE already locally present.
        fi

        if [ \! \( -f $CYGWIN_ARCHIVE \) ] ; then
                echo "Fetching ${CYGWIN_URL}"
                ${FETCH_COMMAND} ${CYGWIN_URL}
        else
                echo $CYGWIN_ARCHIVE already locally present.
        fi

        if [ \! \( -f $BINUTILS_ARCHIVE \) ] ; then
                echo "Fetching ${BINUTILS_URL}"
                ${FETCH_COMMAND} ${BINUTILS_URL}
        else
                echo $BINUTILS_ARCHIVE already locally present.
        fi
}

#
# Extracts the archives.
#
do_extract() {
        # Remove already extracted files first.
        rm -rf ${GCC_VERSION}
        rm -rf ${CYGWIN_DIR}
        rm -rf ${BINUTILS_VERSION}

        # Extract the archives
        if [ -f $GCC_ARCHIVE ] ; then
                echo "Extracting ${GCC_ARCHIVE}"
                tar -jxf ${GCC_ARCHIVE}
        fi

        if [ -f $CYGWIN_ARCHIVE ] ; then
                echo "Extracting ${CYGWIN_ARCHIVE}"
                tar -jxf ${CYGWIN_ARCHIVE}
        fi

        if [ -f $BINUTILS_ARCHIVE ] ; then
                echo "Extracting ${BINUTILS_ARCHIVE}"
                tar -xzf ${BINUTILS_ARCHIVE}
        fi
}


BUILD_DIR_PREFIX=build-

#
# Builds Binutils.
#
do_binutils_build() {
        BUILD_DIR_BINUTILS=${BUILD_DIR_PREFIX}binutils-${TARGET_ARCH}

        # Remove dir if it exists.
        if [ -d $BUILD_DIR_BINUTILS ] ; then
                rm -rf $BUILD_DIR_BINUTILS
        fi

        echo "Building binutils..."

        # Changing directory, so use a sub-shell (?)
        (
                # Create a the build directory.
                mkdir ${BUILD_DIR_BINUTILS} &amp;&amp; cd ${BUILD_DIR_BINUTILS};
                # Configure, build and install binutils
                ../${BINUTILS_VERSION}/configure ${BINUTILS_CONFIGURE_ARGS} &amp;&amp;
                ${GNU_MAKE} -j 12 -w all &amp;&amp; ${GNU_MAKE} -w install
        )

        # Remove build dir
        rm -rf $BUILD_DIR_BINUTILS

        echo "Binutils Build done."
}

#
# "Builds" cygwin. Actually, it only copies some headers around.
#
do_cygwin_build() {
        HEADERS=${PREFIX}/${TARGET_ARCH}/sys-include

        mkdir -p $HEADERS  &amp;&amp;
        cp -rf ${CYGWIN_DIR}/newlib/libc/include/* $HEADERS &amp;&amp;
        cp -rf ${CYGWIN_DIR}/winsup/cygwin/include/* $HEADERS
}

#
# Builds GCC
#
do_gcc_build() {
        BUILD_DIR_GCC=${BUILD_DIR_PREFIX}gcc-${TARGET_ARCH}

        # Remove dir if it exists.
        if [ -d $BUILD_DIR_GCC ] ; then
                rm -rf $BUILD_DIR_GCC
        fi

        echo "Building GCC..."

        # Changing directory, so use a sub-shell (?)
        (
                # Create a the build directory.
                mkdir ${BUILD_DIR_GCC} &amp;&amp; cd ${BUILD_DIR_GCC};
                # Configure, build and install GCC.
                ../${GCC_VERSION}/configure $GCC_CONFIGURE_ARGS &amp;&amp;
                ${GNU_MAKE} -j 12 -w all &amp;&amp; ${GNU_MAKE} -w install
        )
        rm -rf $BUILD_DIR_BINUTILS

        echo "GCC Build done."
}

do_fetch
do_extract
do_binutils_build
do_cygwin_build
do_gcc_build
&lt;/pre&gt;

Unfortunately, the gcc binary built by the script, located in /opt/i386-tiano-pe/bin, can't produce binaries. Invoking the compiler on a source file ("Hello, World!" program) dies with:

&lt;pre&gt;
$ /opt/i386-tiano-pe/bin/gcc main.c -o main
/opt/lib/gcc/i386-tiano-pe/4.2.3/../../../../i386-tiano-pe/bin/ld: crt0.o: No such file: No such file or directory
collect2: ld returned 1 exit status
&lt;/pre&gt;

I assume this is because I skipped the last two steps in the list at the beginning of this post. However, using the compiler to generate an assembler file (parameter -S) and then running the assembler on that file to produce an object file does indeed produce a PE/COFF object file.

&lt;pre&gt;
$ cd /opt/i386-tiano-pe/bin
$ ./gcc -S ~/main.c
$ ./as -o main.o main.s
$ file ./main.o
./main.o: MS Windows COFF Intel 80386 object file
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-4911881595484570277?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/4911881595484570277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=4911881595484570277' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4911881595484570277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/4911881595484570277'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/02/building-cross-compiler-on-freebsd.html' title='Building a Cross Compiler on FreeBSD'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1836356500662460727</id><published>2008-02-04T17:12:00.000+01:00</published><updated>2008-02-05T15:51:28.611+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><category scheme='http://www.blogger.com/atom/ns#' term='TianoCore'/><title type='text'>TianoCore on FreeBSD/amd64</title><content type='html'>I'm attempting to build the TianoCore code base on FreeBSD/amd64. Here's what I did so far.

&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;
In order to be able to check out the EDK2 sources, I installed the &lt;span style="font-family: courier new;"&gt;devel/subversion&lt;/span&gt; port. To check out the source tree, I did this in my home directory:

&lt;pre&gt;
$ svn co https://edk2.tianocore.org/svn/edk2/trunk/edk2 edk2
&lt;/pre&gt;
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;
I installed the &lt;span style="font-family: courier new;"&gt;java/diablo-jdk15&lt;/span&gt; port.
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;
Downloaded &lt;a href="http://ant.apache.org/"&gt;Apache Ant 1.6.5&lt;/a&gt;. I didn't install it through the port but instead downloaded the binary distribution and extracted the archive under &lt;span style="font-family: courier new;"&gt;/opt&lt;/span&gt; since the EDK2 build framework requires very specific versions of the tools.
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;
Did the same thing with &lt;a href="http://ant-contrib.sourceforge.net/"&gt;Ant-Contrib 1.0b3&lt;/a&gt;, &lt;a 
href="http://xmlbeans.apache.org/"&gt;XMLBeans 2.1.0&lt;/a&gt; and &lt;a href="http://sourceforge.net/projects/saxon"&gt;Saxon 8.1.1&lt;/a&gt;.
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;
I created a symbolic link at &lt;span style="font-family:courier new;"&gt;/opt/xmlbeans-2.1.0/lib&lt;/span&gt; to &lt;span style="font-family: courier new;"&gt;/opt/saxon-8.1.1/saxon8.jar&lt;/span&gt;. The build notes for the EDK said a copy was needed, but a symbolic link works just as good. I guess they were running Windows or didn't know about links. Whatever.
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;
Then I set up the environment for the build process as described in the build notes. This is what I did (note that my shell is bash):

&lt;pre&gt;
$ export WORKSPACE=/home/phs/edk2
$ export JAVA_HOME=/usr/local/diablo-jdk1.5.0
$ export ANT_HOME=/opt/apache-ant-1.6.5
$ export XMLBEANS_HOME=/opt/xmlbeans-2.1.0
$ export PATH=$PATH:$ANT_HOME/bin:$XMLBEANS_HOME/bin
&lt;/pre&gt;
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;
I kicked off the build process with this command:

&lt;pre&gt;
$ bash edksetup.sh newbuild
&lt;/pre&gt;

Unfortunately, the build fails with an error:

&lt;pre&gt;
BUILD FAILED
/usr/home/phs/edk2/Tools/build.xml:22: The following error occurred while executing this line:
/usr/home/phs/edk2/Tools/CCode/Source/build.xml:247: The following error occurred while executing this line:
/usr/home/phs/edk2/Tools/CCode/Source/PeCoffLoader/build.xml:68: ar failed with return code 139
/phs/edk2/Tools/CCode/Source/PeCoffLoader/build.xml:68: ar failed with return code 139
&lt;/pre&gt;

This error can be solved by using a GCC that produces PE/COFF binaries instead of the default ELF images. 
&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1836356500662460727?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1836356500662460727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1836356500662460727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1836356500662460727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1836356500662460727'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/02/tianocore-on-freebsdamd64.html' title='TianoCore on FreeBSD/amd64'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-3822073378698436107</id><published>2008-02-03T15:13:00.000+01:00</published><updated>2008-02-05T15:42:34.193+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='coreboot'/><category scheme='http://www.blogger.com/atom/ns#' term='FreeBSD'/><title type='text'>Qemu and Coreboot on FreeBSD/amd64</title><content type='html'>Today I tried to boot FreeBSD inside Qemu, using coreboot. I already wrote a &lt;a href="http://www.coreboot.org/Booting_FreeBSD_using_coreboot"&gt;short guide&lt;/a&gt; on how to do this, but I only tested it on a FreeBSD/i386 host. Now I'm trying to do the same thing, except this time the host is a FreeBSD/amd64 system.

&lt;br /&gt;&lt;br /&gt;

I encountered several problems and I'm going to describe them along with the workarounds here.

&lt;br /&gt; &lt;br /&gt;

First, the devel/dev86 port I created was marked as running on i386 only. I initially did this because I wasn't sure if the software would run on amd64, but after testing it I can say that it does work. So the port needs a little tweaking, namely this line

&lt;pre&gt;
ONLY_FOR_ARCHS= i386
&lt;/pre&gt;
needs to be extended to
&lt;pre&gt;
ONLY_FOR_ARCHS= i386 amd64
&lt;/pre&gt;

or maybe even removed completely.

&lt;br /&gt; &lt;br /&gt;

Second, the RomCC utility used in the coreboot build process crashes, apparently due to a change in GCC 4 as opposed to GCC 3.4 used in older versions on FreeBSD. It crashes in a function called "free_basic_block" and the workaround is this:
&lt;pre&gt;
Index: util/romcc/romcc.c
===================================================================
--- util/romcc/romcc.c  (revision 3088)
+++ util/romcc/romcc.c  (working copy)
@@ -15083,6 +15083,8 @@

static void free_basic_block(struct compile_state *state, struct block *block)
{
+       return;
+
      struct block_set *edge, *entry;
      struct block *child;
      if (!block) {
&lt;/pre&gt;

Third, the linker on FreeBSD/amd64 does not understand the -m32 flag. So I needed a cross compiler for i386. Warner Losh has an &lt;a href="http://bsdimp.blogspot.com/2006/09/cross-building-freebsd.html"&gt;entry&lt;/a&gt; in his blog that describes how to cross build FreeBSD. I don't need all of FreeBSD but only the compiler, so I use this:

&lt;pre&gt;
$ cd /usr/src
$ export TARGET=i386
$ export TARGET_ARCH=i386
$ make toolchain
&lt;/pre&gt;

This gives me an i386 cross compiler in /usr/obj/i386/usr/src/tmp/usr/bin that I need to use to compile coreboot. I did this to tell the GNU make utility to use the cross compiler:

&lt;br /&gt; &lt;br /&gt;

&lt;span style="font-family:monospace;"&gt;
gmake CC=/usr/obj/i386/usr/src/tmp/usr/bin/gcc
&lt;/span&gt;

&lt;br /&gt; &lt;br /&gt;

&lt;strike&gt;
There is one outstanding problem: Qemu crashes when I try to use coreboot as a BIOS replacement. It may have to do with the version of Qemu I'm using right now. I'll try to use an older version later this afternoon to see if it solves the problem.
&lt;/strike&gt;

&lt;br /&gt; &lt;br /&gt;

Using Qemu 0.9.0 with the required patches (see the &lt;a href="http://www.coreboot.org/QEMU_Build_Tutorial"&gt;Qemu Build Tutorial&lt;/a&gt;) made the problem go away and I'm now able to boot FreeBSD/i386 8-CURRENT inside Qemu, using coreboot and ADLO. I've uploaded a complete archive of the port files to the coreboot wiki, see &lt;a href="http://www.coreboot.org/images/2/2e/FreeBSD-Qemu-0.9.0.tgz"&gt;this link&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-3822073378698436107?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/3822073378698436107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=3822073378698436107' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3822073378698436107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/3822073378698436107'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/02/qemu-and-coreboot-on-freebsdamd64.html' title='Qemu and Coreboot on FreeBSD/amd64'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-1977246543274629196</id><published>2008-01-30T22:12:00.003+01:00</published><updated>2008-05-17T18:23:49.448+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Open Firmware'/><title type='text'>Open Firmware Quick Reference</title><content type='html'>I just came accross what seems to be a handy &lt;a href="http://www.firmworks.com/QuickRef.html"&gt;Open Firmware Quick Reference&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-1977246543274629196?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/1977246543274629196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=1977246543274629196' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1977246543274629196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/1977246543274629196'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/01/open-firmware-quick-reference.html' title='Open Firmware Quick Reference'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-345118721724003954.post-8264515260455615617</id><published>2008-01-30T21:37:00.002+01:00</published><updated>2008-05-23T02:12:51.877+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Subversion'/><title type='text'>Vendor Branch Management with Subversion</title><content type='html'>So, I sometimes hack on FreeBSD and want version control for my local changes. Working with CVS and vendor branches seemed to much of a pain and everyone was talking about how nowadays you'd use Subversion anyways. So I decided to give Subversion a try.&lt;br /&gt;&lt;br /&gt;

What helped me a lot in getting started with Subversion was the Book "&lt;a href="http://svnbook.red-bean.com/en/1.4/index.html"&gt;Version Control with Subversion&lt;/a&gt;", which is available online.&lt;br /&gt;&lt;br /&gt;

So I set up a subversion server and import snapshots of the FreeBSD source tree on a more or less regular basis. Here's what I do to update the vendor branch.&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;First, I fetch the latest and greatest of the FreeBSD sources, logged into &lt;span class="Apple-style-span" style="font-style: italic;"&gt;svn.dmz.local.deadc0.de &lt;/span&gt;as user svn. I use &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;csup&lt;/span&gt;, the CVSup replacement in the base system. I don't use CVS since it would leave the CVS directories all over the place. It would also be slower and I don't need its functionality anyways. This is the supfile I use:

&lt;pre&gt;
*default host=cvsup.dmz.local.deadc0.de
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=.
*default delete use-rel-suffix

*default compress

src-all
&lt;/pre&gt;

The actual command I run is:

&lt;pre&gt;
# csup -L 2 -g ~/supfile
&lt;/pre&gt;
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;Then, I use the Script &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svn_load_dirs&lt;/span&gt;, which can be installed through the &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;devel/svn_load_dirs&lt;/span&gt; port. I invoke it as follows:

&lt;pre&gt;
$ svn_load_dirs -t tag http://.../repos/freebsd/vendor current /usr/src
&lt;/pre&gt;

This causes the repository location &lt;i&gt;/repos/freebsd/vendor/current&lt;/i&gt; to be updated with the contents of &lt;i&gt;/usr/src&lt;/i&gt;. After that, a tag is created at &lt;i&gt;/repos/freebsd/vendor/tag&lt;/i&gt;, caused by the parameter -t.

&lt;br /&gt;

This whole process takes a while, and every once in a while, something needs to be acknowledged. So unfortunately, it can't be let run over night. One thing to remember: The command is run as the currently logged in user "svn", but the repository username is "phs". So when the script asks for the password, I hit enter. Then a blank line appears where I enter the repository user name. After hitting enter, the scripts asks for the password again, this time for the right user.&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;The next step is to SSH into &lt;span class="Apple-style-span" style="font-style: italic;"&gt;knecht.dmz.local.deadc0.de&lt;/span&gt; and go to &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;/usr/devel/src&lt;/span&gt;. There, I run &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;blockquote&gt;$ svn up&lt;/blockquote&gt;&lt;/span&gt;After that, I merge the new vendor code with:

&lt;br /&gt;&lt;br /&gt;

&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;
$ svn merge http://.../repos/vendor/freebsd/&lt;previos tag&gt;  http://.../repos/vendor/current .
&lt;/span&gt;
&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;The last step may have produced some conflicts, so I use &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svn status&lt;/span&gt; to detect conflicts.&lt;/li&gt;

&lt;br /&gt;

&lt;li&gt;After all conflicts have been resolved, I commit the changes with &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svn ci&lt;/span&gt; and voilà, that's it.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/345118721724003954-8264515260455615617?l=phisch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phisch.blogspot.com/feeds/8264515260455615617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=345118721724003954&amp;postID=8264515260455615617' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8264515260455615617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/345118721724003954/posts/default/8264515260455615617'/><link rel='alternate' type='text/html' href='http://phisch.blogspot.com/2008/01/vendor-branch-management-with.html' title='Vendor Branch Management with Subversion'/><author><name>phs</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_kgompDzTSFc/R6DQ8en5lUI/AAAAAAAAAAQ/Lmvt9YSbBug/S220/100_2039.png'/></author><thr:total>0</thr:total></entry></feed>
