内核参数
内核需要从引导加载程序获取什么东西吗?通常内核能够从头开始启动系统,那么为什么它需要从引导加载程序获取任何东西呢? 我见过这样的来自内核的启动消息。
"Fetching vars from bootloader... OK"
那么所传递的变量到底是什么? 另外,变量是如何从引导加载程序传递的? 是通过栈吗?
Is there anything that the kernel need to get from the boot loader.Usually the kernel is capable of bringing up a system from scratch, so why does it require anything from boot-loader?
I have seen boot messages from kernel like this.
"Fetching vars from bootloader... OK"
So what exactly are the variables being passed?
Also how are the variables being passed from the boot-loader? Is it through stack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
内核接受所谓的基于文本的命令行选项。 这非常有用,因为您可以做很多事情而无需重新编译内核。 至于参数传递,它取决于架构。 在 ARM 上,它是通过指向内存中某个位置或内存中固定位置的指针来完成的。
以下是在 ARM 上的实现方式。
通常内核无法从头开始引导机器。 可能是从BIOS开始的,但它不是从头开始的。 它需要一些初始化,这是引导加载程序的工作。
The kernel accept so called command-line options, that are text based. This is very useful, because you can do a lot of thing without having to recompile your kernel. As for the argument passing, it is architecture dependent. On ARM it is done through a pointer to a location in memory, or a fixed location in memory.
Here is how it is done on ARM.
Usually a kernel is not capable of booting the machine from scratch. May be from the bios, but then it is not from scratch. It needs some initialisation, this is the job of the bootloader.
Linux 内核从引导加载程序接受一些参数,其中我现在记得的是 vga 参数。 例如:
看看 您应该了解的有关 Linux 内核的 10 个启动时间参数,其中解释了一些常见参数。
There are some parametres that the Linux kernel accepts from the bootloader, of which what I can remember now is the
vga
parametre. For example:Have a look at 10 boot time parameters you should know about the Linux kernel which explains some of the common parametres.
对于 Linux 内核,引导加载程序必须告诉内核一些事情。 它包括诸如内核命令行之类的东西(正如其他人已经提到的那样),在内存中 initrd< /a> 已加载及其大小,如果正在使用 initrd(内核无法自行加载它;通常在使用 initrd 时,访问存储设备所需的模块位于 initrd 内,并且它还必须执行以下操作在能够访问存储之前需要进行一些相当复杂的设置),以及一些各种各样的零碎东西。
请参阅 Documentation/x86/boot.txt (链接到 2.6.30 的版本)了解传统 x86 架构(32 位和 64 位)的更多详细信息,包括如何将这些变量传递到内核设置代码。
For the Linux kernel, there are several things the bootloader has to tell the kernel. It includes things like the kernel command line (as several other people already mentioned), where in the memory the initrd has been loaded and its size, if an initrd is being used (the kernel cannot load it by itself; often when using an initrd, the modules needed to acess storage devices are within the initrd, and it can also have to do some quite complex setup before being able to access the storage), and several assorted odds and ends.
See Documentation/x86/boot.txt (link to 2.6.30's version) for more detail for the traditional x86 architecture (both 32-bit and 64-bit), including how these variables are passed to the kernel setup code.
引导加载程序不使用堆栈将参数传递给内核。 至少在 Linux 中,引导加载程序填充了一个相当复杂的内存结构,内核知道如何解析。 这就是引导加载程序将内核指向其命令行的方式。 请参阅Documentaion/x86/boot.txt 了解更多信息。
The bootloader doesn't use a stack to pass arguments to the kernel. At least in the case of Linux, there is a rather complex memory structure that the bootloader fills in that the kernel knows how to parse. This is how the bootloader points the kernel to its command line. See Documentaion/x86/boot.txt for more info.
Linux 接受来自引导加载程序的变量以允许使用某些选项。 我知道您可以做的一件事就是使您不必登录(恢复模式),并且还有其他几个选项。 它主要只是允许在出现问题或更改密码时进行修复。 如果您选择使用其他选项,这就是 Ubuntu Live-CD 启动 Linux 的方式。
Linux accepts variables from the boot loader to allow certain options to be used. I know that one of the things you can do is make it so that you don't have to log-in (recovery mode) and there are several other options. It mainly just allows fixes to be done if there's an issue with something or for password changing. This is how the Ubuntu Live-CD boots Linux if you select to use another option.
通常这些参数称为命令行参数,它从引导加载程序传递到内核模块。 Bootloader使用许多BIOS中断来检测,
所有硬件细节都会在启动时(即实模式)进行检测,然后将此参数传递给内核。
Normally the parameters called command line parameters, which is passed to kernel module from boot loader. Bootloader use many of the BIOS interrupts to detect,
and all harwares details are going to be detected at boot time, that is in real mode, then pass this parameters to Kernel.