Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIT-V EMBEDDED LINUX.

Similar presentations


Presentation on theme: "UNIT-V EMBEDDED LINUX."— Presentation transcript:

1 UNIT-V EMBEDDED LINUX

2 OUTLINE Introduction of Linux Kernel
Configuring and Booting the Kernel The Root File System Root File Directories Linux File Systems Types of File System Debug Techniques TCP/IP Networking

3 Introduction of Linux Kernel
Embedded Linux is inherited from Linux that has been modified and upgraded by developers in Linux community to be fit as an embedded system. Advantages: portability, flexibility, and lower cost and development environments. What is Embedded Linux? Linux is free open source OS which is fully featured, portable, and extremely versatile. It runs on everything (PDA to Largest Mainframes) Unlike traditional proprietary software, Linux is developed by a multitude of developers across the world Term Linux is to refer one of three disparate concepts A Linux Distribution A Linux System The Linux Kernel

4 Introduction of Linux Kernel (Contd..)
Linux Features UNIX like OS features Preemptive multitasking Virtual Memory Shared Libraries Shared copy-on-write executables TCP/IP networking SMP Support Open Source Why Embedded Linux? Due to its open source nature The kernel can be very small It is highly portable It is highly supported It supports a multi-user environment Supports multi-processor systems Well documented, the source code is available

5 Introduction of Linux Kernel (Contd..)
Linux Distribution It is a collection of software components, including the Linux kernel itself as well as GNU toolchain and a no. of free and open source software such as Emacs, X11, FTP, etc. RedHat, SUSE, and Mandriva and there are many community projects dedicated to creating the distribution such as Debian and Gentoo Linux. Without distros, person installing the Linux manually. Distros making the installing Linux easier, they usually provide both binaries and source, and are segmented into packages, each packages providing one component of the system. Linux Kernel Important element of Embedded Linux is its core. Unlike proprietary OS, its source code is available for anyone to freely use, distribute, or modify The latest released version of the Linux kernel is version 2.4 Linux implements different privilege levels, where a module, which is a kernel functions runs in kernel space and user applications run in user space. Linux can manage both multiple processes and multiple processors

6 Introduction of Linux Kernel (Contd..)
What’s a Kernel? An executive, system monitor. Controls and mediates access to hardware. Implements and supports fundamental abstractions Schedules or allocates system resources Enforces security and protection Responds to user requests for service. Kernel Design Goals: Performance: efficiency, speed Utilize resources to capacity with low overhead Stability Capability: flexibility and compatibility Security, Protection Portability Extensibility

7 Configuring and Booting the Kernel
Bootloader Kernel Root File System Fig. One Binary Image The linux kernel is stored as compressed binary code which unpacks itself automatically direct after system starts. Linux kernel is responsible for setting up all the hardware configuration of the microcontroller and peripherals. Linux kernel loads all necessary drivers.

8 Configuring and Booting the Kernel (Contd…)
Configuring the Kernel: There are many ways to configure the kernel. The kernel will generate a .config file at the end of configuration. It is during configuration that you will be able to select the options you want to see included in the kernel. Configuration Methods: The kernel supports four main configuration methods: Make config: Provides a command-line interface where you are asked about each option one by one. Make oldconfig Feeds config with an existing .config configuration file. This contrast with make config. Make menuconfig If a .config file is present, it uses it to set default values as with make config menu. Make xconfig If a .config file is present, it uses it to set default values as with make config and make menuconfig

9 Configuring and Booting the Kernel (Contd…)
To view the kernel configuration menu, type the appropriate command at the command line with the proper parameters. For our ARM-based user interface modules, we use the following command line: $ make ARCH = arm CROSS_COMPILE = arm-linux-menuconfig Booting: To boot embedded system for the first time, we have to make bootloader which adjusted well to target board. Bootloader plays a very important part in embedded system. Copy kerenl to RAM from flash memory, and execute kernel. Intialize hardware Bootloader have the function that writing data to flash memory. It provides interface to send commands to target board or to inform user’s state of target board.

10 Root File System Last operations conducted by Linux kernel during system startup. It has been essential component. “ / ”- Root File (also called “Super User”) No users and no administrators in most Embedded Linux Root file system requires libraries during kernel initialization (glibc and uClibc) The following command copies that kernel’s entire modules directory to the root filesystem: $ cp –a ${PRJROOT}/images/modules / ${PRJROOT}/rootfs You may copy the kernel image to your target’s root filesystem: $ mkdir ${PRJROOT}/rootfs/boot $ cd ${PRJROOT}/images $ cp zImage ${PRJROOT}/rootfs/boot

