maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Maemo5 boot process (https://talk.maemo.org/showthread.php?t=87959)

reinob 2012-11-21 08:51

Maemo5 boot process
 
1 Attachment(s)
Hi all,

I've gone through the boot process of Maemo5 and made a list of all scripts that are run, starting from /sbin/preinit all the way to /etc/X11/Xsession.post/99initdone :)

It's just an (indented) list. I may turn that into a nice graph some day, but I don't think it's that useful.

Please note that some Nokia-preinstalled services may not be present (if I have uninstalled them), while some of the listed services may come from additional software (e.g. sshd) not part of stock-PR1.3.

There is still the question of what role (if any) /etc/event.replace.d has (have to look at upstart source code) as well as some scripts in /etc/init.d (some are used by the /etc/event.d scripts, others not) and /etc/rc*.d.

I think /etc/rc?.d is a relic from previous Maemo versions, but I have to investigate that more in-depth. If I'm reasonably convinced that this is the case, I will wipe out those folders and see if everything works OK.

Anyway, here it is (also attached to the post).

Code:

*** Loaded by kernel
        /sbin/preinit

*** Loaded by upstart from /etc/event.d
        welcome
        rcS
                dsme
                        bme (may emit G_NOKIA_READY if /var/lib/ke-recv/usb_phonet_mode)
                                rc-default (emits STATE according to /tmp/STATE)
                        kernel-power
                sshd

** State USER
        console (starts serial console /etc/event.d/tty* if R&D mode)
        dbus
                alsaped
                csd
                dsme-dbus
                dsme-thermal
                dsp
                        dsp-manager
                hal
                        rcS-late (emits MOUNTS_OK)
                                pymaemo-optify
                        ohmd
                        sgx
                                xomap
                mce
                n900-fmrx-enabler
                omap3camd0
                pulseaudio
                sms-manager
                sscd (emits cellmo poweron/reset/poweroff/sim.. signal)
                sysinfod

* on cellmo ... (emitted by sscd)
        gprs-provisioning        (on cellmo sim ready)
        pin-query                (on cellmo sim code-required)

* on G_NOKIA_READY
        phonet_at
        softupd

* on MOUNTS_OK
        clock-daemon
        hildon-control-panel-personalisation
        rc-clean-fail-thumbnail
        xsession
                (wait until xomap ready,
                        emit XSESSIONS_STARTING or XSESSIONS_ACTDEAD_STARTING if ACTDEAD
                then
                        exec /etc/X11/Xsession as user)

* on XSESSIONS_STARTING
        bluetoothd
                bluetooth-sysinfo (when starting)
                bluetooth-dun (when started)
        camkeyd
        hildon-desktop
                app-detect
                fmtx
                funambol-cpp-api
                headphoned
                ke-recv
                        nokiamessaging
                ke-recv-extra
                kernel-modules
                location-proxy
                omapcp
                tonegend
                wlancond
                        dnsmasq
                        icd2
        iphb
        signon

* /etc/X11/Xsession (sources, does not execute, scripts)
        if USER
                run-parts /etc/X11/Xsession.d
                        00settings
                        01dbus
                        01maemo-xinput-sounds
                        02maemo-launcher
                        03alarmd
                        03gtk2-engines-sapwood
                        03osso-systemui
                        04b_start_matchbox
                        04devlock_blocker
                        05connui-conndlgs-cellular
                        06stop_matchbox
                        07ssc-ready
                        30osso-startup-wizard
                        40osso-systemui
                        41dbus
                        41maemo-xinput-sounds
                        42maemo-launcher
                        50alarmd
                        51osso-systemui
                        60mission-control
                        65hildon-sv-notification-daemon
                        90gpg-agent

                run-parts /etc/X11/Xsession.post
                        15hildon-status-menu
                        17camera-ui
                        18hildon-home
                        20hildon-desktop
                        21hildon-desktop-wait
                        22camera-ui
                        22clipboard-manager
                        23tracker
                        24connui-conndlgs
                        25hildon-input-method-configurator
                        30tablet-browser-daemon
                        32mafw-gst-renderer
                        32mafw-gst-iradio-source
                        32mafw-tracker-source
                        32mafw-upnp-source
                        40hildon-application-manager
                        41tmp-reaper
                        55ohm-session-agent
                        66maesync-controller
                        68syncd
                        70osso-abook-home-applet
                        99initdone

        if ACTDEAD
                run-parts /etc/X11/Xsession.actdead
                        00settings
                        01dbus
                        03alarmd
                        10sapwood
                        14osso-systemui
                        15matchbox
                        99initdone

** State ACTDEAD
        actdead
        cmt-act-dead
        console
        dbus-actdead
                alsaped
                dsme-dbus
                hal
                        rcS-late (emits MOUNTS_OK)
                                pymaemo-optify
                        ohmd
                        sgx
                                xomap
                mce
                n900-fmrx-enabler
                ohmd
                pulseaudio

* on XSESSIONS_ACTDEAD_STARTING
        -

** State TEST
        wl1251-cal


vi_ 2012-11-21 09:10

Re: Maemo5 boot process
 
Wow, this is a seriously sweet post. You have a spare n900 right? We would'nt want you rm'ing /etc/rc*.d on a production device!

Hurrian 2012-11-21 11:40

Re: Maemo5 boot process
 
So, I've tested removing /etc/event.replace.d and /etc/rcX.d on my N900.

The results:

It boots just fine!

Feel free to try it, although if it doesn't work out I'd recommend having RescueOS loadable from U-Boot at the ready.

reinob 2012-11-21 13:21

Re: Maemo5 boot process
 
Re. /etc/event.replace.d/

Many system services place the upstart file in /etc/event.replace.d/, but then postinstall copies it to /etc/event.d.

I guess this is a way of ensuring that the script is only really put where upstart will find it once the whole package has been extracted.

So I officially state:
BEGIN:
You can wipe out the folder if you like.
It will never be used during booting.
The only thing that could happen is that you install some program (which comes with an upstart script), and the script is placed there.
If so, GOTO BEGIN (if you like).

Next is /etc/rc?.d. Thanks @Hurrian for confirming that the N900 boots just fine after deleting those folders. Just in case I want to figure out WHO/WHAT created those folders in the first place.

foobar 2012-11-21 13:47

Re: Maemo5 boot process
 
pulseaudio in actdead? :p

reinob 2012-11-21 15:21

Re: Maemo5 boot process
 
Quote:

Originally Posted by foobar (Post 1296759)
pulseaudio in actdead? :p

Yup. Remember: alarms have to sound :)

