网站大量收购独家精品文档,联系QQ:2885784924
  1. 1、本文档共26页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
linuxrc详解

linuxrc详解 来源: ChinaUnix博客  日期: 2008.12.18 16:38 (共有0条评论) 我要评论 ? 主題: 請問在busybox 中 linuxrc 與 /sbin/init 的不同處 linuxrc 是 busybox make install 產生出來的 /sbin/init 也是busybox 用來初始開機的程式 我分別用來開機 都可正常運作 那請問兩者的差別在哪裡??還是這兩個東西其實都是一樣的 ^^ 以下為摘自linux kernel Documentation應該可以解決你的疑問。 When using initrd, the system typically boots as follows: ??1) the boot loader loads the kernel and the initial RAM disk ??2) the kernel converts initrd into a normal RAM disk and ? ???frees the memory used by initrd ??3) initrd is mounted read-write as root ??4) /linuxrc is executed (this can be any valid executable, including ? ???shell scripts; it is run with uid 0 and can do basically everything ? ???init can do) ??5) linuxrc mounts the real root file system ??6) linuxrc places the root file system at the root directory using the ? ???pivot_root system call ??7) the usual boot sequence (e.g. invocation of /sbin/init) is performed ? ???on the root file system ?? the initrd file system is removed linuxrc常见错误 2008年09月04日 星期四 下午 04:16 1? ?linuxrc不具备可执行属性 2? ?linuxrc的解释shell不在首行 3? ?linuxrc的解释shell不存在 一般都出不了上面三个原因. linuxrc脚本 kernel启动后,执行/root_china/linuxrc脚本文件,接下来执行/root_china/usr/etc/rc.local脚本文件。这两个文 件我以前没去管是什么意思,起到什么作用,直到今天。 /root_china/linuxrc: #!/bin/sh echo mount /etc as ramfs /bin/mont -n -t ramfs ramfs /etc //将/etc目录mount成可写的ramfs文件系统 /bin/cp -a /mnt/etc/* /etc? ?? ???//将/mnt/etc目录下的文件拷贝到/etc目录下 echo re-create the /etc/mtab entries #re-create the /etc/mtab entries /bin/mount -f -t cramfs -o remount,ro /dev/mtdblock/2 / //将/dev/mtdblock/2 mount成根文件系统 /bin/mount -f -t ramfs ramfs /etc exec /sbin/init? ?? ?//执行脚本档 /usr/etc/rc.local 1. /bin/mount -n -t ramfs ramfs /etc 这句话的作用加载一个ramfs作为/etc目录。这样/etc就是一个可写目录。看这个脚本,得出根文件系统是一个 cramfs(只读可压缩文件系统),而/etc作为系统运行配置文件的存放地点,可能会写一些运行状态在这里,linuxrc第一件事情就是将一个ramfs mount到/etc只读目录中,使得/etc/目录可写,指定参数-n的目的是告诉mount不要写/etc/mtab(这个文件存放当前系统mount了的所有文件系统)。因为现在/etc/目录还是只读,所以这次mount不要写这个文件,否则会失败。ramfs在哪里?在 /etc/fstab文件中应该有ramfs一项,mount会去找这项,如果没有,mount会失败。后面就执行不下去。 2. /

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档