Kernel

This project is meant to serve as a home for Mobile and Internet kernel patches, and to provide a custom kernel for use with the Moblin Image Creator utility. The pristine kernel tree is provided with a debian directory where the patches reside and is used for building the kernel-mid package.

Link to tree: http://moblin.org/repos/projects/kernel-mid-2.6.22.git

Link to tree: http://moblin.org/repos/projects/kernel-mid-2.6.24.git

The two kernels align separately with the Ubuntu gutsy and hardy releases.

Source code
The kernel source code is available by cloning the kernel-mid git repository.

git clone rsync://moblin.org/repos/projects/kernel-mid-2.6.22.git

Or

git clone rsync://moblin.org/repos/projects/kernel-mid-2.6.24.git

After the git clone has completed, the source code will be located in the ./kernel-mid directory.

Note: The source tree is a copy of the pristine kernel sources from the www.kernel.org tree. The project patches are located in kernel-mid/debian/patches and are applied to the kernel sources when the kernel-mid package is built using the dpkg-buildpackage command.

Building the kernel-mid package inside a Moblin Image Creator build root

Below are the steps for pulling down the kernel package sources and building the debian package inside a Moblin Image Creator build root (that is, chroot jail located inside a project) on your local Linux developer workstation. The advantage of building inside the project build root is that it is isolated from the OS installed on your local system and it mirrors the OS installed on your target device.

1. Download and Install Moblin Image Creator on your developer system
Download and install the latest version of the Moblin Image Creator by following the instructions on the Moblin Image Creator page.

2. Create a Moblin Image Creator project
The following creates a Moblin Image Creator project called 'proj1' for the Menlow platform and resides in ~/foo/proj1. This will be your build root for building the kernel-mid packages.

$ cd ~/foo
$ image-creator --command=create-project --platform-name=menlow \
  --project-name=proj1 --project-desc='Project 1 for Menlow' \
  --project-path=./proj1

3. Build the kernel-mid debian package inside the project build root

At this point, you're ready to chroot into the project build root to build your kernel-mid package. Before building the kernel-mid packages, you need to get the source package:

Option 1: Use git clone - for those needing to commit changes
Note: The mount --bind command lets the build root get a reference link to outside of the build root. So, no matter whether they’re inside or outside the build root, developers could access the kernel source code, For example, developers could use the dpkg-buildpackage inside the build root, but use git outside the build root.

$ cd ~/foo
$ git clone \
  ssh://YOURLOGIN@moblin.org/home/repos/projects/kernel-mid-2.6.22 \
  kernel-mid
Or $ git clone \
  ssh://YOURLOGIN@moblin.org/home/repos/projects/kernel-mid-2.6.24 \
  kernel-mid
$ sudo mkdir ~/foo/proj1/kernel-mid
$ sudo mount --bind ~/foo/kernel-mid \
  ~/foo/kernel-mid/proj1/kernel-mid

Option 2: Using git clone - for those who don't need to commit changes
Note: The mount --bind command lets the build root get a reference link to the outside world. So, no matter whether they’re inside or outside the build root, developers could access the kernel source code. For example, developers could use dpkg-buildpackage inside the build root, but use their favorite editor outside.

$ cd ~/foo
$ git clone rsync://moblin.org/repos/projects/kernel-mid-2.6.22.git \
  kernel-mid
Or $ git clone rsync://moblin.org/repos/projects/kernel-mid-2.6.24.git \
  kernel-mid
$ sudo mkdir ~/foo/proj1/kernel-mid
$ sudo mount --bind ~/foo/kernel-mid \
  ~/foo/kernel-mid/proj1/kernel-mid

Once you've implemented the above code, the kernel-mid package can be built under the build root directory. The following commands rebuild the packages:

$ cd ~/foo
$ sudo /usr/sbin/chroot ./proj1
# cd kernel-mid
# dpkg-buildpackage -b

One problem you face, when developing new kernel patches against our patched kernel, is correctly applying all of our kernel patches against the pristine kernel sources. This is an important step, otherwise you would be developing on the wrong kernel source tree. One neat trick is to have the debian/rules file do this for you, resulting in a kernel source tree that you can use for your development. Run the following commands inside the project build root:

# cd kernel-mid
# make -f debian/rules configure

Now, if you look inside ~/foo/proj1/kernel-mid directory, or if you are chrooted into the build root it would be /kernel-mid directory, you can see a patched kernel source tree. At this point, you can use this tree for your development. You could also copy the patch tree to another location and work on the copy. The advantage is that you keep a backup of the original patched tree.

4. Adding your own patches into kernel-mid package
Once you finish your work under the kernel source tree, you may want to create a patch file against your changes and add them to kernel-mid package. Before that, you need to look at this directory: ~/foo/proj1/kernel-mid/debian/patches. First, let's look at the 00list file:

$ cd ~/foo/proj1/kernel-mid/debian/patches
$ cat 00list
hda_sigmatel
k_fast_resume
marvell_wifi
mmc_sdio
squashfs3.2
unionfs
zi9_ACPI_DSDT_override

# menlow_patch_start_here is an empty patch stake
# please put all menlow specific patches under it
menlow_patch_start_here

poulsbo_hda_class_id
poulsbo_hda_device_id
poulsbo_hda_sd_fixup_2_6_21
poulsbo_ide_2.6.21

The file lists the patches in the order that they are applied. New patches should be added at the end of the file. Attention: the menlow_patch_start_here tag is an empty patch stake, so this means that all McCaslin patches must be added at the end of the list, and above the tag. All Menlow patches must be added under the tag.

In the ~/foo/proj1/kernel-mid/debian/patches directory, many patch files end in the .dpatch suffix. These are normal patch files with a dpatch prefix line at the beginning of the patch file. For your patches, insert the prefix line to your patch file as:

#! /bin/sh /usr/share/dpatch/dpatch-run