Info about /sbin/init

Posted by: kim

Info about /sbin/init - 20/02/2000 03:44

Any chance of getting the source code of /sbin/init or atleast some information of what it does?

I've been trying to create an own bootloader which lets you to choose what program you want to run - so that running custom programs without being on console would be possible.

I've been playing with /sbin/init and I can run simple programs in it but since the drives are not mounted yet, I have trouble loading files from other directories, etc.

All I would need to know is how it mounts the drives in beginning and what other init code it executes before it launches /empeg/bin/player. Also as it has some mechanism of remounting partitions and switching to shell-player loop when you press 'q' from the player, it would be nice to have a proper init that does also the same kind of things (to ensure that drives are always in safe state, etc).

Kim

Posted by: altman

Re: Info about /sbin/init - 20/02/2000 12:48

From memory, what it does (very very basically) is:

#!/bin/sh
mount -n /proc
mount -n /dev/hda4 /drive0
mount -n /dev/hdc4 /drive1
exec /empeg/bin/player

...it does more, but this is more to do with recovery & starting shells afterwards (& so on). Take the above and add your menu code afterwards and most things should be ok (I think!)

Hugo


Posted by: kim

Re: Info about /sbin/init - 21/02/2000 03:39

From memory, what it does (very very basically) is:

#!/bin/sh
mount -n /proc
mount -n /dev/hda4 /drive0
mount -n /dev/hdc4 /drive1
exec /empeg/bin/player

...it does more, but this is more to do with recovery & starting shells afterwards (& so on). Take the above and add your menu code afterwards and most things should be ok (I think!)


OK, I tried this:

#!/bin/sh
echo *** Mounting /proc ***
mount -n /proc
echo *** Mounting /drive0 ***
mount -n /dev/hda4 /drive0
echo *** Mounting /drive1 ***
mount -n /dev/hdc4 /drive1
echo *** Executing player ***
exec /empeg/bin/player


But no luck. The player reports that it has been started but then it just seem to hang there. With my own program, it was infinitely giving permission faults or something. Also, those mount commands took quite a while to execute so it probably was mounting them rw even though ro would have been enough.

See the attached log for more details.

Posted by: altman

Re: Info about /sbin/init - 21/02/2000 12:09

Erk, yes, "mount -n -ro -o nocheck" is more like it.

You won't be able to run anything after an exec: this replaces the /bin/sh script with the player. If you want the script to continue after this point, make it an "/empeg/bin/player &".

Hugo