简体   繁体   中英

Embedded Linux Boot Optimization

I am doing project on Pandaboard using Embedded Linux (UBUNTU 12.10 Server Prebuild image) to optimize boot time. I need techniques or tools through which I can find boot time and techniques to optimize the boot time. If anyone can help.

只需从/etc/init.d/rc文件中删除不需要的应用程序,并在每次进程初始化后放入echo,并检查哪个进程需要花费很多时间启动,如果您发现花费更多时间的应用程序,则对该应用程序进行调试,等等。上。

There is program that can be helpful to know the approximate boot-up time. Check this link Time Stamp .

First of all the best you have to do is to compile yourself your own made kernel, get the source on the internet and do a make xconfig and then unselected everythin you don't need. In a second time create your own root filesystem using Buildroot and make xconfig to select/unselect everything you need or not.

Hope this help.

I had the same problem and do that way, now it's clearly not the same ;)

EDIT: Everything you need will be here

to analyze the boot process, you can use Bootchart2 , its available on github: https://github.com/mmeeks/bootchart

or Bootchart , from the Ubuntu packages:

sudo apt-get update
sudo apt-get install bootchart pybootchartgui

There are broadly 3 areas where you can reduce boot time

  1. Bootloader: Modify the linker script to initialize only the required h/w. Also, if you are using an SD card to boot, merge kernel and bootloader image to save time.
  2. Kernel: Remove unwanted modules from kernel config. Also try using compressed and uncompressed image. If your CPU is good enough to handle it go compressed image and check uncompression time required for different compression types.
    1. Filesystem: FS size can be significantly reduced by removing the unwanted bins and libs. Check for dependencies and use only the one's that are required.

For more techniques and information on tools that help in measuring the boot time please refer to the following link. Refer to Training Material

The basic rule is: the fastest code is code that never gets loaded and run, so remove everything you don't need:

  • in U-Boot: don't load and run the full U-Boot at all; use FALCON mode and have the SPL load the Linux kernel and DTB directly
  • in Linux: remove all drivers and other stuff you don't really need; load all drivers that are not essential for your core application as modules - and load them after your application was started. If you take this serious, you may even want to start only one CPU core initially (and start the remaining ones after your application is running).
  • in user space: minimize the size of the root file system. throuw out anything you don't need; configure tools (like busybox) to contain only the really needed functionality; use efficient code (for example, link against musl libc instead of glibc) etc.

What can be acchieved by combining all these measures can be seen in this video - and yes, the complete code for this optimization is available here .

Optimizing embedded Linux Boot process , needs modifications in three level of embedded Linux design.

Note: you will need the source codes of bootloader and kernel

  1. Boot : the first step in optimizing and reducing boot time of board is optimizing boot loader. first you should know what is your bootloader is. If your bootloader is an opensource bootloader like u-boot than you have the opportunity to modify and optimize it. In u-boot we have a procedure that we can skip unnecessary system check and just upload kernel image to ram and start. the documentation and instruction for this is available in u-boot website. by doing this you will save about 4 ~ 5 second in boot.

  1. Kernel : for having a quicker kernel , you should optimize kernel in many sections. for editing you can use on of Linux config menu. I always use a low graphic menu. it need some dependency you can use it by this command:

    $ make menuconfig

    our goal for Linux kernel is to have smaller kernel image and less module to load in boot. first change the algorithm of compression from gzip to LZO. the point of this action is gzip algorithm will take much time to extract kernel. by using LZO we have a quicker kernel decompression process. the second , disable any unnecessary driver or module that you don't have it on your board or you don't use it any more. by doing this , you will lose some device access and cannot use them in Linux but you will have two positive points: less Ram usage , quicker boot time. but please remind that some driver are necessary for Linux and by disabling them you will lose some of main features (for example if you disable I2C driver in Linux you will no longer have a HDMI interface) that you need or in worst case you will have a boot problem (such as boot-loop). The third is to disable some of unusable filesystem to reduce kernel size and boot time. The Fourth is to remove some of compression algorithm to have smaller kernel image. the last thing , If you are using a u-boot bootloader create a uImage instead of zImage. the following steps , are general and main actions , for having quicker boot as 1 second after power attach you should change more option.


  1. after two base layer modifications, now we should optimize boot process in user-space (root file system). depend on witch system are you using , we have different changes to do. in abstract root file system of Linux that have necessary package and system to boot Linux we should use systemd instead of Unix systemv , because systemd have a multi-task init. system and it is faster , after that is udev that you should modify some of loading modules. if you have a graphical user-interface , we can use an easy trick to have a big boot time reduction by initing GUI first and load other module after loading GUI.

if you do all of following tasks , you can have quick boot time and fast system to work with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM