Friday, June 22, 2007

Optimizing Linux Kernel Boot times for embedded devices II

Συνεχίζοντας το προηγούμενο post σε συνάρτηση με το καινούριο podcast απο την timesys, γράφω εδώ τις σημειώσεις που κράτησα. Δεν είναι τα πάντα, απλώς αυτά που βρήκα ενδιαφέροντα.

Το podcast μπορείτε να το ακούσετε εδώ ενώ η ιστοσελίδα είναι εδώ. Θα βρείτε επίσης και κάποια links που είναι αρκετά ενδιαφέροντα.

Πάμε λοιπόν.

Reducing boot times (cont.)
  • Generally a small memory footprint ensures a faster boot time
  • By using CONFIG_EMBEDDED inlining is turned-off, and performance is improved
  • Another thing that CONFIG_EMBEDDED does is to reduce kernel static buffer sizes
  • Prelinking executables saves a lot of time, since the linker does NOT need to find where all the symbols are. You must use prelink
  • Profiling is also a nice way for performance debugging
A note on flash file systems
There are 2 widely used flash filesystems, jffs2 and yffs2. The first (jffs2) is very hard on compression while yffs2 is not. Depending on the trade off between speed and size, a decision must be made on which to use.
Finally bare in mind that when flash storage is reaching its limits the wear algorithms used might make writes take a long time. RAM caching and flushing might be a good idea for non critical data.

Execute in place (XIP)
XIP means that apps are NOT first copied to RAM and then executed, they are executed in place (dhaaaa). In place being usually the flash filesystem. Especially for apps that do not need to be run frequently this might be a big improvement. I wonder what happens when an app 'lives' on a ramdisk? Is it copied to RAM again, or is it run in place anyway?

That's it.

Friday, June 8, 2007

Optimizing Linux Kernel Boot times for embedded devices

Παρακολούθησα το παρκάτω podcast απο την timesys και το βρήκα πολύ ενδιαφέρον. Τα περισσότερα είναι βασικά για κάποιον που ασχολείται με embedded linux αλλά όταν τα ακους όλα μάζι είναι καλύτερα. Επίσης κάποια αν οχι όλα έχουν νόημα και σε full linux εκδόσεις.

http://lldn.timesys.com/files/Episode_011_LinuxLink_Radio.mp3

Κράτησα κάποιες σημειώσεις κατα τη διάρκεια και τις παραθέτω παρακάτω, στα Αγγλικά

Actual Boot Time Reduction
  • Remove default options from the kernel and use ONLY what is necessary
  • Use static network parameters
  • Remove usb drivers (they can be loaded later)
  • Remove component waitstates wherever applicable (kernel hacking)
  • Suppress boot messages (don't just redirect them to the serial)
  • Use busybox instead of a full SysV
  • Init can start an app directly by using "init=/" in the kernel params. Make sure the app always starts and NEVER exits cause you will get kernel panic
  • Statically link boot critical apps.
Perceived Boot Time Reduction
  • Use stage booting with initrd or initramfs in order to load "human interface drivers*" quickly. Show that something IS happening.
  • In addition to the above the app can be broken up so that it initializes in then initramfs (or initrd) and the rest of the facilities are initialized later.
(*)"human interface drivers": The term is not to be confused with USB HID. It means all the drivers that initialize and make usable those devices that can be perceived by human senses, be it LED's, beepers, screens etc.


General points
  • Initramfs can be tricky because if care is not taken when writing to disk, it can grow and eventually fill up the whole available ram.
  • Don't use runlevels
  • When using an app as an init replacement be extra careful
  • Nash is a lightweight shell for busybox.

The above does not cover the whole podcast nor is intended to do so. It's merely a personal reminder. Hope you find it useful