* 외국 사이트에서 참고한 거라,.. 나름대로 메뉴얼을 영어로 써봅니다. 문제가 있는 부분은 메일 주시면 수정/ 반영 하도록 하겠습니다.


0. Introduction
  - Python is very strong language for development of any applications. From now, I'm introducing the porting python 2.5 to arm-linux target board with external python modules like numarray, Numeric, etc. And also this document includes building the cross-compiling chains for PXA-255 target board.
  - Host PC : Red Hat Linux 9 ( vm-ware, static IP using nat )
  - TargetBoard : arm based board ( pxa255 ), and has embedded linux OS.


1. Installing Redhat linux 9

 - Custom, allowing ftp, ssh
 - Kernel development, Development Tools
 - ( installing build-essential, libncurses5-dev )

사용자 삽입 이미지

Select "Custom"


사용자 삽입 이미지

Allowing ftp, ssh services

사용자 삽입 이미지

Select Development tools and Kernel Development.


2. SSH configuration in redhat 9
 - Starting etc
   # /etc/rc.d/init.d/sshd start
   # vi ~/.bash_profile

 - append line : /etc/rc.d/init.d/sshd start
 - applying bash
   #source ~/.bash_profile

3. vsftpd configuration
 - create /etc/vsftpd/vsftpd.conf at the first excutation
   # /etc/rc.d/init.d/vsftpd start
   # vi /etc/vsftpd/vsftpd.conf
        local_enable = YES
        write_enable = YES
   # vi ~/.bash_profile

 - append line to .bash_profile : /etc/rc.d/init.d/vsftpd start
 - applying bash
   # source ~/.bash_profile

The order of installation is very important! ( binutils -> kernel -> gcc -> ... )


4. Building cross-compiling toolchain
 - reference site : http://www.ailis.de/~k/archives/19-arm- ··· wto.html

 4-1. binutils - 2.11.2
   - Download installation file : ftp://ftp.gnu.org/gnu/binutils/binutils-2.11.2.tar.gz
     # tar xvfz binutils-2.11.2.tar.gz
     # ./configure --target=arm-linux
     # make
     # make install

   - verifying new binaries : /usr/local/bin
   - verifying new directory : /usr/local/arm-linux

사용자 삽입 이미지


 4-2. Linux Kernel header files
   - Download installation file : http://ftp.kernel.org/pub/linux/kernel/ ··· 7.tar.gz
   - Download kernel patch file : ftp://ftp.arm.linux.org.uk/pub/armlinux/source/kernel-
