Skip to content

build kernel cmds

xiezhongtian edited this page Feb 23, 2016 · 1 revision

in 64bit machine build 32bit kernel

requires: ia32-libs, lib32gcc1, lib32ncurses5, libc6-i386, util-linux, lib32c-devel

make i386_defconfig ARCH=i386

clearn everything

Make sure you have no stale .o files and dependencies lying around:

 cd linux
 make mrproper

BUILD directory for the kernel:

cd /usr/src/linux-4.X make O=/home/name/build/kernel menuconfig make O=/home/name/build/kernel defconfig sudo make O=/home/name/build/kernel modules_install install

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.

COMPILING the kernel:

Verbose kernel compile/build output:

make V=1 all To have the build system also tell the reason for the rebuild of each target, use "V=2". The default is "V=0".

Clone this wiki locally