New Feature for Linaro Image Tools: Android Hwpack

29 Jan
2013/01/29

Finally, after some delays, Linaro Image Tools now has support for Android hardware pack (or Android hwpack).

What is an Android hwpack

Let’s start with with clearing out the confusion the term “hwpack” has in this context.

Generally speaking, for Linaro Image Tools an hwpack is a tar-ball that contains Debian packages, some configuration and metadata files, and some directory structures, needed to create and install bootable operating system images.

Linaro Image Tools has had support for this kind hwpack since the beginning of time, but they are not necessary to create Android bootable images. The process to create an Android image is slightly different.

This new hwpack, the Android hwpack, is just a configuration file, based on the same syntax of previous Linaro Image Tools hwpack, that stores information necessary to correctly create Android images. An Android hwpack does not contain any Debian packages nor binary blob or anything else, it is just a text file (a YAML file for instance).

It’s probably better to call is “Android configuration file“.

Why an Android hwpack

The necessity for this came out during last Linaro Connect Europe, from the Android team. The needs were an easy way to add support for new boards (without having to hack into Linaro Image Tools code), the possibility to change board parameters (almost) “on-the-fly” for testing (without having to touch code), and the possibility to maintain backward compatibility by providing some kind of “versioned” hwpack, guaranteed to work for specific Linaro releases.

How to use it

In order to use it, you need to have at least Linaro Image Tools version 2013.01. At the time of this writing, Android hwpack support is also being built into the Android boot tarball, so it should be totally transparent for the user: no need to add command line arguments and to pass file paths.

Still, it is possible to pass an Android hwpack to Linaro Android Media Create, the command line tools that creates Android bootable images. The command line argument is the same as Linaro Media Create one: –hwpack

So, if you want to use the new feature, arm yourself with an Android hwpack file (examples can be found on GitHub), and run:

linaro-android-media-create --mmc /dev/sdc --dev panda --boot boot.tar.bz2 --system system.tar.bz2 --userdata userdata.tar.bz2 --hwpack panda-hwpack

Backward compatibility has been maintained: the old hard-coded values have been kept, so it is still possible to use everything in the old way.

If you find bugs, of other possible improvements, feel free to leave them in the comments below, or better on Launchpad.

Fixing Network Errors in VirtualBox

22 Jan
2013/01/22

This is that kind of post that are more necessary to me for remembering than anything else. Lots of digital ink has already been spent on this topic, but, as others I guess, I find that writing down things helps me remembering them (and mind-maps are precious on that front).

VirtualBox Clone Operation

I have a couple of local virtual machines installation for Ubuntu desktop and Ubuntu server, usually the latest LTS ones, and I clone them as I needed: I need to test some scripts, or the installation of a program, like it was being performed on a real installation.

VirtualBox has this nice little feature of creating clones of your virtual machines, and in no time you are up an running with a clean environment (as long as you remembered to take a snapshots at a good point in time).

The Error

When you clone a virtual machine, you are cloning everything of it, configurations included. And that’s where the problem is. The network will not work at all, and ifconfig will tell you that there is no interface configured.

The Solution

The solutions lies in one file:

/etc/udev/rules.d/70-persistent-net.rules

Open that file with your editor, remove the offending line and reboot.

In this case the offending line is an erroneous “eth*” interface, that will results in multiple network entries in that file when just one is needed. Pay attention to the MAC address of the network interface though.

Book Review: Think Like a Programmer

17 Jan
2013/01/17

This is my first attempt at writing a book review, so bare with me if it is not the best around. And here the “usual” disclaimer: I received a free copy of “Think Like a Programmer” from NoStarch Press.

The book: Think Like a Programmer an Itroduction to Creative Problem Solving

Think Like a Programmer Book Cover

Think Like a Programmer book cover.

As the titles goes, this is not only a book about programming or development, it is an exercise on problem solving and thinking. The book has one of the best starts I could imagine: puzzles. Funny puzzles, those that nowadays scare candidates during the hiring processes at big companies.

The puzzle-pace is kept for the first two chapters, and the author guides you into well detailed examples of problem solving: how to break a problem into smaller parts, how to apply your knowledge to unknown problems, where and how to recognize patterns.