patches/v2.4/patch-2.4.17-rmk4.gz
 
   - unpacking linux kernel source
     # tar xvfz linux-2.4.17.tar.gz
     # cd linux-2.4.17.tar.gz
     # copy ../patch-2.4.17-rmk4.gz .

   - applying kernel 2.4.17-rmk4 to 2.4.17 for ARM kernel patch
     # zcat patch-2.4.17-rmk4.gz | patch -p1

   - configure the kernel for ARM
     # make menuconfig ARCH=arm
   - save configuration ( you don't have to do anything! )

   - make with dependency 
     # make dep
 
   - copy include, asm-arm, linux files from kernel source to toolchain directory 
     # mkdir /usr/local/arm-linux/include
     # cp -dR include/asm-arm /usr/local/arm-linux/include/asm
     # cp -dR include/linux /usr/local/arm-linux/include/linux

   - create symbolic link 'sys-linux' for the next compiling
     # cd /usr/local/arm-linux/
     # ln -s include sys-linux


 4-3. gcc compile for building libraries

   - Download file : ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3.tar.gz
     # tar xvfz gcc-2.95.3.tar.gz
     # vi gcc/config/arm/t-linux

 
   - replace this line :
   (before) TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
   (after) TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix_h

 
   - configure -> compile -> install the source code
     # ./configure --target=arm-linux --disable-threads --enable-languages=c
     # make ; make install


 4-4. glibc
   - Download file : ftp://ftp.gnu.org/gnu/glibc/glibc-2.2.4.tar.gz
   - Download file2 ( glibc linuxthreads add-on ) : ftp://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.2.4.tar.gz

   - Unpack the source
     # tar xvfz glibc-2.2.4.tar.gz
  
   - linux thread patch to glibc
     # cd glibc-2.2.4
     # tar xvfz ../glibc-linuxthreads-2.2.4.tar.gz

   - set the environment variable for arm-linux
     # export CC=arm-linux-gcc
 
   - configure, make and make install
     # ./configure arm-linux --target=arm-linux --prefix=/usr/local/arm-linux --enable-add-ons
     # make

   - If you see some error like the figure below, don't be confused.
     # ls /usr/local/arm-linux/include/asm/

사용자 삽입 이미지


   - Maybe you can easily find [arch] and [proc] are symbolic link file, and they are broken.
     # cd /usr/local/arm-linux/include/asm/
     # mv arch arch_old
     # mv proc proc_old
     # ln -s /usr/local/arm-linux/include/asm arch
     # ln -s /usr/local/arm-linux/include/asm/proc-armv/ proc

사용자 삽입 이미지


     # make ( it takes pretty much time )
     # make install

   - unset the environment variable
     # unset CC
    

 4-5. second compile for gcc + glibc
     # mv gcc-2.95.3 gcc-2.95.3_old

   - configure, make and make install
     # ./configure --target=arm-linux
     # make
     # make install

   - if you failed make gcc, don't worry about it :)
     in basicio.c, PATH_MAX is undeclared.    
     # vi libchill/basicio.c
   - replace [ #include <limits.h> ] to [ #include <linux/limites.h> ]
      # make ; make install

5. Building python 2.5
 - reference site
     http://whatschrisdoing.com/blog/2006/10 ··· ython-25
     http://www.ailis.de/~k/archives/19-arm- ··· wto.html

 - I found some web page of python 2.5 for ppc-linux. Above web-site is kindly explain the porting python 2.5 to ppc-linux. I was able to port python 2.5 to arm-linux by above two references.

 - Get the source of python 2.5 : http://www.python.org/ftp/python/2.5/Python-2.5.tgz
 - Get the patch of python 2.5 from Chris : http://whatschrisdoing.com/~lambacck/py ··· le.patch


 5-1. Installing Python 2.5
   - Unpack Python-2.5 source codes
     # tar xvfz Python-2.5.tar
 
   - Apply the patch to python-2.5
     # cd Python-2.5
     # cat ../Python2.5_xcompile.patch | patch -p1

   - Configure, make
     # ./configure
     # make python Parser/pgen

   - backup the excutable file for host PC
     # mv python hostpython
     # mv Parser/pgen Parser/hostpgen

 
   - clean
     # make distclean

   - set the environment values
     # export CC=arm-linux-gcc
     # export CXX=arm-linux-g++
     # export AR=arm-linux-ar
     # export LD=arm-linux-ld
     # export RANLIB=arm-linux-ranlib
     # export | grep "arm"

사용자 삽입 이미지

   - Configure python 2.5. I and Chris set the prefix /python, for easy porting to target-board later
     # ./configure --host=arm-linux --target=arm-linux --prefix=/python

   - Make
     # make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=yes
   - You can see many of warnings, for now, just ignore it. ( if you fix this warning, please e-mail me! : hara at hara4u dot net )

   - Make install
     # make install prefix=/python HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=yes

    - If you did all of these processing without any errors, you may success porting!!! :) Congraturations!



6. NFS and Copy the port to the target board
  - I have some target board which includes ARM-PXA255 core and blabla..
  - And this board has embedded linux 2.4 core and has NFS.
 
  6-1. NFS setup
   - You can use NFS ( Network File System ) first time for porting, because the size of builded python is too big for copying to RAM area of target board.
   
   - First, make directory and change the permission
     # mkdir /nfs
     # chmod 777 /nfs
     # chown nobody nfs
     # chgrp nobody nfs

   - Make environment file
     # vi /etc/exports
            /nfs    localhost(rw,insecure)
            /nfs    164.125.xxx.xxx(rw,insecure)
    
   - Do not use that IP address ( that is the IP of my school, PNU in Korea :D )

사용자 삽입 이미지


   - Start the nfs service and register to .bash_profile
     # /etc/rc.d/init.d/nfs start
     # vi ~/.bash_profile
     # adding [/etc/rc.d/init.d/nfs start] at the end of the file
     # source ~/.bash_profile

   - Turn on the target board
     # mount -t nfs -o nolock 164.125.1.1:/nfs /mnt/nfs

   - Test NFS     
     (host pc) # make /nfs/testfolder
     (target pc) #ls /mnt/nfs

   - If your target board doesn't work for NFS, please install that.

사용자 삽입 이미지


   - Copy all of /python/ directory in host PC
     # cp /python /nfs/ -rf

   - Execute python 2.5 on the target board
     # ( target board ) cd /mnt/nfs
     # cd python/bin
     # ./python

   - How do you think about it? Welcome to python in your target board :D
 

사용자 삽입 이미지


7. install the additional module of python
   - If you use the external module of python, just install them :)

 7-1. numarray-1.2.3
   - Reference URL : http://numpy.org/

   - Numarray is another implementation of an arrayobject for Python ...

   - set the environment values
     # export CC=arm-linux-gcc
     # export CXX=arm-linux-g++
     # export AR=arm-linux-ar
     # export LD=arm-linux-ld
     # export RANLIB=arm-linux-ranlib
     # export | grep "arm"

   - Get the source at http://sourceforge.net/project/showfile ··· %3D32367
   - Download numarray-1.2.3.tar.gz ( platform independent version )

   - build & install
     # tar xvfz numarray-1.2.3.tar.gz
     # cd numarray-1.2.3
     # ../Python-2.5/hostpython setup.py build
     # ../Python-2.5/hostpython setup.py install --prefix=/python

   - Copying the libraries of numarray
     # cd /
     # cp python nfs/ -rf

   - Test the module
     # (target board) cd /mnt/nfs
     # (target board) cd python/bin
     # (target board) ./python 'import numarray'

 

