Ubuntu 编译kernel 的几种方法
来源:互联网 发布:js 复制含有对象的数组 编辑:程序博客网 时间:2024/05/03 16:31
Method 1:
1. Use apt-get source
to download the Ubuntu version of the kernel
apt-get source linux-image-$(uname -r)gives a folder that contains, for example:
linux-3.2.0 linux_3.2.0-26.41.dsclinux_3.2.0-26.41.diff.gz linux_3.2.0.orig.tar.gz
The bolded diff includes all the Ubuntu/Debian customizations.
2. To build a stock kernel with your own .config
, use the "old-fashioned" Debianmake-kpkg
method
sudo apt-get install kernel-packageIf you are compiling a kernel for the first time:
sudo apt-get build-dep linux-image-$(uname -r)Then
cd
into the source directory (here, linux-3.2.0
), and either runmake oldconfig
to create .config
file with your running kernel's configuration, or copy a third-part.config
to this directory.Depending on whether you want a text or graphical config, install:
(Text)
sudo apt-get install libncurses5 libncurses5-dev(Graphical)
sudo apt-get install qt3-dev-tools libqt3-mt-dev
And then run:
(Text)
make menuconfig
(Graphical)
make xconfig
When done, just run
make-kpkg
make-kpkg -j N --initrd --append-to-version=my-very-own-kernel kernel-image kernel-headers
where
N
is how many jobs to run in parallel (usually the number of CPUs you have), andmy-very-own-kernel
is a custom string to identify this build.When done, the kernel image and header files will be ready as debs in the parent directory; you can simply install them withsudo dpkg -i
, which will also take care of adding GRUB entries, etc.
method 2:
1. download kernel code(linux.3.16.1.tar.xz)
, untar the file, then run
make; make modules;
2. install the modules by running:
sudo make modules_installInstall the kernel itself by:
sudo make installThat puts
vmlinuz-3.16.1
(a copy of vmlinuz
),config-3.16.1
(a text file storing kernel configuration parameters), andSystem.map-3.16.1
(the kernel symbol lookup table) in /boot
. For more details, see this comp.os.linux.misc post by Hadron and man installkernel
.Final setup, so the kernel can be started and boot the system:
This section is partly based on information in Kernel/Compile.
With the kernel now where it needs to be, it needs:
an entry in the boot loader's configuration, so you can select and boot from it.
an initial RAM filesystem, the environment from which the kernel loads drivers and mounts the
/
filesystem.(If you're installing an old kernel or have configured your kernel to use devfs instead of the newer udev, you may need or wish to set up an initial ramdisk instead. If you know you need that instead, see
man initrd
.)
Generate your initramfs with mkinitramfs
:
cd /bootsudo mkinitramfs -ko initrd.img-3.16.1 3.16.1
or:
sudo update-initramfs -u -k 3.16.1or:
sudo update-initramfs -c -k 3.0.0
When you update the configuration of the GRUB2 boot loader--which has been the default in Ubuntu since 9.10--should automatically detect the new kernel and add an option to boot from it.
sudo update-grub
It could be possible that the create initrd.img is very large (over 100MB), and the boot partiiton maybe don't have enough free space. In this case, apply the strip parameter when installing modules:
make INSTALL_MOD_STRIP=1 modules_install
Similarly, for building the deb packages:
make INSTALL_MOD_STRIP=1 deb-pkg
- Ubuntu 编译kernel 的几种方法
- 得到kernel版本的几种方法
- 修改kernel的打印等级的几种方法
- Kernel 中调用其它驱动程序的几种方法
- 让Ubuntu装上自己编译的kernel
- MeizuPro5的kernel编译(ubuntu touch)
- ubuntu kernel编译
- Ubuntu kernel 编译安装
- ubuntu 后台运行的几种方法!
- 查看Ubuntu版本号的几种方法
- Ubuntu设置环境变量的几种方法
- OKL4 linux kernel的编译方法
- 关于linux kernel编译的几项关键点
- 关于linux kernel编译的几项关键点
- 关于linux kernel编译的几项关键点:
- Ubuntu 11.04下编译kernel
- Ubuntu 14.04编译Android Kernel
- Ubuntu 14.04.1 LTS上编译安装新的kernel
- Android4.4添加设置菜单
- 如何恢复u盘文件--U盘文件被吃掉怎么恢复
- 显卡坏了的症状主要体现在哪几个方面?
- wing IDE注册详细过程
- android 4.0.1源码编译,学习错误解决
- Ubuntu 编译kernel 的几种方法
- 给计算机安装软件的时候需要注意哪些?
- BZOJ 1811 IOI2005 mea
- POJ 2391-Ombrophobic Bovines(网络流_最大流+floyd+二分)
- 探寻最短的 Google 搜索结果 URL 地址
- 【ZooKeeper Notes 8】 ZooKeeper 权限控制
- 【ZooKeeper Notes 14】数据模型
- 关于linux find mtime的理解
- 为ZooKeeper增加一个小功能:指定IP进行受限客户端过滤