If my list is right, the following things run when ACTDEAD:

welcome (just echo)
rcS
dsme
dme
kernel-power
sshd
actdead (just echo)
cmt-act-dead (kill modem)
console (serial console if R&D)
dbus-actdead (same as "dbus", swap USER/ACT_DEAD start/stop)
alsaped (ALSA policy daemon)
dsme-dbus
hal
rcS-late
ohmd
sgx
xomap
mce
n900-fmrx-enabler (yup, enable FM receiver :)
ohmd (yes, it's activated twice..)
pulseaudio
clock-daemon
hildon-control-panel-personalisation (make sure we have a theme!)
rc-clean-fail-thumbnail (absurd in ACTDEAD mode)
xsession

and then, when X is up and running:
00settings
01dbus (dbus session, system already started)
03alarmd (get them alarms ringing! :)
10sapwood
14osso-systemui
15matchbox (start WM, why? because we can :)[*]
99initdone
[*] OK, I suppose matchbox is started (and the theme framework setup) so that you get the familiar alarm UI if necessary.

When I have some more time I will make a post for each system service (or for a group of them) with an explanation of what it does. I guess a Wiki would be the best way, but I just can't find a way of creating an article :)

Add.: and more importantly, the reboot and shutdown process has to be duly documented.

sifo 2012-11-21 16:12

Re: Maemo5 boot process
 
Nice work reinob :)
btw can you guys wiki this thread up :D ?

./sifo

vi_ 2012-11-21 16:56

Re: Maemo5 boot process
 
Quote:

Originally Posted by reinob (Post 1296828)
Yup. Remember: alarms have to sound :)

If my list is right, the following things run when ACTDEAD:

welcome (just echo)
rcS
dsme
dme
kernel-power
sshd
actdead (just echo)
cmt-act-dead (kill modem)
console (serial console if R&D)
dbus-actdead (same as "dbus", swap USER/ACT_DEAD start/stop)
alsaped (ALSA policy daemon)
dsme-dbus
hal
rcS-late
ohmd
sgx
xomap
mce
n900-fmrx-enabler (yup, enable FM receiver :)
ohmd (yes, it's activated twice..)
pulseaudio
clock-daemon
hildon-control-panel-personalisation (make sure we have a theme!)
rc-clean-fail-thumbnail (absurd in ACTDEAD mode)
xsession

and then, when X is up and running:
00settings
01dbus (dbus session, system already started)
03alarmd (get them alarms ringing! :)
10sapwood
14osso-systemui
15matchbox (start WM, why? because we can :)[*]
99initdone
[*] OK, I suppose matchbox is started (and the theme framework setup) so that you get the familiar alarm UI if necessary.

When I have some more time I will make a post for each system service (or for a group of them) with an explanation of what it does. I guess a Wiki would be the best way, but I just can't find a way of creating an article :)

Add.: and more importantly, the reboot and shutdown process has to be duly documented.

Matchbox is started to display the 5 dots, then the UI for entering the device lock code (if you have a lock code). Matchbox is then **** down and hildon is started up.

reinob 2012-11-21 19:46

Re: Maemo5 boot process
 
Quote:

Originally Posted by vi_ (Post 1296898)
Matchbox is started to display the 5 dots, then the UI for entering the device lock code (if you have a lock code). Matchbox is then **** down and hildon is started up.

Thanks! I fortgot about the dots (I don't have them :). If my analysis is correct, then the device lock screen should NOT appear when in ACTDEAD mode.

Would be happy in somebody would confirm this.. but, how do you turn the N900 down (or rather, go to ACTDEAD) when the device is locked?!

I have to say I very rarely code-lock the N900, and when I do, I lock it manually and unlock it a few minutes later..

mr_pingu 2012-11-21 21:36

Re: Maemo5 boot process
 
Quote:

Originally Posted by vi_ (Post 1296898)
Matchbox is started to display the 5 dots, then the UI for entering the device lock code (if you have a lock code). Matchbox is then **** down and hildon is started up.

Hmm matchbox is used as WM even inside hildon, doesnt it?'

I mean I have mapped ctrl + right arrow mapped to matchbox-remote --next via xbindkeys. When pressed it switches to the next application, alt-tab like ;) That means matchbox is used in hildon or am I totally wrong? :confused:

reinob 2012-11-21 22:06

Re: Maemo5 boot process
 
@mr_pingu,

matchbox is not running when hildon-desktop is running (check with ps for yourself :). What matchbox-remote does is, presumably, to send a standardized message to the window manager (and hildon-desktop is a window manager). I bet if you were running KDE on your N900 matchbox-remote would still work, assuming that KDE (or whatever WM you'd be using) would follow the "standards" (if you can call it a standard anyway).

In short: think of matchbox-remote as a synonym for wm-remote :)

Hurrian 2012-11-21 22:43

Re: Maemo5 boot process
 
Quote:

Originally Posted by mr_pingu (Post 1297004)
Hmm matchbox is used as WM even inside hildon, doesnt it?'

I mean I have mapped ctrl + right arrow mapped to matchbox-remote --next via xbindkeys. When pressed it switches to the next application, alt-tab like ;) That means matchbox is used in hildon or am I totally wrong? :confused:

That would be matchbox1. Matchbox2 is statically linked into hildon-desktop, according to the documentation on the gitorious.

Sourav.dubey 2012-11-24 15:07

Re: Maemo5 boot process
 
Knowing boot process of N900 will help in reparing unbootable device
but what happens in reboot loops
Is any file on opt or rootfs is damaged ?

reinob 2012-11-29 12:13

Re: Maemo5 boot process
 
Quote:

Originally Posted by Sourav.dubey (Post 1297892)
Knowing boot process of N900 will help in reparing unbootable device
but what happens in reboot loops
Is any file on opt or rootfs is damaged ?

A reboot loop may be caused by all sorts of different things. The N900 may be rebooted by:
[1] user action (N/A in a reboot loop)
[2] a critical dsme-executed system process being killed
[3] a startup script actively deciding to reboot/change runlevel
[4] hardware watchdog
[5] kernel panic (indirectly, the reboot is done by the HW watchdog)

I suppose a "typical" reboot loop is caused by [2] or [3].

