-
ANNOUNCE: kmod 3
Hey, kmod 3 is out. Really nice to finish this release. I was hoping to have it between the holidays, but there were some major bugs pending. It’s nice to see udev from git already using it instead of calling modprobe for each module. Kay reported a hundred less forks on bootup after start using libkmod and libblkid.
It’s nice too receive feedback about other architectures that we don’t have access, too. With kmod 3, sh4 joined the other architectures that were tested with kmod.
Since I’m already doing the announcements to the mailing lists, I’ll not repeat the NEWS here. Just look at the archives if you didn’t receive the email.
Happy new year!
-
Given enough eyeballs, all bugs are shallow
So, in last post I said kmod 2 could be released sooner than expected if there were major bugs. Not as much as a surprise, there was 1: depending on the alias passed to the lookup function we were blocked iterating a list.
It’s now fixed in git tree. Thanks to Ulisses Furquim for fixing it and Dave Reisner for the bug report. We already have some other great stuff implemented so we’ll soon have another release.
Another great news is that now we have the maintainer of module-init-tools (Jon Masters) cooperating with us. We will discuss how the two projects will co-exist/merge. So, for now on the official mailing list of the project is linux-modules@vger.kernel.org.
-
ANNOUNCE: kmod 1
For some weeks now I and Gustavo Barbieri at ProFUSION have been working on a new library and a set of tools, libkmod and kmod respectively. This is the announcement of its first public release.
Overview
The goal of the new library libkmod is to offer to other programs the needed flexibility and fine grained control over insertion, removal, configuration and listing of kernel modules. Using the library, with simple pieces of code it’s possible to interact with kernel modules and then there’s no need to rely on other tools for that. This is a thing lacking on Linux for a while and it’s one of the items in the Plumber’s Wish List for Linux. Quoting it:
provide a proper libmodprobe.so from module-init-tools:
Early boot tools, installers, driver install disks want to access
information about available modules to optimize bootup handling.We went one step further and not only we are able now to give an API to load and remove kernel module, but also all the other common operations are being added to this API. The first user for this API will be udev. In a recent Linux Desktop (and also several embedded systems) when computer is booting up, udev is responsible for checking available hardware, creating device nodes under /dev (or at least configuring their permissions) and loading kernel modules for the available hardware. In a kernel from a distribution it’s pretty common to put most of the things as modules. Udev reads the /sys filesystem to check the available hardware and tries to load the necessary modules. This translates in hundreds of calls to the modprobe binary, and in several of them just to know the module is already loaded, or it’s in-kernel. With libkmod it’s possible for udev with a few lines of code to do all the job, benefiting from the configurations and indexes already opened and parsed. We’ve been talking to Kay Sievers (udev’s mantainter) and Lennart Poettering (systemd’s maintainer) regarding this and we are looking forward to have udev using libkmod soon.
Example code:
To insert a module by name without any options and strange configurations it’s sufficient to do as following (without treating errors for easy of comprehension – see the documentation for possible errors):
struct kmod_ctx *ctx = kmod_new(NULL, NULL); struct kmod_module *mod; kmod_module_new_from_name(ctx, name, &mod); kmod_module_insert_module(mod, 0, NULL); kmod_module_unref(mod); kmod_unref(ctx);
Tools
Besides doing the library, we are re-designing the module-init-tools tools on top of the new API we created. With this first version we are already providing compatible binaries for lsmod, rmmod, insmod and modprobe, the last one with some functionality missing. Next versions we plan to fill the gaps with the provided tools and provide all the others like depmod and modinfo.
License
We try to avoid issues regarding licences: the library is licensed under “LGPLv2 or later” and the tools are under “GPLv2 or later”. There’s still lots of work to be done and places to optimize. We greatly appreciate contribution from other developers.
Roadmap
The API is not set on stone and is going to suffer some changes in future releases as we see fit to finish implementing all the tools. Below is the list of the features already implemented
kmod 1
libkmod provides the necessary API for:
- List modules currently loaded
- Get information about loaded modules such as initstate, refcount, holders, sections, address and size
- Lookup modules by alias, module name or path
- Insert modules: options from configuration and extra options can be passed, but flags are not implemented, yet
- Remove modules
- Filter list of modules using blacklist
- For each module, get the its list of options and install/remove commands
- Indexes can be loaded on startup to speedup lookups later
Tools provided with the same set of options as in module-init-tools:
- kmod-lsmod
- kmod-insmod
- kmod-rmmod
- kmod-modprobe, with some functionality still missing (use of softdep, dump configuration, show modversions)
Following is a rough roadmap for future releases:
kmod 2
- Provide the API for features missing in kmod-modprobe, namely: dump configuration and indexes, soft dependencies, install and remove commands. Features relying on ELF manipulation will still be missing;
- Provide all the tools available in module-init-tools. Some of them like depmod may be entirely copied from module-init-tools for later convertion;
kmod 3
- Provide a single kmod tool that will abstract all the others, accepting commands like “kmod list”, “kmod remove”, “kmod insert”. Distributions may then use symlinks from current tools to the kmod binary and we can kill the ‘kmod-*’ test tools that we are introducing in kmod 1;
We thoroughly test the features implemented in kmod, but like any other software it’s possible to contain bugs that we didn’t find; we may decide to release new versions between the versions above and then this numbers change. Otherwise kmod 2 will already be sufficient for udev to pick it up as a dependency and start benefiting from the fine grained control over its operations with kernel modules.
Repositories
The repository for this project is located at http://git.profusion.mobi/cgit.cgi/kmod.git/
Package with kmod 1 source code can be downloaded from: http://packages.profusion.mobi/kmod/
Thanks
Last I’d like to thank Kay Sievers for his support in reviewing code, giving advices and helping to design kmod.
-
AndroidConf 2011
Hoje dei uma palestra na AndroidConf sobre “Modificando a API do Android”. Referências ao projeto que falei sobre AVRCP podem ser encontradas em um post meu anterior. Estou disponibilizando abaixo os slides.
EDIÇÃO 02/12/2011: coloquei uma nota no slide 7, relatando o que falei durante a apresentação sobre uso de IDE.
Para aqueles que não conseguem visualizar acima, segue o link direto para a apresentação.
-
LinuxCon Brazil
I’m back from LinuxCon Brazil, that was held in Sao Paulo on 17 and 18 November. Before the first keynote, ProFUSION was announced as becoming member of Linux Foundation
! Our logo is already in their members page.It was also a great time to talk again to some developers I met in LinuxCon Europe last month and some that were not present there. One talk I really like was given by Eugeni Dodonov about the Intel Linux Graphics stack. It was a good overview of all the graphics stack in Linux, paying attention to Intel’s boards and drivers. Gustavo Barbieri talked about HTML5 and WebKit and other 2 ProFUSION’s employees — Rafael Antognolli and Bruno Dilly — presented “Application Development using Enlightenment Foundation (EFL)”
This time I also gave a presentation entitled “How to become an open source developer”. My focus was on the Brazilian crowd out there, willing to start to contribute to open source projects, looking for a job or just trying to understand why we do open source development. I hope it was useful for them and for you reading this blog, too. So, below are the slides of my presentation:
For those of you who can not see the file embedded above or want the direct link, here it’s in PDF format.
I also talked to some important people regarding a new project of mine. Stay tuned for a new library soon.
-
Back from Kernel Summit, LinuxCon Europe and ELCE
Last week from 23-Oct to 28-Oct I was at 3 conferences in Prague, Czech Republic, together with Gustavo Barbieri, Gustavo Padovan and Ulisses Furquim: the ProFUSION crew in Prague.
Starting from Kernel Summit, I had the opportunity to join the Bluetooth Summit and participate in the discussions regarding this subsystem in Linux, both in kernel and user space. We had a lot of hot topics to discuss, including the upcoming BlueZ 5.0, Bluetooth 3.0 (high speed), Bluetooth 4.0 (low energy) and I could also demonstrate the work I’ve been doing with the AVRCP profile. I’m glad it received a good acceptance from other developers. Some of them I didn’t know personally such as Luiz von Dentz, Claudio Takahasi, Vinicius Gomes. Others I had the pleasure to meet again like Marcel Holtmann and Johan Hedberg.
(We didn’t discuss only bluetooth related things. We noticed that more than 1/3 of the people there, working in the core of Bluetooth in Linux, was Brazilian and soon we were discussing with Samuel Ortis – a French, maintainer of ConnMan – who is the best soccer player
.)Daniel Wagner from BMW also brought up some interesting scenarios of multiple devices connected through Bluetooth in car kits and helmets (like this one): HFP, A2DP, HSP (and maybe also AVRCP?). All of them interacting and working together at the same time. Since the gstreamer conference was also taking place at the same facility we could also discuss with PulseAudio developers. In the end, it seems BlueZ and PulseAudio are working pretty well together, though we still have to polish some rough edges for some use cases like this.
Being at Kernel Summit was a great time to meet developers of other parts of the kernel too, such as Steven Rostetd and Peter Zylstra, with whom I had more contact some time ago when I was working in the Linux scheduler.
When the Kernel Summit was over (on Tuesday), LinuxCon and ELCE were taking off. It was great to have once more these two conferences collocated and being able to attend talks on both of them. There were several talks I’d like to attend but some of them were overlapping.
I’m looking forward to see the recorded talks later this year[1]. It would be too extensive to detail each one here, so I’m just detailing some of them that grabbed more attention from me.Gustavo Barbieri and Sulamita Garcia talked about Demistifying HTML5 and how it can be used to develop Apps. Gustavo focused on the EFL port of WebKit (in which I’m one of the developers
) and the underlying technologies. It seems like the mentality of “let’s do apps in a very high-level language” instead of “providing a native language in a sdk” is coming back. Differently from what happened some years ago, this time maybe it will work out. Only future will show us.Since this year I got involved with Android and development of the platform, I went to several Android-related talks. Leveraging Android’s Linux Heritage was really good stuff, showing how to replace some parts of the Android platform: bash instead of the I-wanna-be-a-shell that comes with Android by default, putting gstreamer in, optimizing some parts of the code, etc. In the same tune there was another talk entitled Build Community Android Distribution and Ensure the Quality. Interesting (but not surprising) to see how hard is to contribute to AOSP and how Android is much different from other open source projects we are used to.
Another interrelated areas that I have interest in (maybe because I work for a company related to embedded systems
) are system initialization, fast boot and development boards (such as Pandaboard). Therefore I attended systemd Administration in the Enterprise and Integrating systemd: Booting Userspace in Less Than 1 Second. The former, given by Lennart and Kay, focused on detailing some systemd features for guys running enterprise servers while in the latter Koen told us about his experience reducing boot time by using systemd in a Pandaboard. In this last talk I also met Jean Christophe, one of the developers of barebox (a bootloader aiming to replace U-Boot). Last time I checked, pandaboard was not in the list of supported boards but I was greatly surprised that now it is. Barebox has the advantages of running with caches enabled, having an architecture much more beautiful and being much faster than u-boot. In summary, IMHO it’s a bootloader done right.Other interesting talk was Tuning Linux For Embedded Systems: When Less is More, in which Darren Hart gave instructions to reduce boot time and image size in very resource constrained scenarios (he was aiming a rootfs of only 4MB and total boot time under a second). Some key things to know is how to investigate what is not important to the application, what can be removed from kernel/userspace in order to fit the requirements and when to replace, why to replace and what to replace. Last but not least, in Developing Embedded Linux Devices Using the Yocto Project and What’s new in 1.1 David Stewart gave a status quo of the Yocto project. Interesting how the project evolved over this year and next time someone doing embedded systems think about ruling out its own distro from scratch, it would be good to look at Yocto.
I met a lot of other people for whom I apologize not citing their name here. This post would be yet bigger than it already is. I had a really great time their and I hope to continue going to these conferences. And the next one is LinuxCon Brazil, in which I’ll talk about How to Become an Open Source Developer. I look forward to seeing all of you there.
I’d like to thank the Linux Foundation for organizing such a great event and ProFUSION to allowing and sponsoring me to be there.
Side note: the problem is that now I want to do a lot of things in different projects without having time to to: systemd, Linux kernel, BlueZ, pandaboard, barebox, Android, etc
[1] UPDATE: videos have been published - http://free-electrons.com/blog/elce-2011-videos/
-
AVRCP 1.3 on BlueZ
During the past weeks I’ve been working again on the BlueZ project and now we can finally announce that the AVRCP 1.3 profile is officially supported.
Technical background
For those who don’t know what I’m talking about, here comes a little background for those buzzwords:
BlueZ is the user-space part of the Bluetooth® technology stack used on Linux and Android. It has support for several Bluetooth profiles such as RFCOMM, HID, PAN, PBAP, OBEX, HFP, A2DP (some of them are implemented as separate projects) that are defined by the Bluetooh SIG. In simpler terms, BlueZ is what allows your Linux device to do amazing things with Bluetooth technology such as stream stereo music, make phone calls and other wireless magics.
One of these profiles supported by BlueZ is AVRCP (Audio/Video Remote Control Profile), which allows two devices to communicate through Bluetooth technology and exchange commands/messages to control the music/video being played.
New features
Until some weeks ago BlueZ only had support for version 1.0 of the AVRCP protocol. This early version allows a Controller device (e.g. a Bluetooth technology-based car kit) to tell the Target device (e.g. a smartphone) to play, pause, go to next music and go to previous music. We’ve now upstreamed an implementation of AVRCP Version 1.3, which adds some nice features to the previously supported version, such as:
- Transmitting metadata of the music being played;
- Change Application Settings such as Equalizer, Repeat, Shuffle and Scan modes;
- Set current status of media playback: playing, stopped, paused, forward-seeking, reverse-seeking.
Some time ago I bought a Bluetooth stereo car kit. How boring it was having the ability to stream music from my phone but not see any information regarding who was playing, which album, etc. This is no more. Now we have proper support for AVRCP 1.3
. Our ProFUSION team utilized the open source baseport for the OMAP™ processor-based Blaze™ mobile development platform from Texas Instruments Incorporated (TI) to help achieve this milestone. Additionally, we worked together with TI on testing and debugging to make this AVRCP 1.3 support a reality. Below you can see yours truly holding a Blaze™ mobile development platform from TI, sending music metadata to a Bluetooth technology-enabled car kit. -
ANÚNCIO: genslide 0.3
É com satisfação que anuncio a primeira versão do programa genslide, genslide 0.3. É um simples programa que criei para facilitar a conversão de letras de música em slides, salvando-os em pdf através de Latex/Xelatex. Esses slides podem ser usados durante shows e cultos e venho usando-os já faz 6 meses na igreja que eu frequento. Embora ainda tenha bastante coisa para ser feita, ele já se mostra bastante útil e facilita bastante na hora de criar novos slides.
A ideia é que o usuário não se preocupe com muito com a formatação, apenas com a divisão de título, estrofes e coro. Se você é da área de computação, isso se traduz dizendo que a gramática é bem simples. Uma símples música, contendo o título e 2 estrofes:
Esse é um título de exemplo
A primeira linha da primeira estrofe
A segunda linha da primeira estrofe
A terceira linha da primeira estrofe
A primeira linha da segunda estrofe
A segunda linha da segunda estrofe
A terceira linha da segunda estrofe
Existem alguns recursos adicionais, como marcação de uma estrofe como coro e marcação de um trecho da música para repetição. Além disso, nem sempre a frase cabe nos espaço disponível do slide. A divisão em várias linhas é feita de forma automática, bem como a divisão entre os slides. Assim, se você tiver uma linha da forma abaixo, ela será automaticamente dividida em 2 ou mais linhas.
Essa é uma linha realmente longa que não caberia em uma única linha no slide
Outro recurso interessante é a integração com o site de letras do Terra. Dessa forma é possível gerar os slides simplesmente passando o link para a letra nesse site. Por exemplo, para gerar um slide da música “Pra cima Brasil”, do João Alexandre:
$ genslide-bin http://letras.terra.com.br/joao-alexandre/46505/
A aparência dos slides finais é dada por um conjunto de arquivos que formam um tema. O tema que uso atualmente é bem simples, mas nada impede que temas mais sofisticados sejam criados. Atualmente a linha acima geraria o conjunto de slides abaixo. Espero que esse programa seja útil não só para mim, mas para todos que precisam fazer esse tipo de conversão.
Download
Você pode fazer o download de genslide na página de downloads do programa. A última versão, 0.3, pode ser obtida em formato tar.bz2 ou zip. Tudo o que você precisa é ter python3 instalado (testado somente em Linux).
Hacking e feedback
O código-fonte da última versão está disponível acima ou, para a última versão de desenvolvimento, você pode fazer o download no repositório do projeto.
-
Criando imagens customizadas de endereços de email
Endereços de email são muitas vezes mascarados na web para que não sejam facilmente obtidos por programas que tem por objetivo enviar spam. É relativamente fácil escrever um programinha que fica vasculhando a web em busca de endereços de email, cadastrá-los em um banco de dados e depois utilizá-los como quisermos. Para que isso não ocorra, várias vezes nos deparamos com endereços de email passados como “joao AT gmail DOT com” ou alguma coisa do tipo. Outra técnica muito utilizada é transformá-lo em uma imagem. Dessa forma o programinha malicioso que a princípio era fácil se torna bem mais difícil.
Eu acho que hoje em dia temos bons programas de anti-spam, o que torna os métodos acima não tão relevantes. Porém, acredito que converter o endereço de email em uma imagem o deixa bonito. Veja por exemplo a minha página de contatos. Fazer imagens desse tipo apara domínios conhecidos como “gmail.com”, “hotmail.com” e “yahoo.com” é bem fácil: vários sites permitem que você escolha um desses domínios e escreva o seu email. Um que eu gostei foi o do freetechjournal, pois tem vários domínios ali dos serviços de email mais populares. É fácil encontrar serviços semelhantes que permitem alguma customização.
Procurei bastante na web algum site que permitisse criar um email com uma imagem de domínio customizada, porém não achei nenhum. Como é uma operação bem simples, resolvi fazer um script em python para isso. Estou disponibilizando o iconifymail, que contém também a imagem usada para a empresa em que trabalho, ProFUSION, que pode servir como base para que você faça a sua própria imagem (obrigado, Marina). O uso é bem simples, basta passar como primeiro argumento a imagem a ser utilizada como domínio e, como segundo, o seu endereço de email (sem o domínio). Algumas coisas eu deixei hard-coded no script, mas creio que seja fácil adaptá-lo para o tamanho de imagem que você quiser. O resultado final é o que pode ser visto abaixo e também na minha página de contatos:
Essa é a versão 0.1 do iconifymail, open source, disponibilizado sob GPLv3. Se você quiser contribuir, pode usar os repositórios git: oficial ou mirror.
-
Easily embedding WebKit into your EFL application
This is the first of a series of posts that I’m planning to do using basic examples in EFL, the Enlightenment Foundation Libraries. You may have heard that EFL is reaching its 1.0 release. Instead of starting from the very beginning with the basic functions of these libraries, I decided to go the opposite way, showing the fun stuff that is possible to do. Since I’m also an WebKit developer, let’s put the best of both softwares together and have a basic window rendering a webpage.
Before starting off, just some remarks:
- I’m using here the basic EFL + WebKit-EFL (sometimes called ewebkit). Developing an EFL application can be much simpler, particularly if you use an additional library with pre-made widgets like Elementary. However, it’s good to know how the underlying stuff works, so I’m providing this example.
- This could have been the last post in a series when talking about EFL since it uses at least 3 libraries. Don’t be afraid if you don’t understand what a certain function is for or if you can’t get all EFL and WebKit running right now. Use the comment section below and I’ll make my best to help you.
Getting EFL and WebKit
In order to able to compile the example here, you will need to compile two libraries from source: EFL and WebKit. For both libraries, you can either get the last version from svn or use the last snapshots provided.
- EFL:
Grab a snapshot from the download page. How to checkout the latest version from svn is detailed here, as well as some instructions on how to compile
- WebKit-EFL:
A very detailed explanation on how to get WebKit-EFL up and running is available on trac. Recently, though, WebKit-EFL started to be released too. It’s not detailed in the wiki yet, but you can grab a snapshot instead of checking out from svn.
hellobrowser!
In the spirit of “hello world” examples, our goal here is to make a window showing a webpage rendered by WebKit. For the sake of simplicity, we will use a default start page and put a WebKit-EFL “widget” to cover the entire window. See below a screenshot:
The code for this example is available here. Pay attention to a comment in the beginning of this file that explains how to compile it:
gcc -o hellobrowser hellobrowser.c \ -DEWK_DATADIR="\"$(pkg-config --variable=datadir ewebkit)\"" \ $(pkg-config --cflags --libs ecore ecore-evas evas ewebkit)
The things worth noting here are the dependencies and a variable. We directly depend on ecore and evas from EFL and on WebKit. We define a variable, EWK_DATADIR, using pkg-config so our browser can use the default theme for web widgets defined in WebKit. Ecore handles events like mouse and keyboard inputs, timers etc whilst evas is the library responsible for drawing. In a later post I’ll detail them a bit more. For now, you can read more about them on their official site.
The main function is really simple. Let’s divide it by pieces:
// Init all EFL stuff we use evas_init(); ecore_init(); ecore_evas_init(); ewk_init();
Before you use a library from EFL, remember to initialize it. All of them use their own namespace, so it’s easy to know which library you have to initialize: for example, if you call a function starting by “ecore_”, you know you first have to call “ecore_init()”. The last initialization function is WebKit’s, which uses the “ewk_” namespace.
window = ecore_evas_new(NULL, 0, 0, 800, 600, NULL); if (!window) { fprintf(stderr, "something went wrong... :(\n"); return 1; }
Ecore-evas then is used to create a new window with size 800×600. The other options are not relevant for an introduction to the libraries and you can find its complete documentation here.
// Get the canvas off just-created window evas = ecore_evas_get(window);
From the Ecore_Evas object we just created, we grab a pointer to the evas, which is the space in which we can draw, adding Evas_Objects. Basically an Evas_Object is an object that you draw somewhere, i.e. in the evas. We want to add only one object to our window, that is where WebKit you render the webpages. Then, we have to ask WebKit to create this object:
// Add a View object into this canvas. A View object is where WebKit will // render stuff. browser = ewk_view_single_add(evas);
Below I demonstrate a few Evas’ functions that you use to manipulate any Evas_Object. Here we are manipulating the just create WebKit object, moving to the desired position, resizing to 780x580px and then telling Evas to show this object. Finally, we tell Evas to show the window we created too. This way we have a window with an WebKit object inside with a little border.
// Make a 10px border, resize and show evas_object_move(browser, 10, 10); evas_object_resize(browser, 780, 580); evas_object_show(browser); ecore_evas_show(window);
We need to setup a bit more things before having a working application. The first one is to give focus to the Evas_Object we are interested on in order to receive keyboard events when opened. Then we connect a function that will be called when the window is closed, so we can properly exit our application.
// Focus it so it will receive pressed keys evas_object_focus_set(browser, 1); // Add a callback so clicks on "X" on top of window will call // main_signal_exit() function ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, window);
After this, we are ready to show our application, so we start the mainloop. This function will only return when the application is closed:
ecore_main_loop_begin();
The function called when the application is close, just tell Ecore to exit the mainloop, so the function above returns and the application can shutdown. See its implementation below:
static Eina_Bool main_signal_exit(void *data, int ev_type, void *ev) { ecore_evas_free(data); ecore_main_loop_quit(); return EINA_TRUE; }
Before the application exits, we shutdown all the libraries that were initialized, in the opposite order:
// Destroy all the stuff we have used ewk_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); evas_shutdown();
This is a basic working browser, with which you can navigate through pages, but you don’t have an entry to set the current URL, nor “go back” and “go forward” buttons etc. All you have to do is start adding more Evas_Objects to your Evas and connect them to the object we just created. For a still basic example, but with more stuff implemented, refer to the EWebLauncher that we ship with the WebKit source code. You can see it in the “WebKitTools/EWebLauncher/” folder or online at webkit’s trac. Eve is another browser with a lot more features that uses Elementary in addition to EFL, WebKit. See a blog post about it with some nice pictures.
Now, let’s do something funny with our browser. With a bit more lines of code you can turn your browser upside down. Not really useful, but it’s funny. All you have to do is to rotate the Evas_Object WebKit is rendering on. This is implemented by the following function:
// Rotate an evas object by 180 degrees static void _rotate_obj(Evas_Object *obj) { Evas_Map *map = evas_map_new(4); evas_map_util_points_populate_from_object(map, obj); evas_map_util_rotate(map, 180.0, 400, 300); evas_map_alpha_set(map, 0); evas_map_smooth_set(map, 1); evas_object_map_set(obj, map); evas_object_map_enable_set(obj, 1); evas_map_free(map); }
See this screenshot below and get the complete source code.




