Adding keymap to Android

I am using a keypad with just 4 keys (HOME, BACK, MENU and ENTER) on my iMX51 board, but it is not correctly mapped.

I started to searching for a solution and found this tutorial:

The keypad keycode wasn’t following the function defined on qwert.kl because it uses other keymap file (/system/usr/keylayout/mxckpd.kl). Now just modifying this file or the keypad keycode in the kernel driver to reflect the same function solved the issue.