compat-drm git tree

I created compat-drm git tree on GitHub. This is a cleaned and stripped version of compat-wireless tree with some initial work done for building drm drivers. I’m currently working on building the latest linux-next drm drivers on kernel version 3.4 and sending the backport patches regularly to my mentor Luis Rodriguez and to the linux-wireless mailing list.

If you have to dig into kernel maintenance and building, I strongly suggest you to take a look at the kbuild documentation available in the linux kernel tree. It reveals a lot of things about building kernel and modules.

Stay tuned for updates.

Making compat scripts distribution agnostic

There exists 2 very useful scripts for testing the work done in compat.git tree: ckmake and get-compat-kernels.

get-compat-kernels downloads and installs a predefined set of kernels (namely from 2.6.24 to the latest one available) to your system. Since we need a configured source tree in which a kernel build is already done, .deb packages from Ubuntu PPA mainline kernel repository are used to ease the process but since we need dpkg to install these packages, the script was written so that it only works on Ubuntu.

So I modified the script in a way that it will extract the packages correctly on any linux distribution in which the ar utility is installed (.deb packages are simply ar archives in which there exists a data.tar.gz containing the files that will be installed on your system).  Ar is shipped within the binutils package which should already be installed on your system if you are doing development.

Once you use get-compat-kernels to download and extract the kernel source trees, you now have to use ckmake to build the compat tree against all the extracted kernels. ckmake sequentially switches to the source trees found under /lib/modules/ and builds the compat tree. Since get-compat-kernels does not depend on Ubuntu anymore , I dropped the distribution check in ckmake to make that function on any distribution.

Now I can test the backports/modifications on Fedora before sending them to the upstream to make sure that they don’t break anything. ckmake script outputs a nice summary about the build state for every kernel version:

Trying kernel                     3.4.0-030400-generic	[OK]
Trying kernel                     3.3.7-030307-generic	[OK]
Trying kernel                     3.2.2-030202-generic	[OK]
Trying kernel                    3.1.10-030110-generic	[OK]
Trying kernel                    3.0.18-030018-generic	[OK]
Trying kernel                  2.6.39-02063904-generic	[OK]
Trying kernel                  2.6.38-02063808-generic	[OK]
Trying kernel                  2.6.37-02063706-generic	[OK]
Trying kernel                  2.6.36-02063604-generic	[OK]
Trying kernel                  2.6.35-02063512-generic	[OK]
Trying kernel                  2.6.34-02063410-generic	[OK]
Trying kernel                  2.6.33-02063305-generic	[OK]
Trying kernel                  2.6.32-02063255-generic	[OK]
Trying kernel                  2.6.31-02063113-generic	[OK]
Trying kernel                  2.6.30-02063010-generic	[OK]
Trying kernel                  2.6.29-02062906-generic	[OK]
Trying kernel                  2.6.28-02062810-generic	[OK]
Trying kernel                    2.6.27-020627-generic	[OK]
Trying kernel                    2.6.26-020626-generic	[OK]
Trying kernel                    2.6.25-020625-generic	[OK]
Trying kernel                    2.6.24-020624-generic	[OK]

 

GSoC 2012 – First steps

Here comes the first blog story about my progress during GSoC 2012.

I am accepted as a GSoC student by Linux Foundation to work on their video driver backport project. The idea is basically about integrating a modern 3D video driver into a compat framework and adding support for backporting it from linux-next.git down to all known supported kernel releases. The initial project idea of Linux Foundation is here.

My mentor is Luis R. Rodriguez which is currently maintaining compat and compat-wireless trees to distribute latest 802.11, Bluetooth subsystem/drivers and some ethernet drivers in source code form. This way, a user either by using their distribution’s package repository or by compiling the compat-wireless tarballs can get access to the latest drivers without needing to build their kernel from scratch.

The compat.git and compat-wireless.git trees are hosted in github.

compat tree

The compat tree is basically for providing the functionalities added in newer kernels to older kernels using a set of header files and exported symbols. A very detailed explanation about the compat framework can be found in the wiki page.

The changes for a subsystem targeted for the upcoming/next major kernel release are kept in subsystem-next.git trees. These changes are merged into the linux-next.git tree on a daily basis. This means that changes targeted for the next kernel release can be backported into the compat.git tree in advance.

compat-wireless tree

The compat-wireless.git tree is basically a placeholder tree with a bunch of scripts and networking specific backport patches in which automated releases are built.

Basically you set up your environment variables to point to the relevant GIT trees to generate compat-wireless tarballs using stable or next trees as your code base. The mechanism also benefits from the compat.git tree as it is crucial for adding support of new functionalities for older kernels.

More info can be found at linux wireless hacking page.

An example backport

In order to get my hands dirty, I prepared and sent a patch for compat.git to backport the newly added ether_addr_equal() function. Since the change is committed to the linux-next.git tree, the backport is needed for generating compat-wireless tarballs from the linux-next.git tree.

Since all kernel code doing an address equality check are modified to use this new function instead of the older compare_ether_addr(), the backport is and should actually be a wrapping around the older function in order to ease the backporting work:

/* Backport ether_addr_equal */
static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
{
    return !compare_ether_addr(addr1, addr2);
}

With this commit, all code in the linux-next.git tree using the new ether_addr_equal() function will correctly build on older kernels because it is now defined through the compat.git tree.