The original implementation is from Frias Renato for Sabreauto board.
How to define the booting time?
The booting time we defined here is from the board be powered up to the main application working and main application be showed directly to the end user, for example: for the media play purpose board, the booting time count to the first video frame be shown on the screen.
For minimizing the booting time, some methods be tried.
- Optimizing for performance.
- Remove unnecessary modules at boot time.
- Start main application at the first time after the kernel be boot up.
Optimizing for performance:
1:Enable MMU and L2-Cache.
2:Optimizing memset and memcpy.
3:Implementation of SDMA, accelerate copying data from NOR flash to memory.
4:Implementation of uSDHC’s ADMA, improve performance for SD card read.
1:Optimizing _memcpy_fromio function at
- Remove unnecessary modules:
1: Disable uart output at u-boot procedure and add quiet parameter to Kernel boot.
2: Remove boot up delay at u-boot.
3: Disable I2C, SPI, SPLASH_SCREEN at u-boot.
Below removing unnecessary modules just for Sabresd board boot up through SD card and MIPI camera overlay on LVDS screen application, for other special board and special board usage application please don’t use below directly.
arch/arm/mach-mx6/board-mx6q_sabresd.c just keep necessary module initialization at
mx6_sabresd_board_init: iomux configuration, uart0, voda, ipu, ldb, v4l2, mipi-csi, i2c1, uSDHC1, pwm0, dvfs, mipi camera clock.
2: Update Linux kernel configuration file. Try to just keep necessary module and configuration to keep minim size. Build necessary modules from external to Kernel itself. Create uImage from Image instead of zImage to reduce Kernel self extraction time. Use ext4 file system on SD card to accelerate rootfs mounting.
Notice: Kernel configuration remove NETWORK support, it includes Unix Domain Socket, the udev mechanism need it, so this kernel configuration can't support rootfs udev dynamic /dev/ nodes and all /dev/ nodes must be created before boot up at rootfs.
- Start main application at the first time after the kernel boots up.
As normal boot up procedure, the init process will handle sysinit script firstly, this script will do some initialization and preparation for most of the user process, But this script normally will be executed for about 1~5 seconds, so now try do main application before the sysinit, while the necessary preparation of main application will be handle by this application internally.
See below example for MIPI camera overly on LVDS screen:
::once:/unit_tests/mxc_v4l2_overlay.out -iw 640 -ih 480 -it 0 -il 0 -ow 1024 -oh 768 -ot 0 -ol 0 -r 0 -t -1 -d 0 -fg -fr 30
::once:/sbin/getty -L ttymxc0 115200 vt100 # GENERIC_SERIAL
- Test result of fast boot on Sabresd board for MIPI camera overly on LVDS screen:
The main application be executed from the board be powered up is about 958ms.
[0.356417 0.356417] [ 0.046637] _regulator_get: get() with no identifier
0.602008] starting pid 21, tty '': '/unit_tests/mxc_v4l2_overlay.out -iw 640 -ih 480 -it 0 -il 0 -ow 1024 -oh 768 -ot 0 -ol 0 -r 0 -t -^@
[0.969609 0.011184] starting pid 22, tty '': '/etc/rc.d/rcS'
[0.973368 0.003759] g_display_width = 1024, g_display_height = 768
[0.977540 0.004172] g_display_top = 0, g_display_left = 0
[0.980927 0.003387] starting pid 23, tty '': '/sbin/getty -L ttymxc0 115200 vt100 '
[1.048454 0.067527] Mounting /proc and /sys
[1.089526 0.041072] Setting the hostname to freescale
[1.116635 0.027109] Mounting filesystems
[1.527320 0.410685] sensor chip is ov5640_mipi_camera
[1.530627 0.003307] sensor frame size is 640x480
[1.533482 0.002855] sensor frame format is UYVY
[1.640221 0.106739] frame_rate is 30
[1.642270 0.000021] frame buffer width 0, height 0, bytesperline 0
[1.990761 0.001033] arm-none-linux-gnueabi-gcc (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20) 4.6.2 20110630 (prerelease)
[2.001161 0.010400] root filesystem built on Tue, 11 Sep 2012 11:43:24 +0800
[2.006249 0.005088] Freescale Semiconductor, Inc.
[2.009531 0.000137] freescale login:
Please see below fast boot video.
I also attached sample code for U-boot and kernel for your reference. Patch code based on L3.0.35_12.09.01_GA.
Original Attachment has been moved to: u-boot.tar.bz2
Original Attachment has been moved to: kernel.tar.bz2
Original Attachment has been moved to: kernel-L3.0.35_1.1.0_121218.tar.bz2