Blog

Boot Time Optimizations - Tslib static modules

05.01.2010 at 10:24

I am trying to speed up the boot process of my little initramfs.

It currently takes about 8.5 seconds from power to the graphical menu. I tested the different kernel compression methods with a patch from Albin Tonnerre which should hopefully end up in 2.6.33. My mesurements show that an LZO compressed kernel saves about 0.5-0.6 seconds.

In kernel land I need to read up on a few things like async/deferred initcalls.

On the userspace front I tried to link my boot application statically which should have 2 advantages.

One thing I need to try out is to link everything statically expect libc which is required by other stuff (kexec, dropbear, busybox). I *think* this should work with a few linker flags but I am not yet sure how it behaves in practice.

-Wl,-Bstatic -leina -lts ... -Wl,-Bdynamic -lc

Fortunately the modular design of the EFL which dlopen(3) modules at runtime also has an option to build said modules statically which means the code will be embedded into the main shared object. This can be enabled at compile time with

./configure --enable-$FOO=static

Unfortunately the same is not possible with stock tslib plugins which is why I wrote a patch to support it.

On a somewhat unrelated note the only thing I hate more than mailing list which are configured for member only posts are mailing lists with slow moderation for non member posts. Grumble.

Marc

» read more » comments

Qi Bootmenu Progress

28.11.2009 at 18:02

I now have a working initramfs generated by these build scripts that launches a bootmenu application which scans the available partitions and presents a list of bootable systems which can be loaded via kexec.

In the process I added uImage support to kexec which means it should work with the current distros out there like SHR which provide uImages for their kernels.

The kernel I am using is based on Lars om-gta02-2.6.31 branch with a few patches to show an openmoko boot logo and my printk verbosity patchset.

The next thing I'm going to do is patching Qi to load an alternative kernel upon AUX press instead of just skipping one.

