MyException - 我的异常网
当前位置:我的异常网» 操作系统 » 2013年二月LFS7.2配置备忘

2013年二月LFS7.2配置备忘

www.MyException.Cn  网友分享于:2015-08-26  浏览:9次
2013年2月LFS7.2配置备忘
1.启动过程
Boot
|
V
内核启动
|
V
init进程 <-配置- /etc/inittab
|
V
rc脚本 <-配置- /etc/sysconfig/rc.site
|
V
各启动脚本 <-配置- /etc/sysconfig里面的各个配置文件
|
V
login shell <-各个shell配置文件


2.启动脚本与RunLevel
Changing run-levels is done with init <runlevel>, where <runlevel> is the target run-level. For example, to reboot the computer, a user could issue the init 6 command, which is an alias for the reboot command. Likewise, init 0 is an alias for the halt command.
0: halt the computer
1: single-user mode
2: multi-user mode without networking
3: multi-user mode with networking
4: reserved for customization, otherwise does the same as 3
5: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm)
6: reboot the computer
(there are more run-levels, but they are for special cases and are generally not used. See init(8) for more details)

There are a number of directories under /etc/rc.d that look like rc?.d (where ? is the number of the run-level) and rcsysinit.d, all containing a number of symbolic links. Some begin with a K, the others begin with an S, and all of them have two numbers following the initial letter. The K means to stop (kill) a service and the S means to start a service. The numbers determine the order in which the scripts are run, from 00 to 99—the lower the number the earlier it gets executed. When init switches to another run-level, the appropriate services are either started or stopped, depending on the runlevel chosen.

The real scripts are in /etc/rc.d/init.d. They do the actual work, and the symlinks all point to them. K links and S links point to the same script in /etc/rc.d/init.d. This is because the scripts can be called with different parameters like start, stop, restart, reload, and status. When a K link is encountered, the appropriate script is run with the stop argument. When an S link is encountered, the appropriate script is run with the start argument.

There is one exception to this explanation. Links that start with an S in the rc0.d and rc6.d directories will not cause anything to be started. They will be called with the parameter stop to stop something. The logic behind this is that when a user is going to reboot or halt the system, nothing needs to be started. The system only needs to be stopped.

These are descriptions of what the arguments make the scripts do:

start
The service is started.
stop
The service is stopped.
restart
The service is stopped and then started again.
reload
The configuration of the service is updated. This is used after the configuration file of a service was modified, when the service does not need to be restarted.
status
Tells if the service is running and with which PIDs.


3.设备与模块管理
Device Node Creation

In recent version of udev, udevd no longer creates device files in /dev. Instead, this must be handled in the kernel, by the devtmpfs filesystem. Any driver that wishes to register a device node will go through devtmpfs (via the driver core) to do it. When a devtmpfs instance is mounted on /dev, the device node will initially be created with a fixed name, permissions, and owner.

A short time later, the kernel will send a uevent to udevd. Based on the rules specified in the files within the /etc/udev/rules.d, /lib/udev/rules.d, and /run/udev/rules.d directories, udevd will create additional symlinks to the device node, or change its permissions, owner, or group, or modify the internal udevd database entry for that object.

The rules in these three directories are numbered in a similar fashion to the LFS-Bootscripts package, and all three directories are merged together. If udevd can't find a rule for the device it is creating, it will leave the permissions and ownership at whatever devtmpfs used initially.

Handling Hotpluggable/Dynamic Devices

When you plug in a device, such as a Universal Serial Bus (USB) MP3 player, the kernel recognizes that the device is now connected and generates a uevent. This uevent is then handled by udevd as described above.

-------------------
Module Loading

Device drivers compiled as modules may have aliases built into them. Aliases are visible in the output of the modinfo program and are usually related to the bus-specific identifiers of devices supported by a module. For example, the snd-fm801 driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801, and has an alias of “pci:v00001319d00000801sv*sd*bc04sc01i*”. For most devices, the bus driver exports the alias of the driver that would handle the device via sysfs. E.g., the /sys/bus/pci/devices/0000:00:0d.0/modalias file might contain the string “pci:v00001319d00000801sv00001319sd00001319bc04sc01i00”. The default rules provided with Udev will cause udevd to call out to /sbin/modprobe with the contents of the MODALIAS uevent environment variable (which should be the same as the contents of the modalias file in sysfs), thus loading all modules whose aliases match this string after wildcard expansion.

In this example, this means that, in addition to snd-fm801, the obsolete (and unwanted) forte driver will be loaded if it is available. See below for ways in which the loading of unwanted drivers can be prevented.

The kernel itself is also able to load modules for network protocols, filesystems and NLS support on demand.


-------------------
Problems with Loading Modules and Creating Devices: 7.4.3.



4. Shell配置文件
我們一定要先知道的就是 login shell 與 non-login shell! 重點在於有沒有登入 (login) 啦!

