1 / 18

AT91SAM Linux Introduction

AT91SAM Linux Introduction. Linux Kernel Introduction. Afternoon Agenda. Linux Kernel Introduction. Linux Device Driver Introduction. Linux Device Driver Getting Started. Hands-on 06. Character Device Driver Developing. Hands-on 07. Platform Device Driver Developing. Hands-on 08.

ivrit
Télécharger la présentation

AT91SAM Linux Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AT91SAM Linux Introduction Linux Kernel Introduction

  2. Afternoon Agenda Linux Kernel Introduction Linux Device Driver Introduction Linux Device Driver Getting Started Hands-on 06 Character Device Driver Developing Hands-on 07 Platform Device Driver Developing Hands-on 08 Add Interrupt Handling in Driver Hands-on 09

  3. Outlines Linux Kernel General Information Linux Kernel source code structure Configure the Linux Kernel Cross-Compile Environments Linux Kernel with AT91 Patches Linux Device User Space / Kernel Space Communication

  4. Linux Kernel Geneal Overview Linux is a POSIX compatible operating system Linux is Opensource Built by the community and under GPL license Linux Kernel provides an interface to the hardware Linux is a modern fully-fledged Unix

  5. Linux Version Rules Present name rules (since 2.6) • Linear development process • Stable kernel updates are named: 2.6.z.w Development window (2 weeks) 2.6.33 2.6.33-rc1 2.6.33-rc3 2.6.33-rc4 2.6.33-rc2 Stabilization phase (6-8 weeks) release candidate revisions 2.6.32 stable branch 2.6.32.1

  6. Supported Hardware Architectures Minimum: 32 bit processors, with or without MMU 32 bit architectures: • alpha, arm, AVR32, cris, h8300, i386, m68k, m68knommu, mips, parisc, ppc, s390, sh, sparc, um, v850 64 bit architectures: • ia64, mips64, ppc64 sh64, sparc64, x86_64 Check the arch/ or Documentation/arch/README for details

  7. Linux source code structure linux-2.6.xx arch init drivers kernel lib include CPU Arch net fs block cryto Mach (Platform) usr ipc mm sound scripts Documentation virt Vendors Products security samples

  8. Linux kernel subsystem Memory Management Device Drivers Kernel Networking Stack Vendors Architecture I/O Systems File System

  9. Configure Linux kernel "make config" • Plain text interface. "make menuconfig" • Text based color menus, radiolists & dialog "make xconfig" • X windows (Qt) based configuration tool. "make defconfig" • Create a ./.config file by using the default symbol values from arch/$ARCH/defconfig.

  10. Cross-compile Environments What is cross compiler? • Cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. • Cross compiler tools are used to generate executables for embedded system or multiple platforms. • Add Cross compiler path to Linux Environment Variable • export PATH=$PATH:<cross compile path>

  11. Makefile Modification Update the version as usual You should change the default target platform, e.g.: • ARCH ?= arm • CROSS_COMPILE ?= arm-none-linux-gnueabi- run (ARM example): • make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- Hint: create an “alias” to save your time Example: • Add command line in .bashrc alias mlx=‘make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- ’ • Then Use command in terminal mlx

  12. Linux Image vmlinux • Non compressed • elf format • Can be used for debug arch/arm/boot/Image • Binary kernel image arch/arm/boot/zImage • zlib compressed kernel image • Default image on arm arch/arm/boot/uImage • U-Boot support image formation other compressed formats available

  13. Access to Linux Kernel Download sources from http://kernel.org/: • wget http://kernel.org/pub/linux/kernel/v2.6/linux2.6.xx.tar.bz2 Useful kernel source links: • Linux daily source snapshots: • http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/ Useful version control system -- git: • Git is a distributed version control system • Git is free and open source • Learn more from http://git-scm.com/ • TortoiseGit

  14. Linux Kernel with AT91 Patches linux-2.6.x arch init fs Sub-dirs net Sub-dirs drivers arm Vendors Products Vendors Products Vendors Products Vendors Products mach-at91 config Kconfig Makefile AT91SAM Products AT91SAM Products AT91SAM Products AT91SAM Default Config Latest enhancements, not published yet to Linux mainline Modify source code, Makefiles and Configuration files Let users make Linux kernel image for AT91 products easily Support the latest AT91 devices

  15. Linux system overview Applications CUI, GUI, text editor… Kernel System call interface for applications Define the driver framework and interface Driver Make kernel to control the hardware Hardware All kinds of devices Application User space Kernel System call interface Driver Kernel space Hardware

  16. I/O Device Character devices • Can be accessed as a stream of bytes( like a file) • Character driver implements at least the open, close, read, and write system calls. • Char device are accessed by means of filesystem nodes, such as /dev/tty1. Block devices • Can be accessed only as multiples of a block. • Like char devices, block device are accessed by filesystem nodes • A block device is device (e.g. disk) that can host a filesystem. • Block drivers have a completely different interface to the kernel than char drivers Network interfaces • In charge of sending and receiving data packets. • Network interfaces are not stream-oriented and therefore, are not easily mapped to a node in the filesystem. • Communication between the kernel and network driver is not through read/write, but rather through packet transmission functions.

  17. How user space commnunicate with Kernel Procfs, Sysfs, and Similar Kernel Interfaces • Linux kernel provides a couple of RAM based file systems to let user space communicate with kernel space. • Procfs, Sysfs, Configfs, Debugfs, and Sysctl. Ioctl • The ioctl mechanism is implemented as a single system call which multiplexes the different commands to the appropriate kernel space function. Kernel System Calls • System calls are used when a user space program wants to use some data or some service provided by the Linux kernel. • When a user space process invokes a system call, the CPU switches to kernel mode and executes the appropriate kernel function. Other Mechanisms • Socket Based Mechanisms • Sending Signals from the Kernel to the User Space • Upcall • Mmap

  18. More information AT91SAM OS Ecosystem: • AT91SAM Linux Ecosystem http://linux4sam.org • AT91SAM WinCE Ecosystem http://www.at91.com/windows4sam • AT91SAM Android Ecosystem http://www.at91.com/android4sam • AT91SAM community forum: http://www.at91.com

More Related