设为首页 收藏本站
查看: 626|回复: 0

[经验分享] Mac OS X 1.4 Tiger: System Startup

[复制链接]

尚未签到

发表于 2016-5-16 08:37:38 | 显示全部楼层 |阅读模式
Update:
2008-12-29: Changed title, cause this is only for 104 Tiger system.

注:这一篇文章详细地描述了OS X的启动过程,包括了从power up到login的全部过程,是看到的最详尽的讲解,对于troubleshoting/system maintenance等都有很高的使用和参考价值。

Mac OS X System Startup

  This page briefly describes the sequence of events that happen when Mac OS X boots.
  Some details of the boot process from power-on until the kernel is up and running are covered in Booting Mac OS X and XNU: The Kernel. To recapitulate:

  • Power is turned on.
  • Open Firmware code is executed.
  • Hardware information is collected and hardware is initialized.
  • Something (usually the OS, but also things like the Apple HardwareTest, etc.) is selected to boot. The user may be prompted to selectwhat to boot.
  • Control passes to /System/Library/CoreServices/BootX, the boot loader. BootX loads the kernel and also draws the OS badges, if any.
  • BootX tries to load a previously cached list of device drivers (created/updated by /usr/sbin/kextcache). Such a cache is of the type mkextand contains the info dictionaries and binary files for multiple kernelextensions. Note that if the mkext cache is corrupt or missing, BootXwould look in /System/Library/Extensions for extensions that are needed in the current scenario (as determined by the value of the OSBundleRequired property in the Info.plist file of the extension's bundle.
  • The init routine of the kernel is executed. The rootdevice of the booting system is determined. At this point, OpenFirmware is not accessible any more.
  • Various Mach/BSD data structures are initialized by the kernel.
  • The I/O Kit is initialized.
  • The kernel starts /sbin/mach_init, the Mach service naming (bootstrap) daemon. mach_init maintains mappings between service names and the Mach ports that provide access to those services.
  From here on, the startup becomes user-level:

  • mach_init starts /sbin/init, the traditional BSD init process. init determines the runlevel, and runs /etc/rc.boot, which sets up the machine enough to run single-user.
  During its execution, rc.boot and the other rc scripts source /etc/rc.common, a shell script containing utility functions, such as CheckForNetwork() (checks if the network is up), GetPID(), purgedir() (deletes directory contents only, not the structure), etc.


  • rc.boot figures out the type of boot (Multi-User, Safe, CD-ROM, Network etc.). In case of a network boot (the sysctl variable kern.netboot will be set to 1 in which case), it runs /etc/rc.netboot with a start argument.
  /etc/rc.netboot handles various aspects of network booting. For example, it performs network and (if any) local mounts. It also calls /usr/bin/nbstto associate a shadow file with the disk image being used as the rootdevice. The idea is to redirect writes to the shadow file, whichhopefully is on local storage.


  • rc.boot figures out if a file system consistency checkis required. Single-user and CD-ROM boots do not run fsck. SafeBootalways runs fsck. rc.boot handles the return status of fsck as well.
  • If rc.boot exits successfully, /etc/rc, the multi-user startup script is then run. If booting from a CD-ROM, the script switches over to /etc/rc.cdrom (installation).
  • /etc/rc mounts local file systems (HFS+, HFS, UFS, /dev/fd, /.vol), ensures that the directory /private/var/tmp exists, and runs /etc/rc.installer_cleanup, if one exists (left by an installer before reboot).
  • /etc/rc.cleanup is run. It "cleans" a number of Unix and Mac specific directories/files.
  • BootCache is started.
  • Various sysctl variables are set (such as for maximum number of vnodes, System V IPC, etc.). If /etc/sysctl.conf exists (plus /etc/sysctl-macosxserver.conf on Mac OS X Server), it is read and sysctl variables contained therein are set.
  • syslogd is started.
  • The Mach symbol file is created.
  • /etc/rc starts kextd, the daemon process that loads kernel extension on demand from kernel or client processes.
  • /usr/libexec/register_mach_bootstrap_servers is run to load various Mach bootstrap based services contained in /etc/mach_init.d
  • portmap and netinfo are started.
  • If /System/Library/Extensions.mkext is older than /System/Library/Extensions, /etc/rc deletes the existing mkext and creates a new one. It also creates one if one doesn't exist.
  • /etc/rc starts /usr/sbin/update, the daemon that flushes internal file system caches to disk frequently.
  • /etc/rc starts the virtual memory system. /private/var/vm is set up as the swap directory. /sbin/dynamic_pageris started with the appropriate arguments (swap filename path template,size of swap files created, high and low water alert triggersspecifying when to create additional swap files or delete existingones).
  • /etc/rc starts /usr/libexec/fix_prebinding to fix incorrectly prebound binaries.
  • /etc/rc executes /etc/rc.cleanup to clean up and reset files and devices.
  • /etc/rc finally launches /sbin/SystemStarter to handle startup items from locations such as /System/Library/StartupItems and /Library/StartupItems.A StartupItem is a program, usually a shell script, whose name matchesthe folder name. The folder contains a property list file containingkey-value pairs such as Description, Provides, Requires, OrderPreference, start/stop messages etc. You can run SystemStarter -n -D as root to have the program print debugging and dependency information (without actually running anything).
  • The CoreGraphics startup item starts the Apple Type Services daemon (ATSServer) as well as the Window Server (WindowServer).
  By default, the loginwindow application (loginwindow.app under /System/Library/CoreServices) is executed for the console device. You can change this line in /etc/ttys if you do not want a graphical login.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-217487-1-1.html 上篇帖子: Mac OS X (Snow Leopard) and SVN (1.6.2) 下篇帖子: Mac OS X 上的PHP开发环境 vim
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表