Archive | January, 2011

cat /proc/meminfo : MemTotal

Linux manages it’s physical memory in clever and often efficient ways – as a result it’s not uncommon to only think about how the memory in your system is being used when we run into performance issues. And this is where the frustration can begin – without fully understanding how memory is managed, it can be very difficult to answer some seemingly straight-forward questions like ‘How much free memory do I have?‘ or ‘How much memory is this process taking?‘. There are a lot of complications and as a result performance monitoring can be a challenge.

I was determined to fully understand precisely what the various memory figures report by the kernel mean and understand – on a practical level – the implications of Linux’s memory management on our performance sensitive applications. In this multi-part post we’ll attempt to debunk many of the mysteries of Linux’s memory.

Continue Reading →

validate_sb: bad superblock, error 8

I’ve recently left the dark ages and entered the world of UBI and UBIFS – it’s generally been a pleasant experience. However whilst getting to grips with it, I occasionally recieved the following error upon mount:

# mount -t ubifs /dev/ubi0_1  /tmp/
UBIFS error (pid 1096): validate_sb: bad superblock, error 8
mount: mounting /dev/ubi0_1 on /tmp/ failed: Invalid argument

The usual approach of googling my way out of problems didn’t give me much luck so I did some exploring. The cause of this failure, despite having been successful in flashing the UBIFS image – was that the UBI volume I was using was too small. The solution is therefore to increase the size of the volume.

Unfortunately though, my current project required me to create a UBI volume of only the minimum size to support a given UBIFS image – yet it would seem that determining the minimum size of a UBI volume for a given UBIFS image was not trivial. I had to do some more digging to find the answer…

Continue Reading →

1 second Linux boot to Qt!

At the end of last year, to demonstrate my company’s swiftBoot service, I put together a rather impressive demo. Using a Renesas MS7724 development board I was able to achieve a one second cold Linux boot to a Qt application. Here’s the demo…

Many people see a demo like this and assume there are ‘smoke and mirrors’ or that we’ve implemented a suspend to disk solution. This is genuinely a cold boot including UBoot (2009-01), Linux kernel (2.6.31-rc7) and Qt Embedded Open Source 4.6.2. We’ve not applied any specific intellectual property but instead spent time analysing where boot delays are coming from and simply optimising them away. The majority of the modifications we make usually fall into the category of ‘removing things that aren’t required’, ‘optimising things that are required’, or ‘taking a new approach to solving problems’ and are tailored very precisely to the needs of the ‘product’.

If you’re interested in exactly what modification I made and a little more about the approach taken – you may be interested in these slides which I presented at ELC-E 2010 – I’m also expecting a video of this presentation to appear on Free Electrons in the near future.

You may also remember my last demo based on an OMAP3530 EVM. [© 2011]

Continue Reading →

Reverse GeoCache

My family and I have recently become interested in the ‘sport’ of GeoCaching – as it was coming up to Christmas I thought it would be a great idea to combine their interests with my need for a project to keep me busy. I therefore decided to build a ‘Reverse GeoCache’ as a Christmas present. As this was relatively successful I thought I’d share the details of my build.

GeoCaching is a bit like a treasure hunt – dotted across the globe are more than a million hidden containers (GeoCaches) waiting to be found by those who are aware of their GPS co-ordinates. A Reverse GeoCache however, is a box which will only open in one location. Therefore the (un)lucky recipient of such a device can only discover it’s contents if they are successful in taking the box to the correct location.

Typically with Reverse GeoCaches the location where the box will open is not known – instead the user is prompted to press a button to ‘attempt’ to open the device. If you’re not in the right place the box won’t open and instead the device will tell you how far away the secret location is. Using this method the user can use trial and error to get closer to the final destination. Whilst you can’t buy a Reverse GeoCache – the idea is not new and others have created such a device (see here, here, here and here). Though the fun is always in the making!

With this functionality in mind and the pressing schedule (it was already the first weekend of December) I came up with a rough design, ordered some components online (Maplin, SKPang, CoolComponents and ValueZone) and eventually produced the following:

Continue Reading →