zedboard--ubuntu12.04 (PC) under HelloWorld drive from failure to success process

Source: Internet
Author: User

Recently looking at the Linux device driver, write a simple HelloWorld program has taken me a long time, the specific process is as follows:

Write HELLOWORLD.C


Write makefile


Note that the commands in makefile are a tab, not multiple spaces, and the name of the source file should not be written incorrectly, and then make, which appears with the following errors Make-c/lib/modules/3.8.0-29-generic/build m=/home /linux/helloworld Modules
MAKE[1]: Entering directory '/usr/src/linux-headers-3.8.0-29-generic '
CC [M]/home/linux/helloworld/helloworld.o
In the file included from include/linux/types.h:5:0,
From Include/linux/init.h:5,
From/home/linux/helloworld/helloworld.c:1:
Include/uapi/linux/types.h:4:23:fatal error:asm/types.h:no such file or directory
Compilation terminated.
MAKE[2]: * * * [/HOME/LINUX/HELLOWORLD/HELLOWORLD.O] Error 1
MAKE[1]: * * * [_module_/home/linux/helloworld] Error 2
MAKE[1]: Leaving directory '/usr/src/linux-headers-3.8.0-29-generic '
Make: * * * [default] Error 2


PC Linux running HelloWorld drive without the need to recompile the kernel, and then prompted the lack of files, and then look at the following is really missing files, so I installed a virtual machine under Windows, Use is also ubuntu12.04, about the installation can see my uploaded resources, will this HELLOWORLD.C and makefile copy under the virtual machine under Ubuntu, run make, appear


LS to see the resulting file as follows:


You can see that nothing has changed, but here it has been made successful. It seems that there are some defects in the installation system with Wubi.

Insmod./helloworld.ko load driver, no print information,/var/log/syslog can be seen under the print information, attention is not under the/var/log/messages Oh. After Vim/var/log/syslog Press G, jump to the back, look at the picture below


In this way, the PC ubuntu12.04 under the HelloWorld drive on the normal running up.


Note: The above is published on October 15, but only on October 17 to find out the real reason, the process above as a memory, the following on the wrong understanding of the above to correct.

First: The above mentioned the PC's Ubuntu (not the virtual machine, that is, the Wubi installed Ubuntu), the compiler HelloWorld driver is not successful, this is really no need to compile the kernel, the above error is because he was made when the use of a cross-compilation environment, Rather than GCC. In the modification of the


Note to the following 3 lines, make is successful. This is not the problem that Wubi installs the Ubuntu system. Note: The modified file is/ETC/BASH.BASHRC, then you must restart the terminal after the modification.


The process of discovering the problem:

October 15, installed a virtual machine, the successful operation of the HelloWorld driver, there will be the above documents, and then the virtual machine installed a cross-compilation tool, on the 17th when the compilation of errors again, the original success of things and mistakes, I think it is the problem here, come, Installation of the above modification is successful, not easy Ah, rookie.


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.