How to enable Autocomplete in vim or vim Intellisense

1.Install vim

sudo apt-get install vim

2.Create a file .vimrc on home folder

touch ~/.vimrc

3.Put these lines inside .vimrc

autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

4.Now use vim , to autocomplte your code use “CTRL+N”

Setting up cross compilation toolchain to compile kernel and vivi for mini 2440

To compile kernel and vivi for our target device (mini2440) we need to  set up a cross compilation environment on our host system.The trick is that we generate binaries for the target(mini2440) on our host system.

So frst we need some packages installed in our system they are

sudo apt-get install build-essential make ncurses gcc g++ libncurses5 libncueses5-dev

After that we need to download some packages

ARM Linux gcc   –  http://www.friendlyarm.net/dl.php?file=arm-linux-gcc-4.3.2.tgz

Cross compiler toolchain   –  http://ftp.arm.linux.org.uk/pub/armlinux/toolchain/cross-2.95.3.tar.bz2

Linux kernel source   –  http://www.friendlyarm.net/dl.php?file=linux-2.6.32.2-mini2440_20110413.tgz

Vivi source  –  http://www.friendlyarm.net/dl.php?file=bootloader_20090728.zip

Now setup cross compiler toolchain and Arm gcc on our system

Configuring cross compiler

tar -xvf cross-2.95.3.tar.bz2
sudo mkdir -p /usr/local/arm
sudo mv 2.95.3/ -v /usr/local/arm/
ls /usr/local/arm/
export PATH=/usr/local/arm/2.95.3/bin:$PATH
echo $PATH

Configuring Arm gcc

tar -xvf arm-linux-gcc-4.3.2.tgz
sudo mv ./usr/local/arm/ /usr/local/arm/
sudo mv /usr/local/arm/arm/4.3.2/ /usr/local/arm/
export PATH=/usr/local/arm/4.3.2/bin:$PATH
echo $PATH

On doing echo $PATH we can see if path variable is set or not

Now compile vivi to generate binary

extract vivi
cd bootloader_20090728/vivi/
cp smdk2440 ./.config
make menuconfig

You may get a error like this

error-Preparing scripts: functionsYour lxdialog utility does not exist

To fix this error we need to give permission to lxdialog

cd scripts/lxdialog/
sudo chmod +x lxdialog
make menuconfig
Load an Alternate config file
make vivi
sudo ../../usbpush/usbpush/usbpush ./vivi

The vivi binary will be generated now on the folder ,Now using usb push utility we can push it to mini2440

Next compiling Linux kernel

cd linux-2.6.32.2/
cp config_mini2440_n35 ./.config
cat .config |grep CPU_S3C2440

Check whether the out put is Y

make menuconfig

An error may occur like this

error –include/linux/compiler-gcc.h:86: linux/compiler-gcc2.h: No such file or directory

make mrproper
make menuconfig

check - system type-->sc32440 machines-->Friendlyarm mini2440 dev board
make
make zImage

make mrproper will eliminate that error and will build necessary dependencies.If everything goes correct you will get an output like this

The zImage is available in this path arch/arm/boot/zImage

Using usbpush push it to mini2440

sudo ../usbpush/usbpush/usbpush arch/arm/boot/zImage

setting up supervivi,kernel & qtopia in mini2440

Download supervivi,zImage,usbpush and qtopia image from

http://www.friendlyarm.net/downloads

These are the files i used

supervivi – http://www.friendlyarm.net/dl.php?file=supervivi_20100818.zip

zImage – http://www.friendlyarm.net/dl.php?file=linux-zImage_20110421.zip

usbpush – http://www.friendlyarm.net/dl.php?file=usbpush.zip

qtopia – http://www.friendlyarm.net/dl.php?file=linux-root_qtopia_qt4_20110305.zip

Extract the usbpush this utility helps us to push the image files from our system to mini2440 target.When we extract we can see one more usbpush folder inside that folder there will be a usbpush binary give executable permission to that binary

sudo chmod +x usbpush/usbpush/usbpush

Get the bootloader using command

sudo minicom

select ” x “  and format the NAND flash

Now the next step is to load supervivi to target board using usbpush.supervivi is the bootloader.

First select ” V

Only after this you should push file from the host system.Push the file like this

sudo ./usbpush/usbpush/usbpush supervivi_20100818/supervivi-128M

If the push is sucessful then the minicom promt will be like this and will be back to the bootloader

and the usbpush prompt will be like this

So vivi is sucessfully installed.Next is zImage, Kernel images generated by the kernel build process are either uncompressed “Image” files or compressed zImage files.here we selects zImage N35 bcoz  MINI2440 with 3.5″ NEC display.

Now we selects ” K ” option to download linux kernel and pushes the extracted zImage

