LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   How to compile only specific arch code (linux-3.8.2/arch/x86) ?. (https://www.linuxquestions.org/questions/linux-kernel-70/how-to-compile-only-specific-arch-code-linux-3-8-2-arch-x86-4175461466/)

abdulrahuman.s@gmail.com 05-10-2013 02:55 PM

How to compile only specific arch code (linux-3.8.2/arch/x86) ?.
 
Hi,
Could you help on my below doubt ?

is it possible to compile specific architecture code (linux-3.8.2/arch/x86) in linux kernel ?

I want to compile kernel code in this "linux-3.8.2/arch/x86/" directory and like to learn the concept and programm and also like to test the compiled binary file using qemu/bochs emulators.

could you please help me to to find a way to compile "linux-3.8.2/arch/x86" code and create a binary image ?

Thanks & Regards,
Abdul

Pearlseattle 05-12-2013 09:03 AM

cd linux-3.8.2
make menuconfig
<now set the options as you want them>
<exit by saying to save your config changes>
make

bsat 05-12-2013 11:40 PM

When you compile the linux kernel, depending on the compiler you are using, by default only one architecture code will get compiled. That is if you use gcc to compile the kernel, the kernel by default will be built only for x86.
If you use a cross compiler like gcc-arm then code for arm will get compiled.( you would need to modify the .config accordingly and pass the relevant parameters to make)
So if you want code for x86 then just use gcc and compile the kernel.

abdulrahuman.s@gmail.com 05-13-2013 12:13 PM

Thanks a lot for the detailed information. It is very helpful,
Could you pls help on below question as well.

I like to learn linux kernel arch code (i.e. arch/x86) from beginning. Where i can start and do more example program to understand linux kernel.

I know ASM, C, Operating system concept and little bit of device driver programming. I want to become expert in linux architecture spefici code(X86).

Please help me with this query ...

Pearlseattle 05-13-2013 03:18 PM

If I would be doing something like that I would probably start by buying a book (there are a few that aren't bad) and start programming a device driver/module for an input device (joystick, mouse, whatever).
Afterwards perhaps I would start looking at the "no-op"/"noop" I/O scheduler and try to understand how it works and try to write my own disk scheduler - but in the end it depends on what you're interested in.

abdulrahuman.s@gmail.com 05-15-2013 12:41 PM

Thanks a lot for guide... :) i will start with LDD and Linux kernel programming books...

Pearlseattle 05-18-2013 04:09 PM

You're welcome.
And don't let them discourage you - a few weeks back I started fiddling around with ioctl and at first it was really hard, but with a bit of perseverance I started understanding how it worked.
I can imagine that the advantage of dealing with the Kernel is that things there are pretty static - not like with UIs where you might have to switch from QT, Clutter, GTK, etc..., having to re-learn every time the basics.
Good luck! :)


All times are GMT -5. The time now is 10:49 AM.