After these two introductory chapters, things start to get serious. Complex concepts are introduced: arrays, pointers, classes, dynamic memory… and the problems accompanying them resemble real-life ones. To fully grok these sections, a good knowledge of C++ is needed. The author introduces each new topic with the basic needed coding knowledges, but if you do not have any previous C or C++ skills at all, the examples and the exercises might be daunting.

The book is broken into 8 chapters and you can perceive the complexity increasing up to a peak in the middle ones. The last two chapters are less demanding and the concepts introduced are not tied to any particular programming language: they step into the realm of software engineering, code reuse and something I would refer to as task management.

In the End…

It is not meant to be a cookbook, nor something you can use as a reference manual. You have to embark yourself , and let the author sail you through a journey of discoveries, learning and problem solving, being patient and going through the proposed exercises. It is a training for your brain, for your code writing-fu, and mostly for how to approach problems and how to tackle them.

The Last Password

13 Jan
2013/01/13

Being overwhelmed by passwords, for all the disparate websites you have to login to, plus trying to keep safe password for personal and work activities without sharing the same ones, was starting to get harder. Too many websites, to much passwords.

The Last Password to Remember

As a colleague of mine suggested, I tried out LastPass. A nicely done online services that offers you the possibility to have a secure password vault where to store your passwords and identities. LastPass integrates also with your browser and helps you:

  • Filling out forms: you can store all your credentials and credit card info too
  • Logging into the stored web sites, also automatically if you tell it so
  • Creating one time and secure passwords
  • Updating the passwords when it detects you are changing them
  • And lots more…

You can even use it with a YubiKey and with Google Autheticator for a two-factors authentication, and it also has a “security challenge” where it tells you if any of your accounts were compromised or how strong are your passwords.  The service is really well done and provides you with a smooth experience (even if the graphical web interface is not the best around).

But it is not open source. This is the kind of service I would like to have as a truly open source project. Are there any open source project like this out there?

In case you want to give LastPass a try, you can use this referral URL: https://lastpass.com/f?1328416

Working from Home, Six Months Later

12 Jan
2013/01/12

Almost six months ago I started working for Linaro, from home. It was the first time for me with a home-based job, and I’m enjoying every minutes of it.

Before joining Linaro I did my fairly amount of researches on the Internet about how to organize your workday and also your life: try to do as if you had to get ready for office, eat & drink, do not always stand sit…

I didn’t change much of my usual habits, and I’m trying to keep home and work activities as much as possible separate from each other. Sometimes they will interfere, but I guess it is normal, as long as you remember to stick to your plan of separating them.

So, this is something I would call my usual day…

Getting Out of Bed

I’m an “early bird” as to speak.

I like getting up early in the morning. Luckily from where we live, opening the window we can see the sea and the sun rising. Getting out of bed is not that bad after all.

During the warmer months I also enjoy going out jogging for 40 minutes, during the colder months I usually start my days with a 30-40 minutes training. Nothing much heart-pumping, and everything weight-free, just free body weight: abs, squat, push-ups, and lots of stretching (sometimes even yoga, but my yoga-skills are really rudimentary). On the Internet you can find plenty of videos and web-sites on how to train in the correct way and for how much, so you still get to vary your training (I still haven’t found a really good Android app for something I would call zen-training: a mix of body and mind exercises, that doesn’t get much into the way, and that suggests you exercises).

Shower, that helps me like a caffeine shot (I do not drink coffee, even if I drink tea), and a big breakfast. Breakfast that for me is the most important meal of the day.

No computer or any electronic gadgets activities until after breakfast.

The Work Day

I sit in front of the PC around 8-8.30, checking emails, reading newspapers and the usual social websites. At 9, my (virtual) pomodoro clock usually starts ticking. I try to organize my working days in that way, sticking to the pomodoro technique as much as possible, and having pomodoro times also for checking IRC and other work related activities I have to do online.

Code, Eat & Drink

I always have something to drink next to my keyboard. Sometimes it even gets on my keyboard, but that’s another story…

Tea in the morning, that usually propels me almost close to lunch time, then water. I do not eat anything else in the morning, and in the afternoon sometimes I have a little break and usually I eat a fruit. At lunch time, I cook: I enjoy cooking, and it is one activity that me and my girlfriend enjoy doing in the evening together. It is a good moment for talking, and for preparing food.