사용자 삽입 이미지

 

 7-2. Numeric-24.2

   - This external module compilation is similiar to numarray module.





8. Conclusion
  - This document is for embedded system programmer.
  - if you modify or copy this document to the other web pages, please confirm to me.
   ( Certainly, The authors of above two reference pages can update their pages using this document with indication of my web-page. And I already trackback this document to their pages. )
  - If you have any question or find any bugs ( include English expressions in this documents!! ), please e-mail me or make any comments to this page.
  - If you have any comments like porting to the other platforms, please trackback this pages or comment.
  - Also, you can uses hangul :D, because I'm Korean.
  - E-mail address : [ hara at hara4u dot net ]

Thank you.


크리에이티브 커먼즈 라이센스
Creative Commons License
2008/10/22 16:52 2008/10/22 16:52
Posted by hara

트랙백 보낼 주소 : http://hara4u.net/trackback/288

  1. Python 2.5 >> arm-lnux target board(pxa255) with external python modules

    2009/03/19 15:32
    삭제
    * 외국 사이트에서 참고한 거라,.. 나름대로 메뉴얼을 영어로 써봅니다. 문제가 있는 부분은 메일 주시면 수정/ 반영 하도록 하겠습니다.0. Introduction - Python is very strong language for development of any app

댓글을 달아주세요

  1. 러블오디
    2008/10/23 03:47
    댓글 주소 수정/삭제 댓글
    먼데? 어쩌라고?-_-;;
    하나도 모르겠음;;;ㅋㅋㅋㅋ
  2. 하라
    2008/10/23 11:34
    댓글 주소 수정/삭제 댓글
    알면 컴공 해야죠 뭐 - ㅅ- ;; ㅋㅋ
  3. 용균
    2008/10/31 18:08
    댓글 주소 수정/삭제 댓글
    몰라도 먹고사는데 지장없으면
    모르는게 약이다. ㅋㅋㅋㅋㅋ
  4. 2010/02/11 17:39
    댓글 주소 수정/삭제 댓글
    정말 감사합니다.
    덕분에, 개발보드에 포팅하는데 성공했네요.^^
  5. hara
    2010/02/12 14:19
    댓글 주소 수정/삭제 댓글
    이목한님 :-) 성공하셨으면, 저에게 피드백 부탁 드립니다~ ^^

<< PREV : [1] : ... [72] : [73] : [74] : [75] : [76] : [77] : [78] : [79] : [80] : ... [299] : NEXT >>

BLOG main image
Hara'z Daily Story by hara

카테고리

All (299)
Daily_Diary (83)
Photo playground (68)
Play music (0)
Life story (45)
Culture (48)
Trip memory (12)
Emotional Engineering (36)
자취생활백서 (0)
루비이야기 (5)

글 보관함

달력

«   2010/03   »
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Total : 152176
Today : 116 Yesterday : 124