11 Root File Directory The file that contains directories entries.
Each directory entry as containing a file name, structure of information describing the attributes of the file. Stat & Fstat function. The Root File Directories are: /bin – Essential command libraries /dev – Device files /etc – Host-specific system configuration /lib – Essential shared libraries and kernel modules /sbin – Essential system libraries /usr – Secondary hierarchy /proc – Virtual file system for kernel and process information.

12 Root File Directories (Contd…)
/bin Contains useful commands that are use to both system administrator as well as non-privileged users. It usually contains the shells like bash, csh, etc and commonly used commands like cp, mv, rm, cat, ls. /dev Look through this directory and you see hda1, hda2 etc /dev/cdrom and /dev/fp0 /dev/dsp and /dev/lp0 /etc It contains all system related configuration files. A “configuration file” is defined as a local file used to control the operation of a program. It must be a static and cannot be executable binary.

13 Root File Directories (Contd…)
/lib The /lib directory contains kernel modules and those shared library images needed to boot the system and run the commands in the root file system. Libraries are identifiable through their filename extension of *.so Windows equivalent to a shared library would be DLL. /proc It is virtual file system. It’s sometimes referred to as a process information pseudo file system. It doesn’t contain real files but runtime system info. It can be regarded as a control and information centre for the kernel.

14 Root File Directories (Contd…)
/usr It usually contains by the largest share of data on a system User programs like telnet, ftp, etc are also place /usr. /sbin Linux discriminates between normal executables and those used for system maintenance and administrative tasks. This directory contains binaries that are essential to the working of the system. These include system administration as well as maintenance and hardware configuration program.

15 Embedded File Systems Types
Ramdisk When you do not have a traditional storage device for storing root file system then you need Ramdisk. Not a file system but a mechanism by which you can load an actual file system into memory and use it as the root file system. RAMFS Files that are not useful across reboots and these would be normally stored in the /tmp directory. Stored in memory rather than flash. Use RAMFS, these do not have fixed size and they shrink and grow with the files stored. CRAMFS CRAMFS uses the zlib routines for compression and it does compression for every 4-KB block. CRAMFS image that needs to be burned in flash can be created using a program called mkcramfs.

16 Embedded File Systems Types (Contd…)
JFFS and JFFS2 JFFS for the Linux 2.0 kernel and JFFS2 for 2.4 kernel JFFS and JFFS2 are log-structured file systems; any change to a file gets recorded as a log, which gets directly stored in the flash. NFS The network file system can be used to mount a file system over the network. The popular desktop file system EXT2 and EXT3 are exportable via NFS. The developer can use a standard Linux desktop for storing an EXT2 and EXT3 file system and access it as root file system. During debugging stage, developer would like to changes in root file system.

17 Embedded File Systems Types (Contd…)
PROC File System It is a logical file system used by the kernel to export its information. It can be used for system monitoring, debugging, etc. The files can be read only or read write depending on the information exported by the files.

18 Debug Techniques Syslog:
It is developed by Eric Allman as part of Sendmail project. Standard logging solution to Unix and Linux systems and also have variety of syslog implementation on other OS. Sandard for forwarding the log messages in an IP network. Used for both syslog protocol as well as application or library sending syslog messages. Syslog is a client/server protocol. The receiver is called “syslogd”. Syslog messages can be sent via UDP and/or TCP. Syslog is used for computer system management and security auditing.

19 Debug Techniques (Contd…)
Strace: To monitor the system calls used by program. To start a program using strace, which prints list of system calls. Use the –p flag to attach to a running process. Useful if a process has stopped responding and might reveal. As strace only details system calls it cannot be used to detect as many problems as a code debugger such as GDB. It is a debugging tool which prints out a trace of all system call made by a another process program. Strace can be used in two ways: Running a new binary. (e.g, strace /bin/ls) By tracing existing process by specifying its process id. (e.g, strace –p 4532)

20 Debug Techniques (Contd…)
GDB: The purpose is to allow you to see what is going on ‘inside” another program while it executes or what another program was doing at the moment crashed. It is a source level debugger, capable of breaking program. At any specific line, displaying the variable values and determining where errors occurred. GDB can do four kinds of things: Start your program, specifying anything that might affect its behavior. Make your program stop on specified conditions. Examine what was happened, when your program has stopped. Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.

21 Configuring TCP/IP Networking
Some of the commands used to configure TCP/IP, have to be executed each time the system is booted. Usually done by invoking them from the system /etc/rc* scripts. Scripts varies in different linux distribution. Older linux distribution, it is known as rc.net or rc.inet In modern distribution, the rc files are structured in a more sophisticated arrangement. You find scripts in /etc/init.d (or /etc/rc.d/init.d) directory that create the network devices and other rc files that run network application programs. Mounting the /proc file system. Installing the binaries. Setting the Hostname. Assigning IP addresses. Creating the subnets. Writing hosts and network files.


Download ppt "UNIT-V EMBEDDED LINUX."

Similar presentations


Ads by Google