Home

1 About LinK+ IDE

image

Contents

1. Preferences ca ccache gt General NA mM Description i ccache is a compiler cache It speeds up re compilation of C C code C C by caching previous compiles and detecting when the same compile 3 callGraph is being done again J gt Help Install Update Enable e Java Linux Kernel Development distcc Plug in Development Remote Systems Run Debug Tasks Team v V V F F Usage Data Collector Validation P XML Restore Defaults Apply amm S Yl In order to enable ccache check the Enable option on the right pane Once it is enabled it checks whether ccache is installed on the machine or not If not a popup appears Click on Yes to follow up with the installation After the ccache installation is completed you may change the ccache settings Cache size GB This option sets the maximum size for cache storage The default and minimum size is 2GB and the maximum is 8GB Clear Cache This button clears the entire cache removing all cached files Restore Defaults Reverts to the default settings Apply Apply all the changes OK Apply the changes and exit the preferences page Cancel Do not apply the changes and exit Now the user can compile the kernel image by Right clicking on the respective project in the Project Explorer View then goto LinK to gt Compilation gt bzimage You can monitor the progress of the ccache during the compilation on the te
2. Avatar ARM hardware architecture is not supported After completion when the user is in a different perspective they can directly goto the LinK Perspective as shown below Kernel Compilation Project Kernel source selection Project name testP Open Associated Perspective This kind of project is associated with the LinK perspective Do you want to e open this perspective now Remember my decision x86 64 ARM e Cancel ish Click Yes to change to LinK IDE Perspective 3 1 2 Project Build Options Project build options are following e Configuration e Compilation e Installation 3 1 2 1 Configuration Right click on the respective project in the Project Explorer View then goto LinK to gt Configuration Compare With Single Step Execution Restore from Local History Configuration xconfig Source Compilation menuconfig Configure Installation on Host allmodconfig Run C C Code Analysis System Call Lew eA defconfig Properties Alt Enter Add Patch oldconfig vi LinK Avatar User Manual Section 3 LinK Projects The wizard provides the following options User can choose any option based on his requirement e xconfig e menuconfig e allmodconfig e clean e defconfig e oldconfig 3 1 2 2 Compilation Right click on the respective project in the Project Explorer View then goto LinK to Compilation The wizard provides the following options User can choose
3. Details Show only the latest versions of available software Hide items that are already installed Group items by category What is already installed Contact all update sites during install to find required software Note Follow the instructions of the install wizard The warning about the installation of an unsigned feature can be ignored Eclipse has to be restarted after installation LinK Avatar User Manual Section 2 LinK Installer Plugin Installation Using LinK Update Site Enter the LinK Update site URL https sourceforge net projects linkplustest files repositor 2 2 4 LinK Perspective LinK Perspective is a customized perspective of Linux Kernel Source Configuration amp Compilation and Device Driver Development When the user is in a different perspective they can directly goto the LinK Perspective by Window gt Open Perspective Other Window Help New Window ec v4 New Editor Debug Show View Team Synchronizing Customize Perspective Save Perspective As Reset Perspective pe Close Perspective Close All Perspectives Navigation Preferences 1l This will open up a wizard select LinK default to activate the Link perspective Open Perspective Hig C C fa CVS Repository Exploring Debug amp Java Gd Java Browsing t Java Type Hierarchy uU Link default J Planning 4 Plug in Development lt Resource Team Synchronizing
4. Right Click on the warning and click on Delete 3 2 6 10 Content Assistance and Quick Fix Utility for Link Driver Development 3 2 6 10 1 Quick suggestion for function pointers Press Ctrl Space in function pointer structure to get suggestion for function pointers 39 LinK Avatar User Manual Section 3 LinK Projects P4 Faaylit myUriver fasylit llseek mydriver llseek 4 aio read mydriver aio read aio write mydriver aio write d i aio fsync 9stat check flags ot compat ioctl fallocate Flock ermine flush ems Fsync criptic get_unmapped_area C C iterate lock Press Ctrl Space to show Template Proposa 3 2 6 10 2 Function Pointer Stub Generation 15 static const struct file operations mydriver fops 246 owner THIS MODULE 47 open mydriver open release mydriver release read mydriver read write mydriver write unlocked ioctl mydriver ioctl fasync mydriver fasync Llseek mydriver llseek aio read mydriver aio read aio write mydriver aio write aio fsync mydriver aio fsync fe mydriver_aio_fsync undeclared here not in a Function 259 static int init m 260 Press Ctrl 1 or click on error marker icon alu wi Lv myut ivci _aiv wi itt j r e A MEN a UNS AAIEN IETEN EESTE DRAAIE NEIDA P gt lint mydriver aio fsync struct kiocb kiocb int a Create function mydriver
5. Bridge utils bridge utils iptables bridge utils iptables dnsmasq bridge utils iptables iptables dnsmasq dnsmasq dnsmasq The packages highlighted in blue are already installed by default 2 1 2 1 QEMU installation in CentOS 1 Install dependencies sudo yum install glib2 devel zlib devel SDL devel libtool libtool Itdl devel 2 Download QEMU 1 6 0 wget c http wiki qemu project org download qemu 1 6 0 tar bz2 3 Extract and get inside qemu 1 6 0 tar xvf qemu 1 6 0 tar bz2 cd qemu 1 6 0 4 Configure QEMU configure target listzZarm softmmu i386 softmmu x86 64 softmmu enable sdl 5 Build QEMU S make j4 6 Install QEMU S sudo make install 2 2 Installation of LinK IDE LinK Avatar User Manual Section 2 LinK Installer Plugin Installation Installation of LinK IDE can be done by using the Automated Installer bundles Eclipse IDE amp LinK Plugins into a single application 2 2 1 LinK IDE Installer Installation 1 Download the LinK IDE Installer The Installer is in tar gz compressed format 2 To uncompress the LinK IDE Installer tar xzvf lt LinK Installer File Name This will create a folder named LinK IDE Open the folder You will find an executable titled linkplus Run the executable which will open eclipse with support for LinK IDE plugins enabled 2 2 2 LinK IDE Updates To update LinK IDE click on Window Check for Updates Help Contents Search
6. Compilation Project Class Header File Source File Source Folder C Project C Project Other It will open a wizard the user needs to enter a File Name to be created in the KERN SRC as LinK Avatar User Manual 23 Section 3 LinK Projects shown in the screenshot below Basic Driver Module Template Y let my driver E KERN SRC gt l my driver File Name hello d gt 3 2 4 Linux Kernel Module Debugging using Probing mechanism The page can be obtained either during the project creation refer section 3 2 1 or while extending the project in order to develop the probe modules In this tool we are providing both jprobe amp kprobe features Select Debugging Mechanisms gt Probing on the left pane and check the Enable checkbox on the right pane as shown in the below screenshot 24 LinK Avatar User Manual Section 3 LinK Projects F Device Information LinK Device Driver Development Wizard Please select any symbol Module PARAM Delayed Works Kernel Timer Tasklet Work Queue Shared Queue Wait Queue Synch Methods Semaphore Completion Spinlock Read Write Seq Lock Kernel Data Type Kernel Linked List Debugging Mechanisms Procfs Sysls Probing Probing g Enable Symbol Table For selecting Symbol JProbe KProbe Search Name APIC init uniprocessor ELCR trigger IO APIC get PCI irq vector BDEV MP bus info PageHuge S24C16 d
7. Development h fs Teele D Cancel Note This wizard contains three pages General Information Page Device Information Page amp Driver Information Page User is free to finish the process at any of the J wizard page General Information Page contains the basic information like e Inthe Driver Name field type a name for the driver project such as my driver e When Use default location is selected the New Project Wizard will create a new project with the specified name in the workspace Otherwise you can specify the location Uncheck the default location and Click on Browse to browse for a location in the file system 17 LinK Avatar User Manual Section 3 LinK Projects LinK Device Driver Development Wizard General Information Enter Project Name Driver Name gi Use default location Author Name License GPL Kernel Version Use Host Machine Kernel Kernel Version 3 13 0 detected Platform Build Information Architecture Host machine 32 bit Toolchain x86 Linux GCC x86 64 ARM Development type Custom Driver Development 2 Back Cancel e Inthe Author Name field type a name e Select the license type from the License combo box e When Use Host Machine Kernel is selected the New Project Wizard will use the running kernel source location Otherwise you can specify the other linux kernel source location Uncheck Use Host Machine Kernel and Click on Browse to browse for
8. Dynamic Help Key AssisL Tips and Tricks Report Bug or Enhancement Cheat Sheets Check for Updates nstall New Software Eclipse Marketplace About Link IDE 2 2 3 Installing LinK Plugins Before Installing the LinK plugin you should have a recent version of Eclipse cpp of any one of the eclipse variants helios gt 3 6 ver already installed on your PC Eclipse can be downloaded from www eclipse org downloads Note In this release Avatar plugins are developed only for Eclipse Helios variant After Eclipse IDE is installed LinK IDE Plugins can be integrated in the following manner 1 After Starting Eclipse Click on He p gt nstall New Software LinK Avatar User Manual Section 2 LinK Installer Plugin Installation Welcome Help Contents Search Dynamic Help Key Assist Shift Ctrl L Tips and Tricks Report Bug or Enhancement Cheat Sheets Check for Updates Install New Software Eclipse Marketplace About Eclipse Platform 2 Enter the location of the plugin zip file by clicking on Archive and selecting the Path of the plugin zip file Available Software Select a site or enter the location of a site n Work with type or select a site x Find more software by working with the Available Software Sites preferences od Name There is no sit Add Repository Location http Archive gt Select All 7 M Cancel
9. LinK Avatar User Manual Section 3 LinK Projects Click on the Finish button The files get added in the table as shown below c LinK Device Driver Development Wizard Device Information Enter directory name Module PARAM Sys s Y Delayed Works I Enable Kernel Timer Tasklet Work Queue Select Option sys 2 Shared Queue Wait Queue Directory Name sys dir Synch Methods Semaphore FileName Operations Completion Spinlock Read Write Add Seq Lock Kernel Data Type Remove Kernel Linked List Debugging Mechanisms Procfs Sysfs gt Probing Back Next gt Cancel Finish Note The above procedure is common for sys class amp sys device 3 2 5 3 sys kernel debug The file system is also known as debugfs debugfs is a simple memory based file system designed specifically to debug Linux kernel code debugfs helps kernel developers export large amounts of debug data into user space Before proceeding further check if debugfs is mounted in your system by mount grep debugfs none on sys kernel debug type debugfs rw If you see output as above you have debugfs pre mounted If not you can mount it as root with the command shown below mount t debugfs nodev sys kernel debug the page can be obtained either during the project creation refer section 3 2 1 or while you are extending the project In order to access the Sysfs 30 LinK Avatar User Manual Section 3 LinK Pr
10. X XML Cancel The perspective is now changed from C C Perspective to LinK default Perspective Note LinK Perspective is an extension of C C Perspective LinK Avatar User Manual Section 3 LinK Projects 3 LinK Projects 3 1 Linux Kernel Configuration and Compilation Project 3 1 1 Project Creation 3 1 1 1 Linux Kernel Compilation Project Linux Kernel Configuration and Compilation Projects are created by selecting File New Project Click on the option Linux Kernel Development Link to expand the option Click on Kernel Compilation Project to select the option Go New Select a wizard o Creation of Linux Kernel Configuration and Compilation Project Wizards gt General b C C Pie cvs b Java Y i Linux Kernel Development LinK Basic Driver Module amp Device Driver Project 2 Kernel Compilation Project gt Plug in Development h C Tbe Click on Next and follow the instructions of Project Creation LinK Avatar User Manual Section 3 LinK Projects The Kernel Compilation wizard will open where the user can enter any Project Name Then the user needs to select the Linux Kernel Source Multiple options are provided where the user can select one among them based on his requirement Kernel Compilation Project Q Project name must be specified A Project name Linux Kernel Sources Select Archive source file Import
11. any option based on his requirement Compare With Single Step Execution Restore from Local History Configuration j Source bzlmage Configure Installation on Host modules Run C C Code Analysis System Call all Emulation Properties Alt Enter Add Patch Note Generally compilation takes some time based on your host system hardware configuration In order to reduce time use distcc and ccache features in preference page By this feature user can complete the compilation process in less time For distcc amp ccache features refer section 4 of this user manual 3 1 2 3 Installation on host Note Before Installation on host the user needs to compile modules After completing compilation Right click on the respective project in the Project Explorer View then goto LinK to gt Compilation gt modules For the Installation on host the user after completing compilation of modules Right click on the respective project in the Project Explorer View then goto LinK to gt Installation on host It will open one window for providing password Enter Password to install on host Sudo password Enter Password eeeeeeeee Ww Remember 17 LinK Avatar User Manual Section 3 LinK Projects 3 1 2 4 Single Step Execution Linux kernel Configuration amp Compilation Build Project can be done in a single step with the following wizard Right click on the respective project in the Project Expl
12. applied e variable a variable file will be created upon which read and write operations will modify the contents of the variable specified For this option a variable with the same name as that of the file name will be created in the code Operations Mention the operations that are to be permitted on this file The possible options are read and read write Read Function Visible when File Type is specified as normal Specify the name of the read function to be called when read is called on this file If you wish to go with any of the previous read functions select the arrow highlighted in the figure and choose one from the list Write Function Visible when File Type is specified as normal and when read write operations are permitted Specify the name of the write function to be called when write is called on this file If you wish to go with any of the previous write functions select the arrow highlighted in the figure and choose one from the list Data Type Visible when File Type is specified as variable Specify the size of the variable associated with this type Once done with filling the details click on the Finish button and the files will be added to the table Now the above setup generates code to create a directory as sys kernel debug debugfs dir and within this directory the files fd and var are created upon which both read and write operations are possible x LinK Device Driver Development Wizard Device Informati
13. by menuconfig during kernel configuration QEMU Provides a Linux Kernel Emulation Framework for testing and debugging the Linux Kernel Bridge utils IPTables DNSMasg Used by QEMU to provide Network Support LinK Avatar User Manual Steps to Install sudo apt get install openjdk 6 jdk or Install through synaptic package manager sudo apt get install openssh server openssh client or Install through synaptic package manager sudo apt get install linux headers uname r sudo apt get install libqt4 dev Or Install through synaptic package manager sudo apt get install libncurses5 Or Install through synaptic package manager sudo apt get install qemu for Ubuntu 10 04 sudo apt get install qemu qemu system for Ubuntu 12 04 Or Install through synaptic package manager sudo apt get install bridge utils iptables dnsmasq Or Install through synaptic package manager Section 2 LinK Installer Plugin Installation 2 1 2 For Other OS Package Fedora 19 BOSS 5 CentOS 6 5 S sudo yum install S sudo apt get install S sudo yum install java 1 7 0 openjdk sudo apt get install openjdk 6 jdk java 1 7 0 openjdk devel i686 devel i686 openssh server openssh openssh server openssh client openssh server openssh clients clients Libqt4 libqt4 dev qt4 devel Libncurses ncurses devel libncurses5 dev ncurses devel qemu system arm qemu qemu system arm qemu system Refer Section 2 1 2 1 system x86 x86
14. driver mod c gt i my driver mod o x86 le gt i my driver o x86 le Makefile B Module symvers modules order B my driver ko afactor Navigate Search Project Window Ae c Utility Extend Project Compile For Other Kernel Click on Browse button and browse the Kernel Source location from file system Compile For Other Kernel Enter Kernel Source Location Location Browse Click on Finish button It will update the Makefile project configuration and includes paths 3 2 6 9 Static Analysis Using sparse Click on LinK Driver Utility on Toolbar Click on Static Analysis using sparse amp j LinK Avatar User Manual Qr S 0D pr Utility ec SEN Extend Project Compile For Other Kernel nydr Copy Driver Modules to QEMU E Static Analysis using sparse LINU 38 Section 3 LinK Projects LinK Console shows sparse warnings lll Terminal E Problems Tasks E BB r Ev r3 H LinK Console make C lib modules 3 13 0 32 generic build M home suman link workspace mydriver KERN SRC modules make 1 Entering directory usr src linux headers 3 13 0 32 generic CHECK home suman link workspace mydriver KERN SRC mydriver c Building modules stage 2 MODPOST 1 modules make 1 Leaving directory usr src linux headers 3 13 0 32 generic home suman link workspace mydriver KERN SRC mydriver c 20 5 warning symbol mydriver major was not decla
15. system File system image media suman 9A98DD8998DD63F3 linux desktop Proje Browse CT Cancel Finish Linux will boot in QEMU file system After booting note down the network address ip QEMU root debian i386 ifconfig etho encap Ethernet HWaddr 54500 E 92 168 76 P80 5054 ff fe 3456 64 Scope Lin RUNNING MULTICAST MTU 1500 WMetric 1 trame o o errors y errors 1 1 KiB E inet addr 127 inet6 addr j UP LOOPBACK Metric 1 RX packets j 0 overruns 0 frame 0 A 5 collisions 0 txqueuelen 0 RX bytes 5020 4 9 KiB TX bytes 5020 4 9 KiB 0 averruns 0 carrier root debian i386 In Eclipse goto Window menu gt Show View gt Remote Systems menu gt Remote Systems LinK Avatar User Manual 3 Section 5 LinK Views t a EF Dre C og gt Help gt gt LinK Views e Make Y Remote Systems 4B Remote Monitor is Remote Scratchpad E Remote Search 55 Remote Shell 44 Remote System Details 13 Remote Systems 5 Team It will open Remote Systems View Right click in the view and select New Connection like the following liapro HE twa B B H T rys Bi Terminal Problems EJ Console 2 Call Hierarchy 49 Tasks g Progress y i E Local h Local Files T Local Shells E T new Connection Import Connection e eb Test L Define a cannectionta remote system Running CH Select Linux and click Next 52 LinK Avat
16. 5ite Launcher Select other 60 LinK Avatar User Manual Section 6 Linux Kernel Emulation using QEMU In the above window on the left pane Double Click on C C Attach to Application it opens with Project name On the right pane in the Main tab C C Application give the path of the vmlinux of the project and Enable the Disable auto build option After the Main tab setting in the same window click on Debugger Tab Debug Configurations Create manage and run configurations C C Application Debugger gdbserver Y C C Attach to A a Cf p Debugger Options ic hello make c C C Postmortem Launch Group Type TCP gt Main Shared Libraries Connection Host name or IP address localhost Port number 1234 E Using GDB DSF Attach to Process Filter matched 5 of 5ite Launcher Select other Debugger select gdbserver Debugger options open the Connection Tab select e Type TCP e Host Name or IP address localhost e Port number 1234 Click on Apply button to apply changes then click Debug button it will ask for change to Debug Perspective Click on Yes and start Debugging by giving breakpoint in Console Window Eg b start_kernel C and then press Enter button 61 LinK Avatar User Manual Section 6 Linux Kernel Emulation using QEMU 6 3 System Call Testing with QEMU System Call testing on QEMU can be done by two steps 1 Run the new
17. 92 168 110 1 not selected vmnet8 172 16 170 1 G not selected wlano not selected Note SSH should be installed Firewall should be disabled Same gcc version sholud be present on local and remote systems Servers for distcc IP Address Username Status Add Remove distcc monitor Start distcc servers After you ve decided the interface for interaction you need to add the servers that help in the compilation process To do so click the Add button and the popup appears as shown below IP Address Add a new connection Please enter the data for new connection IP Address User Name Password 10 242 10 217 dileep Cancel OK IP address of the machine server which helps in the compilation Username The username of the server note that the user must have root privileges Password The password of the corresponding user After filling up the details click OK which would configure the server over ssh and adds it LinK Avatar User Manual 45 Section 4 Linux Kernel Compilation Project Preferences to the list of servers as indicated in the second table as shown below Preferences VES distcc ae gt General ues gt Ant Description distcc distributes compilation of C code across several machines on a C C network distcc should always generate the same results as a local gt CallGraph compile it is simple to install and use a
18. NODE NAME aa I5 define MYDRIVER BUFF SIZE 1624 17 MODULE LICENSE GPL MODULE AUTHOR DEVESH int mydriverz major 0 dev t mydriverz device num struct class mydriver2 class Gtypedef struct privatedata int nMinar char buff MYDRIVER2 BUFF SIZE struct cdev ciev Terminal Problems Console Tasks 3 2 3 Creating Basic Driver Module m o Binks Tig S Device H c Outlin Make q4 r iS alotest i char lowlevel iX char lowlevel 16550 i5 char tty E datatypes _linkedLists i debugfs ie debug proc iS debug sys Fi debug sys class r i debug sys devices iF debug jprobe 1 5 debug kprobe r i55 deferred ktimers E deferred sharedqueues i deferred tasklers i5 deferred workqueues t iS fasync_test iS module param r iS poll test i synch completion synch rwsem r i5 synch semaphore After the user creates a driver module he can extend the project by creating a basic driver module through In the project explore Right Click on the respective project Goto New gt Basic Driver Module as shown in the screenshot below File Edit Source Refactor Navigate Search Project Window Help T A amp e Go gr er New Go Into Open in New Window Copy Paste Delete Rename Import Export Build Project Clean Project Refresh Project File File From Template Folder Basic Driver Module N Device Driver Project Kernel
19. Name 4 Completion Spinlock Read Write Seq Lock q Kernel Data Type Kernel Linked List Debugging Mechanisms h Sysfs Probing 9 Back Next Cancel Finish Files can be added to the procfs by mentioning a list of files in the table provided In order to do so click on the Add button Upon clicking the Add button the following window will popup File Name Name of the file you wish to create Operations Select the operations that you want to perform on this file Possible options are read and read write Read Function Give the name of the function to be invoked when read is called on this file If you wish to go with any of the previous read functions select the arrow highlighted in the figure and choose one from the list Write Function This field is visible only for read write operations If enabled give the name of the function to be invoked when write is called on this file If you wish to go with any of the previous write functions select the arrow highlighted in the figure and choose one from the list 26 LinK Avatar User Manual Section 3 LinK Projects Add Function Wizard Add Function Wizard Click On Finish File Name file 1 Operations read write lt Read Function file_read Write Function file_writel e conei Once everything is done click on the Finish button and the file will be added to the list Make Directory checkbox will be
20. Revision 4 0 25 11 2014 USER MANUAL Sed 1 Shivbagh tel 040 23737124 25 www cdachyd in z Ameerpet email dileepkp cdac in www cdac in CDAC Hyderabad 500016 Link wee LinK Avatar Version User Manual Revision 4 0 Authors Dileep K Panjala Suman Rao M A Raghavendra Rao amp Devesh Kumar Gupta dileepkp sumanm arrao deveshg cdac in Team Embedded C DAC Hyderabad Compiled amp Modified by S Venkata Srikanth amp Santosh Sam Koshy venkatas santoshk cdac in Team Embedded C DAC Hyderabad November 2014 This project is sponsored by Department of Electronics amp Information Technology DeitY Ministry of Communications amp Information Technology Government of India under the OPA no 32563 Link wee Preface This document contains technical information related to LinK IDE which is necessary for the user to 1 Install amp use the tool 2 Install additional utilities to use all the features of LinK IDE 3 Create amp build projects using the tool User Manual Revisions eon Dae von 04 10 2013 Initial Draft of Avatar Release 17 10 2013 Added a new section for examples amp short keys for build options 05 11 2013 LinK First Release Avatar Version 40 25 11 2014 LinK Avatar Version to be uploaded in SourceForge This document is revised periodically comments and suggestions on all aspects of this manual will be encouraged and appreciated Inquiries concerning clar
21. Source Code to Workspace Link to Existing Kernel Source Code Path Browse Platform Build Information Architecture Host machine 32 bit Toolchain x86 Linux GCC x86 64 ARM Cancel 1 Select Archived Source Code This option is to select an archived kernel source with extension formats supporting tar gz bz2 xz The project is created in the workspace and the kernel source files are uncompressed into the project 2 Import Source Code to Workspace This option copies already uncompressed kernel source available on the disk to the Project Workspace The user can navigate to the path of the required kernel source which is thereafter copied to the project workspace 3 Link to Existing Kernel Source Code This option enables the user to link to an alternate location on the disk apart from the project workspace to add kernel source code This is essentially important if the user does not want to create a new project in the workspace and he wants to operate from the kernel source original location only Depending on the selection of Linux Kernel Source the user can choose the Path of the Kernel Source by clicking the Browse button Then the tool will automatically select the hardware architecture based on the host system configuration Click Finish Button to complete the process 10 Link Avatar User Manual Section 3 LinK Projects Note LinK IDE supports multiple architectures x86 x86 64 and ARM In this release
22. Tasklet function should be atomic in nature it can not sleep Probing 3 Back Next Cancel Fish Click on Next for the Device Driver Features Or Click on Finish button for the project creation with the above features Linux Kernel Features Page is divided into two parts 3 2 2 1 First Part First half contains Driver Type Bus Type Device Type and Framework Method e n Driver Type field select the driver name from the list Note In this Release Avatar only char and block driver are supported e n Bus Type field select the bus name from the list Note In this Release Avatar only bus type none is supported e n Device Type field select the device name from the list Note In this Release Avatar only device type generic is supported 20 LinK Avatar User Manual Section 3 LinK Projects e n Framework Method field select the framework method name from the list Note The frameworks will dynamically change based on the Drive Type selection LinK Device Driver Development Wizard Device Driver Development Wizard Click on Finish Driver Type Bus Type Device Type Framework Method Char None Generic Low level Block PCI Misc device None SPI TTY layer Network I2C UART layer USB Input Platform File Operations Registrations amp Operations Basic Registration IRQ Registration loctl Command Cre Port Registration Buffer Management amp open Device No By Kernel By User amp re
23. Validation AML distcc or network distcc should always generate the same results as a local compile it is simple to install and use and it is often much faster than a local compile Enable ice jce Arirnrasc Selection etho 10 242 10 44 selected Restore Defaults Apply In order to enable distcc check the Enable option on the right pane Once it is enabled it checks whether distcc is installed on the machine or not If not a popup appears Click on Yes to follow up with the installation Once distcc is installed you need to configure it As highlighted below select the interface of the local machine through which it should interact with the servers LinK Avatar User Manual 44 Section 4 Linux Kernel Compilation Project Preferences P 4 V V WV V Ww Ww VW v v vV Ww Nw V General Ant C C CallGraph Help Install Update Java Linux Kernel Development ccache distcc Plug in Development Remote Systems Run Debug Tasks Team Usage Data Collector Validation XML Description distcc distributes compilation of C code across several machines on a network distcc should always generate the same results as a local compile it is simple to install and use and it is often much faster than a local compile Enable IP address of the local system to communicate with distcc servers Interface Address Selection etho 10 242 10 44 amp selected vmneti 1
24. a location in the file system e Select the architecture from the Architecture list e Select a required toolchain from the Toolchain list In the Development Type dropdown box the user will have 2 options 1 Custom Driver Development 2 Typical Driver Development Click on Next gt for other Kernel Development Features or Click on Finish for basic module programming Note In this Release Avatar we are not supporting ARM Architecture lure below 3 2 2 Advanced Kernel Module Program amp Device Drivers Project Creation Linux Kernel Features Page contains the Kernel features like 18 LinK Avatar User Manual Section 3 LinK Projects e Module Param e Delayed Works gt Kernel Timer Tasklet e Synchronization gt Semaphore Spinlock and many more e Kernel Data Types e Debugging Mechanisms All the features are optional amp user can select any number of features F C DO LinK Device Driver Development Wizard Device Information Module PARAM Module PARAM Delayed Works Kernel Timer Argument Name Argument Type Argument Permission Tasklet Work Queue Add Shared Queue Remove Wait Queue Synch Methods Semaphore Completion Description Spinlock module param macro will be used to assign the parameters of the Read Write drivers at load time by insmod or modprobe module param name type perm Seq Lock Kernel Data Type Kernel Linked List name name of the variable to be assign at load time
25. ad First Minor No 0 amp write release Minors count 1 amp unlocked ioctl amp poll Device Node Creation amp fasync amp llseek amp aio read amp aio write Access Control None Note Second half view is dynamic it depends on the user s first selection 3 2 2 2 Second Part Second half view contains Operations It contains a list of functions You can select zero or more functions from the list Registration View It depends on the user s first half selection Basic Registration tab fields are compulsory and other registrations fields are optional Example IRQ Registration View 21 LinK Avatar User Manual Section 3 LinK Projects LinK Device Driver Development Wizard Device Driver Development Wizard Click on finish Driver Type Bus Type Device Type Framework Method Char None Generic Low level Block PCI Misc device None SPI TTY layer Network I2C UART layer USB Input Platform File Operations Registrations amp Operations Basic Registration IRQ Registration loctl Command Cre Port Registration Buffer Management amp open IRQ No Interrupt Type Minor No amp read amp write amp release amp unlocked ioctl amp poll amp fasync amp llseek amp aio read TET amp aio write Remove lt Back Cancel Finish Click on Finish button to generate the Device Driver code A device driver project is created with the default settings and a full set of config
26. aio fsync L TODO Auto generated function stub i Renamein file gt gt J gt J PINFOC IN mydriver_aio_fsync Function ile 3 MAKE OQUIE a Mye E ele make 1 module home suman link wd mydriver C C Proble To apply suggestion in code press enter key 3 2 6 10 3 Header file name suggestion gt i debug sys cC TODI Initialise tasklet argument 2 rfr S dn tasklet init amp devices i mydriver tasklet my tasklet 0 _ gt debug sys Include Header file linux interrupt h stinclude linux interrupt h devices i Rename in file PINFO INIT TODO I tasklet ini To apply suggestion in code press enter key LinK Avatar User Manual Section 4 Linux Kernel Compilation Project Preferences 4 Linux Kernel Compilation Project Preferences 4 1 ccache Preference Settings ccache speeds up the re compilation of C C code when the same compilation is repeated This could come handy while recompiling the Linux Kernels again and again ccache can enabled by going through Window Preferences Run Window Help i New Window Open Perspective Show View Customize Perspective Save Perspective As Reset Perspective Close Perspective Close All Perspectives Navigation he In the Preference page on the left pane select Linux Kernel Development gt ccache LinK Avatar User Manual 41 Section 4 Linux Kernel Compilation Project Preferences
27. ar User Manual Section 5 LinK Views New Connection Select Remote System Type Any distribution of Linux System type type filter text EU o General fy FTP Only a Linux EJ Local Ex SSH Only Ex Telnet Only Experimental unis Unix i Windows ace rinst In Host name enter remote system IP address and enter any Connection name and click on Next New Connection Remote Linux System Connection Define connection information Parent profile localhost Host name 192 168 76 2 y Connection name QEMU Description Verify host name Configure proxy settings D lt Back Next Cancel select ssh files click Next LinK Avatar User Manual 53 Section 5 LinK Views New Connection Files Define subsystem information Configuration Properties dstore files Property Value ftp files Available Services Ssh Sftp File Service v SSH Connector Service Ed SSH Settings Description Work with files on remote systems using the Secure Shell ssh protocol D lt Back Next gt Cancel Finish Select processes shell linux gt click Next New Connection Processes Define subsystem information Configuration Properties dstore processes Property Value v processes shell linux Available Services Shell Process Service Description This configuration allows you to work with processes on remote linux systems
28. click on the link it will open the following window 15 LinK Avatar User Manual Section 3 LinK Projects Create a new data type New Structure Structure Name MyDataType Add Member Data Type self_type Member Name Add Member Members Member Name Data Type is Pointer NewData self_type true Remove Cancel After that in Structure Name field enter name of your new data type Then in order to add members into the above structure goto Add Member field select Data Type and give the data type name Next click on Add Member button and repeat this process for adding more members Finally click on Finish button Note f you want to test your System Call with System Call application enable Test user application It will create a user space application for the System Call testing 3 2 Linux Device Driver Development Project 3 2 1 Basic Linux Kernel module program project creation Linux Device Driver Projects are created by selecting File gt New gt Project then Click on that it will open New Project wizard in that go to Linux Kernel Development Link amp select Device Driver Project 16 LinK Avatar User Manual Section 3 LinK Projects Go New Select a wizard mum Wizards gt General N b e C C b zm cCVS gt gt Java Y 2 Linux Kernel Development LinK 4 Basic Driver Module Device Driver Project f Kernel Compilation Project gt Plug in
29. e Refactor Navigate Searq Pw na tly Gr cv Gy a Build All Ctrl B EE Project Explorer 93 za B vr 3 2 6 1 Build Output Bi Problems j Tasks El Console X N E Properties 8 Qemu View 9 amp ud BB Ex r ri B C Build my driver MODPOST 1 modules cc home linkplus runtime EclipseApplication my driver KERN SRC my driver mod o LD M home linkplus runtime EclipseApplication my driver KERN SRC my driver ko make 1 Leaving directory usr src linux headers 3 2 0 52 generic pae make Leaving directory home linkplus runtime EclipseApplication my driver KERN SRC 3 2 6 2 Eclispe Local Terminal Plugin To Open Linux Terminal in Eclipse IDE click on Window gt Show View Other General gt Terminal EM Terminal X B Problems El Console j Tasks Oo H gO suman localhost Note For more information about Google ELT Project visit http code google com p elt 3 2 6 3 Make Target View Y i my driver gt KERN SRC clean modules 3 2 6 4 LinK Device Driver Command Execution Either Right Click on Project select Link Driver Development 34 LinK Avatar User Manual Section 3 LinK Projects Make Targets E P Index LinK Driver Development Utility insmod t Show in Remote Systems view Extend Project rmmod Convert To Compile for other Kernel modprobe Run As Copy Driver Modules to QEMU ismod Shift Alt L L Debug As dmesg ShifE Alt L D Stat
30. e debugging option by Right Click on the respective Project in the Project Explorer and goto LinK to Emulation Debug with QEMU Compare With Single Step Execution Restore from Local History Configuration s Source t Compilation M Debug With QEMU Configure Installation on Host Debug With QEMU Gdbtui Run C C Code Analysis System Call WithFile System With Initrd Image Properties Alt Enter Add Patch QEMU Configuration After click on the Debug with QEMU and follow the procedure First it will open the QEMU Emulator at port number 1234 So After that it will ask for opening the Eclipse Debugger To open Eclipse Debugger Right Click on the respective Project in the Project Explorer and Click on Debug As gt Debug Configuration It will open Debug Configurations Window as given below Debug Configurations Create manage and run configurations 5 if x B Ser Name hello make C Main Debugger gt Source 1 Common t C C pplication C C Application v E C C Attach to Ap home dileep Projects LinkPlusIDE Test Search Project Browse ic hello make Project E C c Postmortem Launch Group hello Browse Build if required before launching Build configuration make Enable auto build Disable auto build Use workspace settings Confiqure Workspace Settings Using GDB DSF Attach to Process Filter matched 5 of
31. evice Information Enter directory name Module PARAM Sysfs E Delayed Works Kernel Timer Enans Tasklet Work Queue Shared Queue Wait Queue Y Synch Methods Semaphore Completion Spinlock Read Write Seq Lock Kernel Data Type Kernel Linked List Debugging Mechanisms Procfs Sysfs Probing 2 Back Next Cancel Once you ve enabled the sysfs Select Option dropdown will list the sysfs entries User can select any one of the below options as shown in the screenshot e sys e sys class e sys device e sys kernel debug 28 LinK Avatar User Manual Section 3 LinK Projects r o LinK Device Driver Development Wizard Device Information Enter directory name Module PARAM Sysfs Delayed Works Enable Kernel Timer Tasklet Work Queue Select Option sys S Shared Queue Y Synch Methods Semaphore FileName Operations Completion Spinlock Read Write Add Seq Lock Kernel Data Type Kernel Linked List Remove Debugging Mechanisms Procfs N Sysfs Probing 9 lt Back Next gt Cancel Inorder to add files in the sys click the Add button which will open the following popup Add Function Wizard Add Function Wizard Click On Finish Operations read write concet N File Name Name of the file to be created Operations Mention the operations that are to be permitted on this file The possible options are read and read write 29
32. ic Analysis using sparse Profile As modinfo UD omm Or Select the project in Project Explorer View and click on LinK Driver Utility on Toolbar amp A ajajoon igato IE Extend Project rmmod E modprobe Compile For Other Kernel NM ee dmesq Shift AlE L D Copy Driver Modules to QEMU lsmod shift Alt L L Static Analysis using sparse modinfo JECT or To run the Driver Build Utility for Driver Module Code directly from the Editor Right Click on the Editor V t mydriver Vectarauons j gt i deferred tasklets rect cima References gt E deferred workqueues Search Text gt E fasync test pedef struct Make Targets gt module param int nMinor LinK Driver Development Utility insmod Shift Alt L I char buff F Run As gt Extend Project rmmod Shift Alt L R struct cde modprobe Shift Alt L M Deoug As Compile for other Kernel CERE Profile As dmesg Shift Alt L D Copy Driver Modules to QEMU lsmod Shift Alt L L inal 23 E E Clean Selected File s r 5 ma Build Selected File s Static Analysis using sparse modinfo Note Build Utility in Editor Context Menu is visible only when the C Editor contains a Linux driver module code Once user clicks on the utilities insmod rmmod modprobe the Password Prompt will be popped up Sudo Password Prompt To perform administrative tasks sudo password is required e g insmod rmmod modprobe Sudo Password Prompt 24 Re
33. ification or interpretation of this manual should be directed to C DAC C DAC 1 Shivbagh Plot No 6 amp 7 Hardware Park Sy No 1 1 Satyam Theatre Road Srisailam Highway Pahadi Shareef Via Ameerpet Hyderabad 500016 Keshavagiri Post Telangana India Hyderabad 500005 Phones 91 40 23737124 25 Telangana India Fax 91 040 23 743382 Link Contents pink cssc 1 1 1 FU Se C n 2 2 LinK Installer Plugin Installation csssccsssccssscsssccssccsssccnssccssscusccusseccscecessenesccessenesseussssusees 4 2 1 SII Nm fo BOS AI NETTEN 4 2 1 1 BO II EO 4 2 1 2 OFORE O c 5 2 1 2 1 QEMU installation im CENTOS m 5 22 Irons ab v 5 2 2 1 LINK IDE Installer Installation ssseeeeee esee nnne 6 2 2 2 Weder 8 3 LINKE Projects ie 9 3 1 Linux Kernel Configuration and Compilation Project ccccccccssecceccesseceeeeseceeeeseeeeeeeeeeeees 9 3 1 1 xielseuSgy um 9 3 1 2 Project Buld OUS arriere deos nn nein E Pu ei A MCN UCM R UE SM D MLUS 11 3 1 3 Linux Kernel System Call Creation Project ccccssscccccsssececceseeceeeeeeceeeeeeeecessueeeeeeeenes 14 3 2 Linux Device Driver Develop
34. ing experience of Linux Kernel Developers The architecture comprises of multiple plug ins which are built for Eclipse mainly using CDT core plugin features j Linux Device Driver Mie Code Generation Linux Device Driver Eclipse IDE Linux Device Driver Code Testing Profiling amp Memory onfigqurz tion Link Avatar User Manual Section 1 About LinK IDE 1 1 Features 1 Supports Hardware Architectures d X86 b x86 64 c ARM No support in this release 2 Wizard for Kernel Configuration amp Compilation 3 Supports Multiple Kernel Configuration Options a xconfig b menuconfig c defconfig d allmodconfig 4 Supports Multiple Kernel Compilation Options a bzlmage b modules c all d clean e distclean 5 Reduction in Kernel Compilation Time through a ccache b distcc 6 QEMU Emulator support for Linux Kernel Image Emulation 7 Linux System Call Development a Support for adding new System Call with multiple arguments b Emulation of the new System Call with QEMU emulator 8 Linux Kernel Debugging using QEMU emulator 9 Linux Device Driver Auto Code Generation a Ulfor Device Driver Auto Code Generation b Support Basic Kernel Module Creations C Support Linux Kernel Features i module param ii synchronization mechanisms 1 mutex 2 semaphores 3 completions 4 reader writer locks 5 spinlocks iii bottom half techniques 1 kernel timers 2 tasklets 3 workq
35. ional gt Es Shell Processes Save user ID CX Ssh Shells zZ 48 Ssh Terminals Host name 192 168 76 2 It will ask for authenticity for the first time click on Yes to connect The authenticity of host 192 168 76 2 can t be established RSA key fingerprint is a98 fc 1c 9f 55 15 a4 c1 55 73 14 ce b4 63 f1 10 Are you sure you want Eo continue connecting NND Select any file from file browser and copy that file fe Home Desktop Untitled Folder Places Is EZ Open with gedit ene Open With p ili Desktop Cut D Documents 2 Copy x Downloads dd Music Move To Pictures Copy To H videos Make Link Fm Rename D Trash Devices Move to Trash 52 GB Volume Revert to Previous Version 84 GB Volume amp Compress Email c Computer a Network Properties Q Browse Network ad m raghavendra o Q Connect to Server Select root folder in Remote Systems and Paste their LinK Avatar User Manual 56 Section 5 LinK Views Show in Tab la Monitor Re f teun Rename A Delete Bi terminal Problems Console ARemote Systems 3 op CUL L5005 7 E FL EL t G ham Export From Project F C5 Lib Import To Project PS ke Targe 3 lnst found Synchr anize Cache D media Create Remote Project b 7mn b ie Test mmn Launch Terminal EM on Launch shell ror Properties issbin e 3 selinux E E L3 5 ys D tmp File will be co
36. ly added System Call kernel image with QEMU 2 Copythe System Call user application on to the running QEMU The first step can be done by below given procedure Right Click on the Linux Kernel Project in the Project Explorer goto LinK to System Call System Call testing with QEMU then it will open a wizard configuration Run QEMU wizard Run QEMU Q Please select QEMU image file I fa 2 Cancel Provide Password and Browse for QEMU file system click on Finish button The second step can be executed by the following given procedure After running QEMU Right Click on the Linux Kernel Project in the Project Explorer LinK to gt System Call gt System Call app copy to QEMU It will open a wizard Browse for target System Call application to copy onto the running QEMU and click on Finish button 62 LinK Avatar User Manual Section 6 Linux Kernel Emulation using QEMU New System Call copying wizard Linux kernel System Call copy Please select test output file D Cancel Finish Note User can check the System Call application binary file in tmp folder of the running QEMU file system LinK Avatar User Manual 63
37. member F Cancel 3 2 6 5 Output Console 35 LinK Avatar User Manual Section 3 LinK Projects roblems Call Hierarchy Tasks C Qemu Mount View o Progress n GH E v Y E Probl 3 Call Hi hy 4 Task Q Mount V mo P E BB rf Gv rj m LinK Console sudo S insmod my driver ko Exit status 0 Switch between LinK Console and C Build Console Click on Console console icon amp select the console H Problems EJ Console zi Call Hierarchy l Tasks z Qemu Mount View amp Progress k 58 rf Ge fie OO LinK Console sudo 5 insmod my driver ko 2 LinK Console Exit 5tatus 8 n 3 2 6 6 Short Keys To get the device driver utilities insmod rmmod modprobe dmesg with short keys the user needs to press SHIFT ALT L and it will open the short keys window as shown in the screenshot below Then the user needs to press d for dmesg i for insmod P for Ismod m for modprobe r for rmmod dmesg Shift Alt L D insmod Shift Alt L I ismod Shift Alt L L modprobe Shift Alt L M rmmod Shift Alt L R 3 2 6 7 Extend Project Select the project in Project Explorer View and click on LinK Driver Utility on Toolbar AME Then Click on Extend Project 36 LinK Avatar User Manual Section 3 LinK Projects gt sj Includes Y SKERN_SRC x n my driver c gt n my driver h gt d
38. ment Project ccsscccccssseecceeesececeeueeececauseeeecseseeeeeegeeeeeeegeces 16 3 2 1 Basic Linux Kernel module program project creation cccsessessecccccceessaeeeseseeseeeeeeees 16 3 2 2 Advanced Kernel Module Program amp Device Drivers Project Creation 18 3 2 3 Creating Basic Driver MOUIE ccccsecccccssssececeesececeeusececeeseececeuseceeseeusceeeseseeeesegaess 23 3 2 4 Linux Kernel Module Debugging using Probing mechanism eeeeeees 24 3 2 5 Linux Kernel Module program with proc sys entry creation ccccccesseeccceeeeeeeeeeeeeees 25 3 2 6 Project Bund ODUONS ITE 33 4 Linux Kernel Compilation Project Preferences csccscsscsccsceccsccsccsceccsccscecceccsccecscescecceccscesces 41 4 1 ccache Prereren SOUS NIE EE TE A E 41 4 2 aisetce Prel Tence SC UNE S en i qur uoo DR ee E Ead d see oiu EON 43 MOCAUL 48 5 1 Linux Device Driver Example Programs csscccccsssecceceessececeesseccceensccecseeeceeeegsceessaenecetsuages 48 5 2 QEMU Remote Systems siereumievttin tdeo pumvuobauvl turhel deu p RbRe RI C dB Oo ROU FRUI UD E PenICPIU SNP FPE UE 50 6 Linux Kernel Emulation using QEMU ccccsccscssccscscssccccsccsccsccccsccsccsceccscecceccscescecceccscesceccess 58 6 1 Linux Kernel Emulation using QEMU sseeseeeseseseeeeeeee nennen nennen enne n
39. mples gt le char lowlevel gt let char tty gt l datatypes linkedLists gt l debug jprobe i debua korobe import example in workspace gt l debug sys gt ct debug sys class Note The example programs contain both the source code and the Readme document In the Readme document the user can view the description and also the syntax amp usage of that respective example 5 2 QEMU Remote Systems This section explores the Remote Systems view Third party plug in which is generally used to monitor remote system Here we are making use of this to view and access QEMU s file system The section describes the steps involved to setup the remote system view for QEMU and how to use it Debug As singleStep Execution 5 Sg Progress 4B Remote Syste Profile As Configuration a Team Compilation Compare With Installation on Host Debug With QEMU Haste Lees cell System Call Debug With QEMU Gdbtui Emulation With File System Add Patch With initrd Image Properties Alt Enter Switch Architecture j EMU Configurati Open Terminal Here LinK to Select project in project explorer Navigate the following by right clicking on project Goto LinK to gt Emulation gt With File System It will open the following window browse for qemu image file and click Finish 50 LinK Avatar User Manual Section 5 LinK Views Emulation with File system wizard Run QEMU Testing with file
40. my driver mod c gt my driver mod o x86 le gt m my_driver o x86 le Makefile gt Module symvers gt modules order gt my_driver ko Compile For Other Kernel f TT F om Select features you want to use All features are optional Click on Finish button F o Extend Project Device Information Device Information Module PARAM Module PARAM Delayed Works Kernel Timer Argument Name Argument Type Argument Permission Tasklet Work Queue P add Shared Queue i Remove Wait Queue aei Synch Methods Semaphore Completion Description Spinlock module_param macro will be used to assign the parameters of the Read Write drivers at load time by insmod or modprobe module_param name type perm Seq Lock name name of the variable to be assign at load time Y Kernel Data Type type type of the variable Kernel Linked List permzpermission for the variable N Debugging Mechanisms Example Procfs In driver int a SMS char name Probing module param a int S IRUGOJ module param name charp S IRUGOJ At load time insmod Hello ko a2 10 name Hello 3 2 6 8 Compile For Other Kernel Select the project in Project Explorer View and click on LinK Driver Utility on Toolbar M 37 LinK Avatar User Manual Section 3 LinK Projects Click on Compile For Other Kernel my driver gt ii Includes Y GS KERN SRC gt my driver c gt h my driver h gt my
41. nd it is often much Faster gt Help than a local compile gt Install Update Y Linux Kernel Development IP address of the local system to communicate with distcc servers ccache z Interface Address Selection distcc E i z gt Plug in Development etho 10 242 10 44 selecte vmneti 192 168 110 1 iL Jnot selected Remote Systems pm vmnet8 172 16 170 1 Inot selected gt Run Debug wlano iL Jnot selected gt Tasks gt Team Note gt Usage Data Collector SSH should be installed Validation Firewall should be disabled XML Same gcc version sholud be present on local and remote systems Servers for distcc IP Address Username Status Add 10 242 10 217 dileep Running Remove distcc monitor Start distcc servers You can monitor the status of the server through the Status column In the screenshot shown here the status is shown as Running indicating that the server is ready to accept connections In case the status other than Running you can click the Start distcc servers button to wake up the servers In any case if you wish to remove any server from the list select the corresponding server and click the Remove button Now the user can compile the kernel image by Right clicking on the respective project in the Project Explorer View then goto LinK to gt Compilation gt bzImage You can monitor the distributed compilation by checking the distcc monitor checkbox as shown below The monitor is an applicati
42. nne ensis 58 6 1 1 Linux Kernel Emulation using QEMU with File System csssesecceccececseeeessseeeeeeeess 58 6 1 2 Linux Kernel Emulation using QEMU with initrd image cccccessccccessescceeeeseceeeeeeeees 59 6 2 Linux Kernel Debugging using QEMU iesssseeeeeeeennnenenneennn nn nnnm nennen nnns 60 6 3 System Call Testing with QEMU sees nnne nnne nnns nnns 62 Section 1 About LinK IDE 1 About Link IDE Linux developers are known to be terminal editing geeks with an inherent liking towards the Linux command line shell and various editors like Emacs Vi and joe However in recent years major enhancements in the Linux Operating System and its extensive support for various hardware platforms have attracted many more developers who seek feature rich integrated and user friendly development environments To fulfil this need the Eclipse IDE provides an excellent platform with extensions such as CDT Autotools plugin multiple plugins from the Linux tools project Target Communication Framework and much more The Plug in Development Environment PDE of Eclipse provides tools to create develop test debug build and deploy plug ins fragments features update sites and RCP products Linux Kernel Programming Plugin Suite LinK is an Eclipse IDE based plugin suite for Linux Kernel Programming that supports X86 amp ARM platforms It provides a feature rich environment that enhances the programm
43. o bit 524C16 start S24C16 stop S24C16 write byte T93C46 Send Command T amp S anFhhmarz Back Selection Cancel Then the user can select either JProbe or KProbe by clicking the radio button as shown in the screenshot below After selecting the probing mechanism the user needs to select the required symbol by entering the names in the Search textbox The wizard will display the symbols based on user search Now the user has to select required symbols by clicking the Selection Click on Finish button to complete 3 2 5 Linux Kernel Module program with proc sys entry creation 3 2 5 1 proc The proc file system is a virtual file system that permits a novel approach for communication between the Linux Kernel and the user space In the procfs virtual files can be read from or written to as a means of communicating with entries in the kernel The page can be obtained either during the project creation refer section 3 2 1 or while extending the project In order to access the procfs LinK Avatar User Manual Section 3 LinK Projects Select Debugging Mechanisms Procfs on the left pane and check the Enable checkbox on the right pane as shown in the below screenshot o Link Device Driver Development Wizard Device Information Device Information Module PARAM Procfs Delayed Works Enable Kernel Timer Tasklet Work Queue Shared Queue Wait Queue Synch Methods Semaphore Directory
44. ojects Select Debugging Mechanisms gt Sysfs on the left pane and check the Enable checkbox on the right pane as shown in the below figure In this case the option to be selected is sys kernel debug c LinK Device Driver Development Wizard Device Information Enter directory name Module PARAM Delayed Works Kernel Timer Tasklet Work Queue Shared Queue Wait Queue Synch Methods Semaphore Completion Spinlock Read Write Seq Lock Kernel Data Type Kernel Linked List Y Debugging Mechanisms Procfs Sysfs Probing Sysfs I Enable Select Option sys kernel debug Make Directory Directory Name File Type varType Op Read func Write func In order to add files in the sys kernel debug click the Add button which will open the following popup Eo Add Function Wizard Add Function Wizard Click on finish File Name fd File Type normal Operations read write Read Function rd Write Function wr LinK Avatar User Manual e 3c Add Function Wizard Add Function Wizard Click on finish File Name varl File Type variable 7 Operations read write Read Function Write Function Data Type us Section 3 LinK Projects File Name The name of the file to appear in debugfs File Type The type of the file to be created The possible options are e normal anormal file will be created to which read and write functionalities can be
45. oll down the page where you ll find the buttons Restore Defaults and Apply Restore Defaults Reverts to the default settings i e clears the settings even the servers list Apply Apply all the changes OK Apply the changes and exit the preferences page Cancel Do not apply the changes and exit Once the compilation starts the distcc monitor appears if enabled as shown below distcc Monitor raghavendra cdac state Host 10 242 10 217 2 10 242 10 217 3 10 242 10 217 3 10 242 10 217 4 10 242 10 217 4 10 242 10 217 5 5 6 7 0 4 Slot File Tasks ap E LU IH i ls P l Preprocess T EIE m Praia T n RR RN psscope c Compile speedstep lib c 10 242 10 217 10 242 10 217 10 242 10 217 localhost i2c core c Compile localhost File c Compile pose Siege ee 47 Link Avatar User Manual Section 5 LinK Views 5 Link Views 5 1 Linux Device Driver Example Programs LinK IDE is also bundled with sample programs of Linux Device Drivers To view the sample programs the user needs to go to the Window gt Show View gt Other Window Help New Window New Editor Open Perspective 1 f Device Driver Examples Customize Perspective p Save Perspective As Make Target Reset Perspective Type Hierarchy Close Perspective Other Shift Alt O Q b Close All Perspectives Navigation Preferences This will open a Show View wizard a
46. on Enter directory name Module PARAM Sys s Y Delayed Works I Enable Kernel Timer Tasklet Work Queue Select Option sys kernel debug lt Shared Queue Walt Queue i id Make Directory 1 5ynch Methods Directory Name debugfs dor Semaphore completion TET File Type varTyp Op ReadilFunc Wri Spinlock aon Fd normal read write rd wr Read Write i i i var variable u8 read write Seq Lock Add Kernel Data Type i Remove Kernel Linked List Debugging Mechanisms Procfs i Sysfs Probing 2 lt Back Next gt Cancel 32 LinK Avatar User Manual Section 3 LinK Projects 3 2 6 Project Build Options By default Build Automatically is enabled if you save the project files it will build automatically and if you want to disable this feature select Project uncheck the Build Automatically To build a project right click on that project then click on Build Project Rename F2 gt gini Import KER Export Build Project im Clean Project m Refresh F5 Close Project Ruilrd Confinurations To Build All LinK Device Driver Projects click on Build All amp icon search Project Run Window Help 384m ty C 1 5 E Build ALL Build Device Driver Projects amp mydriver amp mydriver2 LinK Avatar User Manual 33 Section 3 LinK Projects To build all C projects in workspace press CTRL B or Click on Build All Toolbar File Edit Sourc
47. on which pops up while the compilation has started Once you ve enabled the monitor it checks if the application is already present or not If not a prompt for installation will be popped and follow the steps to complete the installation 46 LinK Avatar User Manual Section 4 Linux Kernel Compilation Project Preferences Preferences b ae a Se a V v V W WV Ww Y yp Ww C WO WO Fy Od General Ant C C CallGraph Help Install Update Java Linux Kernel Development ccache distcc Plug in Development Remote Systems Run Debug Tasks Team Usage Data Collector Validation distcc distcc distributes compilation of C code across several machines on a network distcc should always generate the same results as a local compile it is simple to install and use and it is often much faster than a local compile Enable IP address of the local system to communicate with distcc servers Interface Address Selection etho 10 242 10 44 4 selected vmnet1 192 168 110 1 not selected vmnet8 172 16 170 1 im not selected wlano m not selected Note SSH should be installed Firewall should be disabled Same gcc version sholud be present on local and remote systems Servers for distcc gt XML IP Address 1024200217 distcc monitor Start distcc servers Username Status j Add Running dileep amp l Remove Restore Defaults N Apply E EN Cancel o Scr
48. or the Path of the qcow2 qemu copy on write File System image 58 LinK Avatar User Manual Section 6 Linux Kernel Emulation using QEMU Emulation with File system wizard Run QEMU bzimage not found Recompile the kernel Note Along with the tool qcow2 file system image will be provided After selecting the Path Click on Finish button and it will start emulating Linux Kernel Image Note After booting of Linux Kernel the user needs to provide Username root Password root 6 1 2 Linux Kernel Emulation using QEMU with initrd image Note To execute this option initrd image should be generated for the Linux Kernel To Emulate Linux Kernel Image using initrd image Right Click on the Linux Kernel Project in the Project Explorer and goto LinK to Emulation With initrd image Compare With Single Step Execution Restore from Local History Configuration 50 ds Compilation Debug With QEMU Configure Installation on Host Debug With QEMU Gdbtui Run C C Code Analysis System Call With File System Link Co Emulation With Initrd Image Properties Alt Enter Add Patch After selecting the path Click on Yes button and it will start emulating Linux Kernel Image 59 LinK Avatar User Manual Section 6 Linux Kernel Emulation using QEMU 6 2 Linux Kernel Debugging using QEMU Debugging the Linux kernel image is possible with Eclipse CDT Debugger and QEMU Emulator The user can avail th
49. orer View then goto LinK to Single Step Execution Compare With Single Step Execution E Restore from Local History Configuration Source Compilation Configure Installation on Host Run C C Code Analysis System Call Emulation Properties Alt Enter Add Patch m It will open a wizard with three pages first page has configuration options second page has compilation options and third page has Installation on Host or emulate with QEMU file system of your kernel source 3 1 2 4 1 First Page Linux Kernel Configuration Select xconfig or menuconfig to perform configuration Single Step Execution Linux Kernel Configuration Selected xconfig xconfig menuconfig Click on Next Button to perform configuration operation and enter the second page 3 1 2 4 2 Second Page Linux Kernel Compilation Select any one option given in the wizard below according to requirement 13 LinK Avatar User Manual Section 3 LinK Projects Single Step Execution Linux Kernel Compilation 63 Please select any compilation Executing CC arch x86 kernel asm offsets s n 5 2s Dayr b m be anrr CN DIC IMCAL tdi leE Click on Next button to complete this operation and go to the third page 3 1 2 4 3 Third Page Linux Kernel Installation Select installation type if Host installation provide password Or If you want to Check with QEMU then Browse for QEMU file system Path amp then click on Fini
50. pied into your Remote System and will show the file in Remote Systems file browser f Pu Qr 4 s fi B Links p pulin t E TypeH D An outline is not available B terminal Problems Ge Wk F io dew MakeTarge amp 0 iS Test Fibez fr oot Hell het 37 LinK Avatar User Manual Section 6 Linux Kernel Emulation using QEMU 6 Linux Kernel Emulation using QEMU 6 1 Linux Kernel Emulation using QEMU After compiling Linux kernel image QEMU emulator will be used to emulate the working of Linux kernel before installing on the host For this process we have provided two options for emulation 1 Linux Kernel Emulation using QEMU with File System 2 Linux Kernel Emulation using QEMU with initrd image Note User can use any one of the options according to his requirement 6 1 1 Linux Kernel Emulation using QEMU with File System Right Click on the Linux Kernel Project in the Project Explorer and goto LinK to Emulation With File System Compare With Single Step Execution Restore from Local History Configuration Source Compilation Debug With QEMU Configure i Installation on Host Debug with QEMU Gdbtui Run C C Code Analysis System Call 3 withFile System k Link to Emulation With Initrd Image Properties Alt Enter Add Patch It will open a new wizard as shown in the screenshot below Enter the Password and in the File System image Browse f
51. red Should it be static home suman link workspace mydriver KERN SRC mydriver c 22 7 warning symbol mydriver device num was not declared Should it be st home suman link workspace mydriver KERN SRC mydriver c 24 14 warning symbol mydriver class was not declared Should it be static home suman link workspace mydriver KERN SRC mydriver c 41 18 warning symbol devices was not declared Should it be static and Marks all warnings in Editor 18MODULE AUTHOR DEVESH 19 20 int mydriver majorze 21 22 dev t mydriver device num To delete LinK sparse Markers from Editor Open Markers View Window gt Show View gt General gt Markers lil Terminal B Problems El Console j Tasks l veo errors 4 warnings 16 others Description Resource Path Location Type gt C C Task 16 items v LinK Driver Code Problem Marker 4 items i i amp symbol devices was not declared Should it be static meri e Irene V ERN SRO line 41 LinK Driver Code Problem Marker amp symbol mydriver_class was not declared Should it be static LL ERN SR line 24 LinK Driver Code Problem Marker amp symbol mydriver device num was not declared Should it be static Copy Ctrl C ERN SR line 22 LinK Driver Code Problem Marker amp symbol mydriver major was not declared Should it be static Delete Delete ERN SR line 20 LinK Driver Code Problem Marker Select All Ctrl A Show In Shift Alt W
52. rminal using watch n1 d ccache s command which opens a view as shown below indicating the state of the ccache 42 LinK Avatar User Manual Section 4 Linux Kernel Compilation Project Preferences raghavendra cdac Every 1 0s ccache s directory hit direct e hit preprocessed ache miss alled for Link nsupported source Language nsupported compiler option o input file iles tn cache ache size ax cache size 4 2 distcc Preference Settings home raghavendra ccache 33 18k 79 166 280 592 a 295 8 Mbytes 2 0 Gbytes distcc is a program to distribute builds of C C Objective C or Objective C code across several machines on a network This could reduce the compilation time of huge build such as the Linux Kernel itself Distcc can be enabled through Window gt Preferences New Window Open Perspective ef Show View Customize Perspective Save Perspective As Reset Perspective Close Perspective Close All Perspectives Navigation Preferences In the Preference page on the left pane Select Linux Kernel Development gt distcc LinK Avatar User Manual 43 Section 4 Linux Kernel Compilation Project Preferences Preferences General Ant C C CallGraph i Help Install Update Java Linux Kernel Development ccache Plug in o Remote Systems Run Debug gt Tasks Team Usage Data Collector
53. s shown below Then user needs to go to the LinK Views amp Click on the Device Driver Examples 48 LinK Avatar User Manual Section 5 LinK Views oe Oo Show View gt Debug gt DSF Examples gt Help gt Java gt Java Browsing Y LinK Views Device Driver Examples cg QEMU Mount View gt Make gt Plug in Development gt Tasks gt Team This will open Device Driver Example View as shown in the screenshot below This View contains various types Device Driver examples The user can select any example from the list given o _ ox Outline Mails v t Examples e lt char lowlevel gt EET char tty l datatypes linkedLists Ld Et debug jprobe P e debug kprobe d el debug proc gt l debug sys gt i debug_sys_class gt e debug sys devices gt l debugfs gt l deferred ktimers Ld el deferred sharedqueues d el deferred tasklets i e deferred workqueues l module param gt l synch completion b e synch rwsem b er synch_semaphore t E een canlnck The user can also import the example program into the Workspace as a project by Right Clicking on the respective example program amp then Click on the Import example to workspace 49 LinK Avatar User Manual Section 5 LinK Views This example program will get imported into the Project Workspace where the user can extend the program based on his requirements o Outlin v amp Exa
54. sh button to perform operation Single Step Execution Linux Kernel Installation 63 Please select qemu image file Host Installation gt Check with QEMU 0 0 000000000 File system image Browse 2 Cancel Finish 3 1 3 Linux Kernel System Call Creation Project System Call creation can be done in the following way Right click on the respective project in the Project Explorer View then goto 14 LinK Avatar User Manual Section 3 LinK Projects LinK to System Call Add System Call Compare With Single Step Execution Restore from Local History Configuration LIL Compilation Configure Installation on Host Run C C Code Analysis Link to System Call Emulation i Alt Enter Add Patch Add System Call System Call testing with QEMU System Call app copy to QEMU Properties After clicking on Add System Call it will open a wizard New System Call wizard System Call Name newSystemcall Add Argument Data Type MyDataType Create a new data type Argument Name is Pointer Add Argument Arguments Argument Name Data Type is Pointer New MyDataType false Remove Include user test application ZW RRND Enter System call name then select existing Data Type and finally click the Add Argument button Also the user can create a new data type by clicking Create a new data type link as shown in Figure If you
55. type type of the variable N permspermission for the variable Debugging Mechanisms Example Procfs In driver F int a Sysfs char name Probing module param a int S IRUGOJ module param name charp S IRUGO At load time insmod Hello ko a 10 name Hello Back Neta Cancel Finish Example Tasklet Feature Once the user selects the Tasklet Feature on the left side the tasklet wizard will ask for the necessary fields as shown in the screenshot below 19 LinK Avatar User Manual Section 3 LinK Projects c Link Device Driver Development Wizard Device Information Enter argument value Module PARAM Tasklet Delayed Works Enable Kernel Timer Tasklet Function Name my taskler Work Queue Argument 120 Shared Queue Wait Queue Tasklet Init init exit lt T Synch Methods Semaphore Description Completion Unlike kernel timers scheduling a tasklet you simply ask it to be execute at a later time chosen by the kernel They always run at the time of interrupt Spinlock Maximum Lime it takes to execute the Functions never late than the next timer Read Write tick If system load is low tasklet Function executes immediately Tasklets Seq Lock executes in terms of Software interrupt context Kernel Data Type Usage Kernel Linked List Mostly used in interrupt management because it execute quickly for a short Debugging Mechanisms period of time and in atomic S Procfs Limitations Sysfs
56. ueues LinK Avatar User Manual Section 1 About LinK IDE 4 shared queues iV Linked List Supports the proc and sys file system entry Supports kprobe and jprobe mechanisms Supports IRQ registration and IRQ probing Supports IOCTL commands Creation zm mrp oa Supports Character Device Driver type i Supports file operations selection for Character Device Drivers ii Supports Frameworks 1 low level 2 miscregistration 3 tty Framework 4 UART Framework 5 Input Framework iii Supports Auto Node Creation iv Supports Ports Registration i Supports Block Device Driver No support in this release i Supports block device operations ii Supports CHS Cylinder Heads Sectors ii Supports I O request and make request methods v Supports Block Framework j Supports Network Device Driver No support in this release k Supports Bus types USB PCI I2C SPI and platform LinK Avatar User Manual Section 2 LinK Installer Plugin Installation 2 LinK Installer Plugin Installation 2 1 Before You Begin 2 1 1 For Ubuntu OS S No Name amp Description Java Runtime Environment Required to execute Java Programs Is not shipped with Eclipse Openssh Enables Distributed kernel compilation for Link IDE Linux Kernel Source and Headers Linux Source headers are required for kernel compilation and driver development Libqt4 Package Required by xconfig during kernel configuration Libncurses package Required
57. urations based on the project type and toolchain you selected Basic Device Driver Code is generated based on your selection You should now see the new project in C C Projects view If the user chooses Typical Driver Development type follow the given procedure below Unlike custom driver development typical driver development asks only driver configuration According to the driver configuration it generates code with required kernel features e To select an item double click on it e Select framework type driver type and bus type from framework list driver list and bus list respectively e Set no of devices if applicable Click on Finish button 22 LinK Avatar User Manual Section 3 LinK Projects Eclipse View E a g Project E H Navgato B i FS mydriver F i includes Y QU KERN SRC c mmuydriver c P n mydriver h e 6 mydriwer mod c i mydriver mad a xg amp amp le F i mydriver o x86 1e b Makefile Module syrnvers modules order mydriver ko FS mydriverz isi Includes Y GU KERN SRC c P m mydriverz h H 6 mydriwer2 maod c ia mydriverz mad a xe le eG mydriverz o x86 le b Makefile Module lt ymvers modules order mydriwerz ko 15 Test Qr Em p F 5j mydriver c eq mydriverz c H 1 Autro 1 DEVESH 5 License GPL LINUX DEVICE DRIVER PROJECT sinclude mydriverz h i define MYDRIVER N MINORS 1 ij define MYDRIVER FIRST MINOR B 14 define MYDRIVER2
58. used to create a directory in the proc file system with the name given by the user Now the above setup generates code to create a directory as proc proc_dir and within this directory the file file_1 is created upon which both read and write operations are possible g o LinK Device Driver Development Wizard Device Information Module PARAM Procfs Delayed Works Kernel Timer Tasklet Make Directory Work Queue Directory Name Shared Queue Wait Queue FileName Operations ReadFunction WriteFunction Enable Synch Methods Semaphore Completion Spinlock Add Read Write Seq Lock Remove Kernel Data Type Kernel Linked List Debugging Mechanisms Procfs N Sysfs Probing D lt Back Next gt Cancel Finish 27 LinK Avatar User Manual Section 3 LinK Projects 3 2 5 2 sys The sys file system is a virtual file system over which the information about the devices and drivers are scattered throughout the file system This part of the wizard provides the inputs to the user through which the user can get hands on to accessing the device model of the Linux kernel The page can be obtained either during the project creation refer section 3 2 1 or while you are extending the project In order to access the sysfs Select Debugging Mechanisms gt Sysfs on the left pane and check the Enable checkbox on the right pane as shown in the below screenshot c LinK Device Driver Development Wizard D
59. using any contributed Shell subsystem O Back Next Cancel Select ssh shells click Next LinK Avatar User Manual 54 Section 5 LinK Views New Connection Shells Define subsystem information Configuration Properties dstore shells Property Value v SSh shells Available Services Generic shell service v amp 4 SSH Connector Service Ed SSH Settings Description Work with shells and commands on remote systems using the Secure Shell ssh protocol D lt Back Next gt Cancel Finish Select ssh terminals click Finish New Connection Ssh Terminals Define subsystem information Configuration Properties amp ssh terminals Property Value Available Services 4 SSH Terminal Service v SSH Connector Service Ed SSH Settings Description Work with terminals and commands on remote systems using the Secure Shell ssh protocol 9 lt Back Next Cancel Finish It will ask for the remote system credentials enter required credentials and click on Ok It will connect to the QEMU file systems 55 LinK Avatar User Manual Section 5 LinK Views lil Terminal E Problems El Console 2 Call Hierarchy Tasks Progress AR x Y Ej Local amp Local Files Enter Password t gt Local Shells System type Linux n Host name 192 168 76 2 v Sftp Files Connection name QEMU gt i My Home User ID root v Root Pending Password opt

Download Pdf Manuals

image

Related Search

Related Contents

  Epson NPD4706-00 EN User's Manual  Sony PCV-LX920 Reference Guide  Operating Instructions - Drive Lines Technologies Ltd  Rotel RP-860 User's Manual  SUNNY BOY 3000TL/4000TL/5000TL - Istruzioni per l  Horno multifunción  Insecticida fumigante para el control de insectos – plaga  Manual del Usuario  PDF 686kB  

Copyright © All rights reserved.
Failed to retrieve file