Thursday, 14 April 2011

How to Configure/Use Remote Desktop feature in Ubuntu 10.04

1. Goto System->Preferences->Remote Desktop,
select “Allow other users to view your desktop”  and “Allow other users to control your desktop”.
2. Goto Applications->Internet->Remote Desktop Viewer , enter other PC ip addr or host name , say connect

Some useful linux commands/settings

1. To copy files from other linux pc, you can use scp cmd
$scp <username>@<ip addr>:/<path>/srcfilename <username>@<ip addr>:/<path>/dstfilename (USE -r option for recursive copy)
2. To check all installed packages on the PC
$dpkg –get-selections
3. To set proxy for terminals (you can add these settings to .bashrc in home directory)
export http_proxy=http://<usr name>:<passwd>@<proxy ip addr>:<port num>
export ftp_proxy=ftp://<usr name>:<passwd>@<proxy ip addr>:<port num>
export https_proxy=https://<usr name>:<passwd>@<proxy ip addr>:<port num>
4. You can run changed .bashrc file with cmd $source ~/.bashrc

Usefull cscope and ctags commands

cscope cmd:
1. Invoke cscope -d to launch the cscope. Make sure you already created the cscope database and exists in the current dir where this cmd is issued
2. You can use the find cmd to create cscope database files
find <path> -name “*.c” -print >> cscope.files   [ repeat this for other file ext like .h,.cpp etc]
cscope -b -q -k cscope.files    [ to build the cscope database]
3. Use tab to switch between files and search sections
4. Use Ctl+d to exit the cscope
ctags cmd:
1. Ctr+] to go to definition of symbol
2. Ctr+t to go back to previous location
3. Ctr+i , Ctr+o to toggle between the points
4. ctags -L <file list> to generate tags for all the files in the list
4. ctags -R to generate all files tags recursively (this will generate tags file)
5. set tags=./<path>/tags , ./../<path>/tags in vim to browse the code flow
VIM setup:
Create/edit .vimrc file in user home dir
set ic    -> will ignore case for search
set ts=4   -> will set tab to 4 spaces
set incsearch  -> will highlight the text as we type the search word
set hlsearch    -> highlight the all matching search words
set tags=/<path>/tags,/<path>/tags   -> set your tags path for vim, so that you don’t have to set tags every time you open the vim

More details @
http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html
http://tutorial.fyicenter.com/out.php?ID=4231

OMAP3 Zoom2 Ubuntu 10.04 Environment setup and build steps(for Android Froyo)OMAP3 Zoom2 Ubuntu 10.04 Environment setup and build steps(for Android Froyo)

My scribe notes…
http://omappedia.com/index.php?title=L25.INC2.5_Release_Notes&redirect=no
1. Get the ARM Cross compiler and install
wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
OR
wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package6488/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
mkdir -p ${HOME}/opt
tar -C ${HOME}/opt -jxf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
2. Add Compiler directory to PATH, and cross compiler prefix before build
export PATH=/<toolchain_folder>/bin:$PATH
export CROSS_COMPILE=arm-none-linux-gnueabi-
3. Additional packages required for building
sudo apt-get install git-core flex bison gperf libesd0-dev zip
sudo apt-get install libwxgtk2.6-dev zlib1g-dev build-essential libstdc++5  (or libstdc++6)
sudo apt-get install tofrodos x-dev libx11-dev libncurses5-dev
sudo apt-get install sun-java5-jdk
4. Install sun-java5-jdk package
#add the old Jaunty repos to /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
#then run below commands
sudo apt-get update
sudo apt-get install sun-java5-jdk    # if this cmd fails , then install it from System->Administrator->Synaptic Package manager
5. For ubuntu 10.04 , install below packages
apt-get install git-core uboot-mkimage openjdk-6-jdk bison flex g++-4.4 zlib1g-dev libncurses5-dev libreadline5-dev gperf
sudo update-alternatives –config java
sudo update-alternatives –config javac
6. Install repo if required
$ cd ~/bin
$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
7. Get the source code,
mkdir -p <your directory path>/mydroid
cd <your directory path>/mydroid
export MYDROID=`pwd`
repo init -u <Repo> -b <commit>
repo sync
That is,
mkdir RLS25.INC2.5RC2
cd RLS25.INC2.5RC2
repo init -u git://git.omapzoom.org/platform/omapmanifest.git -b froyo
cd .repo/manifests
git reset –hard RLS25.INC2.5rc2
cd ../..
repo sync
OR
mkdir -p <your directory path>/mydroid
cd <your directory path>/mydroid
export MYDROID=`pwd`
git checkout <Repo> -b <local-branch-name-here> <Branch>
git checkout <Commit>
That is,
git clone git://git.omapzoom.org/kernel/omap.git
cd omap/
git checkout –track -b p-android-omap-2.6.29 origin/p-android-omap-2.6.29
git checkout 6bec52ae43198677467744befd6598ab19f5c041
8. Building U-Boot
$ cd $MYDROID/bootable/bootloader/u-boot
$ make distclean
$ make CROSS_COMPILE=arm-none-linux-gnueabi- omap3430zoom2_config
$ make CROSS_COMPILE=arm-none-linux-gnueabi-
$ cp $MYDROID/bootable/bootloader/u-boot/tools/mkimage ~/bin/
9. BuildING x-loader
$ cd $MYDROID/bootable/bootloader/x-loader
$ make distclean
$ make CROSS_COMPILE=arm-none-linux-gnueabi- omap3430zoom2_config
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ift
10. Get source for kernel and modules
$ cd <your work directory>; export YOUR_PATH=`pwd`
$ mkdir kernel
$ git clone git://git.omapzoom.org/kernel/omap.git kernel/android-2.6.32
$ cd kernel/android-2.6.32
$ git checkout c012c72d887f720609d341a03661da10c87d6445
OR  update code if  you already have code
$ cd $YOUR_PATH/kernel/android-2.6.32
$ git fetch origin
$ git checkout c012c72d887f720609d341a03661da10c87d6445
11. Building Linux kernel
Before the kernel compilation, you will need to download the RLS25.INC2.5rc2 patches for zoom2.
cd <path_to_kernel>
git apply 0001-Page-flipping-frame-buffer-issue-FIXED.patch
git apply 0001-Including-FM-during-kernel-modules-compilation-for-3.patch
$ cd $MYDROID/omap
$ make CROSS_COMPILE=<path to compiler>/arm-none-linux-gnueabi- distclean
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- zoom2_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules
12. Building Android Filesystem
$cd $MYDROID
$cp -Rfp vendor/ti/zoom2/buildspec.mk.default buildspec.mk
$ make -j2
13. Prepare file system
$ cd ~/
$ mkdir myfs
$ cd myfs
$ cp -Rfp $MYDROID/out/target/product/zoom2/root/* .
$ cp -Rfp $MYDROID/omap/drivers/usb/gadget/*.ko .
$ cp -prf $MYDROID/omap/drivers/misc/ti-st/*.ko .
$ cp -Rfp $MYDROID/out/target/product/zoom2/system/ .
$ cp -Rfp $MYDROID/out/target/product/zoom2/data/ .
$ mv init.rc init.rc.bak
$ cp -Rfp init.omapzoom2.rc init.rc
13. You can install Cutecom package for USB based hyper terminal kind of tool. You can install it using Synaptic Package manager
14. Flashing to SD
Create two partitions in SD card one as boot(FAT32) and other filesystem(ext2 or ext3). [you can use package gparted]
$ sudo cp -rf <location_of_uboot.bin>/tmp/boot
$ sudo cp -rf <location_of_MLO>/tmp/boot
$ sudo cp -rf <location_of_uImage>/tmp/boot
$ sudo cp –Rfp ~/myfs/* /tmp/filesystem
$ sudo chmod –R 777 /tmp/filesystem/*
14. Change in bootargs for L25INC2.5rc2  source code
* Frame buffer size removed for 3630. For 3430 add mem=256M in bootargs
#nand unlock
#nand ecc hw
#setenv bootargs console=ttyS3,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1 init=/init \
videoout=omap24xxvout omap_vout.video1_numbuffers=6 omap_vout.vid1_static_vrfb_alloc=y omapfb.vram=“0:4M”
#setenv bootcmd ‘mmcinit 0; fatload mmc 0 0x81c00000 uImage; bootm 0x81c00000′
#saveenv
#boot

How to build and boot your kernel(intel x86, 32-bit) kernel version 2.6.36

1. Download the required kernel source from kernel.org
2. make menuconfig
3. make ARCH=i386 CROSS_COMPILE=</usr/bin/>
4. make ARCH=i386 CROSS_COMPILE=</usr/bin/> modules
5. make ARCH=i386 CROSS_COMPILE=</usr/bin/> install  [This will create your kernel version vmlinux , system.map files in /boot
6. make ARCH=i386 CROSS_COMPILE=</usr/bin/> modules_install [ this will install modules in /lib/modules/<your kernel version>
To create initrd.img file
1. Go to ../boot folder
2. run mkinitramfs -o <initrd.img-[version]>   <version>   [ex: initrd.img-2.6.36 2.6.36]
3 copy initrd.img-<version> to /boot
7. run script /usr/sbin/grub-mkconfig
8. run update-grub to (add your kernel to grub.conf)
9. reboot and select your kernel