user-avatar
Today is Friday
February 10, 2012

Category: Linux kernel

November 14, 2011

New lightweight admin-oriented linux kernel mercurial mirror

by Thomas Capricelli — Categories: Admin, Gentoo, Linux kernel — Tags: Leave a comment

On most servers I’m responsible for, I use to compile my own kernels. Instead of downloading/applying patches, which is cumbersome, I was using the (now broken) mercurial mirror http://www.kernel.org/hg/linux-2.6
It was great as i just had to do something like “hg pull -u; hg up -r v2.6.xx” to update my tree.

Though, this has several drawbacks, and among them some very important:
* the minor versions are not there, such as 2.6.xx.y
* the repository cloning is worth 2.1G, not including the checkout
* you need to specify the tag to get a stable kernel
* the repository contains all intermediate versions, which slows down updating both from network and local checkout.

The first point is the one what bothers me the more. For example at some given date, say the 2.6.39 is not yet released, the last version available in the hg mirror is 2.6.38, although 2.6.38.6 is available. So I  still need to manually patch my checkout because I think 6 minor stable versions are worth having.

My solution to this is a script that I’ve called by the pretty name of eudyptula (this is a very small penguin..). Eudyptula automatically (using cron) updates a mercurial repository to the latest ‘stable’ version of the linux kernel, according to what is found on the official ftp server. The result is here:

https://bitbucket.org/orzel/linux-kernel-stable

The repository clone weights only 220M (excluding the checkout, on my ext4 partition), and contains only one changeset for each update from a stable version to the next. ‘hg pull -u’ is enough to get the latest stable source. Hence the name.

A typical history will look like

* 2.6.38

* 2.6.38.1

* 2.6.38.2

* 2.6.38.3

* 2.6.38.4

* 2.6.38.5

* 2.6.38.6

* 2.6.39

* 2.6.39.1

and will drop any 2.6.38.x release that could appear after 2.6.39 is released.

As a convenience, I’m also tagging versions the same way they are tagged in the official git/mercurial repositories (‘v2.6.38.4″ for example).

Of course, it does NOT makes sense to use this repository if you intend to do kernel development. It is supposed to be used  readonly.

This is a long term project. As of today (november 14th, 2011), I’ve been using this for updating ~10 servers for the last 9 months. I intend to maintain this clone for long, checking and fixing problems if they ever occur.

If there’s enough interest, I could do another mirror for the long-term support versions. Though those versions, officially created and maintained by kernel developers, are not as formally described, and this is more difficult to do from a cron job.

May 13, 2011

How to detect Altivec availability on linux/ppc at runtime

by Thomas Capricelli — Categories: Gentoo, Linux kernel — Tags: , Leave a comment

It is easy to find information on how to detect the availability of the different SSE instructions sets on the x86 platform.. but this get trickier when you’re looking after AltiVec.

This page provide some code and a link explaining why methods based on try and catch exception are bad:

http://freevec.org/function/altivec_runtime_detection_linux

I did few modifications to this code, that I consider enhancements:

  • use /proc/self/ instead of /proc/%d/ based on getpid() to simplify the code, as suggested in comment
  • use of bool for the result variable and the return value
  • clean ugly use of goto when possible
  • do not cache the result in a static variable
#include <fcntl.h>
#include <linux/auxvec.h>
#include <asm/cputable.h>

// from http://freevec.org/function/altivec_runtime_detection_linux
static inline bool altivecAvailable(void)
{
    bool result = false;
    unsigned long buf[64];
    ssize_t count;
    int fd, i;

    fd = open("/proc/self/auxv", O_RDONLY);
    if (fd < 0) {
        return false;
    }
    // loop on reading
    do {
        count = read(fd, buf, sizeof(buf));
        if (count < 0){
            break;
        for (i=0; i < (count / sizeof(unsigned long)); i += 2) {
            if (buf[i] == AT_HWCAP) {
                result = !!(buf[i+1] & PPC_FEATURE_HAS_ALTIVEC);
                goto out_close;
            } else if (buf[i] == AT_NULL)
                goto out_close;
        }
    } while (count == sizeof(buf));
out_close:
    close(fd);
    return result;
}

November 2, 2008

Activities gallery

by Thomas Capricelli — Categories: Admin, Django, Gentoo, KDE, Linux kernel — Tags: , , , , , , , 3 Comments

While developing my recently released activity mercurial extension (and here too), I did a lot of tests on some quite famous/big projects. I’ve found the results to be quite interesting and decided to put up this gallery. Are you interested in the history of commits for kde, linux, django, portage(software), and others?

warning : this is just for fun (copyright Linus Torvalds), I’m perfectly aware that the number of commits is a very bad indicator for development.

The gallery : http://labs.freehackers.org/projects/hgactivity/wiki/Gallery

June 14, 2008

Entering the blogosphere….

by Thomas Capricelli — Categories: Gentoo, KDE, Linux kernelLeave a comment

I intend to use this blog to give insights about my free software development stuff, which is mainly related to Qt/KDE, gentoo, and the linux kernel.

© 2012 Thomas Capricelli All rights reserved - Wallow theme v0.46.5 by ([][]) TwoBeers - Powered by WordPress - Have fun!