Procedure to Port RTlinux to virtex 5 FPGA (PowerPC)

Porting Rtlinux on virtex 5 fpga ,We will be using the linux environment for developing the bit or an ace file.The reason being is linux offers certain cross compiling tools which offers greater flexibility of usage.

We shall procure the rtlinux 3.1 (even 3.2 would be just fine) then we shall use the patch obtained from link ,(get a .bz2 file).This patch contains the real time constraints which we can incorporate with a linux kernel ,I suggest you to use a linux kernel 2.6 or greater as the linux kernels before 2.6 were non premptive and those after 2.6 are premptive,The premptiveness is needed for a real time environment.

I have used a 2.6.33.9

then enter to the directory where the linux kernel is stored by specifying cd directory-path-name

  cd linux-kernel-directory-path-name
     patch –p1 < /path-to-kernel-patch

(please note for beginners the path name eg would be something like '/home/proton/CA_Project/os/os3/fin' )

This creates a patch to the linux kernel with rt constraints,then we need a cross compiler

We can use  -crosstool-0.43
or crosstool-ng
or you can use ELDK ,I recommend the usage of ELDK as its usage is pretty simple unlike the others where you may have to alter some parameters in the shell scripts

Download the ELDK from here.,download the ppc-2008-04-01.iso

Installing ELDK:
change the directory to the one containing the EDLK image file

Now we got to mount this image by

>mount -o loop -t iso9660 ppc-2008-04-01.iso /folderpath

note the folder path indicates the path where the mounting is carried out,once mounted

>cd folderpath

and install by

>./install -d ~/directorypath
directory path indicate the destination where installation occurs.

After this for usage we may have to set the environment parametersfor which we go to the directory where the eldk is installed and run
 
>source eldk_init 4xx

This automatically sets up the environmemnt variables,which means certain parameters will be assigned certain values









mounting




installing






setting up environment variables (note that i have renamed the temp2 to crosscompilereldk ,just to make sense!)

executing
>ppc_4xx-gcc
shows that it is actually working,now you can specify
>ppc_4xx-gcc /pathtofile
path to file indicate the path to file for crosscrompiling wit respect to ppc-4xx

where xx corresponds to any number it may be 405,440 etc

now we have successfully installed ELDK by mounting it and also we can crosscompile any file to ppc architecture.

For porting we need to perform another operation,we need to make a device tree..oops why i didn't tell you before ?,gee i didn't want you to be scared by all these jargons eh ?.

But relax building a device tree is pretty simple (very easy ) it's easy because now we can use the edk gui to build it ,yes no more linux terminal for the time being.

To put it crudely ,device tree contains basic information of the hardware (on which OS is to be ported) .

Now i'll switch over to windows to use the edk ,however YOU CAN CARRY OUT THIS STEP IN LINUX EDK ITSELF

<Development of device tree procedure will be made available as soon as possible>


Now that the device tree is donet.We shall use this .dts file with the kernel .

enter the linux-xx file (file where the linux is stored go inside this linux kernel file which has been already patched) ,now copy the .dts file to /arch/powerpc/boot/dts  after copying you have to RENAME it to  virtex440-anyname.dts (for the virtex 2 pro its virtex405-anyname.dts)


you can also acquire the ram disk image for powerpc linux from here download the ramdisk_image.gz
and save it in /arch/powerpc/boot ,don't extract it ,save it as such.

This ramdisk contains data that allows the real root file system to be mounted so during booting this is first used and unmounted when the actual root file system takes over using the support from ramdisk
Its also called initial ramdisk.

We need to edit a wrapper file in /arch/powerpc/boot file name wrapper

check line 145

ksection=.kernel:vmlinux.strip
isection=.kernel:initrd
link_address='0x400000'

change the link_address='0x400000' to link_address='0x800000'

This is an effort to provide more memory to the kernel

Now we have to configure the kernel or sort of tell the kernel , Ok you are going to be ported to this hardware so make yourself ready.
check the /arch/powerpc/configs it contain 40x and 44x inside this folders are the config files related to various hardwares ,we shall be using the virtex5_defconfig in 44x ,execute
>make ARCH=powerpc 44x/virtex5_defconfig


now its configured ,we will now generate a .elf file by

>make ARCH=powerpc simpleImage.virtex440-anyname

virtex440-anyname is our .dts file,you can also equivalently use a 405

for the ramdisk incorporated .elf file

>make ARCH=powerpc simpleImage.intrd.virtex440-anyname

we have a kernel image with a ramdisk for supporting rootfile systems

check /arch/powerpc/boot there you can find the elf file as simpleImage.virtex405-anyname.elf  or  simpleImage.intrd.virtex405-anyname.elf



LAND ahoy!!!

to port we use the xmd

XMD% connect ppc hw -debugdevice deviceNr 3 cpunr 1
XMD% dow arch/powerpc/boot/simpleImage.virtex405-anyname.elf
XMD%run

Porting complete!!!!!!!!!

No comments:

Post a Comment