From owner-freebsd-questions Sun Nov 29 17:02:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA26127 for freebsd-questions-outgoing; Sun, 29 Nov 1998 17:02:15 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA26120 for ; Sun, 29 Nov 1998 17:02:11 -0800 (PST) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id LAA08589; Mon, 30 Nov 1998 11:31:53 +1030 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.1/8.9.0) id LAA01294; Mon, 30 Nov 1998 11:31:48 +1030 (CST) Message-ID: <19981130113148.H831@freebie.lemis.com> Date: Mon, 30 Nov 1998 11:31:48 +1030 From: Greg Lehey To: "Marko's Work" , freebsd-questions@FreeBSD.ORG Subject: Re: Curious about what happens during boot. References: <01be1bfa$fdc6f100$ba80b7d1@vidbox> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: <01be1bfa$fdc6f100$ba80b7d1@vidbox>; from Marko's Work on Sun, Nov 29, 1998 at 07:47:22PM -0500 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sunday, 29 November 1998 at 19:47:22 -0500, Marko's Work wrote: > With FreeBSD, what script is run first (upon boot) in the /etc directory? > With dos, config.sys and autoexec.bat are run after > command.com, but in FreeBSD what comes after running the kernel? > I would like to trace the whole procedure to become familiar with it. This is a borderline -questions/-hackers question. I'll deal with it here. The first process that UNIX starts is process 0 (strangely enough). Nowadays it doesn't do much more than spawn process 1, which is called init. From the source code (/usr/src/sbin/init/init.c): /* * The mother of all processes. */ Roughly, init performs the following functions on startup: 1. Initializes itself, including ensuring that it's process 1, setting the way it opens the system log file, ensuring that it's a session leader and running as root, and looking at some of the boot flags, including -s (single user) and -f (fast boot). 2. If you specify -s, it will go into single user mode by spawning a copy of itself, which will start a shell. You do what you want and exit the shell. Then the original init continues. 3. Next it starts a shell which runs the script /etc/rc, and waits for it to complete. You can take a look at /etc/rc to see what it does: it reads in the following scripts: /etc/rc.conf to get configuration variables /etc/rc.serial to configure serial devices, /etc/rc.pccard to set up PC-cards (laptop plugin cards), /etc/rc.network to start the network services /etc/rc.i386 for processor-specific startup /etc/rc.local for site-related startup files 4. Finally it looks at the file /etc/ttys and starts all the gettys described there. Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message