Skip to content

hiendang7613/OS-Linux-Kernel-Module-Lab3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HỆ ĐIỀU HÀNH

ĐÔ ÁN 3. TÌM HIỂU VÀ LẬP TRÌNH LINUX KERNEL MODULE

Hình thức: đồ án 3 sinh viên
Deadline: 23h55 ngày 23-12-2020
Nộp bài qua moodle môn học, đặt tên file nộp là MSSV1_MSSV2_MSSV3.zip/rar

Nội dung file nộp gồm: báo cáo những gì mình hiểu (trình bày trên MSWORD), readme của module đã code, và mã nguồn.

Nội dung đồ án:
Mục tiêu hiểu về Linux kernel module và hệ thống quản lý file và device trong linux, giao tiếp giữa tiến trình ở user space và code kernel space

  • Viết một module dùng để tạo ra số ngẫu nhiên.
  • Module này sẽ tạo một character device để cho phép các tiến trình ở userspace có thể open và read các số ngẫu nhiên.

TEST

  • Chạy với quyền root
> insmod mymodule.ko
> cat /dev/chardev0

image

BUILD & INSTALL MODULE

  • Viết Makefile
# ./Makefile
KDIR = /lib/modules/`uname -r`/build
all:
  make -C $(KDIR) M=`pwd`
clean:
  make -C $(KDIR) M=`pwd` clean
  • Viết Kbuild
# ./Kbuild
EXTRA_CFLAGS = -Wall
obj-m = mymodule.o
  • Biên dịch module
> gmake
  • Cài đặt module
> insmod mymodule.ko

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published