[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[openrisc] uclinux installation tutorial



HI All:

  After fightingh against or1k uclinux I decided to write a little
instructions to install it:

First of all you have to see if you have these tools and what version
you have

autoconf   2.13
automake   1.4-p6
bison      1.35
yacc        
flex       2.5.4
gcc        2.95.2
genromfs   You can download it from 
 
http://prdownloads.sourceforge.net/romfs/genromfs-0.5.1.tar.gz 

IMPORTANT
****It was detected some problems with later versions of autoconf and
automake.
****If you have a gcc 3.2 you have to install gcc-2.95 on your system.


Before begin you have to set LANG environment variable to eng to make
your compiler work in english. If you dont do this you can have problems
with uclibc.

export LANG=eng


After you have all this tools instaled on your system you can begin with
the compilation of the tools:

Became as root

First of all the binutils:

cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co or1k/binutils
cd or1k/
mkdir b-b 
cd b-b 
../binutils/configure --target=or32-uclinux --prefix=/opt/or32-uclinux 

If you had an error like CC enviroment not set write export CC=/usr/bin/

make all install 


Then you have to add binutils to your path

export PATH=/opt/or32-uclinux/bin:$PATH 
cd .. 


After binutils you can compile gcc-3.1


cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co or1k/gcc-3.1

mkdir b-gcc
cd b-gcc
 ../gcc-3.1/configure --target=or32-uclinux --prefix=/opt/or32-uclinux
--local-prefix=/opt/or32-uclinux/or32-uclinux --with-gnu-as
--with-gnu-ld --verbose --enable-languages=c
make all install 
cd ..


Now you can download and compile uclinux


cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co
or1k/uclinux/uClinux-2.0.x/

cd or1k/uclinux/uClinux-2.0.x/

You have to go to arch/or32/Rules.make and edit this line

LIBGCC = /opt/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/libgcc.a


Then you can compile it.

make oldconfig
make dep
make
cd ../../../


Because you have a version of gcc working with glibc, the standard GNU
library but to work with uclinux you need a compiler working with
uclibc. 



cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co or1k/uclibc
cd or1k/uclibc
ln -s ./extra/Configs/Config.cross.or32.uclinux Config

You have now to edit the Config file you have just create and modify
these lines

KERNEL_SOURCE=/root/or1k/uclinux/uClinux-2.0.x/
DEVEL_PREFIX = /opt/$(TARGET_ARCH)-uclinux


And now make it

make all install
cd ../../or32-uclinux/bin
rm -f addr2line ar as cc cpp gasp gcc ld nm objcopy objdump ranlib size
strings strip jar grepjar
cd ../../



Now you have to recompile gcc to make it works with uclibc


cd or1k/gcc-ucl
../gcc-3.1/configure --target=or32-uclinux
--prefix=/tmp/tools/or32-uclinux/
--local-prefix=/tmp/tools/or32-uclinux/or32-uclinux/ --with-gnu-as
--with-gnu-ld --verbose --enable-languages=c
make all install
cd ../../


Its time to compile the simulator, this is very simple:


cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co or1k/or1ksim
cd or1k/or1ksim
configure --target=or32-uclinux --prefix=/tmp/tools/or32-uclinux/
make all install
cd ../../



Now we begin to create our rom filesystem


mkdir romfs
mkdir romfs/bin
cp  or1k/uclinux/userland/init/init romfs/bin/
cp  or1k/uclinux/userland/sash/sh romfs/bin/
cp  or1k/uclinux/userland/route/ifconfig romfs/bin/
cp  or1k/uclinux/userland/route/route romfs/bin/
cp  or1k/uclinux/userland/ping/ping romfs/bin/
chmod 777 romfs/bin/*
mkdir romfs/etc
cp  or1k/uclinux/userland/init/rc romfs/etc/
mkdir romfs/dev
cd romfs/dev
mknod ram0 b 1 0
mknod tty c 4 0
mknod tty1 c 4 1
mknod ttyS0 c 4 64
cd ..
genromfs -f ../or1k/uclinux/uClinux-2.0.x/arch/or32/board/initrd
cd ..


Now we create ext2 ramdisk image

mkdir ext2fs
mke2fs -m0 -r0 -O none /dev/ram0 1024
mount /dev/ram0 ext2fs
mkdir ext2fs/bin
cp  or1k/uclinux/userland/init/init ext2fs/bin/
cp  or1k/uclinux/userland/sash/sh ext2fs/bin/
cp  or1k/uclinux/userland/route/ifconfig ext2fs/bin/
cp  or1k/uclinux/userland/route/route ext2fs/bin/
cp  or1k/uclinux/userland/ping/ping ext2fs/bin/
chmod 777 ext2fs/bin/*
mkdir ext2fs/etc
cp  or1k/uclinux/userland/init/rc ext2fs/etc/
mkdir ext2fs/dev
cd ext2fs/dev
mknod ram0 b 1 0
mknod tty c 4 0
mknod tty1 c 4 1
mknod ttyS0 c 4 64
cd ../../
umount ext2fs
dd if=/dev/ram0 of=or1k/uclinux/uClinux-2.0.x/arch/or32/board/initrd



After this we have to recompile uclinux, but we can have a problem with
the lenght of our flash disk.
To recompile:

cd or1k/uclinux/uClinux-2.0.x
make all


If you have an error about the length of the flash disk go to
arch/or32/board/rom.ld and increase the length of the flash disk and the
origin of the eflash.
If you this yo have to go to uclinux/uClinux-2.0.x/sim.cfg and increase
the memory size too.


After this you have you have uclinux ready to launch, but after go to
uclinux/uClinux-2.0.x/sim.cfg and modify the UART section to use tty10
as output.

section uart
enabled = 1
nuarts = 1

device 0
baseaddr = 0x90000000
irq = 2
jitter = -1
16550 = 1
channel = "file:/dev/tty10"
enddevice
end


Then in uclinux/uClinux-2.0.x directory write:

or32-uclinux-sim linux

An then press CRTL-ALT-F10



Javier Castillo Villar

javier@teisa.unican.es
















--
To unsubscribe from openrisc mailing list please visit http://www.opencores.org/mailinglists.shtml