avril 14

Compilation croisée (cross-compiling ) du Kernel pour le PI et PI2

compiler le kernel directement sur le raspberry prend “un certain temps” , je me suis décidé a automatiser l’opération sur mon Pc ( sous debian jessie) .

1er temps récupération des outils , sources du kernel et comme j’utilise aussi des afficheur TFT en SPI , intégration des modules pour les afficheurs

je place tous ces elements dans /home/Raid5/partage/raspberry et je récupère la dernière branche (rpi-4.2.y actuellement 4.2-rc5)

les fichiers compilé seront placé dans /home/Raid5/partage/raspberry/build

note : depuis le 19/01/2015 les drivers TFT sont intégrés dans le noyeau .

cd /home/Raid5/partage/raspberry
mkdir build build/boot build/V1 build/V2
git clone https://github.com/raspberrypi/tools
git clone https://github.com/raspberrypi/linux --branch rpi-4.2.y
cd linux/drivers/video/fbdev
 
ajouter source "drivers/staging/fbtft/Kconfig"
a la dernière ligne du fichier Kconfig

*****************
make menuconfig pour ajouter les drivers fbtft
*****************

on vas editer le .bashrc pour ajouter le chemin du compilateur:
nano ~/.bashrc
on ajoute :/home/Raid5/partage/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin ( si vous etes en 64 bits )
a export PATH

2eme temp compilation :
– Pour le Raspberry PI A, A+, B, B+ :

cd /home/Raid5/partage/raspberry/linux/
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig

#pour activer les modules fbtft ( device driver / graphics support / frame buffer device /  Support for small TFT LCD display modules )
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V1 modules 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V1 modules_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V1 firmware_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V1 dtbs
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V1 dtbs_install

– Pour le Raspberry PI2 :

cd /home/Raid5/partage/raspberry/linux/
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

#pour activer les modules fbtft ( device driver / graphics support / frame buffer device /  Support for small TFT LCD display modules )
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V2 modules 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V2 modules_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V2 firmware_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V2 dtbs
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V2 dtbs_install

Aprés un apéro prolongé et/ou plusieurs café , une fois terminé

cp arch/arm/boot/Image /home/Raid5/partage/raspberry/build/V1/boot/kernel.img

ou pour un Raspeberry PI2

cp arch/arm/boot/Image /home/Raid5/partage/raspberry/build/V2/boot/kernel7.img

les modules se trouvent dans

/home/Raid5/partage/raspberry/build/V1/lib/modules/4.2.0+

ou pour le Raspberry PI2

/home/Raid5/partage/raspberry/build/V2/lib/modules/4.2.0+v7

et un petit script qui fait tout ( a copier dans /home/Raid5/partage/raspberry/build/build.sh) :

 

#!/bin/sh
cd /home/Raid5/partage/raspberry/linux
# compilation pour le A, A+ , B , B+
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V1 modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V1 modules_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V1 firmware_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V1 dtbs
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V1 dtbs_install
cp arch/arm/boot/Image /home/Raid5/partage/raspberry/build/boot/kernel.img
# compilation pour le PI2
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V2 modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V2 modules_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/home/Raid5/partage/raspberry/build/V2 firmware_install
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V2 dtbs
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_PATH=/home/Raid5/partage/raspberry/build/V2 dtbs_install
cp arch/arm/boot/Image /home/Raid5/partage/raspberry/build/boot/kernel7.img

……………………. en cours d’écriture , la suite bientôt/V2

Catégorie : Software | Commentaires fermés sur Compilation croisée (cross-compiling ) du Kernel pour le PI et PI2