Hope you all have some basic info about Linux kernel configuration, bootloader, filesystem etc… before reading this and it has been useful to you.
I am using POKY toolchain since YOCTO build environment is prefered by FREESCALE.
TAGS: i.MX6, YOCTO, Linux, Quick Boot, Kernel Configuration, filesystem, bootloader
Step1. Set up environmental variables
$ cd /opt/poky/1.4+snapshot/
$ source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
$ export ARCH=arm
$ export CROSS_COMPILE=arm-poky-linux-gnueabi-
// $ unset LDFLAGS (use if required).
Step2. Copy Sabresd kernel source tar ball. —Untar
0. Sudo tar –xvf linux-imx.tar –C /home/manjunath/
–Go to directory
1. Cd linux-imx-3.0.35_4.1.10
—set to sabresd default configuration
2. Make mx6qsabresd_defconfig
3. $ make menuconfig
4. $ make uImage
—-insert SD card and copy u-boot
5. $ sudo dd if=u-boot.imx of=/dev/sdc bs=1k seek=1
6. $ sudo dd if=arch/arm/boot/uImage of =/dev/sdc bs=1M seek=1
—-Untar filesystem into SD Card
7. $ sudo tar –xvf rootfs.tar –C /media/sdc
Changes made in u-boot, kernel and filesystem
$ setenv bootdelay = -1 ———–i.e. to disable bootdelay. // Don’t do this at the first step.
Kernel Menuconfig —————— (Listed below are all DISABLED features)
–Standard Kernel features
—-Disable Bug Report
–Kernel .config support
–support for paging of anonymous memory (swap)
–SLUB debug Support
–PCIe support —————————-PCIe is initiated by u-boot (may run it as a module afterwards)
—MIPI camera thing –please remove it and load as a module.
–Remove networking as much as possible.
–Wireless LAN —————————-supports all INTEL related wireless drivers.
–Ext2 and Ext3 related
—keep only ext4 related (it is the fastest among all filesystems)
$ /etc/network/interfaces —————disable inet DHCP and enable static ip.
If needs restart (without actual reboot)
$ /etc/init.d/networking start ——– “after changing interface” file.
Disabling AVAHI daemon (if enabled??)
sudo update-rc.d -f avahi-daemon remove
iii. Go to /etc/init.d and here we can see so many daemons which run at file system boot time, one needs to carefully remove the one’s that are not needed or wasting time.
Statistics and Effects of changes made,
Uboot-1s from minimum 2s
UImage-4s from minimum 6s
Filesystem-3s from minimum 8s // MAY DEPEND ON FILESYSTEM USING.
UIMAGE SIZE—3.23MB from 4.05MB (if “modules” are made out of recommended “drivers” the size still can be reduced).
For example: MIPI Camera can made a module and run as
$ root@joshi-desktop: insmod mipi.ko or in the init script after boot is over.
Boot time initially recorded was 16s and has been successfully reduced to 8s to 9smaximum with SABRESD Filesystem.
OTHER METHODS USED.
Using uncompressed kernel
Doubles the size and reduces very little time in booting. It does not affect much.
Initialization of level 2 cache
Usage of initramfs and initrd (THIS IS A MUST).
Here are some more tricks to make it a QUICK BOOT
1. Remove PCIe
2. Remove Everything related to Network. Just open .config file like
$ linux-source-directory : nano .config
// Half the storage size of Kernel and minimum of 4s will be reduced just by removing Network.
Go to Network section and delete everything related to that.
3. Let as many peripherals as possible be Modules,
iv. PCIe (remember not PCI) etc. These take no part in just booting process.
(Select as <M> instead of <*> in menuconfig.)
I could reduce more than half the size of kernel just by this process.
4. Compile kernel with Printk timestamp.
–> kernel Hacking (in menuconfig)
—-> Compile Kernel with time stamp
This in no way helps reduce boot time but it will definitely give you an idea of which process uses most time and how you may reduce the same.
5. Build Filesystem with Bootchart daemon.
This is a little tricky but nonetheless you may try by modifying .bb file in YOCTO environment (Package bootchart2 is available in YOCTO or in BUSYBOX) or just in local.conf file.
You may download the package directly and start using it by CROSS – Compilation.
6. Use Bootgraph
Several articles on how to use bootgraph are there and you may GOOGLE it.
7. Use Grabserial
Several articles on how to use Grabserial are there and you may GOOGLE it.
8. The most important is GO TO /etc/init.d and swim around all the init files. Try removing each and see what happens?
I am sure you will lot of junk here as well.
QUICK BOOT IS ALWAYS A TRADE OFF BETWEEN TIME AND NUMBER OF PROCESSES.