最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

在NIOS II上安裝uClinux全過程的4篇文章 之 前2篇

2023-07-21 12:33 作者:有AI野心的電工和碼農  | 我要投稿

同一個網(wǎng)站(此網(wǎng)站當年就被屏蔽了無法訪問, 用了些科技)的4篇文章, 當年就是參考這4篇文章成功地在NIOS2上裝上了uClinux, 當時還蠻有成就感的. 估計現(xiàn)在這些都過時了, 也沒多少價值了, 權當記錄一下留個紀念.

原文地址:http://nioswiki.jot.com/InstallNios2Linux

1. 第一篇: InstallNios2Linux

Version 35, changed by jai.dhar@gmail.com. 10/19/2008.?Show version history

Here we will setup the source to build Nios2 uClinux. branch "test-nios2" , per 20080619.

If you already have the toolchain and working uClinux-dist git repo, then you can skip the "new install" below and go to the second half, "Distro upgrade".

1.1 New install

You must have a Linux desktop with software development packages. Login as root or use sudo to install these packages.

On Fedora,RHEL,Centos

sudo yum install git-core make gcc ncurses-devel bison byacc flex gawk gettext ccache zlib-devel gtk2-devel lzo-devel

On Suse,

sudo zypper install git-core make gcc ncurses-devel bison byacc flex gawk gettext ccache zlib-devel lzo-devel

On Debian/Ubuntu,

sudo apt-get update

sudo apt-get install git-core make gcc ncurses-dev bison flex gawk gettext ccache zlib1g-dev libx11-dev texinfo lzo-dev

  • If Ubuntu can't find the lzo-dev package, try lzo2-dev. This is needed for the MTD tools package.

Please check your git version with?git --version. If it is older than 1.5.3.x, please update to the latest.

On Ubuntu,?check if the default shell is "bash"

ls -l /bin/sh

This should give?/bin/sh -> bash,

Otherwise, change it with,

sudo rm /bin/sh?

sudo ln -s bash /bin/sh

followed by a logout and log back in again.

As root, check if you have?cc?which is a symlink to?gcc??

which gcc?

gcc -v?

which cc?

cc -v

if not,

cd /usr/bin?

ln -s gcc cc

Make sure you have 5GB or more free disk space. Please use wget to download the tar file?nios2-linux-20080619.tar?, 842MB. Best thanks to Altera's kindly hosting these files. Please verify the sha1sum after download.

(but don't use Windows ftp, it corrupt the files)

wget ftp://ftp.altera.com/outgoing/nios2-linux-20080619.tar

(SHA1SUM bb851b5494b4ae5c6ccdcfa5625b0f4d9340252a nios2-linux-20080619.tar)

這里下載uClinux dist包(nios2-linux-20080619.tar中包含的有,最新版的只能此途徑下載),下載之后,可用SHA1SUM驗證一下校驗和。

We use?git?to keep the source. You make check out?GitServer?later. The git database inside the tar file was compressed, so we don't do compression on the tar file.

You can build in any working directory as a user account, eg. in your home (say /home/hippo). The tar file contains a nios2-linux dir.

Now the source for the Nios2 uClinux and gnutools was ready.

  • linux-2.6: the Linux kernel source, which is stock Linux kernel plus Nios2 specific patches. The current version is v2.6.26-rc6.

  • uClinux-dist: the uClinux userspace libraries and applications. We will build uClinux here.

  • binutils,gcc3,elf2flt,insight: the gnu tools.

  • uClibc: the main userspace libraries, which is smaller that glibc. please note, newlib doesn't support Nios2 uClinux.

  • u-boot: a powerful boot loader and monitor, DasUBoot .

We will proceed to build the toolchain. If you don't want or fail to build it yourself, you may use the prebuild?BinaryToolchain.

這里是 自己build 交叉編譯工具鏈 or 是下載現(xiàn)成的(即BinaryToolchain鏈接)。下載現(xiàn)成的工具鏈BinaryToolchain的具體方法可見下面的另一篇文章BinaryToolchain?。

If you work on x86_64, 64 bits platform, you will need to change the arch to 32 bits , with?setarch i386?, to build gcc.

It might take hours to build.

好了,不管是自己build的還是用的現(xiàn)成的toolchain,準備好了toolchain工具鏈之后,就要設置一下 環(huán)境路徑 并驗證一下,見下面的:

The default installation path is?toolchain-build/build/nios2. Then setup the PATH for the tools, you can add a line at the end of file?~/.bash_profile?(or?~/.profile?on Debian/Ubuntu) ( the file is hidden, you have to use?ls -a?to find it . For?gedit?use open Location, and enter the file name), like this

PATH=$PATH:/home/hippo/nios2-linux/toolchain-build/build/nios2/bin

Logout and login again. You can use the tools now. Run this to verify that you have it in your command search path,

nios2-linux-uclibc-gcc -v

Try to compile a simple hello.c like this,

nios2-linux-uclibc-gcc hello.c -o hello -elf2flt

The compiled object format is?FLAT.

You may check it with,

nios2-linux-uclibc-flthdr hello

Optionally, add links for ccache, as root or via sudo

ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-gcc?

ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-g++?

ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-c++

When you compile something, the cache will be used and the compilation run faster. You can check cache status with,

ccache -s

Now you can follow?UClinuxDist?to build the kernel.?You should build in the new source tree, nios2-linux/uClinux-dist .

cd uClinux-dist?

make menuconfig?

make vendor_hwselect SYSPTF=<path to your system ptf>?

make

1.2 Release note

Important changes in this release,?nios2-linux-20080619,

  1. the arch name is now "nios2", (but not nios2nommu). Use current development branch test-nios2 by default.

  2. the kernel source linux-2.6.x and uClibc are removed from uClinux-dist. the kernel source is now external linux-2.6 (from linux-2.6.git) at the same directory level as uClinux-dist.

  3. the previous nios2_system.h is relocated to?include/asm-nios2/nios2.h, and now the port/memory address is physical address ,?without cache-bypass, ie no address bit 31 set.

  4. mtd partition maps file altera.c , microtronix.c and EPCS drivers are removed. Now they are in the platform device data of arch/nios2/kernel/config.c, using generic physical maps , m25p80 and altera spi driver.

  5. many arch/drivers reworked/added, such as timer, interrupt handler, cache, ioremap, uart/jtaguart, framebuffer, spi, TSE.

  6. adopt the Makefile from blackfin uclinux-dist, with many userspace libs/apps merged from blackfin. eg, ncurses, openssl, directfb, freetype..etc.

  7. introduce the staging dir, with all libs and headers installed there. the previous include dir was removed.

The latest branch is "test-nios2". Despite the "test" in the name, this does not mean "unstable". All future works and support will base on this branch. I won't update those older branches with the limited time available. Please migrate to the new branch.

The uClinux-dist dose not contain the kernel now. It should stick with "test-nios2" branch. It will merge updates from uclinux.org and blackfin uclinux.

The development of nios2 kernel will stick with mainly the "test-nios2" branch, with proper tags follow Linus' releases. eg "v2.6.26-nios2" tag when Linus release "v2.6.26" stable. Then it will move on to v2.6.27-rc1, but not with a new branch. It is still "test-nios2" branch.

Though there will be some experimental branches from time to time, but they will be merged into the main branch "test-nios2" at proper time. And then deleted.

If you need a "stable" branch, you can create local branch off the stable tags. You might apply patches from stable-queue git. Or you want to freeze. It is all up to you.

1.3 Update

After you have first successful boot, you can get updates from server.

Change to the nios2-linux dir,

(Only if you are behind a proxy firewall and cannot use git protocol, you can change the git to use http to get updates from community server with this command,?./use_http_for_update?. You will need to add the setup of proxy to your login profile (.bash_profile or .profile),

export http_proxy=http://proxy_server:port_number?)

Now fetch updates from server with,?./update?.

++++++++++++++++++++++++++++++

(note) if the kernel couldn't start after update..

Please disable optimize for size, or start with default config again.

General setup -->

[ ] Optimize for size <== unselect

++++++++++++++++++++++++++++++

If you got such error in updating,

Please do a?git checkout -f?. Then `git pull" again.

1.4 Distro upgrade

If you already have the toolchain and working uClinux-dist git repo, you don't have to download the new tar ball nios2-linux-20080619.tar .

As the kernel source is removed from the uClinux-dist dir, you need a kernel source dir.?At the same dir level of uClinux-dist, don't cd uClinux-dist.?Clone the kernel source from the Linus' git.

git clone -n git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Or if you are behind a proxy firewall,

git clone -n http://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Edit the file?.git/config, change the origin url to sopc server,

Or if you are behind a proxy firewall,

Next, create the new branch?test-nios2?and checkout,

Then, checkout the?test-nios2?branch of uClinux-dist,


Now, you may build as before in this?uClinux-dist?dir,

make menuconfig?

make vendor_hwselect SYSPTF=<your_system.ptf>?

make

1.5 migration

The important point is that the kernel source tree was removed from uClinux-dist, and used external linux-2.6 (from git). And the old arch name?nios2nommu?is changed to?nios2.

If you have local commit in older branches, either v2.6.26-nios2 or pre v2.6.26-nios2, you will have to move the local kernel patches from uClinux-dist/linux-2.6.x/ to linux-2.6/ .

First, find your local commit sha1 id in the old branch of uClinux-dist, using

git log <old branch> <dir of interest>

or

gitk <old branch> <dir of interest>

eg,

cd uClinux-dist?

gitk v2.6.24-uc-myabc linux-2.6.x/

Take down the sha1 ID of the commit, 7-8 digits is enough. say, abc6789.

Use git-format-patch to generate patches for cherry-pick,

git format-patch abc6789^..abc6789

Or you can use a range, and pick only you need.

git format-patch <from>..<to>

Some 0001-……patch will be generated.

Filter the patches to change the path and arch reference,

sed -i -e szlinux-2.6.x/zzg 0*patch?

sed -i -e sznios2nommuznios2zg 0*patch

Then create your local branch from test-nios2 branch of linux-2.6/

Now you can apply these patches

For other dir in uClinux-dist, eg, vendors/Altera, generate patches from your local commit.

cd uClinux-dist?

gitk v2.6.24-uc-myabc vendors/Altera?

gitk format-patch <from>..<to>

Filter the patches to change the arch reference,

sed -i -e sznios2nommuznios2zg 0*patch

Now create your local branch from test-nios2 of uClinux-dist, and apply the patches,

git branch --track test-nios2-myabc origin/test-nios2?

git checkout test-nios2-myabc?

git am <path_to_the_patches>

原文地址:http://nioswiki.jot.com/WikiHome/OperatingSystems/BinaryToolchain

2. 第二篇 BinaryToolchain

Version 41, changed by hippo5329@yahoo.com.tw. 09/29/2008.?Show version history

Linked from?UClinuxDist

Attached are binary of the tools to run on Linux PC and root fs from buildroot. You can use it to compile kernel and apps.

Login as a user account on Linux PC, eg, hippo. The user home dir will be?/home/hippo, short form as?~/?.

Use wget to download the cross tools (69MB). Best thanks to Altera's kindly hosting these files.?(but don't use Windows ftp, it corrupt the files)

wget ftp://ftp.altera.com/outgoing/nios2gcc-20080203.tar.bz2

(sha1sum 6873249d8eae7c2981aac6791f044ddaab507566 nios2gcc-20080203.tar.bz2)

Open a terminal. Run as root or use sudo,

sudo tar jxf nios2gcc-20080203.tar.bz2 -C /

The cross gcc tools was expected to be installed in?/opt/nios2?dir. But you may install in any other dirs. Then setup the PATH for the cross gcc, you can add a line at the end of file?~/.bash_profile?(or?~/.profile?on Debian/Ubuntu) ( the file is hidden, you have to use?ls -a?to find it . For?gedit?use open Location, and enter the file name)

PATH=$PATH:/opt/nios2/bin

After you change the?.bash_profile?or?.profile, you need to logout and login again. So that it will be in the PATH when you login.

Check with,

echo $PATH

It should display like this, with nios2 path at the end,

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/nios2/bin

To verify the cross gcc, try out,

nios2-linux-uclibc-gcc -v

It should display the info,

Then try build kernel and apps as in the?UClinuxDist?.

Optionally, you can install?ccache, the compiler cache, which can reduce the compilation time a lot.

Install required package, as root or via sudo

On Fedora,RHEL,

yum install ccache

On Debian/Ubuntu, (via sudo)

apt-get install ccache

Then add links, still as root or via sudo

ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-gcc?

ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-g++?

ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-c++

When you compile something, the cache will be used, you can check cache status with,

ccache -s


在NIOS II上安裝uClinux全過程的4篇文章 之 前2篇的評論 (共 條)

分享到微博請遵守國家法律
濮阳市| 长沙市| 延川县| 通化市| 论坛| 怀柔区| 汨罗市| 鹤庆县| 民勤县| 龙井市| 麻阳| 安西县| 丹凤县| 盐城市| 古蔺县| 论坛| 乌拉特后旗| 武陟县| 辉南县| 阳江市| 攀枝花市| 金坛市| 福贡县| 镇原县| 广汉市| 墨脱县| 镇雄县| 湖州市| 高阳县| 开阳县| 廊坊市| 额尔古纳市| 江孜县| 咸阳市| 双鸭山市| 拉孜县| 社会| 富源县| 绍兴市| 余姚市| 江西省|