sudo ./usbpush/usbpush/usbpush  linux-zImage_20110421/zImage_N35

After this step you may encounter with this error

Enter your selection: k
USB host is connected. Waiting a download.
Length of file is too big : 2517028 > 2097152
Failed downloading file

If you encounter with this error then you can solve this error like this.First go to the shell of vivi by selecting ” q

Then from supervivi promt type this

Supervivi>part del kernel
Supervivi>part del root
Supervivi>part add kernel 0x00060000 0x00500000 0
Supervivi>part add root 0x00560000 0x40000000 0
Supervivi>part save
Supervivi> part show

Now to get back to our previous menu type menu

Supervivi> menu

Now retry to download zImage with previous steps

Now we need to Download the root yaffs image.YAFFS (Yet Another Flash File System) is now in its second generation and provides a fast robust file system for NAND and NOR Flash. It is widely used with Linux and RTOSs, in consumer devices. It is dual licenced under commercial/GPL terms.

Select ” Y ” to download yaffs image and push the qtopia image file

It will take some time…

Now that we have completed all the steps select “ b ”  to boot the system

Here also you will get an error like this

“error – Kernel panic – not syncing: No init found.  Try passing init= option to kernel” –> this will be the error

To fix this error got to supervivi promt and type this

param set linux_cmd_line "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0"

After this select boot.Then the board will boot and we will get prompt of friendlyarm

Now calibrate the screen by clicking on the crosshairs shown and you will be taken to qtopia screen by default qtopia will be in chineese in second tab there is a flag symbol select that it chnages the language select english and we are done

Happy Hacking 🙂

Settingup and configuring mini2440 Friendlyarm on ubuntu10.04

The friendlyarm kit am having is mini2440 http://www.friendlyarm.net/products/mini2440

The software and other packages necessary can be downloaded from the official site

http://www.friendlyarm.net/

The first software we need on our ubuntu system in minicom.Minicom is just like hyperterminal.Install minicom first

sudo apt-get install minicom

Now connect mini2440 to our system two connection one from the serial port and next from the Type B USB plug must be made to the system.On the friendly arm board the NAND/NOR switch must be placed in the NOR position

Now invoke minicom from terminal using command

sudo minicom

usually you will get something like this on your terminal

The problem is you need to configure minicom the port etc use the command dmesg this command lists several other messages also so you have to closely observe to which port the board is connected.Here am using serial to usb converter so the port deteced for mine is ttyUSB5 if you connected it to serial port itself it will be different

kill minicom using the command

sudo pkill minicom

then invoke minicom using

sudo minicom -s

It will give a screen like this

select serial port setup and hit enter

there change serial device to the port detected in my case it will be /dev/ttyUSB5 we can edit that by selecting A option.Also double check that both software and hardware flow control must be in NO

Then select save set up as dfl

After that exit from minicom and try our first command

sudo minicom

If everything went correct then you will get a bootloader like this .This is the preinstalled vivi bootloader on memory

Happy Hacking 🙂

Sound troubleshooting for different versions of ubuntu

If you are using Ubuntu 11.10 (Oneiric), then execute this command and reboot:

 

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` libasound2 linux-alsa-driver-modules-$(uname -r); sudo apt-get -y --reinstall install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` libasound2  linux-alsa-driver-modules-$(uname -r); killall pulseaudio; rm -r ~/.pulse*; sudo usermod -aG `cat /etc/group | grep -e '^pulse:' -e '^audio:' -e '^pulse-access:' -e '^pulse-rt:' -e '^video:' | awk -F: '{print $1}' | tr '\n' ',' | sed 's:,$::g'` `whoami`

If you are using Ubuntu 11.04 (Natty), then execute this command and reboot:

 

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; sudo apt-get -y --reinstall install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r)  libasound2; killall pulseaudio; rm -r ~/.pulse*; sudo usermod -aG `cat /etc/group | grep -e '^pulse:' -e '^audio:' -e '^pulse-access:' -e '^pulse-rt:' -e '^video:' | awk -F: '{print $1}' | tr '\n' ',' | sed 's:,$::g'` `whoami`

If you are using Ubuntu 10.10 (Maverick), then execute this command and reboot:

 

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa;  sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install  linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; sudo apt-get --reinstall install  linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; killall pulseaudio; rm -r ~/.pulse*; sudo usermod -aG `cat /etc/group | grep -e '^pulse:' -e '^audio:' -e '^pulse-access:' -e '^pulse-rt:' -e '^video:' | awk -F: '{print $1}' | tr '\n' ',' | sed 's:,$::g'` `whoami`

