2010-12-13

[ZT+安装]OpenRISC工具链移植方法

安装Toolchain之前,需要有以下物件才能正确执行:
build-essential
make
gcc
g++
flex
bison
patch

texinfo
libncurses-dev
因此,先输入以下指令安装需要的物件:
(以下为Ubuntu的指令下达方式)
sudo apt-get update
sudo apt-get -y install build-essential
sudo apt-get -y install make
sudo apt-get -y install gcc
sudo apt-get -y install g++
sudo apt-get -y install flex
sudo apt-get -y install bison
sudo apt-get -y install patch
sudo apt-get -y install texinfo
sudo apt-get -y install libncurses-dev
(以下为CentOS的指令下达方式)
yum update
yum install build-essential
yum install make
yum install gcc
yum install g++
yum install flex
yum install bison
yum install patch
yum install texinfo
yum install libncurses-dev
接着下载 MOF_ORSOC_TCHN_v3b.sh (需要申请加入会员才能下载)
完成后切换至放置 MOF_ORSOC_TCHN_v3b.sh 的目录下,并于终端机键入指令:
sudo sh MOF_ORSOC_TCHN_v3b.sh
开始执行此shell script
之后会出现以下讯息:
Hello & Welcome to the ORSoC & MOF toolchain builder
############################README#############################
To use this script you have to answer 2 easy y/n questions.
There is a third question after everything is built.
The first question asks if you need to download all the code.
The second checks the download area and permits change if req.
Typically the answers to all the questions are y,y .
The third question asks if you want to run the freshly
built linux image built with the new toolchain as a nice test
in the or1k simulator that is build with this package.
Finally note that it is best to run this script in a clean dir
as root.If you can't run as root things will work fine, but
the simulator run of the linux image will use a default
ramdisk with a prebuilt busybox rather than the fresh
one built by this program. Enjoy
############################README#############################
Get sources & patches select['y'] else you have them select['n'](y/n)
目的是询问是否要取得source codepatch
键入y
This is the current working directory: /home/skourt/文件/or1ksw [/home/skourt/文件/or1ksw] for install select ['y'] else select ['n'] alternate:(y/n)
若显示的是你要的安装位置则键入y,否则键入n,再修改安装位置
之后等待它执行完毕即可(不短的一段时间)
在下载的过程中,会再出现一个问题要你选择:
Run Linux image in the simulator['y'] or not['n'](y/n)
此为询问是否要执行or1ksim来模拟Linux作业系统
在这里我仍然会出现之前的问题,尚待解决

安装完成后,在你安装的目录下,会出现两个资料夹:build 与 download

build:所有Toolchain相关的档案皆安装在此
download:安装Toolchain所需的source codepatch皆先存至此再进行安装到build
而所有工具指令的储存位置则在 build/tools ,要使用Toolchain工具,需要设定环境变量才方便做指令的呼叫,键入以下指令:
export PATH=/opt/build/tools/or32-uclinux/bin:$PATH

此处是假设build资料夹所在之路径在 /opt 
接下来需要注意的是:没有安装GDB!!!

因此,须先至GDB官网 下载GDB以及到 www.opencores.org论坛 下载gdb6.8patch档案(以我为例,我使用gdb6.8or32-gdb-6.8-patch-2.0.bz2),置于build资料夹中

gdb-6.8解压缩至build的资料夹中
tar jxpf gdb-6.8.tar.bz2
进入gdb-6.8资料夹中
cd gdb-6.8
然后执行以下指令:
bzcat -dc ../or32-gdb-6.8-patch-2.0.bz2 | patch -p1

/opt/build中新加入一个资料夹,命名为b-gdb
mkdir b-gdb

进入b-gdb资料夹中
cd b-gdb

然后执行以下指令:
../gdb-6.8/configure --target=or32-uclinux --prefix=/opt/build/tools/or32-uclinux

最后执行makefile以完成gdb之安装:
make all (产生资料夹与component)
make install (安装所有必要的component)
或直接二合一输入亦可:
make all install