[2] may happen if the user has tweaked/modded/deleted something so as to may a daemon crash/exit (e.g. Xorg configuration).

[3] is something I want to investigate: some startup scripts *do* actively decide to reboot, either for good reasons (e.g. after flashing the eMMC) or because they think they're doing something smart (/sbin/preinit, bme, rcS-late, others?)

An example is in /etc/event.d/rcS-late

"If failed to mount /home and system has already been optified - reboot"

Obviously, if getbootstate returns BOOT or SHUTDOWN or an invalid boot state ("Houston, we have a problem") then the N900 will also be rebooted.

This can happen if e.g. the battery is not properly recognized.

I'll try to make a list of things that can go (horribly) wrong while booting.

vi_ 2012-11-29 12:38

Re: Maemo5 boot process
 
Quote:

Originally Posted by reinob (Post 1299647)
...I'll try to make a list of things that can go (horribly) wrong while booting....

On an n900, this will be a very long list!

mr_pingu 2012-12-26 13:46

Re: Maemo5 boot process
 
So I have removed the bootvideo, the 5 dots and inserted loading from framebuffer in preinit. Now what strikes me is that there's some placeholder where the 5 dots once were, black screen no framebuffer output; Is the device actually doing something at the moment that's important for the booting process? More exactly, what is it doing and can we reduce the time the screen is black?

raaj13 2012-12-26 13:59

Re: Maemo5 boot process
 
Quote:

Originally Posted by mr_pingu (Post 1307905)
So I have removed the bootvideo, the 5 dots and inserted loading from framebuffer in preinit. Now what strikes me is that there's some placeholder where the 5 dots once were, black screen no framebuffer output; Is the device actually doing something at the moment that's important for the booting process?

Esssential system programs maybe:)
[Hint: type ps in terminal you will get a list. Most of the programs are the ones that are loaded at boot time(I mean the system ones)]

mr_pingu 2012-12-26 14:44

Re: Maemo5 boot process
 
That's not what I meant, I am curious what is exactly executed at that time. What is running before is not interesting, regarding the purpose of my question.

My hope was that Reinob knows exactly what it is doing, if its uberhaupt doing anything ;)

I guess it may be related to this:
http://talk.maemo.org/showpost.php?p...98&postcount=8

Also, I am just thinking aloud, I didn't investigate it that much myself.

raaj13 2012-12-26 15:46

Re: Maemo5 boot process
 
Quote:

Originally Posted by mr_pingu (Post 1307925)
That's not what I meant, I am curious what is exactly executed at that time. What is running before is not interesting, regarding the purpose of my question.

My hope was that Reinob knows exactly what it is doing, if its uberhaupt doing anything ;)

I guess it may be related to this:
http://talk.maemo.org/showpost.php?p...98&postcount=8

Also, I am just thinking aloud, I didn't investigate it that much myself.

Then i can think of only 1 thing maemo optify boottime
checking /var/log/maemo-optify-boottime.log might help:)
causes around 2 sec(1.91272 sec) delay for me.

reinob 2012-12-27 22:28

Re: Maemo5 boot process
 
Quote:

Originally Posted by mr_pingu (Post 1307905)
So I have removed the bootvideo, the 5 dots and inserted loading from framebuffer in preinit. Now what strikes me is that there's some placeholder where the 5 dots once were, black screen no framebuffer output; Is the device actually doing something at the moment that's important for the booting process? More exactly, what is it doing and can we reduce the time the screen is black?

That must be when X is loaded but hildon-desktop is still not started. During that time, either there's no window manager running, or matchbox is running. When matchbox is running, the lock code/PIN code is asked (if required), and the time/date/regional settings are set (if required).

Have a look in /etc/X11/Xsession.d (might have a typo in there, I'm not particularly concentrated now :).

malfunctioning 2013-04-19 00:01

Re: Maemo5 boot process
 
Just wanted to thank you for this awesome thread.

int_ua 2013-10-06 12:04

Re: Maemo5 boot process
 
1 Attachment(s)
Why isn't this info in the wiki yet?
http://wiki.maemo.org/Maemo_5_boot_process

Adding patch to show that /etc/X11/Xsession.d/3*-5* scripts only execute if ! -e /var/dont_start_suw


All times are GMT. The time now is 05:45.

vBulletin® Version 3.8.8