Archive for December, 2011

Compile OpenCV

Install packages:

sudo apt-get install build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev

Download FFmpeg:

cd /usr/local/src

wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xvfj ffmpeg-snapshot.tar.bz2
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libxvid --enable-x11grab --enable-swscale --enable-shared
make
make install
ldconfig

cd /usr/local/src

wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2/
tar xvfj OpenCV-2.3.1a.tar.bz2
cd OpenCV-2.3.1
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON .
make
make install

1 Comment

Enabling any user to run an X session

/etc/X11/Xwrapper.config – This file has as setting called “allowed_users”. It can accept three values:
1. root
2. anybody
3. console
The above values are self explanatory. You can edit this value to set as anybody for normal user to start X server. If normal user starts X server from console, console can also be set. It can be like this.

Leave a comment

Using scratchbox2 and Ubuntu 11.10


Local machine environment:
- Ubuntu 11.10 64bits

Emulated environment:
- Debian Squeeze armel

Install in local machine:

sudo apt-get install scratchbox2 fakeroot
sudo apt-get install qemu-user qemu
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install cpp-4.4-arm-linux-gnueabi gcc-4.4-arm-linux-gnueabi gcc-4.4-arm-linux-gnueabi-base
sudo apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi gcc-4.5-arm-linux-gnueabi

Init scratchbox configuration:

fakeroot debootstrap --variant=scratchbox --foreign --arch armel squeeze /path/root_fs http://ftp.br.debian.org/debian
sb2-init -n -c /usr/bin/qemu-arm MACHINE_NAME "arm-linux-gnueabi-gcc"

Install into emulated system:

apt-get install g++ rpm zlib1g-dev m4 bison libncurses5-dev gettext build-essential intltool libxml2-dev libtool

Compile outside the box:

cd source
sb2 ./configure
sb2 make -jN
sb2 make install DESTDIR=/path/root_fs

To change the crosscompiler toolchain install the script /usr/local/bin/switch_arm-linux-gnueabi.sh:

#!/bin/bash

if [ -z $1 ]; then
echo -e "\n Error: you need to define the arm-linux-gnueabi version"
echo -e " Usage: switch_arm-linux-gnueabi.sh \n"
exit
fi

if [ ! -f /usr/bin/arm-linux-gnueabi-cpp-$1 ]; then
echo -e "\n Error: arm-linux-gnueabi version $1 do not exist\n"
exit
fi

# Unlink symbolic links
sudo unlink /usr/bin/arm-linux-gnueabi-cpp
sudo unlink /usr/bin/arm-linux-gnueabi-gcc
sudo unlink /usr/bin/arm-linux-gnueabi-gcov

#Define new links for arm-linux-gnueabi
sudo ln -s /usr/bin/arm-linux-gnueabi-cpp-$1 /usr/bin/arm-linux-gnueabi-cpp
sudo ln -s /usr/bin/arm-linux-gnueabi-gcc-$1 /usr/bin/arm-linux-gnueabi-gcc
sudo ln -s /usr/bin/arm-linux-gnueabi-gcov-$1 /usr/bin/arm-linux-gnueabi-gcov
#EOF

1 Comment

Fixing problem The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY

gpg –keyserver pgpkeys.mit.edu –recv-key KEY
gpg -a –export KEY | sudo apt-key add –

Example:

gpg –keyserver pgpkeys.mit.edu –recv-key B5B7720097BB3B58
gpg -a –export B5B7720097BB3B58 | sudo apt-key add –

Leave a comment

Emulate ARM in Qemu

#Download Kernel and initrd

wget http://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/versatile/netboot/vmlinuz-2.6.32-5-versatile
wget http://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/versatile/netboot/initrd.gz

#Create disk

qemu-img create -f raw debian.img 5G

#Start qemu
qemu-system-arm -m 256 -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.gz -hda debian.img -append “root=/dev/rasudo kpartx -av debian.img

#Mount filesystem after install and copy kernel and initrd
sudo mount /dev/mapper/loop1p1 ./mnt/ -o loopm”
sudo kpartx -av debian.img
sudo mount /dev/mapper/loop1p1 ./mnt/ -o loop

#Start qemu again
qemu-system-arm -m 256 -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img -hda debian.img -append “root=/dev/sda1”

More reliable information at http://richizo.wordpress.com/2010/11/15/installing-debian-arm-under-qemu

Leave a comment