最后一个步骤可以省略不做,其目的是将Toolchain的指令路径设定在环境变量PATH中,这样即可在任何一个位置内执行Toolchain的指令,方法如下:
1. 在你的家目录下找到.bashrc这个档案,这个档案的作用是在开机时会执行这档案中的所有指令,以下是利用gedit编辑器开启来做修改:
cd ~
gedit .bashrc
2. 加入以下指令后存档:
export PATH=/opt/build/tools/or32-uclinux/bin:$PATH
最后重开机即完成
以上完全出自我的专题学习blog
我的blog: http://mrleftfpga.blogspot.com/
请各位前辈多多指教~


============ 自己实验结果 ============

Jack@Ubuntu-Desktop[~/work/openrisc/trunk/toolchain_install_scripts]....20:03:15
$[14] ->./MOF_ORSOC_TCHN_v5c_or32-elf.sh

The OpenRISC toolchain install script - Provided by ORSoC & MeansOfFreedom.net
Version v5c

#####################################README#####################################

This script will install tools required for development on the OpenRISC platform
This version (v5c) includes:
gcc-4.2.2, binutils-2.18.50, uClibc-0.9.29
linux-2.6.24, gdb-6.8, busybox-1.7.5 and or1ksim-0.4.0

Please follow the prompts to select the install location.

Note: Two new directories, or32-build and or32-download, will be created in the
current directory for storing downloaded files and building the tools.
Also: This script attempts to mount a ramdisk image in a local directory to copy
in the freshly built busybox. This requires root user privileges - if they are
not deteceted the existing busybox binaries will remain in the ramdisk image.

#####################################README#####################################

Install the toolchain under current directory?
Current directory: [/home/Jack/work/openrisc/trunk/toolchain_install_scripts]
Tools will be installed in [/home/Jack/work/openrisc/trunk/toolchain_install_scri pts/or32-elf]
[Y/n]:
n
Enter the path the toolchain will be installed in:
/opt/or32-elf

Path does not exist. Create /opt/or32-elf now?
[y/N]:
y
Chosen directory is [/opt/or32-elf]
Tools will be installed in [/opt/or32-elf/or32-elf], or1ksim in [/opt/or32-elf/or1ksim]
[y/n]:
y
#########################Checking for required build tools######################

Checking for make /usr/bin/make
Checking for patch /usr/bin/patch
Checking for gcc /usr/bin/gcc
Checking for g++ /usr/bin/g++
Checking for bzip2 /bin/bzip2
Checking for wget /usr/bin/wget
Checking for makeinfo /usr/bin/makeinfo
Checking for libncurses-dev (headers)

--2010-12-13 20:06:11-- ftp://ocuser:*password*@opencores.org/toolchain/md5sums
=> “md5sums”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE md5sums ... 2673
==> PASV ... 完成。 ==> RETR md5sums ... 完成。
长度:2673 (2.6K) (非正式数据)

100%[====================================================================================================>] 2,673 --.-K/s 花时 0.01s

2010-12-13 20:06:31 (215 KB/s) - “md5sums” 已保存 [2673]

Downloading binutils-2.18.50.tar.bz2
--2010-12-13 20:06:31-- ftp://ocuser:*password*@opencores.org/toolchain/binutils-2.18.50.tar.bz2
=> “binutils-2.18.50.tar.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE binutils-2.18.50.tar.bz2 ... 16040444
==> PASV ... 完成。 ==> RETR binutils-2.18.50.tar.bz2 ... 完成。
长度:16040444 (15M) (非正式数据)

100%[====================================================================================================>] 16,040,444 68.5K/s 花时 3m 49s

2010-12-13 20:10:33 (68.4 KB/s) - “binutils-2.18.50.tar.bz2” 已保存 [16040444]


Downloading uClibc-0.9.29.tar.bz2
--2010-12-13 20:10:33-- ftp://ocuser:*password*@opencores.org/toolchain/uClibc-0.9.29.tar.bz2
=> “uClibc-0.9.29.tar.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE uClibc-0.9.29.tar.bz2 ... 2134864
==> PASV ... 完成。 ==> RETR uClibc-0.9.29.tar.bz2 ... 完成。
长度:2134864 (2.0M) (非正式数据)

100%[====================================================================================================>] 2,134,864 77.5K/s 花时 97s

2010-12-13 20:12:29 (21.6 KB/s) - “uClibc-0.9.29.tar.bz2” 已保存 [2134864]


