Jump to content
Forums in Read-Only Mode - Please use Reddit ×
  • 0

question about building a kernel from source


adcdam

Question

9 answers to this question

Recommended Posts

  • 0

you need download the kernel, Gentoo, Git, Debian etc... 

 

go to kernel directory 

 

open the menu and enable what is needed

 

and compile and paste and boot directory

 

emerge -av sys-kernel/gentoo-sources genkernel 

cd /usr/src/linux 

make menuconfig 

make && make modules_install 

Link to comment
Share on other sites

  • 0

 

I read the funtoo wiki about building a kernel from source, when i have to type the command make localmodconfig is the same as in gentoo make menuconfig?

No, "make menuconfig" and "make localmodconfig" are different. Read the description from the kernel sources README.

Copied from /usr/src/linux/README

CONFIGURING the kernel:

- Alternative configuration commands are:

"make config"      Plain text interface.

     "make menuconfig"  Text based color menus, radiolists & dialogs.

     "make nconfig"     Enhanced text based color menus.

     "make xconfig"     X windows (Qt) based configuration tool.

     "make gconfig"     X windows (Gtk) based configuration tool.

     "make oldconfig"   Default all questions based on the contents of
                        your existing ./.config file and asking about
                        new config symbols.

     "make silentoldconfig"
                        Like above, but avoids cluttering the screen
                        with questions already answered.
                        Additionally updates the dependencies.

     "make olddefconfig"
                        Like above, but sets new symbols to their default
                        values without prompting.

     "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.

     "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.

     "make allyesconfig"
                        Create a ./.config file by setting symbol
                        values to 'y' as much as possible.

     "make allmodconfig"
                        Create a ./.config file by setting symbol
                        values to 'm' as much as possible.

     "make allnoconfig" Create a ./.config file by setting symbol
                        values to 'n' as much as possible.

     "make randconfig"  Create a ./.config file by setting symbol
                        values to random values.

     "make localmodconfig" Create a config based on current config and loaded modules (lsmod). 
                           Disables any module option that is not needed for the loaded modules.
                           To create a localmodconfig for another machine,
                           store the lsmod of that machine into a file
                           and pass it in as a LSMOD parameter.

                   target$ lsmod > /tmp/mylsmod
                   target$ scp /tmp/mylsmod host:/tmp

                   host$ make LSMOD=/tmp/mylsmod localmodconfig

                           The above also works when cross compiling.

     "make localyesconfig" Similar to localmodconfig, except it will convert
                           all module options to built in (=y) options.

   You can find more information on using the Linux kernel config tools
   in Documentation/kbuild/kconfig.txt.

 - NOTES on "make config":

    - Having unnecessary drivers will make the kernel bigger, and can
      under some circumstances lead to problems: probing for a
      nonexistent controller card may confuse your other controllers

    - Compiling the kernel with "Processor type" set higher than 386
      will result in a kernel that does NOT work on a 386.  The
      kernel will detect this on bootup, and give up.

    - A kernel with math-emulation compiled in will still use the
      coprocessor if one is present: the math emulation will just
      never get used in that case.  The kernel will be slightly larger,
      but will work on different machines regardless of whether they
      have a math coprocessor or not.

    - The "kernel hacking" configuration details usually result in a
      bigger or slower kernel (or both), and can even make the kernel
      less stable by configuring some routines to actively try to
      break bad code to find kernel problems (kmalloc()).  Thus you
      should probably answer 'n' to the questions for "development",
      "experimental", or "debugging" features.
Link to comment
Share on other sites

  • 0

i started reading linux in a nutshell but i have a question, in the funtoo wiki http://www.funtoo.org/Building_a_Kernel_from_Sourceit say this:

 

Configuring the kernel

Now that the kernel sources are on your system, you should configure them. To do this, change your directory to /usr/src/linux

# cd /usr/src/linux

We are now in the kernel sources directory, next sanitize the sources:

Warning

this will delete your .config

# make clean && make distclean && make mrproper

 

 

but in linux in a nutshell say this

The kernel source code should also never be placed in the  /usr/src/linux/ direc- tory, as that is the location of the kernel that the system libraries were built against, not your newcustom kernel. Do not do any kernel  development under the /usr/src/ directory tree at all, but only in a local user directory where nothing bad can happen to the system.

http://files.kroah.com/lkn/lkn_pdf/ch01.pdf

 

where should i compile the kernel code?

 

 

 

T
Link to comment
Share on other sites

  • 0

Do not do any kernel  development under the /usr/src/ directory tree at all, but only in a local user directory where nothing bad can happen to the system.

Kernel development means writing new or modifying existing kernel source code.

You want to configure and build a kernel using existing code.

Follow the directions in the funtoo wiki and change directory to /usr/src/linux to configure/build a kernel.

If multiple kernel sources are installed with emerge set the /usr/src/linux symlink with eselect depending on the sources to be built.

rj@funtoo ~ $ eselect kernel list
Available kernel symlink targets:
  [1]   linux-debian-sources-3.16.7
  [2]   linux-debian-sources-3.19.3 *
rj@funtoo ~ $ eselect kernel show
Current kernel symlink:
  /usr/src/linux-debian-sources-3.19.3
rj@funtoo ~ $ ls -l /usr/src/linux
lrwxrwxrwx 1 root root 27 Jul 13 22:07 /usr/src/linux -> linux-debian-sources-3.19.3
rj@funtoo ~ $ sudo eselect kernel set linux-debian-sources-3.16.7
rj@funtoo ~ $ eselect kernel list
Available kernel symlink targets:
  [1]   linux-debian-sources-3.16.7 *
  [2]   linux-debian-sources-3.19.3
rj@funtoo ~ $ eselect kernel show
Current kernel symlink:
  /usr/src/linux-debian-sources-3.16.7
rj@funtoo ~ $ ls -l /usr/src/linux
lrwxrwxrwx 1 root root 27 Sep 12 12:55 /usr/src/linux -> linux-debian-sources-3.16.7
Link to comment
Share on other sites

×
×
  • Create New...