There are various make options for configuring the Linux kernel compilation
1. "make config" - Simple plain text interface. It is hard to use and requires you to go through each and every option manually. Not recommended.
2. "make menuconfig" - ncurse based text based interface with color menus, radiolists & dialogs. It needs the ncurse package to be installed in the system. Highly recommended. There are different variation of it that run on X based interface :
a. "make xconfig" - Qt (X windows) based configuration tool.
b. "make gconfig" - GTK (X windows) based configuration tool.
3. "make nconfig" - similar to "make menuconfig" above but a better text based color menus.
4. "make oldconfig" - Default all questions based on the contents of your existing ./.config file and asking about new config symbols. You need to copy your old kernel .config file to the current location.
5. "make silentoldconfig"- Like above, but avoids cluttering the screen with questions already answered. Additionally updates the dependencies.
6. "make defconfig" - Create a ./.config file by using the default symbol values from either arch/$ARCH/defconfig or arch/$ARCH/configs/${PLATFORM}_defconfig, depending on the architecture.
7. "make ${PLATFORM}_defconfig" - Create a ./.config file by using the default symbol values from arch/$ARCH/configs/${PLATFORM}_defconfig. Use "make help" to get a list of all available
platforms of your architecture.
8. "make localmodconfig" - Runs "lsmod" to find all the modules loaded on the current running system. Reads all the Makefiles to locate which CONFIG enables a module. Reads the Kconfig files to find the dependencies and selects that is needed to support a CONFIG. Finally, reads the .config file and removes any module "=m" that is not needed to enable the currently loaded modules.
9. "make allyesconfig" - Create a ./.config file by setting symbol values to 'y' as much as possible.
10. "make allmodconfig" - Create a ./.config file by setting symbol values to 'm' as much as possible.
11. "make allnoconfig" - Create a ./.config file by setting symbol values to 'n' as much as possible.
12. "make randconfig" - Create a ./.config file by setting symbol values to random values.
More information is available in the ./README file of the kernel source tree.
Sunday, June 26, 2011
Friday, June 24, 2011
Make only specific kernel modules
1. You need to first create the .config file by running any of the various "make config" commands
2. Then run the "make" command to build the basic kernel tree
3. Now to build the specific kernel module you can do
$make menuconfig
2. Then run the "make" command to build the basic kernel tree
$make
3. Now to build the specific kernel module you can do
$make modules SUBDIRS=drivers/staging
Wednesday, June 1, 2011
Customize compiling the Linux kernel
There are various ways to customize the Linux kernel compilation to make it more interesting and fun :
1. You can use a tool called "colormake" to show the output of make in a much more readable format.
2. "$make -s" wont print any commands (as if every command was prefixed by @). If the commands themselves are printing output, redirect standard output to /dev/null but still show the standard error by using "$make -s > /dev/null"
More information on various gcc options is available here
1. You can use a tool called "colormake" to show the output of make in a much more readable format.
2. "$make -s" wont print any commands (as if every command was prefixed by @). If the commands themselves are printing output, redirect standard output to /dev/null but still show the standard error by using "$make -s > /dev/null"
More information on various gcc options is available here
Friday, April 22, 2011
Compiling comedi sample programs
First thing you will have to do is install the "comedi" library. Under Ubuntu the package name is "libcomedi0" and "libcomedi-dev". Both packages are available in the Ubuntu "universe" repository.
Once you have the comedi library installed, the command to compile comedi programs using gcc/linux is
Sample program :
Once you have the comedi library installed, the command to compile comedi programs using gcc/linux is
$gcc -Wall -O2 <program_name>.c -lcomedi -lm
Sample program :
#include <stdio.h> /* for printf() */
#include <comedilib.h>
int subdev = 0; /* change this to your input subdevice */
int chan = 0; /* change this to your channel */
int range = 0; /* more on this later */
int aref = AREF_GROUND; /* more on this later */
int main(int argc,char *argv[])
{
comedi_t *it;
lsampl_t data;
it=comedi_open("/dev/comedi0");
comedi_data_read(it,subdev,chan,range,aref, & data);
printf("%d\n",data);
return 0;
}
Monday, April 11, 2011
Develop against linux-next
First thing is to download the git tree for linux-next
To follow changes to the linux-tree tree you need to first do a remote update (this will get all the changes from the remote linux-next branch to the local origin/master tracking branch) and then reset the HEAD pointer of current checked out branch to the HEAD of linux-next remote tracking branch (i.e origin/master).
This will make your current branch (master) *exactly* like the remote linux-next tree. You cannot do pull or merge from the remote tracking branch.
Links :
http://lwn.net/Articles/289245/
http://linux.f-seidel.de/linux-next/pmwiki/pmwiki.php?n=Linux-next.Announcement
http://www.gossamer-threads.com/lists/linux/kernel/1363433?page=last
$git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
To follow changes to the linux-tree tree you need to first do a remote update (this will get all the changes from the remote linux-next branch to the local origin/master tracking branch) and then reset the HEAD pointer of current checked out branch to the HEAD of linux-next remote tracking branch (i.e origin/master).
$git remote update $git reset --hard origin/master
This will make your current branch (master) *exactly* like the remote linux-next tree. You cannot do pull or merge from the remote tracking branch.
Links :
http://lwn.net/Articles/289245/
http://linux.f-seidel.de/linux-next/pmwiki/pmwiki.php?n=Linux-next.Announcement
http://www.gossamer-threads.com/lists/linux/kernel/1363433?page=last
Subscribe to:
Posts (Atom)