If you are using Ubuntu 10.04 (Lucid), then execute this command and reboot:

 

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo add-apt-repository ppa:team-iquik/alsa; sudo apt-get update; sudo apt-get dist-upgrade; sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; sudo apt-get --reinstall install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r)  libasound2; killall pulseaudio; rm -r ~/.pulse*; sudo usermod -aG `cat /etc/group | grep -e '^pulse:' -e '^audio:' -e '^pulse-access:' -e '^pulse-rt:' -e '^video:' | awk -F: '{print $1}' | tr '\n' ',' | sed 's:,$::g'` `whoami`

The command is partially visible in my blog but if you select and pastes it will print the whole command

I tried this for two versions 10.04 and 11.04 both worked fine but i discarded the first install that was recommended by the command which tries to install gnome-panel etc discard it the rest of the installation will get your alsa back on track

Happy Hacking 🙂

Blackmagic Intensity Pro HDMI card error on ubuntu 11.04

The card am having is black magic intensity pro the card was detected on lspci

lspci | grep Blackmagic

03:00.0 Multimedia video controller: Blackmagic Design Device a117

I’ve downloaded the latest driver from BM site. Installation have passed successfully. After rebooting

lsmod | grep blackmagic 

blackmagic 429221 0

the output of dmesg was like this

[ 15.450972] *** bool DeckLinkDriverClass::firmwareHasDownloaded()[1616]: Failed to initialise video output support
[ 15.451075] blackmagic: ERROR: failed to download firmware
[ 15.451087] blackmagic_driver 0000:02:00.0: PCI INT A disabled

After googling i founf this solution

1). Check your current vmalloc sizes
$ cat /proc/meminfo | grep Vmalloc

2). Increase VM size
$ sudo nano /etc/default/grub

change

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

to,

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash vmalloc=256M”

(modify the following as necessary for your grub version)
$ sudo update-grub2

4). Verify changes, by looking for the vmalloc instructions in this file
$ cat /boot/grub/grub.cfg

5). Reboot

6). Double check if your changes has had effects
$ cat /proc/meminfo | grep Vmallo

Setting up Live streaming using VLC and justin.tv

To setup live streaming the os i used is ubuntu 10.10 the kernel version of ubuntu 10.10 is 2.6.35..you need vlc installed in the system….The tv tuner card used is Avermedia Volar Go usb card…The linux driver of the tv tuner is card is available in the site of Avermedia

http://www.avermedia.com/avertv/Product/ProductDetail.aspx?Id=495&tab=APDriver

Install the driver by running the shell program After successful installation of the driver there is a scripts folder run the vlc.sh its asks certain inputs such as which card,which video you need etc if everythings fine you can see the video out on vlc..The AV out from Tv must be connected to the tuner card using AV code..

Now create an an account on justin.tv..From the site you will get a stream key copy that..

Now download jtvlc linux version  from the below link

http://apiwiki.justin.tv/mediawiki/index.php/Linux_Broadcasting_API

I downloaded version  0.41,extract it inside folder there isa jtvlc executable is available.

vlc v4l2:///dev/video0 :input-slave=alsa://hw:1,0 :v4l2-standard=2:v4l2-standard=255  :v4l2-chroma=YUYV :v4l2-input=1 :v4l2-audio-input=0 :v4l2-io=2 :v4l2-width=720 :v4l2-height=576 :v4l2-aspect-ratio=4\:3 :v4l2-fps=0 :v4l2-caching=50 :no-v4l2-use-libv4l2 :v4l2-brightness=-1 :v4l2-contrast=-1 :v4l2-saturation=-1 :v4l2-hue=-1 :v4l2-black-level=-1 :v4l2-auto-white-balance=-1 :v4l2-do-white-balance=-1 :v4l2-red-balance=-1 :v4l2-blue-balance=-1 :v4l2-gamma=-1 :v4l2-exposure=-1 :v4l2-autogain=-1 :v4l2-gain=-1 :v4l2-hflip=-1 :v4l2-vflip=-1 :v4l2-hcenter=-1 :v4l2-vcenter=-1 :v4l2-audio-volume=-1 :v4l2-audio-balance=-1 :no-v4l2-audio-mute :v4l2-audio-bass=-1 :v4l2-audio-treble=-1 :v4l2-audio-loudness=-1 :v4l2-setctrls= :file-caching=300 --sout='#duplicate{dst=display, dst="transcode{venc=x264{keyint=60,idrint=2},vcodec=h264,vb=300,acodec=mp4a,ab=64,channels=1,samplerate=44100}:rtp{dst=127.0.0.1,port=1234,sdp=file:///home/yourusername/vlc.sdp}"}'

Make this command as an shell file.by running this command the output of the tv tuner card can be viewed in VLC player.change this “sdp=file:///home/yourusername/vlc.sdp” in the command with the path of your system the vlc.sdp is a temperory file