Then I need to optimize the whole thing for speed. It currently takes between 12-14 seconds (depending on whether I also scan the flash partition, mounting a jffs2 filesystem is slow because of the initial inode scanning I should probably test with ubifs). This is with the debug board attached, I don't know if that makes a difference. The whole uncompressed initramfs content is about 3.4 Mb (this is with network support + dropbear). I should try to remove more unneeded stuff and maybe link a few things statically. And the kernel can probably also be optimized for speed. Using devtmpfs from 2.6.32 for example would make busybox's mdev obsolete (I don't want to use a static /dev).

Anyway the basic functionality is there and I should probably provide a pre built kernel which contains the initramfs for users to test. And gta01 support is also a TODO item of course. My progress can be followed on the distro-devel list.

Marc

» read more » comments

Status update - debug board - #1024-fix

29.10.2009 at 12:36

Ok short status update for the qi-bootmenu thiny which I am playing around with (although I haven't had much time recently). I reduced the image size by disabling/removing the following components:

The resulting image (without the kernel) compiled with -Os is about 4.5MB large. This could be reduced by some 500K if evas could be compiled with -Os but this caused my elementary test application to segfault. In fact any optimization resulted in a segfault only -O0 worked. I will have to update to latest enlightenment svn and see if the problem is still reproducible.

Because it turned out to be rather difficult to debug a network setup problem without a working network I decided to buy a debug board. A serial console is a handy thing. Fortunately Telepixel GmbH which is located in Bern had the debug board on stock which meant I could pick it up from there.

On the hardware front, someone organized a professional #1024-fix for Switzerland which I am interested in because it doubles battery life.

So my next steps will be to make the usb network work in my image for that I will need to integrate the kernel build (until now I have mainly just tested in a chroot environment). I also started with the bootmenu application but as I lack EFL knowledge I will have to spend some time changing that. And I should push my scripts + code to some public git repository.

On a completely unrelated note I got a few mails about dvtm recently. Someone suggested a keyboard multiplexing mode which could be used to control multiple applications at once for example ssh servers something like ssh-cluster but interactive. By now I have implemented it and should probably prepare a point release containing this new functionality.

Marc

» read more » comments

Cross Arch Remote Debugging with gdb and gdbserver

11.10.2009 at 23:31

To further debug a problem in my little initramfs system I recently added gdbserver to the build scripts. And since I have never done that before I might as well document how this works.

gdbserver which runs on the target basically just provides the 'debugging backend' and makes it available to a normal host gdb. This has the advantage that gdbserver is relatively easy to build for your embedded system of choice, it doesn't provide a user interface and therefore doesn't require readline/curses libraries.

So we cross compile gdbserver whose source can be found in the gdb tarball under gdb/gdbserver like this (replace $ARCH with your target architecture in my case it was armv4tl-unknown-linux-gnueabi):

cd gdb/gdbserver

./configure --build=`./config.guess` 
        --target=$ARCH 
        --host=$ARCH 
        --prefix=/usr 
        --program-prefix="" &&
make &&
make DESTDIR=$SOMEDIR install

Then you will need a host gdb which understands the instructions of your target architecture. Your distribution probably only enabled support for your native architecture which means you will have to build your host gdb from source. Note that this time we only set --target and build from the toplevel directory.

./configure --host=`./config.guess` 
        --build=`./config.guess` 
        --target=$ARCH &&
make &&
make DESTDIR=$SOMEDIR install

Now we can start our debugging session. On the target execute gdbserver and specify a port and your executable.

gdbserver :$SOME_PORT /path/to/file/you/want/to/debug

Back on the host connect to the listening gdbserver instance with your host gdb:

$ARCH-gdb
file /path/to/file/you/want/to/debug
target remote $IP_OF_TARGET:$SOME_PORT
set solib-absolute-prefix $ROOT_DIR
continue

The solib-absolute-prefix should point to the root directory of the target on your host. Confused? Well you probably have cross compiled all your stuff for the target and installed it into a directory on your host and this is what I mean with "the root directory of the target on your host". gdb will use the solib-absolute-prefix whenever it needs to load a shared library. What this means is that if the app you are debugging depends on a library gdb will load the library symbols from $ROOT_DIR/lib/libfoo.so instead of /lib/libfoo.so from the host system where it either has the wrong architecture or doesn't exists at all.

Hope this is useful for someone out there. At the very least I now know where to look should I have to do it again in the future when I have already forgotten how it actually works.

Marc

» read more » comments

Font configuration for elementary + framebuffer backend

08.10.2009 at 22:04

I found out what the problem with the elementary hello world application was. The fonts were missing. So how does font configurtion work? To answer this the XFree86 Font De-uglification HOWTO's TrueType Fonts section is useful. You basically have to copy your fonts into a directory and then run:

ttmkfdir
mkfontdir

This generates a fonts.scale file (which you can ignore because evas doesn't care about it) and a fonts.dir file which is read by evas.

The default elementary theme uses Sans as default font so we have to set up an alias for this. This can be done by creating a fonts.alias file containing for example:

Sans -misc-dejavu sans-medium-r-normal--0-0-0-0-c-0-ascii-0

However it is important that there is now trailing white space at the end of the line. Otherwise evas will reject the alias because it doesn't match with a font from the fonts.dir file which doesn't have any trailing spaces. Of course I only found this out after reading through evas source code and in the meantime I was told to just use X -- Sigh.

Anyway while reading through the source I actually noticed that evas also uses the filename without extension as a font name. So a simple symlink like:

ln -s DejaVuSans.ttf Sans.ttf

also works as alias and in this case we don't need the fonts.alias and fonts.dir files.

On a completely unrelated thing whoever came up with the idea to use XML for the fontconfig configuration files should be taken away from computers better sooner than later.

While the font problem is now solved the next thing to investigate is probably touchscreen handling which doesn't quite work the way it should.

irc

I have never been a heavy user of irc (if you are not paying attention you can just waste too much time with senseless flamewars) but sometimes it's actually a useful medium to get some answers in real time. Anyway because I haven't used my original irc nick for quite some time someone else has overtaken it's ownership. Yeah I really should add a few lines to my login scripts which authenticate my irc nick on freenode and oftc. Anyway registered some new nicks, I am now known as }mat or ]mat.

Marc

» read more » comments

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 >>