login shell:取得 bash 時需要完整的登入流程的,就稱為 login shell。舉例來說,你要由 tty1 ~ tty6 登入,需要輸入使用者的帳號與密碼,此時取得的 bash 就稱為『 login shell 』囉;

non-login shell:取得 bash 介面的方法不需要重複登入的舉動,舉例來說,(1)你以 X window 登入 Linux 後, 再以 X 的圖形化介面啟動終端機,此時那個終端介面並沒有需要再次的輸入帳號與密碼,那個 bash 的環境就稱為 non-login shell了。(2)你在原本的 bash 環境下再次下達 bash 這個指令,同樣的也沒有輸入帳號密碼, 那第二個 bash (子程序) 也是 non-login shell 。
為什麼要介紹 login, non-login shell 呢?這是因為這兩個取得 bash 的情況中,讀取的設定檔資料並不一樣所致。

Bash Startup Files: http://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html



5.目录说明

LFS7.2 on Dell Laptop目录说明
是2013年2月创建的基本LFS系统的目录说明,除了LFS7.2外未安装任何软件包

/bin: 符号链接到各软件包提供的binaries
/boot: 包含三个内核相关文件
/boot/vmlinuz-3.5.2-lfs-7.2:内核
/boot/System.map-3.5.2: System.map is a symbol file for the kernel. It maps the function entry points of every function in the kernel API, as well as the addresses of the kernel data structures for the running kernel. It is used as a resource when investigating kernel problems.
/boot/config-3.5.2: 内核编译时的完整配置文件
/dev: mount /dev 文件系统
/etc/bash_completion.d: 配置文件夹,首先由安装grub时候创建,目前只包含一个文件grub
/etc/default: 默认值设置文件夹,包含默认值配置文件的符号链接,指向各软件包的具体赋值文件
/etc/modprobe.d: 模块载入配置文件,Configuring Linux Module Load Order
/etc/opt: Configuration files for /opt
/etc/inputrc: Handles keyboard mapping for specific situations. This file is the startup file used by Readline — the input-related library — used by Bash and most other shells.
/etc/fstab: 配置/etc/rc.d/init.d/mountfs脚本来mount需要的文件系统,Used by some programs to determine where file systems are to be mounted by default, in which order, and which must be checked (for integrity errors) prior to mounting
/etc/mtab: /etc/rc.d/init.d/mountfs脚本mount的文件系统将被记录在其中
/etc/nsswitch.conf: 配置glibc
/etc/{passwd,group}: 用户和组的配置关系
/etc/hosts: 域名-ip对应关系配置,DNS解析前首先查询本文件
/etc/resov.conf: 配置域名解析服务器
/etc/profile: 配置bash环境
/etc/inittab:配置SysV init进程
/etc/ld.so.conf: 文件包含一个所有目录(/lib 和 /usr/lib 除外,它们会自动包含在其中)的清单,动态装入器将在其中查找共享库。
/etc/ld.so.cache:但是在动态装入器能“看到”这一信息之前,必须将它转换到 ld.so.cache 文件中。可以通过运行 ldconfig 命令做到这一点,当 ldconfig 操作结束时,您会有一个最新的 /etc/ld.so.cache 文件,它反映您对ld.so.conf 所做的更改。从这一刻起,动态装入器在寻找共享库时会查看您在 /etc/ld.so.conf 中指定的所有新目录。 
/etc/localtime: 保存时区信息,由/usr/share/zoneinfo/<xxx>拷贝而来
/etc/rc.d: 保存各种启动脚本
/etc/sysconfig:保存各种启动脚本的配置文件
/etc/sysconfig/clock: 配置启动脚本/etc/rc.d/init.d/setclock
/etc/sysconfig/console: 配置启动脚本/etc/rc.d/init.d/console
/etc/sysconfig/createfiles: 配置启动脚本/etc/rc.d/init.d/cleanfs
/etc/sysconfig/ifconfig.eth0: 配置启动脚本/etc/rc.d/init.d/network  
/etc/sysconfig/modules: 配置启动脚本/etc/rc.d/init.d/modules
/etc/sysconfig/network: 配置启动脚本/etc/rc.d/init.d/localnet 
/etc/sysconfig/rc.site: 配置启动脚本/etc/rc.d/init.d/rc
/etc/sysconfig/udev_retry: 配置启动脚本/etc/rc.d/init.d/udev_retry
/home: 空
/lib: 包含各个软件包提供的动态链接库的符号链接
/lib/modules: Modules安装目录
/lib/{lsb,services}: 链接到软件包lfs_bootscript的相关脚本
/lib/firmware: 空
/lpkg: 含义为Linux Packages, LFS基础软件包的直接安装目录
/media: Mount point for removeable media
/media/cdrom: 空
/media/floopy: 空
/mnt: 空(Mount point for a temporarily mounted filesystem)
/opt : 空(Add-on application software packages)
/proc: Kernel and process information virtual filesystem
/root: Optional, Home directory for the root user 
/run: A tmpfs, this file is not persistent across boots
/sbin: 符号链接到各软件包提供的binaries
/sdoc: 保存系统说明文件
/srv: 空,contains site-specific data which is served by this system.
/sys: mount sysfs
/tmp: Must be made available for programs that require temporary files. Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.
/usr/bin: 符号链接到各软件包提供的binaries
/usr/include: 符号链接到各软件包提供的Headers
/usr/lib: 包含各个软件包提供的动态链接库的符号链接
/usr/local: 类似/usr,空
/usr/sbin: 符号链接到各软件包提供的binaries
/usr/share/{aclocal,aclocal-1.12}:各软件包提供的m4宏符号链接
/usr/share/{i18n,locale,terminfo,zoneinfo,tabset}:locale, charmaps,terminfo,zoneinfo,tabset等的符号链接
/usr/share/info:各软件包info文件的符号链接
/usr/share/man:各软件包man文件的符号链接
/usr/share/misc:各软件包misc文件的符号链接
/usr/share/ss:各软件包ss文件的符号链接
/usr/share/doc:各软件包doc文件的符号链接
/usr/share/et:各软件包et文件的符号链接
/usr/share/以软件包名称命名的文件夹: 其他各软件包提供的share文件的符号链接
/usr/src: 空
/var/: Contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.

