Difference between revisions of "Kernel Reconfiguration"

From Gumstix User Wiki
Jump to: navigation, search
(remove spam)
Line 1: Line 1:
 +
=[http://egyworene.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 
[[Category:How_to_-_linux]]
 
[[Category:How_to_-_linux]]
 
[[Category:How_to_-_general]]
 
[[Category:How_to_-_general]]
Line 12: Line 13:
 
  $ cd $OVEROTOP
 
  $ cd $OVEROTOP
 
  $ grep linux org.openembedded/conf/machine/overo.conf
 
  $ grep linux org.openembedded/conf/machine/overo.conf
  PREFERRED_PROVIDER_virtual/kernel = "linux-omap3"
+
  PREFERRED_PROVIDER_virtual/kernel = "linux-omap3"
  
 
And the current revision as defined here
 
And the current revision as defined here
Line 67: Line 68:
 
To reconfigure the kernel with the current state of Gumstix's OE things, you will need ''gnome-terminal''. Run this command: '''bitbake gumstix-kernel -c menuconfig'''
 
To reconfigure the kernel with the current state of Gumstix's OE things, you will need ''gnome-terminal''. Run this command: '''bitbake gumstix-kernel -c menuconfig'''
  
NOTE: You have to have ncurses and ncurses-dev installed in order for the MENUCONFIG to actually work.<br>
+
NOTE: You have to have ncurses and ncurses-dev installed in order for the MENUCONFIG to actually work.&lt;br&gt;
NOTE: If a screen flashes infront of you and dissapears edit $OE_HOME/org.openembedded.snapshot/conf/bitbake.conf to the following <br>
+
NOTE: If a screen flashes infront of you and dissapears edit $OE_HOME/org.openembedded.snapshot/conf/bitbake.conf to the following &lt;br&gt;
<code><pre>
+
&lt;code&gt;&lt;pre&gt;
 
-GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLRCCMD}'
 
-GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLRCCMD}'
 
+GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLCMDS}'
 
+GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLCMDS}'
</pre></code>
+
&lt;/pre&gt;&lt;/code&gt;
  
 
NOTE: If you don't have gnome-terminal installed and wish to use xterm instead, use:
 
NOTE: If you don't have gnome-terminal installed and wish to use xterm instead, use:
<code><pre>
+
&lt;code&gt;&lt;pre&gt;
-GNOME_TERMCMD = 'gnome-terminal --disable-factory -t "$TERMWINDOWTITLE"'
+
-GNOME_TERMCMD = 'gnome-terminal --disable-factory -t &quot;$TERMWINDOWTITLE&quot;'
 
-GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLRCCMD}'
 
-GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLRCCMD}'
+GNOME_TERMCMD = 'xterm -title "$TERMWINDOWTITLE"'
+
+GNOME_TERMCMD = 'xterm -title &quot;$TERMWINDOWTITLE&quot;'
 
+GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -e ${SHELLCMDS}'
 
+GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -e ${SHELLCMDS}'
</pre></code>
+
&lt;/pre&gt;&lt;/code&gt;
  
The kernel config information is kept in<br>
+
The kernel config information is kept in&lt;br&gt;
''$OE_HOME/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.XX/gumstix-custom-YYYYY/defconfig''<br>
+
''$OE_HOME/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.XX/gumstix-custom-YYYYY/defconfig''&lt;br&gt;
 
where XX is the current default kernel version for your bitbake environment.  That nugget is set in the
 
where XX is the current default kernel version for your bitbake environment.  That nugget is set in the
 
''$OE_HOME/com.gumstix.collection/conf/machine/include/gumstix.inc'' file, under the PREFERRED_VERSION_gumstix-kernel
 
''$OE_HOME/com.gumstix.collection/conf/machine/include/gumstix.inc'' file, under the PREFERRED_VERSION_gumstix-kernel
and YYYYY is usually one of connex/basix/verdex.  That nugget comes from<br>
+
and YYYYY is usually one of connex/basix/verdex.  That nugget comes from&lt;br&gt;
 
''$OE_HOME/build/conf/auto.conf''
 
''$OE_HOME/build/conf/auto.conf''
  
After running menuconfig, running "bitbake -c rebuild gumstix-kernel" will blow away the customizations just made.  There is probably a better way to do this, but in order to preserve the customizations, you can copy the new config file and replace the default config.  For example, to preserve a verdex board's config, do:
+
After running menuconfig, running &quot;bitbake -c rebuild gumstix-kernel&quot; will blow away the customizations just made.  There is probably a better way to do this, but in order to preserve the customizations, you can copy the new config file and replace the default config.  For example, to preserve a verdex board's config, do:
  
<code><pre>
+
&lt;code&gt;&lt;pre&gt;
 
cp \
 
cp \
 
  $OE_HOME/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/.config \
 
  $OE_HOME/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/.config \
 
  $OE_HOME/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.21/gumstix-custom-verdex/defconfig
 
  $OE_HOME/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.21/gumstix-custom-verdex/defconfig
</pre></code>
+
&lt;/pre&gt;&lt;/code&gt;
  
 
Now that you have replaced the default config, the following commands will rebuild and repackage the new kernel and create new images for you:
 
Now that you have replaced the default config, the following commands will rebuild and repackage the new kernel and create new images for you:
  
<code><pre>
+
&lt;code&gt;&lt;pre&gt;
 
bitbake -c rebuild gumstix-kernel
 
bitbake -c rebuild gumstix-kernel
 
bitbake -c rebuild task-base-gumstix
 
bitbake -c rebuild task-base-gumstix
 
bitbake gumstix-basic-image
 
bitbake gumstix-basic-image
</pre></code>
+
&lt;/pre&gt;&lt;/code&gt;
  
  
Line 112: Line 113:
  
 
Your kernel is now larger than the 1MB originally specified so do_sizecheck() fails?
 
Your kernel is now larger than the 1MB originally specified so do_sizecheck() fails?
You'll probably want to edit the ~/verdex-oe/org.openembedded.dev/conf/machine/include and change the maximum image size to, say, 2MB, i.e. KERNEL_IMAGE_MAXSIZE = "2097153".  Actually, you should really do this in the user.collections directory to keep the original source tree clean.
+
You'll probably want to edit the ~/verdex-oe/org.openembedded.dev/conf/machine/include and change the maximum image size to, say, 2MB, i.e. KERNEL_IMAGE_MAXSIZE = &quot;2097153&quot;.  Actually, you should really do this in the user.collections directory to keep the original source tree clean.

Revision as of 15:37, 23 November 2010

Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page

There are several possible work flows for modifying the kernel: [Using bitbake] [Using kernel tools]


Overo

These instructions assume you are using the default gumstix-oe kernel which is declared here

$ cd $OVEROTOP
$ grep linux org.openembedded/conf/machine/overo.conf
PREFERRED_PROVIDER_virtual/kernel = "linux-omap3"

And the current revision as defined here

$ bitbake --show-versions | grep linux-omap3
linux-omap3                            0:2.6.32-r51

So the rest of the example will assume linux-omap3-2.6.32 revision 51. This is the kernel that will be built when we use the reference 'virtual/kernel' in bitbake commands.

Substitute the kernel version and revision your system is using in the following steps.


First build the kernel normally with bitbake. If you have built an image, then it's already done.

If not run this command

$ bitbake virtual/kernel

This will create a source directory in the ${OVEROTOP}/tmp/work/overo-angstrom-linux-gnueabi directory. In this case it will be

${OVEROTOP}/tmp/work/overo-angstrom-linux-gnueabi/linux-omap3-2.6.32-r51

To modify the kernel configuration, run menuconfig via bitbake. Make your changes and save the configuration.

$ bitbake -c menuconfig virtual/linux

The new kernel configuration file you created can be found here.

${OVEROTOP}/tmp/work/overo-angstrom-linux-gnueabi/linux-omap3-2.6.32-r51/git/.config

Copy that file to where the bitbake recipe for the kernel will use it.

$ cp ${OVEROTOP}/tmp/work/overo-angstrom-linux/gnueabi/linux-omap3-2.6.32-r51/git/.config \
   ${OVEROTOP}/org.openembedded.dev/recipes/linux/linux-omap3-2.6.32/overo/defconfig

Then rebuild the kernel.

$ bitbake -c clean virtual/kernel
$ bitbake virtual/kernel

Then rebuild the rootfs to get the modules installed correctly.

Substitute the image you are using, the example if you are using the omap3-console-image.

$ bitbake omap3-console-image

Finally, install the new kernel and rootfs the way you normally would using either a microSD card or by copying to onboard nand.

Verdex

To reconfigure the kernel with the current state of Gumstix's OE things, you will need gnome-terminal. Run this command: bitbake gumstix-kernel -c menuconfig

NOTE: You have to have ncurses and ncurses-dev installed in order for the MENUCONFIG to actually work.<br> NOTE: If a screen flashes infront of you and dissapears edit $OE_HOME/org.openembedded.snapshot/conf/bitbake.conf to the following <br> <code><pre> -GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLRCCMD}' +GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLCMDS}' </pre></code>

NOTE: If you don't have gnome-terminal installed and wish to use xterm instead, use: <code><pre> -GNOME_TERMCMD = 'gnome-terminal --disable-factory -t "$TERMWINDOWTITLE"' -GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x ${SHELLRCCMD}' +GNOME_TERMCMD = 'xterm -title "$TERMWINDOWTITLE"' +GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -e ${SHELLCMDS}' </pre></code>

The kernel config information is kept in<br> $OE_HOME/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.XX/gumstix-custom-YYYYY/defconfig<br> where XX is the current default kernel version for your bitbake environment. That nugget is set in the $OE_HOME/com.gumstix.collection/conf/machine/include/gumstix.inc file, under the PREFERRED_VERSION_gumstix-kernel and YYYYY is usually one of connex/basix/verdex. That nugget comes from<br> $OE_HOME/build/conf/auto.conf

After running menuconfig, running "bitbake -c rebuild gumstix-kernel" will blow away the customizations just made. There is probably a better way to do this, but in order to preserve the customizations, you can copy the new config file and replace the default config. For example, to preserve a verdex board's config, do:

<code><pre> cp \

$OE_HOME/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/.config \
$OE_HOME/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.21/gumstix-custom-verdex/defconfig

</pre></code>

Now that you have replaced the default config, the following commands will rebuild and repackage the new kernel and create new images for you:

<code><pre> bitbake -c rebuild gumstix-kernel bitbake -c rebuild task-base-gumstix bitbake gumstix-basic-image </pre></code>


Other notes

Totally lost inside of menuconfig? Press '/' to search for appropriate options.

Want to know more about the kernel? I found the 'Linux Kernel in a Nutshell' book (not to be confused with the 'Linux in a Nutshell' book) quite helpful. The book is freely available online here (http://www.kroah.com/lkn/); Chapter 4 (Configuring and Building) and Chapter 6 (Upgrading a Kernel) as well as the first bit of Chapter 7 (Customizing a Kernel) and the last bit of Chapter 8 (Kernel Configuration: Kernel Debugging) have useful notes about kernel configuration.

Your kernel is now larger than the 1MB originally specified so do_sizecheck() fails? You'll probably want to edit the ~/verdex-oe/org.openembedded.dev/conf/machine/include and change the maximum image size to, say, 2MB, i.e. KERNEL_IMAGE_MAXSIZE = "2097153". Actually, you should really do this in the user.collections directory to keep the original source tree clean.