Linux install

Name:
Location: United States

Thursday, December 13, 2007

How to setup a cross compile environment on linux machine

1. Install linux on host machine
2. Enable tftp, nfs,and samba service--do it with root account
2.1 Set up tftp server for downloading image to target, append sudo prefix if sudoer list is setup
  • Edit /etc/xinet.d/tftp to enable tftp service, set disable=no
  • Reload xinet serivice, /sbin/service xinetd reload
2.2 Set up NFS server so that target machine can mount root file system on the server machine.
  • Edit /etc/exports, add the following line
/localhome/wli/rootfs 172.30.80.0/10(rw,sync,no_root_squash)
  • Restart NFS service, /sbin/service nfs restart
2.3 Setup samba service on linux server machine. Samba service is used for mapping user work directory
to window machine so
that we can use window editor to edit the application files .

  • Edit /etc/samba/smb.conf
  • Add an entry there to allow sharing of home directory to window

[wli]
comment = Wende's stuff
path = /localhome/wli
valid users = wli
public = no
writable = yes
printable = no
create mask = 0765
  • Add samba user and setup passwd
smbpasswd -a wli
restart smb service
/sbin/service smb restart
That's all, using window browser to log in to the server.



3. Add current user wli to sudo list account, /etc/sudoers
wli ALL=(ALL) NOPASSWD: ALL

4. Install cross compile tool, like crosstool on /opt directory
cd /opt
sudo mkdir /opt/crosstool
sudo chown $USER /opt/crosstool /make sure you're on the sudoer list. if not, use su command
wget http://kegel.com/crosstool/crosstool-0.43.tar.gz
tar xvfz crosstool-0l43.tar.gz
cd /opt/crosstool-0.43
vi demo-powerpc-603.sh ---uncomment the following line
eval `cat powerpc-603.dat gcc-4.1.0-glibc-2.3.6-tls.dat` sh all.sh --notest
sh
demo-powerpc-603.sh
.........................
this will download and install tool chain on /opt/crosstool directory
/opt/crosstool/gcc-4.1.0-glibc-2.3.6/

.............................

3.1 Add the compilers to the PATH environment

vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/opt/crosstool/gcc-4.1.0-glibc-2.3.6/powerpc-603-linux-gnu/bin
export PATH
export CROSS_COMPILE=powerpc-603-linux-gnu

3.2
source the new bash_profile
source ~/.bash_profile
you're ready to go at this moring. Test drive a hello.c program.
4. You may need mkimage as well if you want to build uImage. You can either copy it from ELDK or get the source and compile it.
copy them to /opt/crosstool/gcc-xx-glibc-xxx/powerpc-405-linux-gnu/bin



Thursday, December 06, 2007

MTD basic and configuration

  1. Introduction
MTD device is made up of blocks. Operation includes read, write and erase.Erase operation operates on blocks or whole device.
2. How to set up MTD device
  • Specify the partitions on Flash device

  • Specify the type of Flash and location

  • Configure flash driver for your chosen chip

  • Configure the kernel with the appropriate driver

3. How to communicate flash partitions to the linux kernel
  • RedBoot partition table parsing(redboot is a bootloader for ARM )
  • Command line partition table parsing
First, enable it on kernel configuration.
  • Using mtd partition mapping drivers (see drivers/mtd/maps for examples)

Wednesday, December 05, 2007

How to generate patch

1. To generate patchs across all levels of source trees, run
diff -urN orginal_directory/ new_directory/ >my_patch

my_patch will show difference between old_directory sources and new_directory sources codes
binary file can not be patched.
2. To apply patch to the old source tree
cd original_directory
patch -p1 <../my_patch