Getting Into Bed Again

After dinner, we spend time on the couch watching movies, or doing our open-source-communities related activities. I also enjoy doing a 10-15 minutes streching/yoga session before getting into bed again. And before falling asleep, I always read a good book.

As in all rules that you set for yourself, form time to time I do not follow them, without feeling guilty. I need the liberty of doing what I like to do, with the confidence of getting back to my habits.

Convert a bazaar repository into a git one

08 Jan
2013/01/08

Yesterday, for a work task, I needed to convert a bazaar repository into a git one, to store code for other teams (that mostly use git) to work on. The bazaar repo was very simple actually, small history and it didn’t contain any merges.

Read The Docs™

Or almost… The first thing I did was heading other bazaar extensive documentation, in particular to its wiki sections on plugins. And there you have it, just an install-command away, ready to work: bzr-fastimport. Yeah, it says import, but it works also on the export part.

The steps I took:

bzr branch repo git-repo
cd git-repo && git init
bzr fast-export `pwd` | git fast-import
rm -rf .bzr

It should work also for fairly complex projects, though I didn’t try it on one.

Home Made Media Center with Ubuntu

07 Jan
2013/01/07

During the Christmas holidays I spent some time “refurbishing” a netbook me and my girlfriend have, but is not used, into an home-made media center, running (at the moment) plain Ubuntu 12.10.

We watch some TV, during and after dinner, mostly for TV series and movies, and we used to do that loading everything on a USB key attached to the TV. A boring, and repetitive task. So why not giving some new life to that small netbook?

Ingredients

All the ingredients for this recipe are:

  • A netbook (this one has an Atom N570 CPU, 1GB RAM, 500GB disk)
  • Copy of Ubuntu 12.10 32-bit
  • VGA cable
  • 2 USB hard-disks
  • A Hi-Fi system (optional)

Installing the operating system, the necessaries codecs and all the updates is an easy-peasy experience nowadays. Nothing special to report, everything works flawlessly. After connecting all the cables, safely hidden from the eye (the back of the TV is turning into a jungle), the netbook-turned-media-center is now stored in a shady place in the living room, connected to the TV via its VGA cable (unfortunately the only video output), linked to the Hi-Fi via Bluetooth (hurray! one cable less!), with close to 2TB of USB-connected disk space, sharing videos and music on the internal network.

At the moment I’m piloting the media center via a VNC connection from a Nexus 7, but I’m planning to find a (or write my own) keyboard and mouse app for the tablet to pair up via Bluetooth with the netbook. Or a special Ubuntu oriented Android app to control an Ubuntu machine in an easy way.

I tried installing Rygel to serve media files, but had no luck in making it work. I will have to dig deeper and give it another try. The other solution I was pondering was to install XMBC. Time permitting, I’ll probably try it out.

Of course everything is not perfect: I have some high quality videos, Matroska files weighing from 2 to 8 GB, that the system is not handling in a good way. The smallest ones are not reproduced correctly, audio and video are out of sync, the biggest ones are not reproduced at all: or you get video, or you get audio. Guess the decoding is not that fast to handle everything is a smooth way. Listening to music via the Bluetooth connection to the Hi-Fi, is not as bad as I would have thought: it actually provides a really enjoyable experience.

Eternal Editor Search

04 Jan
2013/01/04

Finding the perfect code editor

In my eternal search for a no resource hungry (Python) code editor that can help you getting things done easily and quickly, I started using SublimeText at its 2.0 version (albeit not being an open source project).

I never used Mac OS X TextMate, but some people described SublimeText as a valid alternative to that editor, and I always heard good words about TextMate.

After using SublimeText for almost 4 months, I’m finding myself really happy with the cool working experience it provides and its capabilities.