Downloading busybox-1.7.5.tar.bz2
--2010-12-13 20:12:29-- ftp://ocuser:*password*@opencores.org/toolchain/busybox-1.7.5.tar.bz2
=> “busybox-1.7.5.tar.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE busybox-1.7.5.tar.bz2 ... 1727420
==> PASV ... 完成。 ==> RETR busybox-1.7.5.tar.bz2 ... 完成。
长度:1727420 (1.6M) (非正式数据)

100%[====================================================================================================>] 1,727,420 93.3K/s 花时 23s

2010-12-13 20:13:03 (73.5 KB/s) - “busybox-1.7.5.tar.bz2” 已保存 [1727420]


Downloading or1ksim-0.4.0.tar.bz2
--2010-12-13 20:13:03-- ftp://ocuser:*password*@opencores.org/toolchain/or1ksim-0.4.0.tar.bz2
=> “or1ksim-0.4.0.tar.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE or1ksim-0.4.0.tar.bz2 ... 1132681
==> PASV ... 完成。 ==> RETR or1ksim-0.4.0.tar.bz2 ... 完成。
长度:1132681 (1.1M) (非正式数据)

100%[====================================================================================================>] 1,132,681 60.8K/s 花时 17s

2010-12-13 20:13:28 (63.8 KB/s) - “or1ksim-0.4.0.tar.bz2” 已保存 [1132681]


Downloading initrd-fb-03.ext2.last.work.1.7.5.bz2
--2010-12-13 20:13:28-- ftp://ocuser:*password*@opencores.org/toolchain/initrd-fb-03.ext2.last.work.1.7.5.bz2
=> “initrd-fb-03.ext2.last.work.1.7.5.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE initrd-fb-03.ext2.last.work.1.7.5.bz2 ... 549002
==> PASV ... 完成。 ==> RETR initrd-fb-03.ext2.last.work.1.7.5.bz2 ... 完成。
长度:549002 (536K) (非正式数据)

100%[====================================================================================================>] 549,002 54.8K/s 花时 9.9s

2010-12-13 20:13:46 (53.9 KB/s) - “initrd-fb-03.ext2.last.work.1.7.5.bz2” 已保存 [549002]


Downloading binutils-2.18.50.or32_fixed_patch-v2.1.bz2
--2010-12-13 20:13:46-- ftp://ocuser:*password*@opencores.org/toolchain/binutils-2.18.50.or32_fixed_patch-v2.1.bz2
=> “binutils-2.18.50.or32_fixed_patch-v2.1.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE binutils-2.18.50.or32_fixed_patch-v2.1.bz2 ... 609200
==> PASV ... 完成。 ==> RETR binutils-2.18.50.or32_fixed_patch-v2.1.bz2 ... 完成。
长度:609200 (595K) (非正式数据)

100%[====================================================================================================>] 609,200 37.5K/s 花时 19s

2010-12-13 20:14:18 (30.9 KB/s) - “binutils-2.18.50.or32_fixed_patch-v2.1.bz2” 已保存 [609200]


Downloading gcc-4.2.2-or32-fp.patch.bz2
--2010-12-13 20:14:18-- ftp://ocuser:*password*@opencores.org/toolchain/gcc-4.2.2-or32-fp.patch.bz2
=> “gcc-4.2.2-or32-fp.patch.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE gcc-4.2.2-or32-fp.patch.bz2 ... 30860
==> PASV ... 完成。 ==> RETR gcc-4.2.2-or32-fp.patch.bz2 ... 完成。
长度:30860 (30K) (非正式数据)

100%[====================================================================================================>] 30,860 18.0K/s 花时 1.7s

2010-12-13 20:14:30 (18.0 KB/s) - “gcc-4.2.2-or32-fp.patch.bz2” 已保存 [30860]


Downloading linux_2.6.24_or32_unified_v2.3.bz2
--2010-12-13 20:14:30-- ftp://ocuser:*password*@opencores.org/toolchain/linux_2.6.24_or32_unified_v2.3.bz2
=> “linux_2.6.24_or32_unified_v2.3.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE linux_2.6.24_or32_unified_v2.3.bz2 ... 787484
==> PASV ... 完成。 ==> RETR linux_2.6.24_or32_unified_v2.3.bz2 ... 完成。
长度:787484 (769K) (非正式数据)

