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:
U-Boot:
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.
Kernel:
1:Optimizing _memcpy_fromio function at arch/arm/kernel/io.c
Remove unnecessary modules:
U-Boot:
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.
Kernel:
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.
1: Modify 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:
Can you give some more information about the points
"Implementation of SDMA, accelerate copying data from NOR flash to memory" and "Implementation of uSDHC’s ADMA, improve performance for SD card read"? Where can i find information to be able to implement this?
Where did you store the different parts of the system (bootloader, kernel, rootfs)?
Do you happen to have a breakdown of where the time was spent in bootup before your optimisations and where afterwards? It would be interesting to see where you gain the biggest advantage.
Specifically for the u-boot optimisation it would be interesting to know what the load speed is before and after the optimisations?
For 12.0.9 GA code. with serial output, the U-boot boot up time without optimization is about 1.7s. while with optimization is about 0.5s, the optimization composed of screen splash: 200ms, I2C init and PFUSE:730ms; Kernel load: 170ms .
I'm very interested on how you enable the video camera on i.MX6 SabreAI board. Could you share some info about it? I like to know your kernel config and what camera through which interface to the SabreAI board. Thanks!
I have not touched SabreAI board, on SabreSD board which is my fast boot platform, camera interface is CSI serial. you can find kernel config of SabreSD for fastboot in the attachment kernel.tar.bz2.
The AI board has 1 MIPI CSI, 1 Camera LVDS-in and 2 video in. I find the OV5640 driver in my BSP but I didn't find a matching camera for the CSI port. I also find some OV5642 camera sensor without the proper connector. Could you send me the detail info for the camers's manufacture and model? Thanks
SabreSD has one serial MIPI and one parallel MIPI interface, both those MIPI interfaces have the same physical interfaces, my camera for fast boot is OV5640DSL-A00A that has serial MIPI interface, and our BSP (1209) has this camera driver. Thanks!
If you follow my patch in the kernel configuration, the kernel should disable network option, that will disable udev service, so you need create those dev nodes on the rootfs manually.
Optimizing _memcpy_fromio function at arch/arm/kernel/io.c
This is an interesting change - did you profile the kernel to find whether it was actually being called or not and how much time the 'unoptimized' function took? There are actually scant few places where an i.MX6 would run across this function.
Apart from supporting ADMA in the SDHC controller, using SDMA (over a large chunk.. small copies take longer to set up than it takes to copy it) which seem functionally worthwhile and would give an improvement at least in CPU time used, a properly configured kernel (i.e. loaded to the correct load address and not needing any relocation) and U-Boot (i.e. has the correct load address hardcoded into it) should not be doing much memory copying at all past the early U-Boot relocation step - which the 2009.08 FSL BSP U-Boot doesn't do - and at least none that would benefit vastly from being more optimized. The small amount of time that U-Boot actually takes doing LARGE memory copies (especially if you're implementing SDMA..), and the small amount of instances of memcpy_fromio being called in the kernel seems that these are straw man optimizations.
Do you have any profiling data to support the speed improvement as a whole with each function change?