More LiveCD space optimizations
Josua Dietze
digidietze at draisberghof.de
Wed Nov 10 09:01:31 GMT 2010
Martin Owens:
[quote]
On Fri, 2010-11-05 at 16:20 -0400, Martin Pitt wrote:
> One thing that currently needs it is usb-modeswitch. I'd love the
> usb-modeswitch-dispatcher thing to be rewritten in C, Vala, or another
> compiled language. Not only is it holding tcl in the default install,
> but it also dramatically slows down boot.
That already is written in C, it's the script that pulls in the config
and runs the usb_modeswitch program which is written in tcl.
It should be very possible to convert it to python or vala.
I have to wonder what 200 udev rules all with different vendor and
product ids does to the boot time.
[/quote]
Allow me to explain a few things, wrapping up from the end:
There is nothing that can be done about the udev rules. There are many
different devices now that need a mode switch, each to be treated
individually. And the rules are already filtered to only being looked at
for subsystem "usb", action "add", and specific interfaces having device
class 8. I assume you can't even measure a boot time difference with and
without these rules.
What *can* be done is to avoid running the Tcl script if no such device is
present. This is the state of things in the vast majority of cases, taken
care of by the udev rules.
One special case of a reboot with an already switched device is fixed in
the coming-up version 1.1.5 so that the Tcl wrapper is definitely only run
when really needed (modem ID not yet covered by "option" module).
Given that the device switching itself takes around 5 to 20 seconds
depending on the respective device firmware, the running time of the Tcl
script is really negligible.
BTW, the "wrapper-wrapper" sh script will fork and never hold up the udev
phase.
Regarding the wrapper mechanism itself it is important to note that there
is a deliberate separation between the C code and the script. The C part is
meant to be portable to non-Linux systems and only depends on libusb. The
script does the main task of properly identifying devices, for which the
USB IDs are just not sufficient (example: 05c6:1000).
It also enables new devices not known to the "option" driver yet to bind to
it at runtime. Users of new models are able to use them with very small
additions to the setup.
Now the Tcl language: I can see that it is hard to carry it on if there is
only one system-related usage case. I will downright refuse to convert the
wrapper into a binary for tranparency reasons, but I'm open to suggestions
regarding other script languages that are expected to stay on the Live CD.
Let me just say that I hate the Bash syntax, and I would use Perl only if
held at gunpoint :-)
And on a grumbling side remark, the Tcl shell including the lib is 1.1 MB
unpacked on my system. Oh well. I'm all for a Live *DVD*.
Josua Dietze
More information about the ubuntu-devel
mailing list