The default Blackfin development board Linux and User-Space configuration examples, are optimized for ease of use and flexibility, and not for size and startup time.
There are hundreds of options enabled by default, allowing you to test drive various Linux drivers and application examples. Or there are options only useful during development and debugging. Having these options in an embedded production system is pointless.
Small memory footprint, low power and a fast boot time are typically in the interest of the embedded system designer.
This capture illustrates a 1 Second boot. For instrumentation I used GPIOs.
Configuration:
| Section | Time Spend | Comments |
|---|---|---|
| Boot Bootloader | 20ms | Time between RESET High and u-boot invoking bootcmd=bootm 0x20040000 |
| Bootloader loading u(vm)Image | 381ms | Time between bootm command and executing the first kernel instruction in head.S |
| Linux kernel Startup | 302ms | Time between executing the first kernel instruction and kernel invoking /bin/init |
| User Space Setup * | 271ms | Time between kernel invoking /bin/init and end of /etc/rc scrip |
| Total Boot Time | 973ms |
Config files used during this benchmark are available here: 1 Sec. Boot Config Files
Configuration:
| Section | Time Spend | Comments |
|---|---|---|
| Boot Bootloader | 20ms | Time between RESET High and u-boot invoking bootcmd=bootm 0x20040000 |
| Bootloader loading u(vm)Image | 427ms | Time between bootm command and executing the first kernel instruction in head.S |
| Linux kernel Startup | 366ms | Time between executing the first kernel instruction and kernel invoking /bin/init |
| User Space Setup * | 244ms | Time between kernel invoking /bin/init and end of /etc/rc scrip |
| Total Boot Time | 1057ms |
Config files used during this benchmark are available here: 1 Sec. Boot TCPIP Config Files
See SPI flash boot example below: spi_boot_linux_form_processor_reset_into_user_space_in_less_than_1.4_second
Set CONFIG_BFIN_BOOT_MODE to BFIN_BOOT_PARA instead of BFIN_BOOT_BYPASS this saves approx. 2ms
See also here: env
u-boot env: #set bootdelay 0
root:/> fw_setenv bootdelay 1
Compile u-boot with #define CONFIG_SILENT_CONSOLE
u-boot env: #set silent 1
u-boot env: #set baudrate 115200
The time spend here scales linearly with the size of your image your loading into memory.
Image sizes in the example discussed here:
michael@mhenneri-D02:~/devel/svn/uclinux-dist-trunk_3/images> ll total 9600 lrwxrwxrwx 1 michael users 18 2008-08-05 13:12 linux -> linux.initramfs.gz -rwxr-xr-x 1 michael users 2185567 2008-08-05 13:12 linux.initramfs -rwxr-xr-x 1 michael users 1816927 2008-08-05 13:12 linux.initramfs.gz -rw-r--r-- 1 michael users 773120 2008-08-05 13:12 rootfs.initramfs -rw-r--r-- 1 michael users 8236 2008-08-05 13:12 rootfs.initramfs.contents -rw-r--r-- 1 michael users 406936 2008-08-05 13:12 rootfs.initramfs.gz -rw-r--r-- 1 michael users 359142 2008-08-05 13:12 System.map.initramfs -rw-r--r-- 1 michael users 359142 2008-08-05 13:12 System.map.initramfs.gz lrwxrwxrwx 1 michael users 16 2008-08-05 13:12 uImage -> uImage.initramfs -rw-r--r-- 1 michael users 940474 2008-08-05 13:12 uImage.initramfs -rw-r--r-- 1 michael users 941208 2008-08-05 13:12 uImage.initramfs.gz -rw-r--r-- 1 michael users 533519 2008-08-05 13:12 vmImage -rwxr-xr-x 1 michael users 1398334 2008-08-05 13:12 vmlinux
u-boot env: #set verify n
See 1 Sec. Boot Config Files this configuration can be booted in exactly 1 Second.
Example: Calibrating delay loop... 1046.52 BogoMIPS (lpj=2093056)
Example Kernel command line:
root=/dev/mtdblock0 rw console=ttyBF0,115200 quiet lpj=2093056
Further speedups are easily possible:
By removing more options, such as support for printk, System V IPC, etc. the overall bootime can be less than 0.7 Seconds.
Disabling sysfs and procfs does have some negative side effects:
sysfs
No firmware loading (which affects most wireless cards). No power control/events. No tweaking of devices which export attributes only in sysfs (which is more and more each day but largely device-specific). No bus discovery (any bus, but for us usb is what really matters). Some more …
procfs
No information about running processes, filesystems, memory, network.
No access to sysctl tunables (/proc/sys/)
This capture illustrates a 0.4 Seconds boot, of minimalistic system.
Almost all device drivers are removed except for Serial and GPIO. Kernel features such as loadable module support and many others are removed. User space only includes init, shell, ls and echo.
This setup may fit together with the bootloader into 0.5 Mega Byte of flash memory.
| Section | Time Spend | Comments |
|---|---|---|
| Boot Bootloader | 20ms | Time between RESET High and u-boot invoking bootcmd=bootm 0x20040000 |
| Bootloader loading u(vm)Image | 168ms | Time between bootm command and executing the first kernel instruction in head.S |
| Linux kernel Startup | 224ms | Time between executing the first kernel instruction and kernel invoking /bin/init |
| User Space Setup | 9ms | Time between kernel invoking /bin/init and end of /etc/rc scrip |
| Total Boot Time | 421ms |
The config files used can be downloaded here:
michael@mhenneri-D02:~/devel/svn/uclinux-dist-trunk_3/linux-2.6.x> bfin-uclinux-size vmlinux */built-in.o
text data bss dec hex filename
713068 54280 17604 784952 bfa38 vmlinux
69558 3692 3428 76678 12b86 drivers/built-in.o
116032 1224 1748 119004 1d0dc fs/built-in.o
13820 2509 1128 17457 4431 init/built-in.o
95120 7176 5488 107784 1a508 kernel/built-in.o
19028 12 16 19056 4a70 lib/built-in.o
44700 2852 508 48060 bbbc mm/built-in.o
120 0 0 120 78 net/built-in.o
1352 4 4 1360 550 security/built-in.o
305664 0 0 305664 4aa00 usr/built-in.o
michael@mhenneri-D02:~/devel/svn/uclinux-dist-trunk_3/images> ll total 4180 lrwxrwxrwx 1 michael users 18 2008-08-05 15:16 linux -> linux.initramfs.gz -rwxr-xr-x 1 michael users 939908 2008-08-05 15:16 linux.initramfs -rwxr-xr-x 1 michael users 796548 2008-08-05 15:16 linux.initramfs.gz -rw-r--r-- 1 michael users 305664 2008-08-05 15:16 rootfs.initramfs -rw-r--r-- 1 michael users 6895 2008-08-05 15:16 rootfs.initramfs.contents -rw-r--r-- 1 michael users 164813 2008-08-05 15:16 rootfs.initramfs.gz -rw-r--r-- 1 michael users 125155 2008-08-05 15:16 System.map.initramfs -rw-r--r-- 1 michael users 125155 2008-08-05 15:16 System.map.initramfs.gz lrwxrwxrwx 1 michael users 16 2008-08-05 15:16 uImage -> uImage.initramfs -rw-r--r-- 1 michael users 415208 2008-08-05 15:16 uImage.initramfs -rw-r--r-- 1 michael users 416145 2008-08-05 15:16 uImage.initramfs.gz -rw-r--r-- 1 michael users 250272 2008-08-05 15:16 vmImage -rwxr-xr-x 1 michael users 623513 2008-08-05 15:16 vmlinux
This example uses a similar configuration than the first 1 Sec. boot from NOR flash example.
Significant further time savings can be achieved be using the JFFS2 Summary feature.
Please follow this link: JFFS2 Mount Process Speedup to read more.
| Test Setup |
|---|
| u-boot-1.1.6 SVN Revision: 1326 |
| Linux version 2.6.26.2-ADI-2009R1-pre-svn5184 |
| gcc version 4.1.2 (ADI svn) #5648 |
| SPI Flash used: ATMEL AT45DB321D |
Layout: 3 MTD partitions on SPI Dataflash:
| Address | Comment |
|---|---|
| 0x00000000-0x00040000 | bootloader |
| 0x00040000-0x00120000 | linux kernel |
| 0x00120000-0x00400000 | jffs2 root file system |
Configuration:
The config files used can be downloaded here:
| Section | Time Spend | Comments |
|---|---|---|
| Boot Bootloader | 35ms | Time between RESET High and u-boot invoking bootcmd=eeprom read 0x1000000 0x40000 8b7ff;bootm |
| Bootloader loading vmImage | 364ms | Time between eeprom read command and executing the first kernel instruction in head.S |
| Linux kernel Startup | 539ms | Time between executing the first kernel instruction and kernel invoking /bin/init |
| User Space Setup * | 423ms | Time between kernel invoking /bin/init and end of /etc/rc scrip |
| Total Boot Time | 1.36s |
michael@mhenneri-D02:~/devel/svn/uclinux-dist-trunk_3/linux-2.6.x> bfin-uclinux-size vmlinux */built-in.o
text data bss dec hex filename
949649 64356 49016 1063021 10386d vmlinux
32606 962 1080 34648 8758 block/built-in.o
121916 4794 3828 130538 1fdea drivers/built-in.o
302511 2560 2132 307203 4b003 fs/built-in.o
16807 2509 1128 20444 4fdc init/built-in.o
14176 684 0 14860 3a0c ipc/built-in.o
155093 12968 30476 198537 30789 kernel/built-in.o
35164 72 2296 37532 929c lib/built-in.o
71212 3740 576 75528 12708 mm/built-in.o
119772 3972 1796 125540 1ea64 net/built-in.o
2522 0 0 2522 9da security/built-in.o
133 0 0 133 85 usr/built-in.o
lrwxrwxrwx 1 michael users 18 2008-08-21 17:26 linux -> linux.initramfs.gz -rwxr-xr-x 1 michael users 2130338 2008-08-21 17:26 linux.initramfs -rwxr-xr-x 1 michael users 1827234 2008-08-21 17:26 linux.initramfs.gz -rw-r--r-- 1 michael users 643072 2008-08-21 17:25 rootfs.initramfs -rw-r--r-- 1 michael users 12071 2008-08-21 17:25 rootfs.initramfs.contents -rw-r--r-- 1 michael users 343870 2008-08-21 17:25 rootfs.initramfs.gz -rw-r--r-- 1 michael users 430228 2008-08-21 17:25 rootfs.jffs2 -rw-r--r-- 1 michael users 377012 2008-08-21 17:26 System.map.initramfs -rw-r--r-- 1 michael users 377012 2008-08-21 17:26 System.map.initramfs.gz lrwxrwxrwx 1 michael users 16 2008-08-21 17:26 uImage -> uImage.initramfs -rw-r--r-- 1 michael users 915303 2008-08-21 17:26 uImage.initramfs -rw-r--r-- 1 michael users 916128 2008-08-21 17:26 uImage.initramfs.gz -rw-r--r-- 1 michael users 571390 2008-08-21 17:25 vmImage -rwxr-xr-x 1 michael users 1473255 2008-08-21 17:25 vmlinux
Configuration:
The config files used can be downloaded here:
| Section | Time Spend | Comments |
|---|---|---|
| Boot Bootloader | 35ms | Time between RESET High and u-boot invoking bootcmd=eeprom read 0x1000000 0x40000 8b7ff;bootm |
| Bootloader loading vmImage | 436ms | Time between eeprom read command and executing the first kernel instruction in head.S |
| Linux kernel Startup | 521ms | Time between executing the first kernel instruction and kernel invoking /bin/init |
| User Space Setup * | 451ms | Time between kernel invoking /bin/init and end of /etc/rc scrip |
| Total Boot Time | 1.44s |
michael@mhenneri-D02:~/devel/svn/uclinux-dist-trunk_3/linux-2.6.x> bfin-uclinux-size vmlinux */built-in.o text data bss dec hex filename 1982319 74400 55416 2112135 203a87 vmlinux 32606 962 1080 34648 8758 block/built-in.o 3299 36 8 3343 d0f crypto/built-in.o 136690 5270 3860 145820 2399c drivers/built-in.o 302511 2560 2132 307203 4b003 fs/built-in.o 16807 2509 1128 20444 4fdc init/built-in.o 14176 684 0 14860 3a0c ipc/built-in.o 155093 12968 30476 198537 30789 kernel/built-in.o 35164 72 2296 37532 929c lib/built-in.o 71212 3740 576 75528 12708 mm/built-in.o 332314 13772 8164 354250 567ca net/built-in.o 2522 0 0 2522 9da security/built-in.o 803840 0 0 803840 c4400 usr/built-in.o
lrwxrwxrwx 1 michael users 18 2008-08-21 16:24 linux -> linux.initramfs.gz -rwxr-xr-x 1 michael users 2597785 2008-08-21 16:25 linux.initramfs -rwxr-xr-x 1 michael users 2220953 2008-08-21 16:24 linux.initramfs.gz -rw-r--r-- 1 michael users 803840 2008-08-21 16:24 rootfs.initramfs -rw-r--r-- 1 michael users 12783 2008-08-21 16:24 rootfs.initramfs.contents -rw-r--r-- 1 michael users 429021 2008-08-21 16:24 rootfs.initramfs.gz -rw-r--r-- 1 michael users 529440 2008-08-21 16:24 rootfs.jffs2 -rw-r--r-- 1 michael users 432847 2008-08-21 16:25 System.map.initramfs -rw-r--r-- 1 michael users 432847 2008-08-21 16:24 System.map.initramfs.gz lrwxrwxrwx 1 michael users 16 2008-08-21 16:25 uImage -> uImage.initramfs -rw-r--r-- 1 michael users 1142481 2008-08-21 16:25 uImage.initramfs -rw-r--r-- 1 michael users 1141928 2008-08-21 16:24 uImage.initramfs.gz -rw-r--r-- 1 michael users 713205 2008-08-21 16:24 vmImage -rwxr-xr-x 1 michael users 1775055 2008-08-21 16:24 vmlinux
For more information see here: Serial NOR Flash and U-Boot
Index: include/configs/bf537-stamp.h =================================================================== #define CONFIG_BFIN_BOOT_MODE BFIN_BOOT_SPI_MASTER #define CONFIG_VCO_MULT 21 #define CONFIG_SCLK_DIV 4 #define CONFIG_EBIU_SDRRC_VAL 0x3F8 #define CONFIG_EBIU_SDGCTL_VAL 0x009111CD #define CONFIG_SPI #define CONFIG_SPI_BAUD 2 #define CONFIG_SPI_BAUD_INITBLOCK 2 #undef CONFIG_RTC_BFIN #define CONFIG_SILENT_CONSOLE
baudrate=57600 loads_echo=1 ipaddr=192.168.0.15 serverip=192.168.0.2 autoload=no rootpath=/romfs gatewayip=192.168.0.1 netmask=255.255.255.0 hostname=bf537-stamp loadaddr=0x1000000 ubootfile=u-boot.ldr update=tftp $(loadaddr) $(ubootfile);eeprom write $(loadaddr) 0x0 $(filesize) addip=set bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):eth0:off ramargs=set bootargs root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600 console=ttyBF0,57600 ramboot=tftp $(loadaddr) uImage;run ramargs;run addip;bootm nfsargs=set bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath),tcp,nfsvers=3 nfsboot=tftp $(loadaddr) vmImage;run nfsargs;run addip;bootm flashboot=bootm 0x20100000 ethaddr=00:E0:22:FE:52:3A ethact=Blackfin EMAC verify=n bootcmd=eeprom read 0x1000000 0x40000 8b7ff;bootm silent=y stdin=serial stdout=nc stderr=nc bootargs=root=/dev/mtdblock2 rw rootfstype=jffs2 console=ttyBF0,57600 quiet lpj=2093056 bootdelay=0
For ATMEL Binary Page Size DataFlash use these options:
make MKFS_JFFS2_FLAGS='-e 0x2000 -n'
root:/> modprobe mtdchar root:/> flash_eraseall -j /dev/mtd2 Erasing 0 Kibyte @ 2dfe00 -- 99 % complete. root:/> cp /var/rootfs.jffs2 /dev/mtd2 root:/> cp /var/vmImage /dev/mtd1
root:/> cat /etc/rc # This file targets a *development* system. Many things are not # needed for *production* systems. Comment out what you do not need. #hostname blackfin mount -t proc proc /proc -o noexec,nosuid,nodev mount -t sysfs sysfs /sys -o noexec,nosuid,nodev # # Setup dynamic /dev and let mdev manage it for us # #if [ -e /bin/mdev ] ; then # mount -t tmpfs mdev /dev -o exec,nosuid,mode=0755,size=10M # [ -e /proc/sys/kernel/hotplug ] && echo /bin/mdev > /proc/sys/kernel/hotplug # /bin/mdev -s #fi # # Setup dynamic pseudo-terminal file system ... needed by any system that # uses telnet or ssh (like dropbear) rather than the old static pty system. # You should give this a dedicated gid and set the mode to 0650. # mkdir -p /dev/pts mount -t devpts devpts /dev/pts -o noexec,nosuid # # Give the log/state/runtime files in /var temporary storage that'll be # lost when we reboot. # mount -t ramfs var /var mkdir /var/tmp /var/log /var/run /var/lock # # Give temp files a read/write location not in flash/etc... # mount -t tmpfs tmp /tmp -o nosuid,nodev # # Needed if you plan on doing anything USB related # #[ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb # # Needed if you run an NFS server on the board # #grep -qs nfsd /proc/filesystems && mount -t nfsd nfsd /proc/fs/nfsd # # Useful for debugging only # #[ -d /sys/kernel/debug ] && mount -t debugfs debugfs /sys/kernel/debug # # Create your own interpreters for random file formats # #[ -d /proc/sys/fs/binfmt_misc ] && mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc # # User interface to security modules (selinux, etc...) # #[ -d /sys/kernel/security ] && mount -t securityfs securityfs /sys/kernel/security # # Do random network setup # #dhcpcd & #ifconfig eth0 10.100.4.251 up #ifconfig lo 127.0.0.1 #inetd & #cat /etc/issue #cat /etc/motd
Linux version 2.6.26.2-ADI-2009R1-pre-svn5184-dirty8 (michael@mhenneri-D02) (gcc version 4.1.2 (ADI svn)) #5648 Thu Aug 21 16:19:22 CEST 2008
Board Memory: 64MB
Kernel Managed Memory: 64MB
Memory map:
fixedcode = 0x00000400-0x00000490
text = 0x00001000-0x000e6dd0
rodata = 0x000e6de0-0x00111da8
bss = 0x00111dc0-0x0011f638
data = 0x0011f638-0x0012e000
stack = 0x0012c000-0x0012e000
init = 0x0012e000-0x00141000
available = 0x00141000-0x03eff000
DMA Zone = 0x03f00000-0x04000000
Hardware Trace Active and Enabled
Blackfin support (C) 2004-2008 Analog Devices, Inc.
Compiled for ADSP-BF537 Rev 0.3
Blackfin Linux support by http://blackfin.uclinux.org/
Processor Speed: 525 MHz core clock and 131 MHz System Clock
boot memmap: 0000000000141000 - 0000000003eff000 (usable)
On node 0 totalpages: 16127
DMA zone: 126 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 16001 pages, LIFO batch:3
Normal zone: 0 pages used for memmap
Movable zone: 0 pages used for memmap
NOMPU: setting up cplb tables for global access
Instruction Cache Enabled
Data Cache Enabled (write-back)
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 16001
Kernel command line: root=/dev/mtdblock2 rw rootfstype=jffs2 console=ttyBF0,57600 quiet lpj=2093056
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 256 (order: 8, 1024 bytes)
console [ttyBF0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Kernel managed physical pages: 16127
Memory available: 62644k/65536k RAM, (76k init code, 919k kernel code, 285k data, 1024k dma, 584k reserved)
Calibrating delay loop (skipped)… 1046.52 BogoMIPS preset
Mount-cache hash table entries: 512
Blackfin Scratchpad data SRAM: 4 KB
Blackfin L1 Data A SRAM: 16 KB (15 KB free)
Blackfin L1 Data B SRAM: 16 KB (16 KB free)
Blackfin L1 Instruction SRAM: 48 KB (42 KB free)
net_namespace: 192 bytes
NET: Registered protocol family 16
Blackfin GPIO Controller
Blackfin DMA Controller
stamp_init(): registering device resources
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 122
io scheduler noop registered (default)
simple-gpio: now handling 48 GPIOs: 0 - 47
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART
bfin_mac_mdio: probed
bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=25)@sclk=131MHz)
bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1
mtd_dataflash spi0.1: at45db321d (4096 KBytes) pagesize 512 bytes, erasesize 4096 bytes
Creating 3 MTD partitions on “SPI Dataflash”:
0x00000000-0x00040000 : “bootloader(spi)”
0x00040000-0x00120000 : “linux kernel(spi)”
0x00120000-0x00400000 : “file system(spi)“
bfin-spi bfin-spi.0: Blackfin BF5xx on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7
rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0
bfin-wdt: initialized: timeout=20 sec (nowayout=0)
TCP cubic registered
NET: Registered protocol family 17
rtc-bfin rtc-bfin: setting system clock to 1970-01-01 21:06:10 UTC (75970)
JFFS2 write-buffering enabled buffer (512) erasesize (8192)
VFS: Mounted root (jffs2 filesystem).
Freeing unused kernel memory: 76k freed
dma_alloc_init: dma_page @ 0x0013a000 - 256 pages at 0x03f00000
Loading compressed kernel (vmImage) or kernel+initrd (uImage) in u-boot from SPI flash is fast. However accessing SPI flash backed JFFS2 file systems in the kernel tends to be slow.
Therefore it is recommendable loading a kernel image with an attached Initial RAM Disk(initrd).
Then mount a JFFS2 file system (from your rc script), holding files that needs to be preserved during reboots, of files that are not frequently accessed. (Sacrifice runtime memory usage for boot speed.)
Use RamFS or TmpFS File systems for temporary files not needed after a reboot.
Complete Table of Contents/Topics