What I found most interesting in these months are:

  • Loads of plugins
  • Code completion (through one of its many plugins)
  • JSON based configuration files
  • Great project support, with almost instant project switch through the command palette
  • A very responsive command palette
  • Integration with static code analysis tools
  • Powerful editing capabilities (multi-selection editing in primis)
  • Possibility to integrate the Python debugger
  • Integrated Python console
  • A “disctraction free” mode (now called it like that, but it is just full screen editing

It has extensive documentation, and also nifty video tutorial to set-up a dev environment with ease.

In the next months I will polish my vim-fu, I want to do some tests using the Chromebook with its Chrome OS for development purposes. Almost all of my dev activities happen online, and through a Google hosted account and Chrome OS has a decent shell with SSH support (and also different SSH plugins available in the Chrome Web Store). I just need a VM, or a VPS somewhere, where to store the code and all the development tools, and see how it plays out.

Think Like a Programmer

01 Aug
2012/08/01

Another quick post for a small promotion, always from the lovely No Starch Press. This time is the turn of the book “Think Like a Programmer“, by V. Anton Spraul.

As for the previous promotion, you can get 40% off on the paper version, plus the DRM-free ebook versions. The promotion lasts one week, and here is your chance to have it:

http://nostar.ch/TLAP_Promo

I’m reading the book now, No Starch asked me to write a review, and I have to say it is an enjoyable and challenging reading.

Go get it, for new programmers and also for seasoned ones, it is always interesting to challenge your mind and your knowledge.

Multiple Boards and Bootloaders on a Single Hardware Pack

27 Jul
2012/07/27

Multiple Boards and Bootloaders

Finally, Linaro Image Tools has support for multiple boards and multiple bootloaders on single configuration file and hardware pack.

Linaro Image Tools

Linaro Image Tools is a set of command line utilities that help in the creation and installation of Linaro built operating system images so they can be run on ARM based computers.

With Linaro Image Tools you can take a generic ARM Ubuntu or Android operating system image and customise it with the hardware specific packages needed to make it run on a specific board. These hardware specific packages are found in a hardware pack, which itself is generated using a tool, linaro-hwpack-create and a configuration file.

The old days

Old days computer

The Old Days of Computer

In the “old days”, this configuration file (an INI-style configuration file) and hardware pack held information for just one ARM board: it was not possible to define a single configuration file for multiple boards that shared most, if not all, of the same configuration and as a consequence, the resulting hardware pack could only be used with a single device too.

Starting with the new 2012.07 Linaro Image Tools release, it is now possible to support multiple boards/devices and multiple bootloaders with a single hardware pack. This should speed up development because one hardware pack can be used for several boards running similar hardware, reducing the number of hardware packs that need to be created to test new code on multiple devices.

A new configuration file format has been created: now based on YAML, it enables engineers to express more complex scenarios, and Linaro Image Tools has been expanded to support this new format.

Backward compatibility is maintained: the old version 2 format is still supported, but it will be deprecated in the Linaro Image Tools 2012.08 release, when the new version 3 format will have had enough use to have any bugs found and fixed.

The very old version 1 format is now completely unsupported and the ability to read these files will be dropped from Linaro Image Tools with the 2012.08 release.

With these changes, a new command line tool has been written to help engineers convert an old version 2 configuration file format into a version 3 one: running linaro-hwpack-convert <config-file> will create a version 3 configuration file called <config-file>.yaml (after that you can remove the suffix, it is not necessary, but we keep the old file for you). This file is then used by linaro-hwpack-create to create a new style hardware pack. The procedure for creating a hardware pack has not changed and Linaro Image Tools will automatically detect and use the new format.

The only thing that changes when you use linaro-media-create is you can now specify a bootloader for a hardware pack that can provide more than one. Predictably, this option is –bootloader <bootloader name> and if you want to know what your options are, you can query a hardware pack by using the –read-hwpack option:

linaro-media-create --hwpack hwpack_linaro-lt-panda_1_armhf_v3.tar.gz --read-hwpack
+--------------------------------------+--------------------------------------+
Supported boards                       | Supported bootloaders
+--------------------------------------+--------------------------------------+
linaro-lt-panda                        | uefi,u_boot
+--------------------------------------+--------------------------------------+

linaro-media-create –hwpack hwpack_linaro-lt-panda_1_armhf_v3.tar.gz –bootloader u_boot …

Unfortunately, not all of the features described here are already available in the 2012.07 release of Linaro Image Tools. What is available at the moment is:

  • Converter from old configuration file to new one.
  • Support for the new YAML syntax.

The code with all the features was merged after the release, but is already in for the 2012.08 one. And if you feel adventurous, you can get the development version and test it out.

If you find any bugs, or want to suggest improvements, please do so in the Linaro Image Tools Launchpad page.

This post was written by James Tunnicliffe and me