//==================================================
(5.内核初始化)
引导装入程序 (bootloade)和 第二阶段引导装入程序(bootstrap loader)的区别:
前者在开发板加电之后取得控制权,而且它在任何情况下都不会依赖内核。pc上的BIOS?
后者的主要作用是充当开发板级 的引导装入程序和内核之间的纽带。pc上的GRUB 和 Lilo属于这种。
这些类似于PC体系结构的第一和第二阶段的装入程序。
不同的head.o文件:
第二阶段引导装入程序 ,是arch/
/boot/compressed/head.s(为避免和后者混淆,书中作者建议 命名为 kernel_bootstrap_loader_head.s)
内核入口点: arch//kernel/head.s
合成内核映像文件的结构:
//==================================================
(9.文件系统)
防止文件系统损坏的另一个措施,是确保磁盘写操纵得以立即执行。
系统同步机制(sync)可以强制所有IO请求队列都能在相应设备上响应。
对于由于电源掉电或驱动失败带来的数据异常,windows采用在每次文件写操作后执行一个sync命令,付出了降低系统性能的代价。
//==================================================
(16.2.3 静态内核命令行)
Many of today's processors that contain an MMU cannot access any memory without some initial mapping via registers in the processor.[3] Typically, a small amount of memory is made available at
boot time to accommodate loading and decompressing the kernel and a ramdisk image. Trying to
access code or data beyond these early limits will fail. (是这样吗?不理解 by imjacob)
[3] The AMCC PPC405 is a perfect example of this. The interested reader is encouraged to examine the BAT registers in this processor.
//==================================================
(17.linux与实时)
软实时:如果错过时限,系统计算的价值或结果会有所减少。
硬实时:如果某一次时限被错过,导致系统失败,或可能产生灾难性的后果。
It is considered good design practice to minimize the processing done in the actual interrupt service
routine. Indeed, this execution context is limited in capability, so it is desirable to simply service the hardware device and
leave the data processing to a Linux bottom half,[2] also called softIRQs.
//==================================================
(8.设备驱动程序基础)
一.modprobe 与 insmod ,rmmod 区别:前者能够处理设备驱动程序模块之间的依赖性。
二.
构建步骤:
1. Starting from the top-level Linux source directory, create a directory under .../drivers/char
called examples.
2. Add a menu item to the kernel configuration to enable building examples and to specify built-in
or loadable kernel module.(kconfig文件)
3. Add the new examples subdirectory to the .../drivers/char/Makefile conditional on the menu
item created in step 2.(makefile文件)
4. 在examples 目录中加makefile文件和源文件(原文分4,5,这里修改by imjacob)
三.
文件系统的设备节点将用户空间程序与设备驱动程序联系起来。
By itself, the device node is just another file on our file system. However, because of its special status as a device node, we use it to bind to an installed device driver. If an application process issues an open() system call with our device node as the path parameter, the kernel searches for a valid device driver registered with a major number that matches the device node 。(内核会搜索所有使用与该设备节点匹配的有效设备驱动程序,该程序是用主版本号进行注册的)in our case, 234. This is the mechanism by which the kernel associates our particular device to the device node.(这种机制就是内核将特定设备与相应设备节点相互关联的方式。)
For those curious about the purpose of the minor number, it is a mechanism for handling multiple
devices or subdevices with a single device driver. It is not used by the operating system; it is simply
passed to the device driver. The device driver can use the minor number in any way it sees fit. As an
example, with a multiport serial card, the major number would specify the driver. The minor number
might specify one of the multiple ports handled by the same driver on the multiport card. Interested readers are encouraged to consult one of the excellent texts on device drivers for further details.
阅读(1164) | 评论(0) | 转发(0) |