文章评论

程序员都该阅读的书
程序员都该阅读的书
程序员应该关注的一些事儿
程序员应该关注的一些事儿
为啥Android手机总会越用越慢?
为啥Android手机总会越用越慢?
老程序员的下场
老程序员的下场
要嫁就嫁程序猿—钱多话少死的早
要嫁就嫁程序猿—钱多话少死的早
我是如何打败拖延症的
我是如何打败拖延症的
老美怎么看待阿里赴美上市
老美怎么看待阿里赴美上市
为什么程序员都是夜猫子
为什么程序员都是夜猫子
我跳槽是因为他们的显示器更大
我跳槽是因为他们的显示器更大
 程序员的样子
程序员的样子
Java程序员必看电影
Java程序员必看电影
那些性感的让人尖叫的程序员
那些性感的让人尖叫的程序员
鲜为人知的编程真相
鲜为人知的编程真相
每天工作4小时的程序员
每天工作4小时的程序员
程序员眼里IE浏览器是什么样的
程序员眼里IE浏览器是什么样的
不懂技术不要对懂技术的人说这很容易实现
不懂技术不要对懂技术的人说这很容易实现
初级 vs 高级开发者 哪个性价比更高?
初级 vs 高级开发者 哪个性价比更高?
写给自己也写给你 自己到底该何去何从
写给自己也写给你 自己到底该何去何从
60个开发者不容错过的免费资源库
60个开发者不容错过的免费资源库
科技史上最臭名昭著的13大罪犯
科技史上最臭名昭著的13大罪犯
当下全球最炙手可热的八位少年创业者
当下全球最炙手可热的八位少年创业者
十大编程算法助程序员走上高手之路
十大编程算法助程序员走上高手之路
我的丈夫是个程序员
我的丈夫是个程序员
2013年美国开发者薪资调查报告
2013年美国开发者薪资调查报告
聊聊HTTPS和SSL/TLS协议
聊聊HTTPS和SSL/TLS协议
如何区分一个程序员是“老手“还是“新手“?
如何区分一个程序员是“老手“还是“新手“?
“肮脏的”IT工作排行榜
“肮脏的”IT工作排行榜
程序员的鄙视链
程序员的鄙视链
2013年中国软件开发者薪资调查报告
2013年中国软件开发者薪资调查报告
5款最佳正则表达式编辑调试器
5款最佳正则表达式编辑调试器
10个帮程序员减压放松的网站
10个帮程序员减压放松的网站
程序猿的崛起——Growth Hacker
程序猿的崛起——Growth Hacker
一个程序员的时间管理
一个程序员的时间管理
程序员和编码员之间的区别
程序员和编码员之间的区别
10个调试和排错的小建议
10个调试和排错的小建议
程序员的一天:一寸光阴一寸金
程序员的一天:一寸光阴一寸金
漫画:程序员的工作
漫画:程序员的工作
看13位CEO、创始人和高管如何提高工作效率
看13位CEO、创始人和高管如何提高工作效率
亲爱的项目经理,我恨你
亲爱的项目经理,我恨你
Web开发者需具备的8个好习惯
Web开发者需具备的8个好习惯
总结2014中国互联网十大段子
总结2014中国互联网十大段子
中美印日四国程序员比较
中美印日四国程序员比较
程序员最害怕的5件事 你中招了吗?
程序员最害怕的5件事 你中招了吗?
Java 与 .NET 的平台发展之争
Java 与 .NET 的平台发展之争
做程序猿的老婆应该注意的一些事情
做程序猿的老婆应该注意的一些事情
什么才是优秀的用户界面设计
什么才是优秀的用户界面设计
程序员周末都喜欢做什么?
程序员周末都喜欢做什么?
程序员必看的十大电影
程序员必看的十大电影
那些争议最大的编程观点
那些争议最大的编程观点
软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有