操做系統是管理硬件資源,爲上層庫與軟件提供接口系統軟件。html
序號 | 描述 | 連接 |
01 | 內核構建系統 | http://www.cnblogs.com/elewei/p/8244895.html |
02 | 進程 | http://www.cnblogs.com/elewei/p/4740512.html |
03 | 線程 | http://www.cnblogs.com/elewei/p/8151516.html |
04 | 進程間通訊 | http://www.cnblogs.com/elewei/p/8157793.html |
05 | 內存管理 | |
06 | 文件系統 | http://www.cnblogs.com/elewei/p/7765716.html |
07 | 網絡 | http://www.cnblogs.com/elewei/p/8079470.html |
08 | 字符驅動 | http://www.cnblogs.com/elewei/p/8214379.html |
09 | 內核調式技術 | http://www.cnblogs.com/elewei/p/8227903.html |
10 | 競爭與併發 | http://www.cnblogs.com/elewei/p/8228142.html |
11 | Linux服務器初始化配置 | http://www.cnblogs.com/elewei/p/5968846.html |
3. 基於Windows操做系統linux
序號 | 描述 | 連接 |
01 | Windows服務 | http://www.cnblogs.com/elewei/p/8677052.html |
4. 操做系統軟件shell
操做系統設置服務器
序號 | 描述 | 連接 |
01 | CentOS 初始化配置 | https://www.cnblogs.com/elewei/p/5968846.html |
序號 | 描述 | 連接 |
01 | CentOS 初始配置 | https://www.cnblogs.com/elewei/p/5968846.html |
02 | Ubuntu LAMP環境 | https://www.cnblogs.com/elewei/p/10036951.html |
<Understanding the Linux Kernel> Daniel P.Bovet && Marco Cesati網絡
<Linux Device Drivers> Jonathan Corbet併發
<Linux Kernel Development> Robert Loveelectron
<Advance Programming in the UNIX Environment> W. Richard Stevenside
<深刻理解Linux虛擬內存管理>網站
<深刻理解Linux網絡內幕>ui
BSD操做系統
https://cis.temple.edu/~ingargio/old/cis307s96/
經典網站:
https://www.infradead.org/~mchehab/kernel_docs/index.html
http://www.elinux.org/ Embeded Linux WiKi
http://kerneltrap.org/
https://www.linux.com/
https://kernelnewbies.org/Documents
https://lwn.net/Kernel/Index/
http://www.tldp.org/
http://www.kerneltravel.net/
http://www.daimabus.com/
Linux 郵件列表
http://fxr.watson.org/
http://elixir.free-electrons.com/linux/latest/source 內核源碼
https://www.win.tue.nl/~aeb/linux/lk/lk.html#toc3
https://wiki.linuxfoundation.org/networking/start
https://kernelnewbies.org/KernelBuild 內核編譯
http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/
內核區分與服務
三類驅動
* 字符設備
* 塊設備
* 網絡接口
一個Hello World 模塊
/** * @file hello.c * @author elewei * @date 2017/01/06 * @version 0.2 * @brief 一個Linux Hello World 模塊! * 當調用insmod加載內核模塊時,在/var/log/kern.log文件中顯示消息 * 模塊能夠添加一個參數, Hello name * @see http://www.cnblogs.com/elewei/p/7688444.html 查看詳細信息 */ #include <linux/init.h> // Macros used to mark up functions e.g., __init __exit #include <linux/module.h> // Core header for loading LKMs into the kernel #include <linux/kernel.h> // Contains types, macros, functions for the kernel MODULE_LICENSE("GPL"); // < The license type -- this affects runtime behavior MODULE_AUTHOR("Elewei"); // < The author -- visible when you use modinfo MODULE_DESCRIPTION("A simple Linux driver module example"); ///< The description -- see modinfo MODULE_VERSION("0.2"); ///< The version of the module static char *name = "world"; ///< An example LKM argument -- default value is "world" module_param(name, charp, S_IRUGO); ///< Param desc. charp = char ptr, S_IRUGO can be read/not changed MODULE_PARM_DESC(name, "The name to display in /var/log/kern.log"); ///< parameter description /** @brief The LKM initialization function * The static keyword restricts the visibility of the function to within this C file. The __init * macro means that for a built-in driver (not a LKM) the function is only used at initialization * time and that it can be discarded and its memory freed up after that point. * @return returns 0 if successful */ static int __init hello_init(void){ printk(KERN_INFO "EBB: Hello %s from the BBB LKM!\n", name); return 0; } /** @brief The LKM cleanup function * Similar to the initialization function, it is static. The __exit macro notifies that if this * code is used for a built-in driver (not a LKM) that this function is not required. */ static void __exit hello_exit(void){ printk(KERN_INFO "EBB: Goodbye %s from the BBB LKM!\n", name); } /** @brief A module must use the module_init() module_exit() macros from linux/init.h, which * identify the initialization function at insertion time and the cleanup function (as * listed above) */ module_init(hello_init); module_exit(hello_exit);
Makefile
// Makefile obj-m += hello.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
上面的Makefile能夠這樣寫
# 若是KERNELRELEASE已經定義, 能夠從內核編譯系統調用
ifneq ($(KERNELRELEASE),)
obj-m := hello.o
# 不然直接從命令行調用內核編譯系統
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
第一步:編譯內核
make
第二步:插入模塊
insmod ./hello.ko
第三步:查看模塊
lsmod
第四步:移除模塊
rmmod hello
#include<stdio.h> #include<unistd.h> #include<stdlib.h> int main(void) { int pid; pid=fork(); if(pid==0) { printf("This is child process,pid=%d,bye!\n",getpid()); exit(0); } sleep(1); printf("Press return to remove zombie process\n"); getchar(); wait(NULL); printf("Press return to exit\n"); getchar(); return 0; }