Unix/linux Environment C Programming Introductory Tutorial (OPENSUSECCPP) and Linux kernel-driven development environment building

Source: Internet
Author: User


1. openSUSE is a great Linux game.


2. Select the default virtual machine


3. Select Install the operating system later


4. Select Linux openSUSE


5. Select the default virtual machine name

6. Set the processor to dual core.

7. Memory set to 2G


8. Select Network Address Translation


9. Setting up the IO controller


10. Select the default disk type


11. Create a new virtual disk


12. Set the disk size

13. Select the path to save the virtual disk


14. Complete Virtual Machine creation


15. Setting up a virtual machine


16. Select the openSUSE image



17. Turn on the virtual machine

18. Virtual Machine Startup

19. Installing openSUSE

20. Installation program Loading

21. System Startup


22. In System initialization

23. Select Chinese to start the installation

24. Consent Agreement

25. Click Next to complete the two-step

26. Click Next


27. Synchronizing N TP Server

28. Click Next


29. Select KDE Desktop

30. Set Account password


31. Start the analysis system

32. Start installing the Software

33. Select all the options


D/C + + development

Linux kernel-Driven development


34. Start the installation

35. In the installation

36. When the installation is in progress

37. Installation Complete Entry interface

38. Write a C-language HelloWorld

39. Start the terminal

40. Enter the path

41. Compile execution

42. Write a C + + code 1,CC

43. Print statements, C + +

44. Print out the results

45. Drive HelloWorld


#include <linux/init.h>//driver initialization

#include <linux/module.h>//Drive Module

Module_license ("Dual BSD/GPL");//Follow the Linux protocol

static int hello_init (void)

{

PRINTK (Kern_alert "Hello, world\n");//Print driver information

return 0;

}

static void Hello_exit (void)

{

PRINTK (Kern_alert "Goodbye, cruel world\n");//Print driver information

}

Module_init (hello_init);//Print driver initialization information

Module_exit (hello_exit);//print driver end information

46.Q Driver compilation options, note all,clean The following actions are preceded by the TAB key


PWD = $ (shell pwd)

KERNEL_SRC =/lib/modules/$ (Shell uname-r)/build

Obj-m: = hello.o

MODULE-OBJS: = hello.o

All

$ (make)-C $ (KERNEL_SRC) m=$ (PWD) modules

Clean

RM *.ko

RM *.O

47. Compiler driver

48 Super Admin Load Driver


49 See driver output

50 Uninstall the driver and view


51 Drive exits.


52 Times All drives

53. Driver List

54.

This time the openSUSE ccpp and Linux kernel-driven development environment to build the completion, I hope you seriously practice.

Related Article

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.