Notes

Powered by The LE Company

Friday, October 25, 2013

Building Linux kernel image for ARM with Eclipse [Part 2]

C.  Build Linux kernel Image

     At first, we need to import the Linux kernel source code into the Eclipse IDE

- In Eclipse, select File -> New -> Makefile Project with Existing Code.
Browse to the linux-stable directory you prepared above for the Existing Code Location.

Project name is AT91SAM9260-Linux as figure below.


- Modify the build properties for this project.
- Select Projects > properties.
- Select C/C++ Build.
- Select the Behavior tab.
- Enable Parallel Builds.
Select the Use Parallel Build option.
Select Use Parallel Jobs.
Enter the number of parallel jobs to run (equal with number of CPU cores in your host PC).


Selects C/C++ Build->Environment and adds four environment variables as below.

ARCH=arm
CROSS_COMPILE=arm-none-linux-gnueabi-
KCFLAGS=-mno-unaligned-access
INSTALL_MOD_PATH=${HOME}/modules_install
PATH=${PATH}:${HOME}/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin


Next, we will consecutively create six makefile targets as follow.
- Go to Project > Make Target > Create.
In box Target name, fill name of the make target: at91sam9260_9g20_defconfig. Then press OK to complete as the figure below.


Repeats above steps again for the other targets uImage, dtbs, clean, modules, modules_install.

As result, we will have six Make Targets as the figure below.


Now, in order to build kernel image, doing the steps following in order:

 a. Runs the make target at91sam9260_9g20_defconfig by double-click on its name. A new .config file will be created in root directory after running this make target.
There needs only to run the make target at91sam9260_9g20_defconfig once. We will need only run it again once having any updating in the default configuration file (/AT91SAM9260-Linux/arch/arm/configs/at91sam9260_9g20_defconfig).

b. Run the make target clean to clean the previous build.

c. Run the make target uImage to compile and generate the kernel image.
This steps will consecutively create the files Image (uncompressed image), zImage (compressed image) and uImage (compressed image compatible with u-boot) in directory /AT91SAM9260-Linux/arch/arm/boot.


The other make targets will be used to build the loadable module and deploy them.
Note: We can change compilation options in default configuration file by issuing command in terminal: make ARCH=arm menuconfig. Because this command cannot execute in Eclipse IDE console, so we don't need create a make target for it. Not all things can do in Eclipse :))

No comments: