linux 内核编译学习
编译内核步骤和命令(PP亲测)

安装有关编译程序。安装make ,gcc, make-kpkg,运行menuconfig等等和编译内核相关的工具。
安装不了,请检查/etc/apt/sources.list 文件。
有关命令:
sudo apt-get install build-essential kernel-package libncurses5-dev libqt3-headers
首先,清理以前编译时留下的临时文件。如果是刚刚解开的包,不需要执行这步。如果是第二次或者是第n次编译,那么一定要执行。
相关命令如下:
$ sudo make mrproper
网上很多教程上说把现在使用的内核的config拷贝过来参考,据实验,是不需要的,ubuntu还有
debian会自动做这步。不过这条命令倒是可以学习一下。当然你可以将以前的配置拷贝过来。
八、重新启动验证新内核。
代码:
$ sudo reboot
然后安装虚拟机的等个几个小时吧。
七、安装内核
代码:
$ cd /usr/src
$ sudo dpkg -i linux-image-(按tab键)
文件名很长,如果不用tab自动补足是不可能的,tab键万岁。
安装完成后和老内核比较一下大小
代码:
$ ls -l /boot/
相关命令:
代码:
$ sudo make-kpkg clean
$ sudo make-kpkg --initrd --append-to-version=wind1 kernel_image kernel_headers
上述命令中的wind1可以用自己喜欢的字符代替,最后的字符一定是数字.
教你如何学习linux内核

教你如何学习linux内核毫不夸张地说,Kconfig和Makefile是我们浏览内核代码时最为依仗的两个文件。
基本上,Linux 内核中每一个目录下边都会有一个Kconfig文件和一个Makefile文件。
对于一个希望能够在Linux内核的汪洋代码里看到一丝曙光的人来说,将它们放在怎么重要的地位都不过分。
我们去香港,通过海关的时候,总会有免费的地图和各种指南拿,有了它们在手里我们才不至于无头苍蝇般迷惘的行走在陌生的街道上。
即使在内地出去旅游的时候一般来说也总是会首先找份地图,当然了,这时就是要去买了,拿是拿不到的,不同的地方有不同的特色,只不过有的特色是服务,有的特色是索取。
Kconfig和Makefile就是Linux Kernel迷宫里的地图。
地图引导我们去认识一个城市,而Kconfig 和Makefile则可以让我们了解一个Kernel目录下面的结构。
我们每次浏览kernel寻找属于自己的那一段代码时,都应该首先看看目录下的这两个文件。
利用Kconfig和Makefile寻找目标代码就像利用地图寻找目的地一样,我们需要利用Kconfig和Makefile来寻找所要研究的目标代码。
比如我们打算研究U盘驱动的实现,因为U盘是一种storage设备,所以我们应该先进入到drivers/usb/storage/目录。
但是该目录下的文件很多,那么究竟哪些文件才是我们需要关注的?这时就有必要先去阅读Kconfig和Makefile文件。
对于Kconfig文件,我们可以看到下面的选项。
config USB_STORAGE_DATAFABbool "Datafab Compact Flash Reader support (EXPERIMENTAL)"depends on USB_STORAGE && EXPERIMENTALhelpSupport for certain Datafab CompactFlash readers.Datafab has a web page at </>.显然,这个选项和我们的目的没有关系。
linux kernel5.15编译原理

linux kernel5.15编译原理Linux kernel 5.15编译原理Linux kernel是一个开源操作系统内核,其稳定版本的更新和发布对于整个Linux生态系统具有重要意义。
在内核更新的过程中,编译内核是一个重要的步骤。
本文将为您解释Linux kernel 5.15的编译原理,并逐步回答关于该主题的问题。
第一步:准备工作在开始编译内核之前,我们需要做一些准备工作。
1. 下载内核源代码要编译特定版本的Linux内核,首先需要从Linux官方网站(2. 安装必要的依赖项编译内核需要一些工具和依赖项。
在大多数Linux发行版中,您可以使用包管理器来安装它们。
例如,在Ubuntu上,您可以运行以下命令安装常见的依赖项:sudo apt-get install build-essential libncurses-dev bison flexlibssl-dev libelf-dev这些依赖项将帮助您构建所需的内核映像。
第二步:配置编译选项在编译内核之前,需要配置一些编译选项以满足特定需求。
1. 进入内核源代码目录解压下载的内核源代码,并在终端中进入解压后的目录。
例如:tar -xf linux-5.15.tar.xzcd linux-5.152. 清理旧的配置选项可以使用以下命令清理旧的内核配置选项:make mrproper3. 配置编译选项可以使用以下命令进入菜单式配置界面:make menuconfig在配置界面中,您可以选择不同的内核功能、驱动程序和选项。
根据需要进行选择,并保存配置文件。
第三步:编译内核完成配置后,我们可以开始编译Linux内核了。
1. 执行编译命令使用以下命令开始编译内核:make这个过程可能需要一些时间,具体取决于您的计算机性能。
2. 安装编译后的内核完成编译后,可以使用以下命令安装编译后的内核:sudo make install此命令将复制编译后的内核映像、模块和其他文件到适当的位置,并更新GRUB或其他引导程序配置。
riscv linux内核编译过程

riscv linux内核编译过程全文共四篇示例,供读者参考第一篇示例:RISC-V(Reduced Instruction Set Computing-V)是一种基于精简指令集(RISC)的开源指令集架构,旨在提供更灵活、更适用于现代计算需求的处理器设计。
在RISC-V架构中,Linux内核是最受欢迎的操作系统之一,为RISC-V平台提供强大的支持和功能。
本文将介绍RISC-V Linux内核的编译过程,帮助您了解如何在RISC-V架构下编译和定制Linux内核。
一、准备编译环境无论您是在本地计算机还是远程服务器上编译RISC-V Linux内核,首先需要安装必要的工具和软件包。
一般来说,您需要安装以下软件:1. GCC:GNU Compiler Collection是一个功能强大的编译器套件,用于编译C、C++和其他编程语言的程序。
在RISC-V架构下编译Linux内核时,可以使用最新版本的GCC版本。
2. Make:Make是一个构建自动化工具,可以大大简化编译和安装过程。
在编译Linux内核时,Make是必不可少的工具。
3. Git:Git是一个版本控制系统,可以帮助您获取和管理源代码。
在编译RISC-V Linux内核时,您需要从GitHub上克隆Linux内核源代码。
4. 软件包:除了以上基本软件外,您还可能需要安装其他依赖软件包,如Flex、Bison等。
二、获取Linux内核源代码```git clone https:///torvalds/linux.git```通过上述命令,您将在当前目录下创建一个名为“linux”的文件夹,其中包含了Linux内核的源代码。
您可以根据需要切换到不同的分支,如稳定的分支或特定版本的分支。
三、配置内核选项在编译RISC-V Linux内核之前,您需要配置内核选项以适应特定的硬件平台或应用需求。
您可以通过以下命令进入内核配置菜单:```make menuconfig```通过上述命令,将打开一个文本界面,您可以在其中选择不同的内核配置选项。
LINUX内核模块编译步骤

LINUX内核模块编译步骤编译Linux内核模块主要包括以下步骤:1.获取源代码2.配置内核进入源代码目录并运行make menuconfig命令来配置内核。
该命令会打开一个文本菜单,其中包含许多内核选项。
在这里,你可以配置内核以适应特定的硬件要求和预期的功能。
你可以选择启用或禁用各种功能、设备驱动程序和文件系统等。
配置完成后,保存并退出。
3. 编译内核(make)运行make命令开始编译内核。
这将根据你在上一步中进行的配置生成相应的Makefile,然后开始编译内核。
编译的过程可能需要一些时间,请耐心等待。
4.安装模块编译完成后,运行make modules_install命令将编译好的模块安装到系统中。
这些模块被安装在/lib/modules/<kernel-version>/目录下。
5.安装内核运行make install命令来安装编译好的内核。
该命令会将内核映像文件(通常位于/arch/<architecture>/boot/目录下)复制到/boot目录,并更新系统引导加载程序(如GRUB)的配置文件。
6.更新GRUB配置文件运行update-grub命令来更新GRUB引导加载程序的配置文件。
这将确保新安装的内核在下次启动时可用。
7.重启系统安装完成后,通过重启系统来加载新的内核和模块。
在系统启动时,GRUB将显示一个菜单,你可以选择要启动的内核版本。
8.加载和卸载内核模块现在,你可以使用insmod命令来加载内核模块。
例如,运行insmod hello.ko命令来加载名为hello.ko的模块。
加载的模块位于/lib/modules/<kernel-version>/目录下。
如果你想卸载一个已加载的内核模块,可以使用rmmod命令。
例如,运行rmmod hello命令来卸载已加载的hello模块。
9.编写和编译模块代码要编写一个内核模块,你需要创建一个C文件,包含必要的模块代码。
Linux内核编译过程详解

内核升级前的准备工作:Linux系统进行内核升级或定制内核时需要安装GCC编译工具、make编译器,同时变异内核需要root权限。
安装GCC编译环境参考:/rhelinux/248.html操作系统:RHEL 5.5开始安装:按照以下顺序安装所需要的包就可以完成GCC的安装了1. rpm -ivh kernel-headers-2.6.18-194.el5.i386.rpm2. rpm -ivh glibc-headers-2.5-49.i386.rpm3. rpm -ivh glibc-devel-2.5-49.i386.rpm4. rpm -ivh libgomp-4.4.0-6.el5.i386.rpm5. rpm -ivh gcc-4.1.2-48.el5.i386.rpm6. rpm -ivh libstdc++-devel-4.1.2-48.el5.i386.rpm7. rpm -ivh gcc-c++-4.1.2-48.el5.i386.rpm8. rpm -ivh ncurses-5.5-24.20060715.i386.rpm9. rpm -ivh ncurses-devel-5.5-24.20060715.i386.rpm注意:在升级编译完内核,重启后提示如下错误信息:RedHat nash Version 5.1.19.6 startingrver(2.6.33.3)mount: could not find filesystem …/dev/root‟setuproot: moving /dev failed: No such file or directorysetuproot: error mounting /proc: No such file or directorysetuproot: error mounting /sys: No such file or directoryswitchroot: mount failed: No such file or directoryKernel panic – not syncing: Attempted to kill init![Linux-initrd @ 0x1fc37000,0x228585 bytes]于是在网上找了很多,也尝试了很多加模块、重编译了N次、改fstab等方法,都不行。
编译Linux内核

编译Linux内核实验目的学习重新编译Linux内核,理解、掌握Linux内核和发行版本的区别。
实验内容重新编译内核是一件比你想像的还要简单的事情,它甚至不需要你对内核有任何的了解,只要你具备一些基本的Linux操作系统的知识就可以进行。
本次实验,要求你在RedHat Fedora Core 5的Linux系统里,下载并重新编译其内核源代码(版本号KERNEL-2.6.15-1.2054);然后,配置GNU的启动引导工具grub,成功运行你刚刚编译成功的Linux内核。
实验提示Linux是当今流行的操作系统之一。
由于其源码的开放性,现代操作系统设计的思想和技术能够不断运用于它的新版本中。
因此,读懂并修改Linux内核源代码无疑是学习操作系统设计技术的有效方法。
本实验首先介绍Linux内核的特点、源码结构和重新编译内核的方法,讲述如何通过Linux系统所提供的/proc虚拟文件系统了解操作系统运行状况的方法。
最后,对Linux编程环境中的常用工具也有简单介绍。
1.1查找并且下载一份内核源代码我们知道,Linux受GNU通用公共许可证(GPL)保护,其内核源代码是完全开放的。
现在很多Linux的网站都提供内核代码的下载。
推荐你使用Linux的官方网站: ,如图1-1。
在这里你可以找到所有的内核版本。
图1-1 Linux的官方网站由于作者安装的Fedora Core 5并不附带内核源代码,第一步首先想办法获取合适版本的Linux内核代码。
通过命令# uname –r2.6.15-1.2054_FC5这就是说,RedHat Fedora Core 5采用的内核版本是2.6.15-1.2054_FC5。
但是,官方网站/pub/linux/kernel/找不到对应版本。
请别着急,既然它是RedHat发布的,RedHat的官方网站总有吧。
浏览/pub/fedora/linux/core/5/source/SRPMS,我们发现果然有文件kernel-2.6.15-1.2054_FC5.src.rpm,这个rpm文件就是2.6.15-1.2054_FC5版的内核源代码了。
Linux内核裁剪与编译

创建一个用于编译的内核目录,并配置相应的环境变量。
内核配置与选择
配置内核
01
使用make menuconfig或其他配置工具进行内核配置,选择所
需的特性和功能。
定制内核
02
根据实际需求,禁用不必要的模块和功能,以减小内核体积。
配置参数
03
在编译过程中,根据需要设置编译参数,如优化级别、编译器
选项等。
编译过程与注意事项
执行编译
在配置完成后,执行make命令开始 编译内核。
等待编译完成
编译过程可能需要较长时间,取决于 系统性能和内核大小。
注意事项
在编译过程中,注意观察日志信息, 以便及时发现和解决问题。
内核安装
编译完成后,按照系统要求进行内核 安装和引导配置。
04
内核编译优化
编译优化简介
-O3
在`-O2`的基础上,进一步开启更多的编译器优化选项。
-Os
以最小化代码大小为目标进行优化,适用于嵌入式系统等资源受限的环境。
-fPIC
生成位置无关代码,便于动态链接。
编译优化实践
根据目标硬件平台和性能 需求,选择合适的编译选 项。
关注内核代码质量,避免 过度优化导致代码可读性 和维护性下降。
优化内核
针对特定需求进行内核优化,如调整调度 策略、优化内存管理等,以提高系统的性 能和响应速度。
定制内核
根据需求分析结果,定制内核的功能和参 数,如禁用不必要的模块、开启特定功能 等。
案例三:使用第三方工具进行内核裁剪与编译
总结词
选择合适的第三方 工具
配置工具链
导入内核源码
自动裁剪与编译
使用第三方工具进行内 核裁剪与编译,可以借 助第三方工具的自动化 和智能化功能,提高内 核裁剪与编译的效率和 准确性。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
linux内核编译模式:built-in,将相应功能编译到内核中;module,将相应功能编译成模块,生成. 0文件,动态调用为什么要编译内核:主要是定制内核,根据需要将相应的功能加到内核中;主要任务1).获得内核源文件:;2).配置内核(获得内核配置文件.config):make config|menuconfig|xconfig|oldcon fig3).备份相关文件4)建立内核,相关命令:A.make dep #建立依赖关系表;B.make clean or make mrpropper #删除安装过程中产生的大量临时文件;(可选)C.make bzImage #建立内核,通常在/usr/src/arch/i386/boot目录下;D.make modules #编译内核模块;(可选)E.mkinitrd /boot/initrd-2.6.31.5 #F.make module install(把内核模块存放到相应的位置) (可选)5). 安装内核cp /usr/src/arch/i386/bzImage /boot/vmlinuz-2.6.31cp /usr/src/linux/System.map /boot/system.mapmake install ,6).编辑/boot/grub/grub.conf文件;步骤:S1.了解系统相关信息uname -aS2.下载内核源文件(linux-2.6.31.5.tar.bz2)及补丁(patch-2.6.31.5)cd /usr/srcbzip2 -dc linux-2.6.31.5.tar.bz2 | tar vxf - #解包bzip2 -dc patch-2.6.31.5.bz2 | patch -p1 #解包,给内核源代码打补丁(未执行成功)(或使用patch命令给内核源码打补丁patch -p0 original <patch name)S3.配置内核cd ./linux-2.6.31.5make menuconfigS4.编译内核?A.make dep #建立依赖关系表;make clean or make mrpropper #删除安装过程中产生的大量临时文件B.make bzImage #建立内核,通常在/usr/src/arch/i386/boot目录下;make modules #编译内核模块;(可选)C.mkinitrd /boot/initrd-2.6.31.5 #make module install(把内核模块存放到相应的位置) (可选)make[1]: *** No rule to make target `|', needed by `firmware/keyspan/ usa19qi.fw.gen.S'. Stop.make: *** [firmware] Error 2S5. 安装内核cp /usr/src/arch/i386/bzImage /boot/vmlinuz-2.6.31cp /usr/src/linux/System.map /boot/system.mapmake installS6.vi /boot/grub/grub.confS7.重启机器测试结果以下内容为make help内容:Cleaning targets:clean - Remove most generated files but keep the config andenough build support to build external modulesmrproper - Remove all generated files + config + various backup files distclean - mrproper + remove editor backup and patch files Configuration targets:config - Update current config utilising a line-oriented program menuconfig - Update current config utilising a menu based program xconfig - Update current config utilising a QT based front-endgconfig - Update current config utilising a GTK based front-end oldconfig - Update current config utilising a provided .config as base silentoldconfig - Same as oldconfig, but quietly, additionally update deps randconfig - New config with random answer to all optionsdefconfig - New config with default answer to all optionsallmodconfig - New config selecting modules when possible allyesconfig - New config where all options are accepted with yes allnoconfig - New config where all options are answered with noOther generic targets:all - Build all targets marked with [*]*vmlinux- Build the bare kernel* modules- Build all modulesmodules_install- Install all modules to INSTALL_MOD_PATH (default: /) firmware_install- Install all firmware to INSTALL_FW_PATH(default: $(INSTALL_MOD_PATH)/lib/firmware)dir/ - Build all files in dir and belowdir/file.[ois] - Build specified target onlydir/file.ko - Build module including final linkmodules_prepare - Set up for building external modulestags/TAGS - Generate tags file for editorscscope - Generate cscope indexkernelrelease - Output the release version stringkernelversion - Output the version stored in Makefileheaders_install - Install sanitised kernel headers to INSTALL_HDR_PATH (default: /usr/src/linux-2.6.31.5/usr)Static analyserscheckstack - Generate a list of stack hogsnamespacecheck - Name space analysis on compiled kernelversioncheck - Sanity check on version.h usageincludecheck - Check for duplicate included header filesexport_report - List the usages of all exported symbolsheaders_check - Sanity check on exported headersheaderdep - Detect inclusion cycles in headersKernel packaging:rpm-pkg - Build both source and binary RPM kernel packagesbinrpm-pkg - Build only the binary kernel packagedeb-pkg - Build the kernel as an deb packagetar-pkg - Build the kernel as an uncompressed tarballtargz-pkg - Build the kernel as a gzip compressed tarballtarbz2-pkg - Build the kernel as a bzip2 compressed tarball Documentation targets:Linux kernel internal documentation in different formats:htmldocs - HTMLpdfdocs - PDFpsdocs - Postscriptxmldocs - XML DocBookmandocs - man pagesinstallmandocs - install man pages generated by mandocscleandocs - clean all generated DocBook filesArchitecture specific targets (x86):* bzImage - Compressed kernel image (arch/x86/boot/bzImage)install- Install kernel using (your) ~/bin/installkernel or (distribution) /s bin/installkernel orinstall to $(INSTALL_PATH) and run lilofdimage - Create 1.4MB boot floppy image (arch/x86/boot/fdimage) fdimage144 - Create 1.4MB boot floppy image (arch/x86/boot/fdimage) fdimage288 - Create 2.8MB boot floppy image (arch/x86/boot/fdimage) isoimage - Create a boot CD-ROM image (arch/x86/boot/image.iso) bzdisk/fdimage*/isoimage also accept:FDARGS="..." arguments for the booted kernelFDINITRD=file initrd for the booted kerneli386_defconfig - Build for i386x86_64_defconfig - Build for x86_64make V=0|1 [targets] 0 => quiet build (default), 1 => verbose buildmake V=2 [targets] 2 => give reason for rebuild of targetmake O=dir [targets] Locate all output files in "dir", including .configmake C=1 [targets] Check all c source with $CHECK (sparse by default) make C=2 [targets] Force check of all c source with $CHECKExecute "make" or "make all" to build all targets marked with [*]For further info see the ./README file以下内容为下载的内核源文件包中README部分内容:DOCUMENTATION:- There is a lot of documentation available both in electronic form on the In ternet and in books, both Linux-specific and pertaining to general UNIX quest ions. I'd recommend looking into the documentation subdirectories on any Li nux FTP site for the LDP (Linux Documentation Project)books. This REA DME is not meant to be documentation on the system: there are much bette r sources available.- There are various README files in the Documentation/ subdirectory: th ese typically contain kernel-specific installation notes for some drivers for ex ample. See ocumentation/00-INDEX for a list of what is contained in each f ile. Please read the Changes file, as it contains information about the probl ems, which may result by upgrading your kernel.- The Documentation/DocBook/ subdirectory contains several guides for kernel developers and users. These guides can be rendered in a number of formats: PostScript (.ps), PDF, HTML, & man-pages, among others. After i nstallation, "make psdocs", "make pdfdocs", "make htmldocs", or "make man docs" will render the documentation in the requested format.INSTALLING the kernel source:- If you install the full sources, put the kernel tarball in a directory (eg. yo ur home directory) and unpack it:gzip -cd linux-2.6.XX.tar.gz | tar xvf -orbzip2 -dc linux-2.6.XX.tar.bz2 | tar xvf -Do NOT use the /usr/src/linux area! This area has a (usually incomplete) set of kernel headers that are used by the library header files. They should match the library, and not get messed up bywhatever the kernel-du-jour happens to be.- You can also upgrade between 2.6.xx releases by patching.Patches ar edistributed in the traditional gzip and the newer bzip2 format. Toinstall by patching, get all the newer patch files, enter thetop level directory of the kernel source (linux-2.6.xx) and execute:gzip -cd ../patch-2.6.xx.gz | patch -p1orbzip2 -dc ../patch-2.6.xx.bz2 | patch -p1(repeat xx for all versions bigger than the version of your currentsource tree, _in_order_) and you should be ok. You may want to remove the backup files (xxx~ or xxx.orig), and make sure that there are no failed patches (xxx# or xxx.rej). If there are, either you or me hasmade a mistake.Unlike patches for the 2.6.x kernels, patches for the 2.6.x.y kernels(also known as the -stable kernels) are not incremental but instead apply directly to the base 2.6.x kernel. Please readDocumentation/applying-patches.txt for more information. Alternatively, the script patch-kernel can be used to automate this process. It determines the current kernel version and applies any patches found.linux/scripts/patch-kernel linuxThe first argument in the command above is the location of thekernel source. Patches are applied from the current directory, butan alternative directory can be specified as the second argument.- If you are upgrading between releases using the stable series patches(for example, patch-2.6.xx.y), note that these "dot-releases" arenot incremental and must be applied to the 2.6.xx base tree. For example, if your base kernel is 2.6.12 and you want to apply the2.6.12.3 patch, you do not and indeed must not first apply the2.6.12.1 and 2.6.12.2 patches. Similarly, if you are running kernelversion 2.6.12.2 and want to jump to 2.6.12.3, you must firstreverse the 2.6.12.2 patch (that is, patch -R) _before_ applyingthe 2.6.12.3 patch.You can read more on this in Documentation/applying-patches.txt- Make sure you have no stale .o files and dependencies lying around:cd linuxmake mrproperYou should now have the sources correctly installed.SOFTWARE REQUIREMENTSCompiling and running the 2.6.xx kernels requires up-to-dateversions of various software packages. ConsultDocumentation/Changes for the minimum version numbers requiredand how to get updates for these packages. Beware that using excessively old versions of these packages can cause indirecterrors that are very difficult to track down, so don't assume thatyou can just update packages when obvious problems arise duringbuild or operation.BUILD directory for the kernel:When compiling the kernel all output files will per default bestored together with the kernel source code.Using the option "make O=output/dir"allow you to specify an alternate place for the output files (including .config).Example:kernel source code: /usr/src/linux-2.6.Nbuild directory: /home/name/build/kernelTo configure and build the kernel use:cd /usr/src/linux-2.6.Nmake O=/home/name/build/kernel menuconfigmake O=/home/name/build/kernelsudo make O=/home/name/build/kernel modules_install install Please note: If the 'O=output/dir' option is used then it must be used for all invocations of make.CONFIGURING the kernel:Do not skip this step even if you are only upgrading one minorversion. New configuration options are added in each release, andodd problems will turn up if the configuration files are not set upas expected. If you want to carry your existing configuration to anew version with minimal work, use "make oldconfig", which willonly ask you for the answers to new questions.- Alternate configuration commands are:"make config" Plain text interface."make menuconfig" Text based color menus, radiolists & dialogs. "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 aboutnew config symbols."make silentoldconfig"Like above, but avoids cluttering the screenwith questions already answered.Additionally updates the dependencies."make defconfig" Create a ./.config file by using the defaultsymbol values from either arch/$ARCH/defconfigor arch/$ARCH/configs/${PLATFORM}_defconfig,depending on the architecture."make ${PLATFORM}_defconfig"Create a ./.config file by using the defaultsymbol values fromarch/$ARCH/configs/${PLATFORM}_defconfig.Use "make help" to get a list of all availableplatforms of your architecture."make allyesconfig"Create a ./.config file by setting symbolvalues to 'y' as much as possible."make allmodconfig"Create a ./.config file by setting symbolvalues to 'm' as much as possible."make allnoconfig" Create a ./.config file by setting symbolvalues to 'n' as much as possible."make randconfig" Create a ./.config file by setting symbolvalues to random values.You can find more information on using the Linux kernel config toolsin Documentation/kbuild/kconfig.txt.NOTES on "make config":- having unnecessary drivers will make the kernel bigger, and canunder some circumstances lead to problems: probing for anonexistent controller card may confuse your other controllers- compiling the kernel with "Processor type" set higher than 386will result in a kernel that does NOT work on a 386. Thekernel will detect this on bootup, and give up.- A kernel with math-emulation compiled in will still use thecoprocessor if one is present: the math emulation will justnever get used in that case. The kernel will be slightly larger,but will work on different machines regardless of whether theyhave a math coprocessor or not.- the "kernel hacking" configuration details usually result in abigger or slower kernel (or both), and can even make the kernelless stable by configuring some routines to actively try tobreak bad code to find kernel problems (kmalloc()). Thus youshould probably answer 'n' to the questions for"development", "experimental", or "debugging" features.COMPILING the kernel:- Make sure you have at least gcc 3.2 available. For more information, refer to Documentation/Changes. Please note that you can still run a.out user pro grams with this kernel.- Do a "make" to create a compressed kernel image. It is also possible to d o "make install" if you have lilo installed to suit the kernel makefiles, but yo u may want to check your particular lilo setup first. To do the actual install you have to be root, but none of the normal build should require that. Don't take the name of root in vain.- If you configured any of the parts of the kernel as `modules', you will als o have to do "make modules_install".- Verbose kernel compile/build output:Normally the kernel build system runs in a fairly quiet mode (but not totall y silent). However, sometimes you or other kernel developers need to see c ompile, link, or other commands exactly as they are executed.For this, use "verbose" build mode. This is done by inserting "V=1" in th e "make" command. E.g.: make V=1 allTo have the build system also tell the reason for the rebuild of each targe t, use "V=2". The default is "V=0".- Keep a backup kernel handy in case something goes wrong. This is espec ially true for the development releases, since each new release contains new code which has not been debugged. Make sure you keep a backup of the m odules corresponding to that kernel, as well. If you are installing a new kern el with the same version number as yourworking kernel, make a backup of your modules directory before you do a "make modules_install".Alternatively, before compiling, use the kernel config option "LOCALVERSION" to append a unique suffix to the regular kernel version. LOCALVERSION can be set in the "General Setup" menu.- In order to boot your new kernel, you'll need to copy the kernel image (e.g. .../linux/arch/i386/boot/bzImage after compilation) to the place where you r regular bootable kernel is found.- Booting a kernel directly from a floppy without the assistance of a bootloa der such as LILO, is no longer supported.If you boot Linux from the hard drive, chances are you use LILO which us es the kernel image as specified in the file /etc/lilo.conf. The kernel image fi le is usually /vmlinuz, /boot/vmlinuz, /bzImage or /boot/bzImage. To use th e new kernel, save a copy of the old image and copy the new image over th e old one. Then, you MUST RERUN LILO to update the loading map!! If you don't, you won't be able to bootthe new kernel image. Reinstalling LILO is usually a matter of running /sbi n/lilo.You may wish to edit /etc/lilo.conf to specify an entry for your old kernel i mage (say, /vmlinux.old) in case the new one does not work. See the LILO docs for more information. After reinstalling LILO, you should be all set. Sh utdown the system,reboot, and enjoy! If you ever need to change the default root device, vid eo mode,ramdisk size, etc. in the kernel image, use the 'rdev' program (or alternat ively the LILO boot options when appropriate). No need to recompile the ker nel to change these parameters.- Reboot with the new kernel and enjoy.IF SOMETHING GOES WRONG:- If you have problems that seem to be due to kernel bugs, please check the file MAINTAINERS to see if there is a particular person associatedwith the part of the kernel that you are having trouble with. If thereisn't anyone listed there, then the second best thing is to mailthem to me (torvalds@), and possibly to any other relevant mailing-list or to the newsgroup.- In all bug-reports, *please* tell what kernel you are talking about,how to duplicate the problem, and what your setup is (use your common sense). If the problem is new, tell me so, and if the problem isold, please try to tell me when you first noticed it.- If the bug results in a message likeunable to handle kernel paging request at address C0000010Oops: 0002EIP: 0010:XXXXXXXXeax: xxxxxxxx ebx: xxxxxxxx ecx: xxxxxxxx edx: xxxxxxxxesi: xxxxxxxx edi: xxxxxxxx ebp: xxxxxxxxds: xxxx es: xxxx fs: xxxx gs: xxxxPid: xx, process nr: xxxx xx xx xx xx xx xx xx xx xxor similar kernel debugging information on your screen or in yoursystem log, please duplicate it *exactly*. The dump may look incomprehensible to you, but it does contain information that mayhelp debugging the problem. The text above the dump is alsoimportant: it tells something about why the kernel dumped code (inthe above example it's due to a bad kernel pointer). More informationon making sense of the dump is in Documentation/oops-tracing.txt- If you compiled the kernel with CONFIG_KALLSYMS you can send the dump as is, otherwise you will have to use the "ksymoops" program to make sense of the dump (but compiling with CONFIG_KALLSYMS is usually preferr ed).This utility can be downloaded from/pub/linux/utils/kernel/ksymoops/">ftp://ftp.<country>/ pub/linux/utils/kernel/ksymoops/ .Alternately you can do the dump lookup by hand:- In debugging dumps like the above, it helps enormously if you canlook up what the EIP value means. The hex value as such doesn't helpme or anybody else very much: it will depend on your particularkernel setup. What you should do is take the hex value from the EIPline (ignore the "0010:"), and look it up in the kernel namelist tosee which kernel function contains the offending address.To find out the kernel function name, you'll need to find the systembinary associated with the kernel that exhibited the symptom. This isthe file 'linux/vmlinux'. To extract the namelist and match it againstthe EIP from the kernel crash, do:nm vmlinux | sort | lessThis will give you a list of kernel addresses sorted in ascendingorder, from which it is simple to find the function that contains the offending address. Note that the address given by the kerneldebugging messages will not necessarily match exactly with thefunction addresses (in fact, that is very unlikely), so you can'tjust 'grep' the list: the list will, however, give you the startingpoint of each kernel function, so by looking for the function thathas a starting address lower than the one you are searching for butis followed by a function with a higher address you will find the oneyou want. In fact, it may be a good idea to include a bit of"context" in your problem report, giving a few lines around theinteresting one.If you for some reason cannot do the above (you have a pre-compiled kernel image or similar), telling me as much about your setup aspossible will help. Please read the REPORTING-BUGS document for details. - Alternately, you can use gdb on a running kernel. (read-only; i.e. you cannot change values or set break points.) To do this, first compile the kernel with -g; edit arch/i386/Makefile appropriately, then do a "make clean". You'll also need to enable CONFIG_PROC_FS (via "make config"). After you've rebooted with the new kernel, do "gdb vmlinux /proc/kcore". You can now use all the usual gdb commands. The command to look up the point where your system crashed is "l *0xXXXXXXXX". (Replace the XXXes with the EIP value.)gdb'ing a non-running kernel currently fails because gdb (wrongly) disregards the starting offset for which the kernel is compiled.。