Linux Bootup Time Reduction for Digital Still Camera
Total Page:16
File Type:pdf, Size:1020Kb
Linux Bootup Time Reduction for Digital Still Camera Chanju Park Kyuhyung Kim Samsung Electronics, Co. Samsung Electronics, Co. [email protected] [email protected] Youngjun Jang Kyungju Hyun Samsung Electronics, Co. Samsung Electronics, Co. [email protected] [email protected] Abstract OS [2], VxWorks [3], etc., have been widely used for the operating system of DSC. How- ever, some of RTOSes does not support the ex- Bootup time is a very important issue in the tensibility, adaptability, and flexibility [4]. In DSC System because customers want to cap- order to support these properties, we adopt the ture immediately specific image. In this paper, embedded Linux as an OS in our DSC which we present the experience of the implementa- kernel features can be modified freely because tion methods and the performance evaluation its source codes are opened. results for reduction of bootup time which was used in SAMSUNG DSC platform. At first Linux uses standard device driver interfaces we introduce the DSC platform and develop- and it supports the POSIX APIs, so it pro- ment environments and next we explain the op- vides diverse extensibility. Using the Linux timization method for the bootloader and the can considerably reduce the long-term develop- kernel bootup time. We also describe root file ment cost so that the DSC can strengthen the system, device driver module configuration and one of the most important competitive powers- DSC applications initialization for bootup time. “Time to Market”. There are many CE prod- There are various techniques for linux bootup ucts adopting embedded Linux [5]. However, time reduction and we explain the most impor- in DSC, only a few companies use it, such tant differences. as Ricoh Company that made prototype Linux DSC [6]. 1 Introduction There would be various important requirements to load embedded Linux in the DSC. Among them, the major requirement would be the real- Recent digital convergence trends drive CE time performance, and the bootup time. Re- products to have many functions in single de- cently, embedded Linux provides many fea- vice. The DSC also follows it that provides tures for real time and the DSC hardware also many functions such as MP3, PMP, and net- does many works for image processing to re- work function. Various real time operating duce S/W computation overhead. By H/W and system (RTOS), such as ITRON [1], ZORAN S/W supporting, we can achieve real-time re- 232 • Linux Bootup Time Reduction for Digital Still Camera quirement of DSC. However, we still have a important requirement, the bootup time. In this paper, we will describe “bootup time reduction” which is one of the major require- ments in the Linux DSC. This paper organized as follows. In the next session, we describe the boot procedure of the DSC, and then present the technologies relevant to improving bootup time for Linux. The last section presents the results of implementation and future research direction. 2 Bootup time reduction methods 2.1 Environments We used the Samsung DSC reference platform for implementing Linux DSC. It has a 16/32- bit RISC microprocessor, designed to provide DSC features—6 mega pixel CCD, powerful JPEG encoder/decoder, Divx decoder, audio DSP, 64MB DDR memory controller, Camera Figure 1: Initial Samsung FPGA DSC Platform interface, SD Host & Multi-Media Card inter- using S5C7380x face, etc. Especially, it includes an OneNAND flash memory and no NOR flash memory. • Memory: 64MB SDRAM , 64MB One- The initial Samsung FPGA DSC platform is NAND flash shown in Figure 1. • DSC Module: CCD censor, Image Pro- S5C7380x is the high spec digital camera plat- cessing Unit, AF/Zoom/Shutter/Iris mo- form of Samsung, which integrates many pe- tor, Digital LCD, JPEG encoder/decoder, ripherals for fast Image processing. OSD, 3A(AE, AWB, AF) module, etc. The major features of the platform are: • OS: Linux kernel 2.4.20 • Kernel Size: about 1MB (uncompressed • Core: Arm926EJS (16K I/D cache) Image) • Image processor: Samsung S5C7380x • File System: Cramfs for root file system, • System clock: 216Mhz Fclock, 108Mhz Robust File system for OneNAND Hclock 2006 Linux Symposium, Volume Two • 233 2.2 DSC Bootup Procedure flash for two reasons. Samsung’s OneNAND is a single chip flash that offers the ultra-high den- sity of NAND and has the interface to NOR at The booting of the DSC system is a pro- very attractive price. The OneNAND is based cess from power-up to ready-to-shoot. (Af- on NAND architecture integrating buffer mem- ter Ready- to-shoot state, we can capture any ory and logic interface. It takes both advantages images). It consists of three main operations, from high-speed data read function of NOR “Boot loader”, “Kernel initialization,” and “Ap- flash and the advanced data storage function of plication Initialization”. After power up, the NAND flash. It is mandatory to make addi- boot loader initializes the system and starts the tional small boot loader for copying the kernel system process. Then it copies the kernel im- image to memory. age into memory. Once the kernel is loaded, the kernel initializes many resources and loads After loading the kernel image, bootloader con- H/W module into memory, then it mounts sev- tinues loading a RFS(Root File System) image eral file systems to the several mount points. into RAM. Typically the RFS image is stored in compressed form (gz), therefore, it must be We summarize three steps of the bootup proce- loaded from storage and decompressed. But by dure as follows: making RFS on a cramfs File System, it allows fast boot time since only used files are loaded • Boot Loader and uncompressed. In addition, we can con- sider the initializing device drivers. In order 1. System initialization to shorten bootup time, the bootloader loads 2. Kernel image copy to RAM driver concurrently as many as it can. • Kernel Initialization 2.4 File system 1. Init kernel 2. Init device drivers Root file system (RFS) is essential element for • Application Initialization running kernel on embedded system. There are 1. Run RC script many file systems, and these can be used as Linux root file system. Each file system has 2. Run Applications its own functionality, various bootup methods 3. Preview Mode (ready-to-shoot) with different bootup time. There are many sub works to do for mounting file system. For example, decompressing the compressed file 2.3 Boot loader system, copying itself from storage device to memory, searching the file system contents, Bootloader is a program that runs just before an searching inodes, journaling, and so on. There- OS really starts its work. It initializes a system fore, the reduction of RFS mounting time is and loads a kernel image into RAM. If we use very important. NOR flash as a boot device, we can shorten the bootup time using kernel XIP [7]. To minimize mounting time, we adopt the CRAMFS as root file system. The CRAMFS However, in our work, we should use the One- is designed for simple and small file system, so NAND flash memory instead of using NOR it has smaller bootup time comparing to other 234 • Linux Bootup Time Reduction for Digital Still Camera file systems. The CRAMFS reads only super input. So user can capture image when- block among entire file system element while it ever user wants after DSC init. On pre- mounting root file system. We can have rel- view mode, system displays some infor- atively short boot time using the CRAMFS. mation about system information, storage While the CRAMFS has a shorter boot time, it information, image quality, date, etc. has some demerits. It can be used only with This information is represented as icon, read-only attribute, so it’s recommended that font, menu images on the LCD display use the CRAMFS only on boot area, and use unit. Because the OSD hardware unit in another file system on other area that needs to DSC use these resources, we call it as read and write operation. But if we use special OSD data. All OSD data must be loaded options for cramfs, specific directories would from permanent storage media to mem- not be compressed, so we can save the mount ory. But it is time wasting job to load all time. OSD data during bootup time. We can re- duce the loading time by selective loading only necessary resources for booting. If 2.5 Application Optimization Issues we need more OSD data, we can load them later dynamically. Loading DSC application module is final se- 3. Lazy process creation – During DSC sys- quence of bootup procedure In DSC system. tem operates, many subtasks—like event After loading applications, bootup sequence processing, resource management, image is finished and the system becomes ready-to- processing, power management—are ex- shoot mode. This section describes about time ecuted. Many processes are invoked for consuming part while loading and running ap- executing these tasks. When creating a plication on bootup sequence, and time reduc- process, system runs system call named tion techniques of application. fork(). But invoking fork() wastes time about tens of ms. It is an overhead when used on bootup time. So it is recom- 1. Init script – After kernel bootup, ker- mended to create processes when they are nel executes init program which is located needed, not to create them when booting at /sbin/init. This program does the system. some tasks according to /etc/inittab script. For optimizing bootup time, it’s necessary to remove unused service on init 2.6 Other Optimization Methods script and to run only necessary applica- tions. As we mentioned on before, this Until now, many DSC specific methods for re- init script and applications are included in ducing bootup time are introduced.