Tag Archives: git

Kernel develpoment on e60

Now that I have access to the serial console on Samsung e60 reader let’s build a new linux kernel for it.

The e60 reader has an ARM processor, to compile the kernel we need a cross compilation toolchain.
The first option is to use the one Samsung released with the other sources. It must work, however I don’t really like the idea to run binaries from unknown sources.
The second option is to build our own toolchain, we often have to do that for systems that requires patches on the compiler.
Here, Samsung’s binutils look like they were taken between 2.17 and 2.18 release (they are named 2.17.50 but are still slightly different from this snapshot) but they don’t seam to embed homemade patches. As for ggc I didn’t take time to check.
I choose to use the emdebian cross-development toolchain lenny version. (As the article in the french open silicium magazine #1 about FriendlyARM proposes to do).

Installing the cross-development toolchain on debian

First the archive keys:


sudo apt-get install emdebian-archive-keyring

Then we add a /etc/apt/sources.list.d/emdebian.list file with the following content:


deb http://ftp.uk.debian.org/emdebian/toolchains lenny main
deb-src http://ftp.uk.debian.org/emdebian/toolchains lenny main

The we update the package list to install the needed packages:


sudo apt-get update
sudo apt-get install libc6-armel-cross libc6-dev-armel-cross libstdc++6-armel-cross binutils-arm-linux-gnueabi gcc-4.3-arm-linux-gnueabi g++-4.3-arm-linux-gnueabi

That’s it ! We have now our cross-compilation toolchain installed from packages, so easy to update or remove.

The kernel sources

Samsung released it’s modified 2.6.29.4 version. By cloning the kernel 2.6.29.y git branch, I could quickly see that their changes applied well to the 2.6.29.6 version (the last in the branch).

In order to better sort the changes michel.s had splat them into several patches
(patchs on e60-open project). After a few trials I build a series file allowing to apply those patches with quilt or better to import them to a git branch with git quiltimport. The order I choose allows to drop easily some patches (the last ones).

One particular point on those patches is that some include binary files:

  • fs/rfs/*.o a proprietary journaling layer over FAT. If you want my point ov vue, we don’t need that. After all we have free journaling file systems available and linux is able to mount something else than FAT over USB…
  • drivers/usb/gadget/file_storage.o also the corresponding .c file was removed, the BSD/GPL license from the original code allows a binary distribution (however I didn’t check if Alan Stern’s name appears in the doc) but I’d have liked that Samsung give that source code.

U-Boot

Before compiling the kernel, we need the mkimage utility from U-Boot. Here, Let’s build the U-Boot released by Samsung, and let’s just copy the tools/mkimage to a location in our PATH (that’s the only install method I could find).


make smdkc100_config 
make CROSS_COMPILE=arm-linux-gnueabi-

cp tools/mkimage ~/bin/

Building linux

For the config, one of the patches includes a .config. That file is a copy of config_rfs so even without the previous patch, we can get Samsung’s config.

Finally we can compile!


make CROSS_COMPILE=arm-linux-gnueabi- CFLAGS="-march=armv4t -mtune=cortex-a8" CXXFLAGS="-march=armv4t -mtune=cortex-a8" ARCH=arm uImage


We can then load our kernel by following The kernel testing howto from e60-open project. To load the kernel we will need the following command:


sudo dnw arch/arm/boot/uImage

That’it, and it works ! Well almost, the kernel cannot find his modules. This will not be a big deal for the ones included in the sources (but the subject of a next post) but the /lib/modules/max14540.ko and lib/modules/dhd.ko modules are not included in the sources while reporting a GPL license to the kernel.

Missing source code

The Samsung Open Source Release Center website has a contact form, but it does not seam to work (I even booted my netbook on windows to try with IE8 without success). After browsing the french e60 forum I found their email address and mailed them, no answer so far (not even automatic). Let’s wait …

Conclusion

We can compile a kernel for the e60 reader without using the cross tools from Samsung.
There still some work to load modules as the one on the reader are copiled for 2.6.29.4 and our kernel does not want to load them. (I’ve already done a few tests but that will be a next posts’ topic.)
But without the missing sources it will be hard for us to best use our e60 reader.

Update: I got an answer from Samsung, they updated the released archive. I still have to look at it.

First step in kernel development

I wanted to work on linux kernel from some time, but didn’t really know where to start. One day a wise man told me “a good way to learn is to do it! So get an USB device and write the driver for it.” I answered: “Well I didn’t thought of that, usually I’d use libusb for such cases.”

A USB device

Some days later, I didn’t find any nice device, but I thought, why not building it as well?
As I already told you, I’ve already hacked out an USB device: USBtinyISP. So I got back to the original code: usbtiny and I build myself a small device with 4 LED and 2 buttons:

My prototype's picture

I didn’t use and ATtiny, but an ATmega8 to keep more room for future improvements 😉 (The ATtiny2313 is already full with the USBtinyISP code).

And here is the schematic: (as picture, the gschem sources stay in git under the sch folder):

The schematic

Once the wiring done, some few lines of code based on the usbtiny sample, and that’s it: A firmware for the ATmega (in the root of the project).

Then I needed to test it, so back to the first idea, some code lines using libusb, available in the test, helped to improve the firmware 😉

Everything’s OK, let’s write a driver.

The Linux driver

Well I just followed some tutorials:

Finaly looking at the usbled.c file in Linux sources to get some more updates.

This build a module that adds the files leds and keys in the device folder that Linux creates in /sys/bus/usb/.

That’s it! I don’t know if you learned something, but I did learn a lot! 😉

All source code are available under GPL2 or GPL2+ on my gitweb: jvdg_usbgadget.git

As for the egocentric name, it’s just to avoid any name conflict. This has no mean to be integrated anywhere anyway. (The device uses an USB ID reserved to prototyping, so unusable for products…)

Triage X Bugs of 2011 first Weeks (TXBW9-10-11)

I’ve been lasy about the reporting lately, so this is a 3 weeks update at once !

The bug count according to udd is down to 818. I guess this is due to Kibi‘s triaging on input related bugs, but I helped to close a few one too !

I kept my week numbering as before, so now I know the first bugs I pinged are more that 11 weeks old. I guess if some submitter did not answer in that delay, they will probably never do it. I think the bug count will go down again ! 😉

  • #451708 ping & close – xserver-xorg-input-synaptics: Option “GuestMouseOff” “true” not working.
  • #424743 ping & forwarded – X11 pen driver doesn’t work on tabletPC Fujitsu Stylistic 2300 (fix included).
  • #499664 ping, try nouveau – X fails to start with xserver-xorg-video-nv 1:2.1.12-1.
  • #512614 confirmed & upstream – xset dpms rejects reasonable values as illegal.
  • #512711 ping and later closed – All keypresses repeated roughly three times each, makes login impossible.
  • #513128 ping – X server crashes every time when gnome-screensaver starts.
  • #486356 merge with #482592 – numlock led is inversed (using numlockx) .
  • #515737 ping & closed – After upgrading from Etch to Lenny, mouse pointer is very slow and keys don’t repeat.
  • #515840 ping – Desktop is not using full screen after upgrade from etch to lenny.
  • #516860 closed after looking at the git history – Xorg with ‘-sharevts’ use almost 100% of the CPU.
  • #362434 ping & closed, suggested to try nouveau – nv has problems with xcursor-themes.
  • #502131 ping & closed – System gets into a `state’ and fails to process modifier keys.
  • #453296 closed (old ping unanswered) – MacBook: cannot assign right mouse click to lower Enter key.
  • #504537 ping – X server eats CPU on sparc.
  • #502313 ping – Applications are getting “ghost” Alt keypress events, but I press no keys.
  • #527118 ping – autoadded input devices kill X server.
  • #270887 forwarded – startx and xinit do not preserve client arguments.
  • #542542 closed after looking at the git history – non-VGA compatible graphics devices won’t run X.
  • #492888 ping – xorg ignores keystrokes.
  • #543210 merge with #492783 – Alt-F7 to return to X, passes F7 key to top focus’d window.
  • #524413 closed – xauth fails with xorg 7.4, this was actually an xinit bug and the git log lead to #549377 being closed…

The X Strike Force (still) needs you !

You can have a look at the X Strike Force Bug Closing Procedure and check XSF unstable bugs sorted by date.

New Projects pages and Gengo update.

I’ve been adding pages for my Projects. Previously this kind of data was on Trac, but I’ve never been using it actively. And I’m mostly using git for my new development instead of subversion.

I could have used Trac with git, but for project presentation WordPress pages are good enough.

But I wanted to have comments on some pages, which meant a theme update and another Gengo fix. Also I’ve done a big history rewrite by moving my version of gengo to git. If ever Jamie Talbot is really seriously considering starting development again. Then I hope he can pick some patches from my version 😉

Trial and errors with git branches

I’ve recently learned to use git (for my xorg adapted packages) and used it later for netsed.

In order to develop UDP in netsed, I had to try several stuff, my network programming experience in C is back to some school time, so this was really trial and errors. And here git really helps, all I had to do is create branches for each trial, so I don’t loose any tracks I’ve taken, then when I found the right way to do it, I could just merge or cherry pick from the branches (or even just copy past from gitk to my favorite editor gvim) and that was it !

Of course I can now delete the trial branches, but those were really helpful during development time.

This meant abusing of git commit --amend, git merge ( --squash ) and git cherry-pick commands, but well you cannot build a clean code without effort.

I should probably give another look at git stash which seams to fill similar needs.

Taking over Netsed

Netsed, the network packet stream editor, is a program originally written by Michal Zalewski .

While the program idea is good, it’s implementation had some lack, and nobody seamed to care enough to fix it.

I did already hack it some years ago, and it appeared that my changes was fixing a debian RC bug (#586037) so I took netsed maintenance as one of my new projects!

For now only my changes and patches proposed by Mats Erik Andersson are integrated.

But I will start working on a test suite (still have to find the right tools for that, would ruby be nice ?), and of course implement UDP support.

Also I’d like to really thank Mats Erik Andersson and Tim Retout for their answers and support.

Resources:

Building xserver 1.6 for Xorg 7.5

Update: As explained in other posts, I’m no longer using this xserver version myself. So this stays here, but I’m not planning to update it in any manner.

The goal of the xserver downgrading is to run intel IEGD drivers on recent GNU/Linux distribution (debian squeese in my case). This seams to be the only maintained driver for the US15W GMA500 (poulsbo) chipset.

Continue reading