ARM Linux上启动的一些细节 [英] Some details on ARM Linux boot

查看:380
本文介绍了ARM Linux上启动的一些细节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解Linux中的引导ARM架构的细节。我做了很多在互联网上搜索,到目前为止,了解一些细节,虽然我每次我读到一篇文章带来很多其他的新条款,这使事情变得更加复杂的时候感觉。我有2个板在运行Linux的制造商Olimex 9261和beaglebone黑色。我在嵌入式系统尤其是手臂的专长是pretty不错,但并没有发挥太多的Linux,但(除了一些用户空间程序和内核字符驱动程序)。

I'm trying to understand the details of linux booting on arm architecture. I did lot of search on the internet and understood so far some details although I feel each time I read an article it brings lot of other new terms and this makes things more complex. I do have 2 boards running linux, an olimex 9261 and a beaglebone black. My expertise in embedded systems especially arm is pretty good, but didn't play too much with linux though (except some user space programs and char drivers in kernel).

下面是我的问题:

一一板,我有以下的uboot输出(Linux的2.6.30):

One one board I have the following uboot output (linux 2.6.30):

 bootargs=mem=64M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2
 bootcmd= cp.b 0xC0042000 0x22000000 0x00199954; bootm 0x22000000

该板具有64MB内存(在0x20000000映射),512MB NAND闪存(没有找到映射到目前为止)和2MB数据闪存(在0xC0000000的映射)。

The board has 64MB RAM (mapped at 0x20000000), 512MB nand flash(didn't find mapping so far) and 2MB data flash (mapped at 0xc0000000).

我不明白这里:


  • 为什么会出现在bootargs mem中= 64?这难道不应该被指定为ATAG或DTB?

  • 为什么会出现指定的参数时,我们通过控制内核控制台?正在使用的tty内核已经被uboot的?配置

  • 的initrd VS根文件系统。这仍然是我也不清楚。我知道initrd文件可以包含在内核块设备或其中的uboot有详细地址传递给内核独立的图像(真的吗?)。我们可以没有一个initrd内核包含+另一个文件系统,这样JFFS2,从内核运行的驱动程序休息吗?其实,我无法理解在开机使用的内核文件系统的完整信息。在这种设置中有我,有4个文件:的uImage,引导,env.bin和JFFS2文件系统。所以没有initrd的。这是如何工作?以及如何生根文件系统的过程在上述bootargs指出?在我的理解中,内核应该首先访问jffs2文件系统,然后抢的/ dev / mtdblock1找到该图片并进行安装。也许,我的理解是错误的。其实内核和文件系统之间的这种相互作用是什么,我似乎并不明白。
    在上面的bootcmd,内核从NAND拷贝到SDRAM中,然后bootm跳转到它。但如何在内核找到启动时间JFFS?
    我看到启动在这个输出线:
    VFS:在设备上安装31根(JFFS2文件系统):1。

在板用户指南我发现这一点:

In the board user guide I found this:

警告:由于AT91SAM9261芯片勘误表引导从NAND闪存
不支持的。

WARNING: Due to AT91SAM9261 chip errata booting from NAND flash is not supported.

...

512MB NAND闪存(在Linux中被视为硅驱动器)。

512MB NAND Flash (seen in Linux as silicon drive).


  • 编译内核之后,我发现System.map可能不具有的所有符号。我检查了的vmlinux,它是一样的。有谁知道为什么吗?也许编译器配置不正确?

非常感谢,
丹尼尔。

Many thanks, Daniel.

推荐答案

你的大多数问题都可以通过的阅读该文档附带您的Linux源代码。一些关键文件,

Most of your questions can be answered by reading the Documentation that comes with your Linux source. Some key files are,


  • 内核parameters.txt

  • ARM / booting.txt

请采取通过他们来看看,因为他们将有目前的信息到你的Linux版本。

Please take a look through them as they will have information current to your version of Linux.

一一板,我有以下的uboot输出(Linux的2.6.30):

One one board I have the following uboot output (linux 2.6.30):

针对ARM的内核2.6.30 pre-日期设备树。

The 2.6.30 kernel pre-dates device trees for the ARM.

为什么会出现在bootargs mem中= 64?这难道不应该被指定为ATAG或DTB?

why there is a mem=64 in the bootargs? Isn't this supposed to be given as ATAG or DTB ?

有两种机制。在 ATAGS 是更加灵活,因为它可以指定内存的一些非连续的银行。这个想法是启动code可以探测内存,并通过它提供的 ATAGS 。这就是理论。它往往是很难做到,因此允许用户指定的存储= 64 是一个更容易实现。如果有两个板类型,一种有64MB和一个带128MB,它是由用户提供的命令行使用额外的内存。

There are two mechanisms. The ATAGS is more flexible as it can specify several non-contiguous banks of memory. The idea is that boot code can probe the memory and provide it via ATAGS. That is the theory. It is often tough to do, so allowing a user to specify mem=64 is a lot easier to implement. If there are two board types, one with 64MB and one with 128MB, it is up to the user to provide a command line to use the extra memory.

为什么会出现指定的参数时,我们通过控制内核控制台?正在使用的tty内核已经被配置uboot的?

why is there a console given as argument when we pass the control to kernel? Is the kernel using the tty already configured by uboot?

有些设备有多个串行端口。有些内核可能希望使用'u-boot的端口别的东西。 HDSPA调制解调器,打印机等的Linux内核和U形引导控制台可以是不同的。这是一个特点。我经常使用的的/ dev / null的的作为控制台。硬件通常是吝啬给予额外的串行端口。也许你是幸运的,你的硬件人并不认为软件是免费的。

Some devices have multiple serial ports. Some kernels may wish to use the 'u-boot' port for something else. HDSPA modem, printer, etc. The Linux kernel and the u-boot consoles may be different. That is a feature. I often use /dev/null as the console. Hardware is often stingy to give an extra serial port. Maybe you are lucky and your hardware people don't think software is free.

的initrd VS根文件系统。

initrd vs rootfs.

您可以直接引导到文件系统(根文件系统),但所有的code和机制,寻找code必须是Linux映像里面。即使他们(JFFS2 / NAND),你可能会损坏的根文件系统的NAND为穿而告终。 NAND的第一128MB通常是一个更高的质量。你可以把一个Linux这里的initrd,能够主文件系统的修复。对于其他引导设备,它可能不是直线前进引导设备和复杂的决策可以在initrd映像进行。通常情况下的的initrd 的花费少得多的时间的安装的,你可以更快速地执行某些动作。最后,你可以装载不同的模块,然后锁定模块加载在initrd。

You may boot directly to a file system (rootfs), but all of the code and mechanisms for finding the code must be inside the Linux image. Even if they are (JFFS2/NAND), you may end up with a corrupt rootfs as NAND wears. The first 128MB of NAND is usually a higher quality. You may put a Linux with initrd here that is capable of repair of the main file system. For other boot devices, it may not be straight forward to boot the device and complex decisions can be made in an initrd image. Often the initrd take far less time to mount and you may perform some actions more quickly. Finally, you may load different modules and then lock module loading in the initrd.

您可以使用的根文件系统的直接。它是容易实现。在的initrd 的是更灵活和强大。您可能希望尽快过渡到JFFS2育碧/ UBIFS。如果你没有一个的的initrd 的,那么这是pretty很多不可能的(至少更难以实施)。

You may use the rootfs directly. It is simpler to implement. The initrd is much more flexible and powerful. You may wish to transition from JFFS2 to Ubi/UbiFS. If you don't have an initrd, then this is pretty much impossible (at least much more difficult to implement).

在此设置中有我,有4个文件:的uImage,引导,env.bin和JFFS2文件系统。所以没有initrd的。

In this setup I have, there are 4 files: uImage, bootstrap, env.bin and jffs2 file system. So there is no initrd.

的uImage 的可能具有的的initrd 的连接到它。它安装一个虚拟盘,并在其后的卸载的(和 switch_root 新/最后的根文件系统的)内存是免费使用。然而,你的命令行没有的的initrd 的信息,所以你可能没有之一。

The uImage may have an initrd attached to it. It is mounted as a ramdisk and after it unmounts (and switch_root to the new/final rootfs) the memory is free to use. However, your command line has no initrd info, so you probably don't have one.

在我的理解中,内核应该首先访问了jffs2文件系统,然后抢的/ dev / mtdblock1找到该图片并进行安装。也许,我的理解是错误的。其实内核和文件系统之间的这种相互作用是什么,我似乎并不明白。在上面的bootcmd,内核从NAND拷贝到SDRAM中,然后bootm跳转到它。但如何在内核找到启动时间JFFS?我看到启动在这个输出线:VFS:在设备上安装31根(JFFS2文件系统):1。

In my understanding, the kernel should access first the jffs2 file system, then grab the image found in /dev/mtdblock1 and mount it. Perhaps my understanding is wrong. Actually this interaction between kernel and file system is what I seem not to understand. In the above bootcmd, the kernel is copied from nand to sdram then bootm jumps to it. But how does the kernel find the jffs at booting time? I see this output line during boot: VFS: Mounted root (jffs2 filesystem) on device 31:1.

您有资料查找设备; 根=的/ dev / mtdblock1 键,你告诉它的文件系统类型; rootfstype = JFFS2 。缺少的部分是在的init = / sbin目录/的init 。你可以读到关于它的<一个href=\"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/kernel-parameters.txt\"相对=nofollow>内核parameters.txt为Linux 。 JFFS2的安装后,的的init 的code查找一个进程运行。这是一切的父进程,它会开始执行许多不同的进程。通常,它是初始化,但您可以指定的init = / bin / sh的,你将只是有一个壳开始。这可能是开发一个的的initrd 的图像,你可以只用一个进程在运行测试脚本。

You have information to find the device; root=/dev/mtdblock1 and you told it the file system type; rootfstype=jffs2. The missing piece is the the init=/sbin/init. You can read about it in the kernel-parameters.txt for your Linux. After the JFFS2 is mounted, the init code looks for a process to run. It is the parent process of everything and it will start to execute many different processes. Typically it is init, but you can specify init=/bin/sh and you will just have a shell to start with. This can be a good way to develop an initrd image as you can test scripts with only one process running.

编译内核之后,我发现System.map可能不具有的所有符号。我检查了的vmlinux,它是一样的。有谁知道为什么吗?也许编译器配置不正确?

After compiling the kernel, I observed the System.map doesn't have all symbols. I checked the vmlinux and it's the same. Does anyone know why? Maybe the compiler was not configured properly?

的System.map 的真的只有外部函数和数据。它不包括所有的功能。事实上,一些功能可能不存在由于衬里。

The System.map is really only external functions and data. It does not include every function. In fact some functions may not exist due to in-lining.

警告:由于来自NAND闪存芯片AT91SAM9261启动勘误表不支持

WARNING: Due to AT91SAM9261 chip errata booting from NAND flash is not supported.

我猜是的u-boot的来处理这个工作。

I guess it is u-boot's job to handle this.

这篇关于ARM Linux上启动的一些细节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