20135314 Zhu Hengzhi-Experiment Four

Source: Internet
Author: User

Beijing Institute of Electronic Technology (BESTI)

Real Inspection report

Course: Cryptographic system design Basic class: 1353

Name: Zhu Hengzhi

Study No.: 20135314

Score: Instructor: Lou Jia Peng Experimental Date: 2015.11.17

Experiment level: Preview degree: Experiment time: 15:30~17:30

Instrument Group: 4 Compulsory/elective: Compulsory experiment serial number: 14

Experiment Name: Introduction to kernel-driven design-module-driven experiment

Experiment purpose and Requirement: Mastering the process of driving development and debugging by using module mode

Experimental instrument:

Name

Model

Number

ARM Development Board

Up-tech

1

Lenovo Computer

1

Experimental content, steps:

1. Read and understand the source code

Go to/arm2410cl/exp/drivers/demo and read the source code using the VI editor or other editor.

2. Compile driver module and test program

There are two ways to compile in Makefile, you can use GCC on this computer, or you can use the cross compiler

To compile, here we only introduce the results of using GCC.

[Email protected]/]# cd/arm2410cl/exp/drivers/demo/

[[email protected] demo]# make

Gcc-c-I.. -wall-o-d__kernel__-dmodule-i/usr/src/linux/include Demo.c-o demo.o

Demo.c:108:warning:initialization from incompatible pointer type

Gcc-c-I.. -wall-o-d__kernel__-dmodule-i/usr/src/linux/include Hello.c-o hello.o

Gcc-i. -wall-o-d__kernel__-dmodule-i/usr/src/linux/include-c-o test_demo.o test_demo.c

GCC Test_demo.o-o Test_demo

Note: If there is a problem with compiling, it may be that a Linux connection is not established under/USR/SRC, you can use

The following command:

[Email protected] demo]# cd/usr/src/

[Email protected] src]# LN-SF linux-2.4.20-8 Linux

[[email protected] src]# ls

Debug Linux linux-2.4 linux-2.4.20-8 redhat

3. Test driver

If you compile with GCC, you need to set up the device node with the following command, and if you use a cross-compiler, you do not need to establish a device node.

#mknod/dev/demo C 254 0

The first step is to insert the driver module DEMO.O, then you can use the Lsmod command to see if the module has been inserted, without

You can also use the Rmmod command to unload the module when using the module.

[Email protected] demo]# Insmod demo.o

Warning:loading DEMO.O would taint the Kernel:no license

See http://www.tux.org/lkml/#export-tainted For information about tainted modules

Module Demo loaded with warnings

The following tests are performed using the test program, following the success of the previous steps, as shown below:

[Email protected] demo]#./test_demo

Write bytes Data To/dev/demo

0:0 1 2 3

1:4 5 6 7

2:8 9 10 11

3:12 13 14 15

4:16 17 18 19

5:20 21 22 23

6:24 25 26 27

Beijing Universal pioneering technology co.,ltd.

236

tel:010-82110740 82110741 82110742 82110743

FAX: Switchboard ext. 828

Http://www.up-tech.com

Bo Chong Technology (Up-tech)

7:28 29 30 31

*****************************************************

Read bytes Data From/dev/demo

0:31 30 29 28

1:27 26 25 24

2:23 22 21 11

3:12 13 14 15

4:16 17 18 19

5:20 10 9 8

6:7 6 5 4

7:3 2 1 0

*****************************************************

If the module is not successfully inserted, the following situation occurs:

[Email protected] demo]#./test_demo

# # # #DEMO Device Open fail####

After the driver module is successfully inserted, a device file called demo is created under/dev and we can

Use the cat command to directly invoke the Read function to test the reading process.

[Email protected] demo]# Cat/dev/demo

Device Open success!

Experiment Experience:

Makefile error, enter the reference below to modify:

Kerneldir =/usr/src/linux

#KERNELDIR =/arm2410cl/kernel/linux-2.4.18-2410cl/

Includedir = $ (kerneldir)/include

#CROSS_COMPILE =armv41-unknown-linux-

20135314 Zhu Hengzhi-Experiment Four

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.