How to reduce the Upstart size?

Asked by bottlegroup

Hi all:
        I have a question about upstart module (in Linux).
        The size of the Upstart is too big to me (I am developing an
        embedded linux, it uses upstart instead of init),

        do you have any idea about how to reduce the upstart size?(like
        compile option or flag or menuconfig...,etc)

        I read the upstart documents but I think it didn't tell how to config upstart
        (add or delete features.)

        Thank you~

        Please also send a mail to "<email address hidden>" . Thanks again.

Question information

Language:
English Edit question
Status:
Solved
For:
upstart Edit question
Assignee:
No assignee Edit question
Solved by:
Scott James Remnant (Canonical)
Solved:
Last query:
Last reply:
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) said :
#1

On Thu, 2009-07-02 at 11:13 +0000, bottlegroup wrote:

> I have a question about upstart module (in Linux).
> The size of the Upstart is too big to me (I am developing an
> embedded linux, it uses upstart instead of init),
>
Which size are you interested in? There are many different metrics for
code size.

What is your target size?

Here's an example from a running system:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 4104 376 ? Ss Jun30 0:00 /sbin/init

Upstart's Resident Stack Size (the amount of physical memory it is
using) is 376 KB.

In comparison, here's sysvinit:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2032 524 ? Ss 2008 8:59 init [2]

The RSS is 524 KB.

While Upstart's VSZ (Virtual Memory Size) is larger, it is sufficiently
swappable that it's resident size can be smaller.

Scott
--
Scott James Remnant
<email address hidden>

Revision history for this message
bottlegroup (bottlegroup) said :
#2

Hi scott:
            Thanks for your answer.

            But actually, what I need is "how to reduce the library size that I
            built from upstart module".

            Embedded system need small image size to burn into the flash on the
            target board. So I wish the image size is smaller.

            Upstart is a opensource, we need to compiler it into the Embedded
            Linux, but if I run "make", it will build the complete functional upstart
            module; but I don't want the "complete functions". Have any compile
            options or flags or config to let me can config what function I need
            manually ?
            Best Regard

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) said :
#3

On Fri, 2009-07-03 at 04:00 +0000, bottlegroup wrote:

> But actually, what I need is "how to reduce the library size that I
> built from upstart module".
>
> Embedded system need small image size to burn into the flash on the
> target board. So I wish the image size is smaller.
>
Again, I'd like to know what your targets are? Upstart is not large:

-rwxr-xr-x 1 root root 124K 2008-09-30 00:54 /sbin/init*

The current stripped binary is only 124KB. While larger than sysvinit,
this is not exactly huge.

> Upstart is a opensource, we need to compiler it into the Embedded
> Linux, but if I run "make", it will build the complete functional upstart
> module; but I don't want the "complete functions". Have any compile
> options or flags or config to let me can config what function I need
> manually ?
>
No, there isn't really anything you can turn off in Upstart, and there's
no functionality that you can do without.

If you're looking for a minimal init system, without any features other
than being able to boot a static system, have you considered something
like eINIT?

Scott
--
Scott James Remnant
<email address hidden>

Revision history for this message
bottlegroup (bottlegroup) said :
#4

Hi Scott:
            Here is mine:
            -rwxr-xr-x 1 root root 211348 Jun 24 2009 /sbin/init
            -rwxr-xr-x 1 root root 142288 Jun 24 2009 /sbin/initctl

            total about 345K

            I wish I can downsize to 200~250K or even less;

            Ask you another question: if I remove the upstart module,
            (upstart uses script files in /etc/event.d/ to start the services when
            boot) what steps should I take to make syszVinit init the services
            which upstart does?

Revision history for this message
Best Scott James Remnant (Canonical) (canonical-scott) said :
#5

On Mon, 2009-07-06 at 05:51 +0000, bottlegroup wrote:

> Here is mine:
> -rwxr-xr-x 1 root root 211348 Jun 24 2009 /sbin/init
> -rwxr-xr-x 1 root root 142288 Jun 24 2009 /sbin/initctl
>
> total about 345K
>
> I wish I can downsize to 200~250K or even less;
>
If your resource constraints are that tight, I would strongly suggest
not using Upstart.

> Ask you another question: if I remove the upstart module,
> (upstart uses script files in /etc/event.d/ to start the services when
> boot) what steps should I take to make syszVinit init the services
> which upstart does?
>
No idea.

Scott
--
Scott James Remnant
<email address hidden>

Revision history for this message
bottlegroup (bottlegroup) said :
#6

Thanks Scott James Remnant, that solved my question.