Home9260 QuickStart GuideApplication Notes9260 Boot speed

Fast startup time is highly desirable for an embedded device. In this application note, we discuss techniques to optimise the startup time for a Linux-based Snapper 9260 Quick Start Kit.

Out of the box, a Snapper 9260 QSK is configured to maximise flexibility and ease of development. As a result, our test unit took approximately 11 seconds to boot, as measured as the time from power being applied to the unit to Linux login prompt. In this application note, we will demonstrate how to reduce that by about half.

To time the boot progress, we'll use support/scripts/serial_watch.sh. If you power on the unit at the same moment as kicking off serial_watch, power-up delays can be isolated as well as long-running boot stages.

Baseline boot time: 10.8s

Contents

Bootloader

  • Remove U-Boot boot delay
setenv bootdelay 0

Since you can still interrupt the boot process by holding a key during boot, so no significant downside.

Boot time: 9.8s

  • Use uncompressed kernel image

On development host, in your kernel build directory:

make Image
arm-none-linux-gnueabi-objcopy -O binary vmlinux vmlinux.bin
mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e 0x20008000 -n "Linux-2.6.20 Image" -d vmlinux.bin Image

On QSK, under Linux:

mtdtool --eraseall Kernel
mtdtool --write Kernel /path/to/linux-2.6.20/Image

The Image takes longer to load, but has no decompression stage, so boots faster overall.

Boot time: 8.9s

  • Don't verify image in U-Boot
setenv verify no

May lead to corrupted images not being detected; only really an issue for uncompressed images, since compressed images contain a self-check already.

Boot time: 8.6s

Linux

  • Preset loops-per-jiffy
setenv extra_bootargs lpj=495616

Copy 'lpj=...' string from the kernel boot output (dmesg | grep lpj) into the U-Boot-provided kernel bootargs.

Boot time: 8.4s

  • More minimal kernel

In the Snapper 9260 QSK kernel directory, use make menuconfig to uncheck the following options:

CONFIG_KALLSYMS
CONFIG_ELF_CORE
CONFIG_SNAPPER_BASEBOARD_ALL
CONFIG_MODULE_UNLOAD
CONFIG_OABI_COMPAT
CONFIG_PM
CONFIG_APM
CONFIG_INPUT_MOUSEDEV
CONFIG_INPUT_TOUCHSCREEN
CONFIG_INPUT_KEYBOARD
CONFIG_INPUT_EVDEV
CONFIG_SERIO_LIBPS2
CONFIG_I2C_MICRON
CONFIG_I2C_DEBUG_ALGO
CONFIG_I2C_DEBUG_BUS
CONFIG_I2C_DEBUG_CHIP
CONFIG_USB_MON
CONFIG_USB_GADGET_DEBUG_FILES
CONFIG_LOGO
CONFIG_EXT2_FS
CONFIG_PROFILING
CONFIG_DEBUG_KERNEL
CONFIG_ENABLE_MUST_CHECK
CONFIG_CRYPTO_AES
CONFIG_CRYTPO_DES
CONFIG_CRYPTO_SHA1

Removing these shrunk the uncompressed kernel from 3.6MB to 2.9MB, reducing boot times by about 0.3s. Additional drivers and smaller pieces can be removed to shifted out to modules on a per-application basis, for devices that do not need support at boot time.

Boot time: 8.1s

  • Remove network support for devices that don't require networking

In the Snapper 9260 QSK kernel directory, use make menuconfig to uncheck the following options:

CONFIG_NET

If the production unit does not require networking, significant space and time savings are possible by removing networking from the kernel. Since U-Boot retains network support, this does not impact development as much as might be expected, either.

Boot time: 5.6s

  • Suppress printk output
setenv extra_bootargs "$extra_bootargs\ quiet"

This works better than compiling out printk completely, since it allows dmesg to display boot messages.

Boot time: 5.3s

  • Ensure YAFFS filesystem is unmounted cleanly

On boot, YAFFS will execute a file-system check if it detects that the filesystem was not shut down cleanly previously. To avoid this overhead, ensure that the filesystem is unmounted before powering down.

Userspace

  • InitRD
  • Startup
    • MDev & PDev
    • Remove udev
    • Remove use of /etc/init.d/devices
    • Parallel startup scripts?
    • Don't use init at all, just a custom startup script

Miscellaneous notes

  • Snapper 9260 boot delay

When booting from the on-chip RC, the startup time is fixed at 1200 ms and not 240 μs as specified in Table 6-1 on page 16. (As per /public/info/datasheets/cpu/atmel/at91sam9260_doc6221.pdf pg. 759)

References

 

 

Applications

rs1

rs_2

rs_3

rs_4