JZ2440 driver compilation, installation and testing

Publisher:快乐球球Latest update time:2022-07-22 Source: csdnKeywords:JZ2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Compile the Linux kernel

Documents needed:

a. Kernel file (e.g. linux-2.6.22.6.tar.bz2)

b. Corresponding patch file (for example, linux-2.6.22.6_jz2440.patch)


$ tar xjf linux-2.6.22.6.tar.bz2//Unzip the kernel file

$ cd linux-2.6.22.6

$ patch -p1 < ../linux-2.6.22.6_jz2440.patch //Apply patch

$ mv ../4.3-inch LCD_mach-smdk2440.c arch/arm/mach-s3c2440/mach-smdk2440.c // Replace 4.3-inch source code

$ cp config_ok .config

$ make uImage


After completion, remember the location of the kernel file

Here is /home/stu/JZ2440_QQ_WuLian/linux-3.4.2


After successful compilation, the uImage file is generated in the arch/arm/boot directory of the kernel.

Note: To successfully "make uImage", you must copy the mkimage tool obtained when compiling u-boot to /usr/bin

The mkimage tool is in the tools directory under the u-boot source code.


2. Compile the driver

Documents needed:

a. Driver source file (such as first_drv.c)

b. Makefile

First modify the Makefile


KERN_DIR = /work/system/linux-3.4.22


all:

    make -C $(KERN_DIR) M=`pwd` modules 


clean:

    make -C $(KERN_DIR) M=`pwd` modules clean

    rm -rf modules.order


obj-m += first_drv.o


Change the first line path KERN_DIR = /work/system/linux-3.4.22 to the location where your kernel file is placed

Then make

It can be found that first_drv.ko is generated


pay attention:

The prerequisite for compiling the driver module is that the kernel has been successfully compiled.


3. Compile test files

Documents needed:

a. Test source file (such as firstdrvtest.c)


Compile


arm-linux-gcc firstdrvtest.c -o firstdrvtest


You can find that the executable file firstdrvtest is generated


4. Test on the development board

A. Put the driver file first_drv.ko and the test file firstdrvtest generated earlier into the nfs mount directory

2440 Mounting a Linux folder via NFS Reference 2440 Mounting a Linux folder via NFS


cp first_drv.ko /home/stu/nfs

cp firstdrvtest /home/stu/nfs


B. Load (register) driver module

a.//Create an empty directory

mkdir -p /lib/modules/3.4.2

You must create an empty directory like /lib/modules/2.6.30.4, otherwise the ko module cannot be uninstalled

b. Mobile drive module


cp first_drv.ko /lib/modules/3.4.2/


#cd /lib/modules/3.4.2/

#insmod first_drv.ko //load

#lsmod//View

first_drv 1329 0 - Live 0xbf010000 (O)

buttons 2693 0 - Live 0xbf008000 (O)


If you want to uninstall, use rmmod


#rmmod first_drv

#lsmod

buttons 2693 0 - Live 0xbf008000 (O)


C. Execute the test


./firstdrvtest on


You can see the light on


./firstdrvtest off


You can see the lights go out

Keywords:JZ2440 Reference address:JZ2440 driver compilation, installation and testing

Previous article:mini2440 mounts linux folder via nfs
Next article:JZ2440--Patch and compile u-boot under Linux

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号