# optimising kernel boot time in AT91SAM9260...



## vpnm_87 (Dec 29, 2008)

i am using AT91SAM9260, Olimex board..i hav cross-compiled linux 2.6.26 kernel and copied that to Nand memory..its booting successfully..but it takes about two minutes to boot..can anyone tell d way to optimize the boot time..n plz tell me d average boot time that my kernel ought to have...

this s d output i captured in minicom while booting...

U-Boot>RomBOOT(pressed reset key in board directly)

>AT91Bootstrap loading from 0x8400...

U-Boot 1.2.0 (Apr 18 2008 - 12:47:19)

DRAM: 64 MB
NAND: NAND device: Manufacturer ID: 0xec, Chip ID: 0xdc (Samsung NAND 512MiB 3,3V 8-bit)
512 MiB
In: serial
Out: serial
Err: serial
KS8721 PHY Detected
End of Autonegotiation
Hit any key to stop autoboot: 0

NAND read: device 0 offset 0x100000, size 0x15c5b4
1426868 bytes read: OK
## Booting image at 21500000 ...
Image Name: Linux-2.6.26
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1426804 Bytes = 1.4 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux............................................................................................ done, booting the kernel.
Linux version 2.6.26 ([email protected]) (gcc version 4.0.1) #4 Tue Dec 23 17:06:39 IST 2008
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
Machine: Olimex SAM9-L9260
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 180 MHz, master 90 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: mem=64M console-ttyS0,115200 root=/dev/sda1 rootdelay=10
AT91: 96 gpio irqs in 3 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [tty0] enabled
console [ttyS0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61952KB available (2604K code, 188K data, 112K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 192 bytes
NET: Registered protocol family 16
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
msgmni has been set to 121
io scheduler noop registered
io scheduler anticipatory registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL
brd: module loaded
MACB_mii_bus: probed
eth0: Atmel MACB at 0xfffc4000 irq 21 (00:00:00:00:00:00)
eth0: attached PHY driver [Generic PHY] (mii_bushy_addr=ffffffff:01, irq=-1)
Driver 'sd' needs updating - please use bus_type methods
NFTL driver: nftlcore.c $Revision: 1.98 $, nftlmount.c $Revision: 1.41 $
INFTL: inftlcore.c $Revision: 1.19 $, inftlmount.c $Revision: 1.18 $
SSFDC read-only Flash Translation layer
NAND device: Manufacturer ID: 0xec, Chip ID: 0xdc (Samsung NAND 512MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 0 at 0x00000000
Bad eraseblock 1 at 0x00020000
Bad eraseblock 2 at 0x00040000
Bad eraseblock 3 at 0x00060000
Bad eraseblock 8 at 0x00100000
Bad eraseblock 9 at 0x00120000
Bad eraseblock 10 at 0x00140000
Bad eraseblock 11 at 0x00160000
Bad eraseblock 12 at 0x00180000
Bad eraseblock 13 at 0x001a0000
Bad eraseblock 14 at 0x001c0000
Bad eraseblock 15 at 0x001e0000
Bad eraseblock 16 at 0x00200000
Bad eraseblock 17 at 0x00220000
Bad eraseblock 18 at 0x00240000
Bad eraseblock 32 at 0x00400000
Bad eraseblock 33 at 0x00420000
Bad eraseblock 34 at 0x00440000
Bad eraseblock 35 at 0x00460000
Bad eraseblock 36 at 0x00480000
Bad eraseblock 37 at 0x004a0000
Bad eraseblock 38 at 0x004c0000
Bad eraseblock 39 at 0x004e0000
Bad eraseblock 40 at 0x00500000
Bad eraseblock 41 at 0x00520000
Bad eraseblock 42 at 0x00540000
Bad eraseblock 43 at 0x00560000
Bad eraseblock 44 at 0x00580000
Bad eraseblock 45 at 0x005a0000
Bad eraseblock 46 at 0x005c0000
Bad eraseblock 47 at 0x005e0000
Bad eraseblock 48 at 0x00600000
Bad eraseblock 49 at 0x00620000
Bad eraseblock 50 at 0x00640000
Bad eraseblock 51 at 0x00660000
Bad eraseblock 52 at 0x00680000
Bad eraseblock 53 at 0x006a0000
Bad eraseblock 54 at 0x006c0000
Bad eraseblock 55 at 0x006e0000
Bad eraseblock 56 at 0x00700000
Bad eraseblock 57 at 0x00720000
Bad eraseblock 58 at 0x00740000
Bad eraseblock 59 at 0x00760000
Bad eraseblock 60 at 0x00780000
Bad eraseblock 61 at 0x007a0000
Bad eraseblock 62 at 0x007c0000
Bad eraseblock 63 at 0x007e0000
Bad eraseblock 1509 at 0x0bca0000
Bad eraseblock 2609 at 0x14620000
Creating 2 MTD partitions on "NAND 512MiB 3,3V 8-bit":
0x00000000-0x00a00000 : "Bootloader Area"
0x00a00000-0x20000000 : "User Area"
ftl_cs: FTL header not found.
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 20, io mem 0x00500000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usb 1-1: new full speed USB device using at91_ohci and address 2
usb 1-1: configuration #1 chosen from 1 choice
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver cdc_wdm
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0
rtc-at91sam9 at91_rtt.0: rtc0: SET TIME!
i2c /dev entries driver
i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
ieee80211: 802.11 data/management/control stack, git-1.1.13
ieee80211: Copyright (C) 2004-2005 Intel Corporation <[email protected]>
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock
Waiting 10sec before mounting root device...
mmc0: card is read-write
mmc0: new SD card at address 1234
mmcblk0: mmc0:1234 SA01G 995328KiB 
mmcblk0: p1
scsi 0:0:0:0: Direct-Access G & T USB Flash Drive 5.00 PQ: 0 ANSI: 2
sd 0:0:0:0: [sda] 2009088 512-byte hardware sectors (1029 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 2009088 512-byte hardware sectors (1029 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sda:<7>usb-storage: queuecommand called
sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
kjournald starting. Commit interval 5 seconds
EXT3 FS on sda1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem).
Freeing init memory: 112K
INIT: version 2.86 booting
Starting the hotplug events dispatcher: udevdudevd[890]: main: the kernel does not support inotify, udevd can't monitor configuration file changes
.
Synthesizing the initial hotplug events...end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
end_request: I/O error, dev mtdblock0, sector 0
done.
Waiting for /dev to be fully populated...done.
Activating swap...done.
Checking root file system...fsck 1.40-WIP (14-Nov-2006)
/dev/sda1: clean, 16978/62976 files, 179966/251125 blocks
done.
EXT3 FS on sda1, internal journal
FATAL: Could not load /lib/modules/2.6.26/modules.dep: No such file or directory
Setting the system clock..
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
Cleaning up ifupdown....
Loading kernel modules...FATAL: Could not load /lib/modules/2.6.26/modules.dep: No such file or directory
Loading device-mapper support.
Checking file systems...fsck 1.40-WIP (14-Nov-2006)
done.
Setting kernel variables...done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Setting up networking....
Configuring network interfaces...Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth0/00:de:ad:b0:05:00
Sending on LPF/eth0/00:de:ad:b0:05:00
Sending on Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67
eth0: link up (100/Full)
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.126 -- renewal in 1409286138 seconds.
done.
Starting portmap daemon....
INIT: Entering runlevel: 2
Starting system log daemon: syslogd.
Starting kernel log daemon: klogd.
Starting portmap daemon...Already running..
Starting MTA: exim4.
Starting internet superserver: inetd.
Starting OpenBSD Secure Shell server: sshd.
Starting NFS common utilities: statd.
Starting deferred execution scheduler: atdStarting periodic command scheduler: crond.

Debian GNU/Linux 4.0 sam9-l9260 ttyS0

sam9-l9260 login: root
Password: 
Last login: Fri Dec 26 09:53:48 2008 on ttyS0
Linux sam9-l9260 2.6.26 #4 Tue Dec 23 17:06:39 IST 2008 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.


----------



## lotuseclat79 (Sep 12, 2003)

Hi vpnm_87,

I do not know how long your kernel should take to boot, but here are three threads you might be able to find out some information that will help you to optimize your boot time:

How Linux Boots, The Boot Process Explained.

Reducing Boot Time On a General Linux Distro.

How PowerTOP, LatencyTOP, and Five-Second Boot Improve Desktop Linux.

-- Tom


----------



## vpnm_87 (Dec 29, 2008)

thank u very much for ur guidance...but almost 60% in d links i cant understand(like adding bootchart in my U-boot,and i dont even have GUI enabled)..my agenda is simple like removing unnecessary scripts like MTA:exim4 and some daemons(i dont know exactly)..i wud be very pleased if u give some suggestion for that..

thanks in advance...


----------



## lotuseclat79 (Sep 12, 2003)

Hi vpnm_87,

Try bum (Boot-Up Manager) from here.

The easiest thing for you to do would be to download the tarball, bum-2.2.1.tar.gz See the section entitled: *Tarball* and ignore the 2.2.0 version implied in the example, but use the example with 2.2.1 version after download.

Note: Pay attention to the *Requirements*, i.e. other package dependencies of bum which also need to be installed first.

-- Tom


----------



## vpnm_87 (Dec 29, 2008)

hi lotuseclat79,

now only saw ur post..anyway thank u...i managed to remove the unnecessary scripts usin /etc/rc2.d/(changed S to K)...

i need one more suggestion..i have a file called "armv5l-uclibc-sam9260"(got with Olimex board AT91SAM9260)...it gets flashed along with kernel images to my Samsung NAND 512MB)...is that similar to initrd img(with root directories)??i hav no idea what it is???

i burnt jffs2.img(93 MB)image also into my NAND...now i dont know how to set my u-boot 1.2.0 setenv command...it shows kernel panic when i give root=/dev/mtdblock1..asks for init= in that panic....

is that jff2.img needed or that armv5l-uclibc-sam9260 file system is sufficient????

its urgent...help me plz...

thanks in advance.


----------



## lotuseclat79 (Sep 12, 2003)

Hi vpnm_87,

The file, armv5l-uclibc-sam9260, looks like it might be required as it has "libc" in its name, so I would keep it for that reason and that it came with the Olimex board.

Not sure what you mean about setenv, but here are a couple of examples of its use at the command line level to give you an idea about sorting it out where '$' is prompt:

$ setenv HOSTNAME `uname -n | tr A-Z a-z` # Machine hostname

$ set path = ( /usr/bin /bin /usr/sbin /sbin ); 
$ setenv MANPATH "/usr/man:/usr/share/man";

Look up the man pages for: getenv, putenv, environ, and setenv, i.e. like this:
$ man setenv

-- Tom

P.S. Welcome to TSG!


----------

