7 Nov 2010

Installer Android 2.2 sur HTC Tattoo Orange (fr) sous Linux


Préface

HTC a promis debut 2010 une mise à jour pour Android 2.1 pour le HTC Tattoo, mais de plus en plus il y a des messages dans les forums divers, que HTC ne compte pas à faire une mise à jour de Android 1.6 (version actuel sur les derniers Tattoos). Mécontent de cet attitude envers les proprietaires d'un HTC Tattoo, j'ai décidé d'installer un micrologiciel customisé (basé sur Android 2.2) sur mon Tattoo.
Après plusieurs heures de recherches (surtout sur le forum de xda-developers.com) et plusieurs tentatives, voici les démarches à faire.

Attention : vous faites des modifications importantes sur votre mobile, je ne suis pas responsable si vous cassez votre mobile (normalement tout est réparable).
Ceci a été effectué sous openSUSE 11.3.

Installer le Android SDK et connecter le Tattoo

D'abord il faut se procurer du SDK pour Android ici : http://developer.android.com/sdk/index.html.
Ensuite extraire l'archive téléchargé dans un dossier facile à atteindre (/home/marc-andre/Android-SDK dans mon cas) et pour faciliter les tâches suivantes, mettre à jour les chemins : 

PATH=$PATH:/home/marc-andre/Android-SDK/tools

Mettez votre Tattoo en mode débogage USB : Paramètres -> Applications -> Développement -> Débogage USB et connectez votre Tattoo avec le câble USB à l'ordinateur.

Maintenant taper les commandes suivantes :

adb start-server
adb devices

Si vous-avez un résultat comme ceci :

List of devices attached
HT9A2LG13080    device

vous êtes bon pour la suite.


Créer la GoldCard

Pour forcer le Tattoo à accepter nos actions, il faut créer une goldcard, donc une carte MicroSD modifié. Une GoldCard permet de simuler un CID d'un HTC nu.

Tapez la commade suivante :

adb shell "cat /sys/class/mmc_host/mmc1/mmc1:*/cid"

(Attention : avec les guillemets !)

Copiez le code hexadécimal affiché (ça ressemble à ça : 532600bd227d9c0347329407514d5402) et allez sur http://hexrev.soaa.me/, coller le code dans le champs et soumettez le. 
Copiez ensuite le nouveau code et allez ici : http://psas.revskills.de/?q=goldcard.
Remplissez le formulaire avec votre adresse mail valide (vous recevez la GoldCard sur cette adresse mail) et collez le code copié précédemment, passer le test anti-spam et envoyez le formulaire.

Faites une sauvegarde de votre MicroSD sur votre ordianteur (il faut imperativement brancher la carte sur votre ordinateur - avec un lecteur de carte par example). Puis formatez la carte en VFAT (FAT32).
Si vous avez reçu votre GoldCard par mail, on peut continuer par la commande suivante (Attention, indiquez les bons chemins vers goldcard.img et votre carte SD !) :

sudo dd bs=512 if=~/goldcard.img of=/dev/sdc1 #dans mon cas

Remettez la carte dans votre Tattoo puis démarrez le.

Forcer le root sur Tattoo

Pour pouvoir continuer, il nous faut l'accès du superutilisateur. Hélas, sous le micrologiciel de HTC, on peut pas avoir par défaut accès en root. Il faut qu'on utilise une faille dans le noyau fourni par HTC (et depuis la connaissance de cette faille, celle-ci n'a pas été corrigé - tant mieux pour nous).

Téléchargez mon archive http://www.mediafire.com/?md0icohcexd5zv8 et décompressez-le dans un dossier facile a retenir (/home/marc-andre/assets dans mon cas).
Maintenant on va copier un petit logiciel sur le Tattoo pour exploiter cette faille et qui nous permet d'avoir l'accès en mode superutilisateur, pour cela faites :

adb shell "mkdir /data/local/bin" #s'il y a une message d'erreur que le dossier existe, c'est bon
adb push /home/marc-andre/assets/exploit-m7/m7 /data/local/bin/m7 #comme toujours mon cas
adb push /home/marc-andre/assets/flash_image /data/local/bin/flash_image
adb push /home/marc-andre/assets/su /data/local/bin/su
adb push /home/marc-andre/assets/tattoo-hack/tattoo-hack.ko /data/local/bin/tattoo-hack.ko
adb push /home/marc-andre/assets/boot.img /data/local/bin/boot.img
adb push /home/marc-andre/assets/recovery-tattoo.img /data/local/bin/recovery-tattoo.img
adb shell "cd /data/local/bin && chmod 755 ./m7"

Et maintenant il faut aller dans la console et exécuter m7 :

adb shell
$ cd /data/local/bin
$ while ./m7 ; do : ; done

Il y a certainement plusieurs lignes qui défilent, c'est tout a fait normale, et à la fin vous avez un '#' (il se peut qu'il faut d'abord appuyer sur Entrée pour faire un saut à la ligne). Nous avons accès en mode superutilisateur ! Pour vérifier si c'est le cas, tapez :

# export LD_LIBRARY_PATH=/system/lib
# export PATH=/system/bin
# id

Si vous-avez l'affiche suivante :

uid=0(root) gid=1000(shell) groups=1003(graphics),1004(input),1007(log),1011(adb),1015(sdcard_rw),3001(net_bt_admin),3002(net_bt),3003(inet)

ça veut dire que c'est bon (notez le 'root').

Pour que ça reste comme ça (et encore plus), il faut passer à l'étape suivante.

Installation de 'su' et nouveau bootloader

Toujours dans la console du Tattoo tapez :

# chown root.root /data/local/bin/su
# chmod 4755 /data/local/bin/su
# insmod /data/local/bin/tattoo-hack.ko
# mount -o rw,remount /dev/block/mtdblock5 /data
# mount -o rw,remount /dev/block/mtdblock3 /system
# mv /data/local/bin/su /system/bin/su

(Si vous recevez un erreur pour le tattoo-hack.ko, essayez l'autre dans le dossier tattoo-hack-g6561203)

Ouvrez maintenant une autre console Linux, et essayez si 'su' vous donne accès en mode superutilisateur :

adb shell
$ /data/local/bin/su

Si vous avez un '#', c'est bon.

Et avant tout, on installe le nouveau bootloader :

# chown root.root /data/local/bin/flash_image
# /data/local/bin/flash_image boot /data/local/bin/boot.img

Une fois achève, redémarrez votre Tattoo avec :

# reboot

Remplacer le mode recovery

Une fois votre Tattoo est redémarré, retournez dans la console du Tattoo, et normalement vous êtes déjà superutilisateur :

adb shell
# /data/local/bin/flash_image recovery /data/local/bin/recovery-tattoo.bin

puis

# reboot recovery

Dès que votre Tattoo est en mode recovery, par la console faites :

adb shell
# /sbin/bart -a -b -c --norecovery

pour faire une sauvegarde de votre installation et redemarrez votre Tattoo :

# reboot

Flasher le nouveau ROM sur le Tattoo

Après la sauvegarde, il nous reste que de choisir le ROM à installer. Moi pour ma part, j'ai choisi "fyodor FroYo AOSP Tattoo v0.7.2c" (faites un tour sur http://forum.xda-developers.com/forumdisplay.php?f=544 pour regarder les pour et contres de tous les ROMs).

Copiez d'abord le fichier update.zip (ou le ROM de votre choix renommé en update.zip) sur la carte SD :

adb push /home/marc-andre/assets/update.zip /sdcard/update.zip
adb shell reboot recovery

Quand votre Tattoo est de nouveau dans le recovery, videz d'abord le cache Dalvik et Data. Et ensuite choisissez Flash update.zip. L'installation du nouveau ROM est en route.

Après l'installation, redémarrez votre Tattoo et voilà, vous êtes partie sous Android 2.2 !

Par contre il manque les Google Apps, vous les trouvez ici : http://goo.gl/oetkQ.

Dans la console : 

adb push gapps-mdoi-20101020-signed.zip /sdcard/gapps.zip
adb shell reboot recovery

et dans le mode recovery juste flasher le ZIP de la carte SD. 

Épilogue

Pour passer mon Tattoo sous Android 2.2 il m'as fallu 2 jours. J'ai écrit ce tutoriel de mémoire et avec l'historique de mon navigateur pour retrouver mon chemin. En plus je ne suis pas trop doué pour écrire des tutoriaux, vous m'excusez.
Je ne suis pas sur s'il faut passer vraiment par toutes les étapes ci-dessus, mais ça peut pas faire de mal.
Mais si jamais vous rencontrez un problème, n'hésitez pas de laisser un commentaire pour que je peut mettre à jour mon tutoriel avec la partie manquant / fausse.

Crédits

Aux développeurs du http://forum.xda-developers.com.

28 Oct 2010

Kubuntu 10.10 ditched in favor of openSUSE 11.3

Enough is enough...

After a change to Ubuntu 10.04 in begin of June, I switched back to Kubuntu 10.04 in September  due to a buggy Gnome (for example this long-known bug with copy & past not working after you close the software of origin) and other reasons. But Kubuntu didn't look nice either, and felt as well unstable and slow. I nevertheless waited for 10.10 to come out and to do an upgrade, but it just got worse. The software I need for my work didn't function as expected (take Skype for example).

Research

I did some research about opinions from others for a stable workstation Linux. The main contestants were Red Hat or SLED. Fedora, the offspring of Red Hat is cutting etch and therefor object to possible breaks in software. Nothing I can use. So I installed openSUSE in VirtualBox and gave it a tryout. The first impression was more then good, the difference between Kubuntu and it are big.

It's done...

So I ditched this week my Kubuntu 10.10 installation for openSUSE 11.3.
But what i missed straight away was dash (the bash replacement under Ubuntu), it will take some time, but I will get used to it.
What else struggled me was the RPM package management system. It is far from as smooth as the Debian packaging system; mostly I had problems with dependency resolution - or I just do not know yet how to use it correctly. And when talking about the packaging system, I was (and am) quiet confused with the repositories under openSUSE. So what I appreciated much, the first moment I knew about it, is the package search on software.opensuse.org, so no need to search a long time for a certain package in some lost repository (or a PPA for Ubuntu).

It feels good

For now I can feel more stability and cohesion in openSUSE then I felt in Kubuntu for a long time. My Skype worked straight out the box, I got Sun/Oracle Java and VirtualBox installed and can code right away without having the impression that my workstation is an old 486.

Just on my servers I will hold on to Ubuntu, I cannot afford it to have downtime on them just because I messed something up as long as I am not familiar to zypper...

PS: My favorite game OpenTTD did install completely with the necessary content and works great !

29 Jun 2010

My *NIX history

1995 - 1996
First time I got in touch with *NIX was with FreeBSD back in 1995, when it was featured in a PC magazine (I do not remember which one it was). Back then I was young and just attracted by the idea of a different OS, other then Windows 3.11/DOS. But you can imagine that - as a Windows 3.11 user - it was something I couldn't possibly understand nor use.

1997 - 1999
In 1997 I got in touch with Corel Linux, tried it on my PC but still didn't got the idea about incompatibility between Microsoft products and Linux, so I dumped it fast as I couldn't do anything with it. And while in my civil service, a student showed me SuSE Linux on his PC; but my previous experience with Corel Linux kept me on distance.

2000 - 2003
Back in 1999 I got an old IBM laptop and had already 2 PCs with Windows installed. And I had a RedHat Distribution on hand, so I gave Linux another try.
I liked it, and - as I wasn't depending on my laptop as my sole PC - kept it installed. I got in touch with other Linux users on IRC and at this time (like it is still the case today), working in the console was cool.
After some weeks I replaced RedHat with Slackware, because I wanted something "hard" to work with. I managed to get wireless and sound working on my old laptop. The console was my home for a long time, with ncurses there were so many applications perfectly running in it. The same time, when I worked with a fellow webdesigner, we used a SuSE Linux server. I liked very much Yast to keep control over the system.
To keep trying something different, in 2002 I replaced on one of my PCs Windows with BeOS (not quiet a *NIX). It was a nice OS, but unfortunately without a future.

2005 - present
As my life got a bit turbulent in 2004, I did not have any PC until 2005 when I bought a Toshiba Laptop. And at first I started with Fedora. And as usual, I couldn't stay with it and wanted again something different, and so I found Ubuntu.
It should be the beginning of a long relation as my favourite Linux distribution.

Over the last couple of years I tried other OS as well, like MirOS and other BSD derivatives, Solaris, Darwin and countless Linux distributions (thank you dual-boot and VirtualBox).

On the server-side I used for about a year Gentoo, but changed afterwards to Ubuntu Server, because that way I have the same tool-set as on my workstation (call me lazy).

Since I work as a developer for Sudimage (4 years now), I only used the KDE-based Kubuntu, but recently i switched to Ubuntu with Gnome.

Future
Now I keep a closer look on the Elementary OS as my future OS.

Not yet
What I never tried yet (but what I wish to do as soon as possible):
  • Debian
  • Arch
  • DragonFly BSD
  • CentOS (as server OS)

Ces derniers heures [suivi]

Ceci est un suivi sur Ces derniers heures.

Maintenant pour du vrai, ces derniers heures ont sonné. Tout à été transféré temporairement vers nos serveurs récent, en attend de créer les hébergements définitif.

Ces derniers heures ont duré quand-même presque 2 ans.

14 Jun 2010

[Screencast] Magento - Création d'un article configurable

Voici mon premier screen-cast concernant Magento et la création d'un article configurable. La vidéo est en cours de édition.



(Si la vidéo s'affiche pas correctement, allez sur www.youtube.com/watch?v=rByeeOHDCw4)

Un tutoriel pour le changement automatique des images après la sélection d'une option est en préparation.

4 Jun 2010

PrestaShop vs. Magento CE

After a half year with PrestaShop as our proposed solution for e-commerce websites, and another half year with Magento CE as our 'new' solution, here is a small review from our experience :

PrestaShop


+ Pro :
  • Easy installation
  • Easy to modify (making changes to the behaviour without affecting the core files)
  • Good template system (Smarty)
  • Fast response-time from the community
- Contra :
  • Buggy (core AND modules)
  • Limited for extended needs
  • Toy-like interface
  • Rare updates and almost no bug-fixes
Our first impression was, that PrestaShop could fast and easily replace our in-house solution for e-commerce. With the small core and the logical framework of PrestaShop, it was easy to install our customers websites.
But already after a short while we got more and more costumers dissatisfied with the look and feel of the back-office, and we got more and more bug reports as well. The only answers to those bugs were workarounds with other modules to circumvent the problems. This is unacceptable for our clients and puts us into a bad light.

So we were looking for an alternative.

Magento CE


+ Pro :
  • Stable core (based on Zend Framework)
  • Very broad base of functions included, almost no limits for extensions
  • Professional looking Front and Back-office
  • Many extensions available with an easy upgrade function (Magento Connect)
- Contra :
  • Installation can be tricky, moving an installation is very hard
  • Modifications are difficulty to realise for newcomers
  • Templates are not easily to maintain, you need to know the way how Magento CE works to know where you have to modify what .phtml file
  • The responsiveness of the community forum is almost inexistant
After our switch to Magento CE I can confirm, that modifying a base installation of it is time consuming when you are new to it. At first sight all those XML configuration scripts may be scaring, but after a while you get to know where you will find the file you need to figure something out or to modify it.
As with PrestaShop, modifications are not done on the core files, but as extended classes to the MVC, or in creating a cascading folder tree to rewrite template files.

What did we learn


PrestaShop may be great for DIY users, but for us it is not something we can  install for our clients. It is fast deployed and easily adapted to the design you wish for it. But the limitations you have - even if you could extend it - are a no-go. Someone who has the time to extend it to his needs, that is great, but in our business : time is money. That applies as well on the bug-hunting in PrestaShop installations, and more on the waiting for bug-fixes from the project.
Magento CE is a hard one at first, but after 3 - 4 installations and modifications of the base system, you get to know it. A negative side is, that you have to search a long time if you have questions, but when you find what you are looking for, you can be sure it is well documented. Just be sure to look for the right version of Magento.

Magento CE is for us the way to go !


PS : If I need to write a non-common extension to Magento CE, I will try to write a how-to. Maybe one of you can use it later.

3 Jun 2010

After 4 years on KDE, back to Gnome

First a little introduction :

I am a proud long-time Linux user. First I started with Slackware (back in '99) on my IBM Laptop and I succeeded to accomplish many things, like getting my wireless working. But I was a purist on Linux; since I had 3 other PCs with Windows installed. After a long break on PCs, in 2004 I got my hands on a Toshiba Laptop and installed Fedora on it but had some issues and so I switched to Ubuntu. The Gnome DE was something "new" and exiting for me. But then came another break on PCs until fall 2005, where I build a shiny new PC just for me.

I gave Kubuntu a try. It was great, finally a DE where I could go on my servers with Konqueror, as if they where folders on my PC. And the all in all working great together of the applications was refreshing. I changed to Gentoo, Sabayon, Mint - always with KDE - but came always back to Kubuntu.

But with the release of KDE 4, the great deception overcome me as well as so many others. Because I am someone who likes his habits and does not like to change, I wanted to give KDE 4 a try, even if I could have stayed with 3.5 (but it is in all cases a dead end in favour of the new release).
Before the release I had many expectations on KDE 4; I wanted to have the same working horse, just with a new blanket. The first release was buggy, of course - there is no problem with it, they start something new from scratch, I waited for the 4.1. Lesser bugs, but also lesser similarities to the old version I was used to. True, they did go a big step to push forward new techniques, but I never got used to Dolphin as the filemanager, to take an example. And the change back to Konqueror in KDE 4 was not the same anymore. I could feel it in my daily use (and believe me, I use the filemanager quiet often), that they "ditched" Konqueror in favour of Dolphin.

Many may say that I can do many things in the configuration, etc. But I just do not have the time (else I would go back to Slackware or Gentoo). What I love most today is the fact, that - thanks to the big distributions - Linux got mainstream. Ease of use is the key.

So I had less and lesser pleasure working on KDE, and more and more details came to my attention. Some minor glitches in the design of the task-bar, the whole DE was sluggish and "heavy". I do not know how to put it in words.
The fact is, I installed the Beta of Ubuntu 10.04 in VirtualBox to see how Gnome looks like this days. What caught my eyes first was the integration of social networks and IM into Gnome. That was something I did not know I wanted.
And I took also a sneak-peak on Gnome 3 - what seems very promising - to see what the future looks like. Still on my old workstation I changed via tasksel to the Gnome DE and had straight the impression I expected from the VirtualBox experience.

So I took my decision to install Ubuntu 10.04 on my next PC (which arrived last Monday, a Dell Precision T1500).

I have to admit, I still need time to get used to Gnome, but I do not regret the switch to it. I will nevertheless keep an eye on KDE, to see how it will evolve in the near future.

Concrete 5 : Ajouter un logo du type de ficher au "Bloc Images" [TinyHowTo]

Un petit tutoriel pour ajouter un sélecteur CSS au bloc d'images de l'installation de base de Concrete 5.4 :

Le but est celle-ci :





D'abord il faut créer le dossier 'file' dans le dossier /blocks à la racine de Concrete5. Ensuite copier les fichiers 'view.php' et 'controller.php' dans ce nouveau dossier.

Ouvre le fichier 'controller.php' et ajout la fonction suivant à la fin de la classe :

function getFileExtension() {
$f = $this->getFileObject();
$file_name = $f->getTitle();
$file_extension = explode('.',$file_name);
return $file_extension[1];
}

Maintenant ouvre le fichier 'view.php' et change à la ligne 7 (la balise HTML) comme suivant :

<a href="<?php echo View::url('/download_file', $controller->getFileID())?>" title="<?php echo stripslashes($controller->getLinkText())?>" class="file-type-<?=$controller->getMimeType()?>"><?php echo stripslashes($controller->getLinkText())?></a>

Le résultat est comme avant, le lien habituel mais désormais avec un sélecteur CSS en plus pour rajouter un logo, comme dans le style suivant (cas PDF) :

.file-type-pdf {
display:block;
background-image:url(./images/pdf.gif);
background-position:0 center;
background-repeat:no-repeat;
padding-left:20px;
}

Voilà, un logo du type de fichier pour le téléchargement des fichiers Concrete 5.

Concrete 5 : Add a filetype-logo to the "File-Block" [TinyHowTo]

A small how-to add a CSS selector to the File-block in the Concrete 5.4 base install :

The Goal

When linking to a file for download, a nice way to brush up the presentation of the link is to display the file-type icon alongside it. This gives the site visitor an idea as to what they are downloading, and makes the link stand out a bit more within the page:






By default, concrete5's file block simply displays a link to the file, without any icon. But adding this icon can be easily done with some quick modifications to the file block's view.php and controller.php files.

Override the File Block's View Template and Controller

First you have to create the folder 'file' in the blocks folder in your concrete5 root. Then copy the files 'view.php' and 'controller.php' from the /concrete/blocks/file/ folder in your newly created one. This will allow you to make changes to these two templates without affecting the core files.

Modify the Controller

Open the controller.php and add the following function to the end of the class :
function getFileExtension() {
$f = $this->getFileObject();
$file_name = $f->getTitle();
$file_extension = explode('.',$file_name);
return $file_extension[1];
}

Modify the View

Now open the view.php and change the line 7 (the HTML link) to :

<a href="<?php echo View::url('/download_file', $controller->getFileID())?>" title="<?php echo stripslashes($controller->getLinkText())?>" class="file-type-<?=$controller->getMimeType()?>"><?php echo stripslashes($controller->getLinkText())?></a>

What you get

As a result you will have the usual link, but now with a CSS selector you can use to add a file-type logo/icon, like this style-sheet (case PDF) :

.file-type-pdf {
display:block;
background-image:url(./images/pdf.gif);
background-position:0 center;
background-repeat:no-repeat;
padding-left:20px;
}


Now you have a file-type logo with your file download in Concrete5.