15
Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th , 2009 EE382N-4 Project

Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Embed Size (px)

Citation preview

Page 1: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Beagle Board Fast Boot

Hui ChenKeji Ren

Dec 10th, 2009

EE382N-4 Project

Page 2: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Outline

• Motivation

• Objectives

• Hardware of Beagle Board

• Techniques in optimizing boot time

• Boot time result

• Conclusions

• Future work

• Live demo

EE382N-4 Project

Page 3: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Motivation: Why Faster Boot Time?

Boot time definition: 

Time from turning on power to shell prompt (or a GUI).

 

• Impact the first perception an end user has of the product

• Critical to obtain a positive end user experience

• Save power

EE382N-4 Project

Page 4: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Objectives

• Optimize software in Beagle Board for speed

1. bootloader

2. Linux Kernel

3. user-space applications 

 

• Achieve a 5-second fast boot time in Beagle Board. Original boot

time was about 15 seconds.

EE382N-4 Project

Page 5: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Beagle Board Hardware

• OMAP 3530 Processor

600 MHz ARM Cortex-A8 with NEON

• 256MB on-chip RAM

• 256MB NAND Flash

• Peripheral I/Os

DVI-D, SD/MMC+, S-Video, USB 2.0

Stereo In/Out, RS232 Serial

• Power

USB or 5V DC

EE382N-4 Project

Page 6: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Serial Cable SetupWe made a customized Null Modem cable to connect Beagle Board to

PC's serial port.

EE382N-4 Project

Page 7: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Boot Sequence

EE382N-4 Project

Page 8: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Strategies

• Load from NAND Flash

X-loader and u-boot’s loading speed: NAND = 1MB, MMC = 500KB/s

NAND’s block size is 128 KB per reading. We modified x-loader to only load 2 blocks

(instead of 7 blocks originally).

 

• Remove unnecessary initialization, integration check and data movement

We modified u-boot to

1. Embed configuration environments into u-boot (instead of reading from NAND)

2. Turn off Kernel CRC check

3. Remove Kernel relocation in u-boot

EE382N-4 Project

Page 9: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

• Reduce user response time

1. Set bootdelay to zero in u-boot (so user can't interrupt u-boot)

2. Turn off serial output by passing 'quiet' parameter to Kernel

• Reduce code size

We used '-Os -mthumb' flag to compile all code (x-loader, u-boot, kernel and user-

space applications). Code size wins hands down.

 

• Remove unnecessary functionalities in Kernel and avoid modules

We compiled a 1.2MB Kernel with USB, network, ext3/JFFS2 and a driver for our

Pegasus Ethernet adapter.

Strategies (cont.)

EE382N-4 Project

Page 10: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

• User-space optimization

1. Tune uclibc and busybox carefully. Total size of rootfs is about 780KB without

losing desired features.

2. Minimize init scripts: disable syslogd and klogd, remove unused tty and rc scripts. 

• Choose faster file system

Ext3 needs journal daemon whose loading time varies (can be over one second).

Instead we use Ext2.

We didn't choose JFFS2 on NAND due to the buggy Linux driver.

Strategies (cont.)

EE382N-4 Project

Page 11: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Boot Time Result[ 0.000005] < 0.000005> Texas Instruments X-Loader 1.4.2 (Dec 8 2009 - 23:36:42)[ 0.003808] < 0.003803> Loading u-boot.bin from nand[ 0.228279] < 0.224471> [ 0.228349] < 0.000070> [ 0.232136] < 0.003787> U-Boot 2009.06-rc2-dirty (Dec 08 2009 - 23:47:30)[ 0.232178] < 0.000042> [ 0.239877] < 0.007699> OMAP3530-GP ES3.0, CPU-OPP2 L3-165MHz[ 0.239932] < 0.000055> OMAP3 Beagle board + LPDDR/NAND[ 0.239959] < 0.000027> DRAM: 256 MB[ 0.251298] < 0.011339> NAND: 256 MiB[ 0.259473] < 0.008175> In: serial[ 0.259526] < 0.000053> Out: serial[ 0.259545] < 0.000019> Err: serial[ 0.263444] < 0.003899> Board revision C[ 0.263485] < 0.000041> Hit any key to stop autoboot: 0 [ 0.267380] < 0.003895> [ 0.271382] < 0.004002> NAND read: device 0 offset 0x280000, size 0x123000[ 1.551374] < 1.279992> 1191936 bytes read: OK[ 1.555640] < 0.004266> ## Booting kernel from Legacy Image at 80007fc0 ...[ 1.561426] < 0.005786> Loading Kernel Image ... OK[ 1.561455] < 0.000029> OK[ 1.565348] < 0.003893> [ 1.565392] < 0.000044> Starting kernel ...[ 1.565410] < 0.000018> [ 1.895363] < 0.329953> Uncompressing Linux.............................................................................. done, booting the kernel.[ 2.923280] < 1.027917> Please press Enter to activate this console.

Boot time was measured by using ptx_ts script from host Linux PC:$ picocom --b 115200 -d 8 /dev/ttyS0 | ptx_ts 'Texas'Total boot time from power on to terminal welcome prompt is 2.92 seconds without network.

EE382N-4 Project

Page 12: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Boot time composition

Delay (second)

Loading u-boot from NAND 0.22

Loading Kernel from NAND 1.28

Execution (x-loader + u-boot) 0.06

Uncompressing Kernel 0.73

Execution (Kernel) 0.29

Mounting Memory Card 0.27

User-space applications 0.07

Total 2.92

EE382N-4 Project

Page 13: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Conclusions

• We achieved shorter boot time than we expected.

• A project page has been setup with wiki pages and all source codes:

http://code.google.com/p/swiftbeagle/

• We obtained a good understanding on 

1. Beagle Board hardware

2. What are required in writing a bootloader (such as disabling MMU/dcache,

detecting machine ID and passing ATAGS to Kernel). We wrote our own

bootloader called S-Loader. However, development of S-Loader is still in

debugging phase and Kernel stalls after uncompressing itself.

3. Patching Kernel source

4. Building a Linux rootfs from scratch

5. Compiler optimization techniques (we believe we found a defect in Code

Sourcery's latest ARM gcc compiler/library)

EE382N-4 Project

Page 14: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Future Work: What Would Be Different?

0.5 second boot can be realized by utilizeing:

XIP(Execution in Place), uncompressed Kernel and faster FS(JFFS2 on MTD).

Delay (second) Optimization to use

XIP

XIP

Execution (x-loader + u-boot) 0.06

uncompressed Kernel

Execution (Kernel) 0.29

faster FS

User-space applications 0.07

Total 0.42

EE382N-4 Project

Page 15: Beagle Board Fast Boot Hui Chen Keji Ren Dec 10 th, 2009 EE382N-4 Project

Demo Time

EE382N-4 Project