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
Previous article:mini2440 mounts linux folder via nfs
Next article:JZ2440--Patch and compile u-boot under Linux
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- The problem of being unable to sample data when using the 28335 ADC module to sample current
- FPGA_100 Days of Journey_Vending Machine
- About Allegro copper plating
- Draw dice at home
- Altium Designer 21.6.1 7 days of sharing
- Can such a demand be met?
- MS430G2755 Code transplantation process for MSPBoot
- Company products - rare problems with STM32 MCU ADC
- RT-Thread device framework learning I2C device
- Matrix-Vector Derivative Law