100%[====================================================================================================>] 787,484 92.2K/s 花时 10s

2010-12-13 20:14:47 (76.1 KB/s) - “linux_2.6.24_or32_unified_v2.3.bz2” 已保存 [787484]


Downloading uClibc-0.9.29-or32-patch-1.1.bz2
--2010-12-13 20:14:47-- ftp://ocuser:*password*@opencores.org/toolchain/uClibc-0.9.29-or32-patch-1.1.bz2
=> “uClibc-0.9.29-or32-patch-1.1.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE uClibc-0.9.29-or32-patch-1.1.bz2 ... 22355
==> PASV ... 完成。 ==> RETR uClibc-0.9.29-or32-patch-1.1.bz2 ... 完成。
长度:22355 (22K) (非正式数据)

100%[====================================================================================================>] 22,355 16.1K/s 花时 1.4s

2010-12-13 20:14:56 (16.1 KB/s) - “uClibc-0.9.29-or32-patch-1.1.bz2” 已保存 [22355]


Downloading or32-gdb-6.8-patch-2.4.bz2
--2010-12-13 20:14:56-- ftp://ocuser:*password*@opencores.org/toolchain/or32-gdb-6.8-patch-2.4.bz2
=> “or32-gdb-6.8-patch-2.4.bz2”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE or32-gdb-6.8-patch-2.4.bz2 ... 67769
==> PASV ... 完成。 ==> RETR or32-gdb-6.8-patch-2.4.bz2 ... 完成。
长度:67769 (66K) (非正式数据)

100%[====================================================================================================>] 67,769 46.1K/s 花时 1.4s

2010-12-13 20:15:03 (46.1 KB/s) - “or32-gdb-6.8-patch-2.4.bz2” 已保存 [67769]


Downloading rgd_uc_29v5dotconfig
--2010-12-13 20:15:03-- ftp://ocuser:*password*@opencores.org/toolchain/rgd_uc_29v5dotconfig
=> “rgd_uc_29v5dotconfig”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE rgd_uc_29v5dotconfig ... 4064
==> PASV ... 完成。 ==> RETR rgd_uc_29v5dotconfig ... 完成。
长度:4064 (4.0K) (非正式数据)

100%[====================================================================================================>] 4,064 --.-K/s 花时 0.002s

2010-12-13 20:15:14 (1.76 MB/s) - “rgd_uc_29v5dotconfig” 已保存 [4064]


Downloading rgd_bb_1.75dotconfig
--2010-12-13 20:15:14-- ftp://ocuser:*password*@opencores.org/toolchain/rgd_bb_1.75dotconfig
=> “rgd_bb_1.75dotconfig”
正在解析主机 opencores.org... 92.43.36.68
正在连接 opencores.org|92.43.36.68|:21... 已连接。
正在以 ocuser 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /toolchain ... 完成。
==> SIZE rgd_bb_1.75dotconfig ... 21310
==> PASV ... 完成。 ==> RETR rgd_bb_1.75dotconfig ... 完成。
长度:21310 (21K) (非正式数据)

100%[====================================================================================================>] 21,310 13.1K/s 花时 1.6s

2010-12-13 20:15:23 (13.1 KB/s) - “rgd_bb_1.75dotconfig” 已保存 [21310]


Downloading gcc-core-4.2.2.tar.bz2
--2010-12-13 20:15:23-- ftp://anonymous:*password*@ftp.gnu.org/gnu/gcc/gcc-4.2.2/gcc-core-4.2.2.tar.bz2
=> “gcc-core-4.2.2.tar.bz2”
正在解析主机 ftp.gnu.org... 140.186.70.20
正在连接 ftp.gnu.org|140.186.70.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /gnu/gcc/gcc-4.2.2 ... 完成。
==> SIZE gcc-core-4.2.2.tar.bz2 ... 19104360
==> PASV ... 完成。 ==> RETR gcc-core-4.2.2.tar.bz2 ... 完成。
长度:19104360 (18M) (非正式数据)

 1% [> ] 225,888 2.95K/s 估时 5h 9m ^ 1% [> ] 228,784 --.-K/s 估时 5h 14m


本文地址:http://114er.blogspot.com/2010/12/ztopenrisc.html
原创文章如转载,请注明链接: 转自Welcome Funny Guys

0 评论: