Cross Compilation in MPC8313RDB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cross Compilation in MPC8313RDB

2,346 Views
ak79
Contributor I
Hi,

 I am trying to build an Kernel module for MPC8313RDB on a suse machine. When I ran the make it did not generate .ko file (kernel module) and this does not give any kind of error or warning messages. I am not able to find where the error is or where I am going wrong. can some one please help me resolve this issue.

MY computer OS: Suse 10.3 with 2.6.18 kernel
My Board OS: Linux with 2.6.20 kernel

The makefile has:

    KERNELDIR := /Board/ltib-mpc8313erdb-20070824/rootfs/lib/modules/2.6.20/build
    PWD := $(shell pwd)

default:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) modules

On running make command I see this:

(none):/Board/ltib-mpc8313erdb-20070824/rpm/BUILD/linux-2.6.20/driver # make
make -C /Board/ltib-mpc8313erdb-20070824/rootfs/lib/modules/2.6.20/build M=/Board/ltib-mpc8313erdb-20070824/rpm/BUILD/linux-2.6.20/driver modules
make[1]: Entering directory `/Board/ltib-mpc8313erdb-20070824/rpm/BUILD/linux-2.6.20'
  Building modules, stage 2.
  MODPOST 0 modules
make[1]: Leaving directory `/Board/ltib-mpc8313erdb-20070824/rpm/BUILD/linux-2.6.20'
(none):/Board/ltib-mpc8313erdb-20070824/rpm/BUILD/linux-2.6.20/driver #

Thanks,
Ak

Tags (1)
0 Kudos
2 Replies

638 Views
abartky
Contributor IV

Ak,

When it comes to compiling, building, etc. on the MPC8313E-RDB (or other Freescale boards) on a Linux Development system using the Freescale BSP, the key thing IMHO to remember is that what you need to do is build for the target, not the way that you usually build Linux where you are building for the same machine you are running on.

Because of that paradigm, if you go to a directory and try and run standard make, gcc, or other linux commands, they will execute in the context of building for your host machine, not as a cross compile.

So IMHO, if you want to develop kernel or user mode programs for the MPC8313E-RDB, you will need to use the Freescale Linux Target Image Builder (LTIB), let it do the work as far as setting the right environment variables, using the right compiler, etc. and not try and setup all the environment variables, cross compilers, etc. on your own. In theory it probably could be done, but using LTIB is a lot less work.

So for your case, where you wish to compile, build, etc. for the kernel, if you have edited your files correctly and make changes (assuming you've done the step of telling LTIB to build and leave the kernel sources), if you go to your LTIB main directory and type "./ltib" it will setup the proper environment variables, prep the kernel for building, compile, link, setup, etc. to the point where it creates a file call "uImage" which is the actual kernel to load on the target board.

If you want to execute individual steps, LTIB allows for step by step development by allowing command line options when you call the ./ltib script. So for example, to do a step by step build of the kernel you can do an initial setup, compile and build by executing:

alan@raptor:~/ltib-mpc8313erdb-20070824$ ./ltib -p kernel -m scbuild

To perform the "install step" (which does further setup of the kernel): you use:

alan@raptor:~/ltib-mpc8313erdb-20070824$ ./ltib -p kernel -m scinstall

To perform the "deploy step" (which also calls the install step, and does the full binary build of the kernel): you use:

alan@raptor:~/ltib-mpc8313erdb-20070824$ ./ltib -p kernel -m scdeploy

If you want to cut to the chase and just build the kernel as a complete step, but leave everything else alone, you can use:

alan@raptor:~/ltib-mpc8313erdb-20070824$ ./ltib -p kernel

There is a pretty good description of the command line options and how to use them at www.bitshrine.org which is the home page for the open source LTIB. In particular, you should download and read the instructions from the FAQ. Here is the direct link to it:

http://www.bitshrine.org/autodocs/LtibFaq.html

In particular pay attention to the steps mentioned in the "How do I make changes to a package and capture them" section which lists the step by step process of using LTIB (the kernel is treated as a single package).

In my case I have made several modifications to the Ethernet/IEEE-1588 gianfar.c code for my project and have used the above steps when I do my incremental compiles and builds for my MPC8313E-RDB kernel modifications.

Hope this helps :smileyhappy:

Cheers,

abartky

0 Kudos

638 Views
ak79
Contributor I
Thanks abartky,

Your information on compiling the packages is targetted for building a new kernel image and transferring this on to the board. In my case, I am looking at builing a kernel module which is going to be an addon module on the currently installed kernel. I am looking at building a module file (.ko) from a single .c file. I want to use it on the board. I do not want to change any currently installed packages or the board's kernel image.

thanks
Ak

PS: I have built the same kernel module on the Desktop machine. I am trying to get the same on the MPC8313 board.
0 Kudos