Was this page helpful?

安裝 STLinux Cross-Compile Enviroment(交叉編譯環境) 至 Ubuntu

    STLinux 必須安裝在 Ubuntu/Debian 或 RedHat/CentOS 系統內。

    系統環境

    • Ubuntu 8.04.4/10.10
    • STLinux 2.3
    • 網際網路 (安裝後需線上更新所有套件)
       

    安裝前的準備

    使 /bin/sh 使用 bash(註:Ubuntu 預設使用 dash)

    sudo apt-get install bash
    sudo dpkg-reconfigure dash <選 NO>
    

    安裝 rpm

    sudo apt-get install rpm
    sudo apt-get install python-urlgrabber python-rpm python-sqlitecachec python-libxml2
    
    wget http://www.stlinux.com/sites/default/files/stlinux23-host-STLinux_deps-0.1-5.i386.rpm
    sudo rpm -ivh stlinux23-host-STLinux_deps-0.1-5.i386.rpm
    

    方法一: 安裝 STLinux (用 ISO 檔,適用 Ubuntu 8)

    下載 STLinux 2.3 ISO

    wget ftp://ftp.stlinux.com/pub/stlinux/2.3/iso/STLinux-2.3-sh4-03-11-07.iso
    

    掛載 ISO 檔

    sudo mkdir /mnt/iso
    sudo mount -o loop STLinux-2.3-sh4-03-11-07.iso /mnt/iso 
    

    安裝 STLinux

    cd /mnt/iso
    sudo ./install all-sh4-glibc 
    

    方法二:安裝 STLinux (線上安裝,適用 Ubuntu 10 之後,建議)

    wget  ftp://ftp.stlinux.com/pub/stlinux/2.3/install
    

    下載下來請把 install檔案打開,用文字編輯器改兩個地方:
    第 356列 "yum-wavefront-3.2.24-1.i386" 換成 "yum-wavefront-3.2.24-3.i386"
    第 358列 yum-2.6.1-17.i386 換成 "yum-2.6.1-19.i386" (加上雙引號並改19)

    或直接使用修改好的install
    intstal檔檔案屬性最後都要改成可做為程式執行

    開始安裝

    sudo ./install --debian all-sh4-glibc

     

    如果一切正常,會開始安裝所有套件(約 5XX 個),完成後會出現以下的畫面:

    Complete!
    Warning, could not load sqlite, falling back to pickle

    *************************************************
    *          INSTALLATION COMPLETED               *
    *                                               *
    * Website: http://www.stlinux.com               *
    * Support: https://bugzilla.stlinux.com         *
    *                                               *
    *************************************************

    安裝後的事項

    更新 STLinux 所有套件

    cd /opt/STM/STLinux-2.3/host/bin/
    sudo ./stmyum update
    

    TIPs:

    安裝套件數約 38 個
    更新套件數約 286 個

    建立 Cross-Compile 指令的 PATH

    > vi ~/.profile

    加上這幾行
    # for STLinux Cross-Compile
    export PATH="$PATH:/opt/STM/STLinux-2.3/devkit/sh4/bin"
    

    驗證一下

    > . ~/.profile
    > sh4-linux-gcc -v

    Using built-in specs.
    Target: sh4-linux
    Configured with: ../configure --target=sh4-linux --prefix=/opt/STM/STLinux-2.3/devkit/sh4 --exec-prefix=/opt/STM/STLinux-2.3/devkit/sh4 --bindir=/opt/STM/STLinux-2.3/devkit/sh4/bin --sbindir=/opt/STM/STLinux-2.3/devkit/sh4/sbin --sysconfdir=/opt/STM/STLinux-2.3/devkit/sh4/etc --datadir=/opt/STM/STLinux-2.3/devkit/sh4/share --includedir=/opt/STM/STLinux-2.3/devkit/sh4/include --libdir=/opt/STM/STLinux-2.3/devkit/sh4/lib --libexecdir=/opt/STM/STLinux-2.3/devkit/sh4/libexec --localstatedir=/opt/STM/STLinux-2.3/devkit/sh4/var --sharedstatedir=/opt/STM/STLinux-2.3/devkit/sh4/share --mandir=/opt/STM/STLinux-2.3/devkit/sh4/man --infodir=/opt/STM/STLinux-2.3/devkit/sh4/info --enable-checking=assert --program-prefix=sh4-linux- --with-local-prefix=/opt/STM/STLinux-2.3/devkit/sh4 --with-sysroot=/opt/STM/STLinux-2.3/devkit/sh4/target --enable-languages=c,c++ --enable-threads=posix --enable-nls --enable-c99 --enable-long-long --with-system-zlib --enable-shared --disable-libgomp --enable-multilib --with-multilib-list=m4,m4-nofpu --enable-symvers=gnu --with-gxx-include-dir=${prefix}/target/usr/include/c++/4.2.4 --enable-__cxa_atexit
    Thread model: posix
    gcc version 4.2.4 (snapshot) (STMicroelectronics/Linux Base 4.2.4-73) 

    Cross-Compile 交叉編譯

    主要編譯指令集

    Tool Native Name STLinux
     GNU C Compiler  gcc  sh4-linux-gcc
     GNU C++ Compiler  g++  sh4-linux-g++
     GNU C++ Pre-processor  cpp  sh4-linux-cpp
     GNU Linker  ld  sh4-linux-ld
     GNU Assembler  as  sh4-linux-as
     GNU Librarian  ar  sh4-linux-ar

     

     

    Was this page helpful?
    標籤 (Edit tags)
    • No tags

    文件 1

    文件大小日期附件上傳者 
     install
    無描述
    13.76 KB00:12, 22 Oct 2012thx動作
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core