简体   繁体   English

引导新编译的Linux内核

[英]Booting a newly compiled linux kernel

I have started reading the book Essential Linux Device Drivers. 我已经开始阅读Essential Linux Device Drivers一书了。 I am following the process for compiling and booting into a new kernel. 我正在关注编译和引导到新内核的过程。 However I am unable to boot into the newly compiled kernel - I select the new kernel in grub and then ..nothing...the screen just stays the same. 但是我无法启动进入新编译的内核 - 我在grub中选择新内核然后..没有...屏幕保持不变。

Here are the steps I am taking, as described in the book (I am using kernel 2.6.24 as that is what the book is based on) - 以下是我正在采取的步骤,如书中所述(我正在使用内核2.6.24,因为这是本书的基础) -

  • cd /usr/src/linux-2.6.24 (the base dir of the kernel I downloaded) cd /usr/src/linux-2.6.24(我下载的内核的基地目录)
  • make clean 干净
  • cp arch/x86/configs/i386_defconfig .config cp arch / x86 / configs / i386_defconfig .config
  • make bzImage cp arch/x86/boot/bzImage /boot/vmlinuz make bzImage cp arch / x86 / boot / bzImage / boot / vmlinuz

The book says that 'you might need to alert your bootloader about the arrival of the new boot image. 该书说“你可能需要提醒你的引导程序有关新引导映像的到来。 If you are using the GRUB bootloader, it figures this out automatically'. 如果您正在使用GRUB引导加载程序,它会自动计算出来。

Well it didn't figure it out automatically in my case as there was no option to select this kernel in GRUB. 好吧,在我的情况下它并没有自动解决,因为没有选择在GRUB中选择这个内核。 So I did it manually by typing update-grub in the terminal. 所以我通过在终端中键入update-grub手动完成。 And this didn't work either. 这也不起作用。 However once I changed the filename from vmlinuz to vmlinuz-2.6.24 and type update-grub it picked it up. 但是,一旦我将文件名从vmlinuz更改为vmlinuz-2.6.24并输入update-grub,它就会把它拿起来。 So on page 11 of the book there seems to already be multiple things left out... 所以在本书的第11页似乎已经遗漏了多个东西......

The book says to then reboot the machine. 书说要重新启动机器。

Anyway, I am now able to select this kernel in GRUB but as I said above it doeesn't boot properly, the screen just goes blank and never changes. 无论如何,我现在能够在GRUB中选择这个内核,但正如我上面说的那样,它无法正常启动,屏幕只是空白而且永远不会改变。 So am I missing something? 我错过了什么吗? I have followed the instructions in the book exactly. 我完全按照书中的说明进行操作。

Most automatic grub setups include kernel options to hide the messages generated as the kernel attempts to boot. 大多数自动grub设置包括内核选项,用于隐藏内核尝试引导时生成的消息。 For example: 例如:

/boot/vmlinuz-x.x.x.x-generic root=UUID=something ro quiet splash

While on the grub menu line of the kernel you wish to boot, press 'e' to temporarily edit it, and delete options such as quiet and splash (but leave the ro). 在您希望启动的内核的grub菜单行上,按“e”暂时编辑它,并删除诸如quiet和splash之类的选项(但保留ro)。

Then boot the temporarily modified line, and see the progress messages in order to get an idea where the boot is failing. 然后启动临时修改的行,并查看进度消息,以便了解启动失败的位置。

The default configuration probably requires an initrd (eg because the file system and root device needs their driver, from modules, which is what initrd provides). 默认配置可能需要initrd (例如,因为文件系统和根设备需要其驱动程序,来自模块,这是initrd提供的)。

You could either configure your kernel appropriately (carefully enabling as in-kernel, not in-modules, the essential drivers) for your particular hardware, or use a procedure to build a kernel package with its initrd. 您可以为您的特定硬件适当地配置内核(小心地启用内核,而不是模块内,基本驱动程序),或者使用过程来构建带有initrd的内核包。

You should find a procedure appropriate for your linux distribution and habits, eg something like this or that . 您应该找到适合您的Linux发行版和习惯的过程,例如类似这样那样的过程 I am using on Debian: 我在Debian上使用:

time fakeroot make-kpkg -j2 --initrd --revision=3.4.2 --append-to-version=-amd64 binary

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM