linux--源码学习makefile

1、内核中的makefile

内核中的每个模块下都存在makefile,用于编译内核模块,以sample/watchdog为例

-rw-r--r-- 1 root root 127 Mar 27 13:41 Makefile
-rw-r--r-- 1 root root 382 Mar 27 13:41 watchdog-simple.c
[root@VM_0_11_centos watchdog]# pwd
/home/kernel_source/linux/samples/watchdog
[root@VM_0_11_centos watchdog]#
# SPDX-License-Identifier: GPL-2.0
CC := $(CROSS_COMPILE)gcc
PROGS := watchdog-simple

all: $(PROGS)

clean:
        rm -fr $(PROGS)
[root@VM_0_11_centos watchdog]# ll
total 20
-rw-r--r-- 1 root root  127 Mar 27 13:41 Makefile
-rwxr-xr-x 1 root root 8624 Mar 29 01:56 watchdog-simple
-rw-r--r-- 1 root root  382 Mar 27 13:41 watchdog-simple.c
[root@VM_0_11_centos watchdog]#

2、clean

[root@VM_0_11_centos watchdog]# ll
total 20
-rw-r--r-- 1 root root  127 Mar 27 13:41 Makefile
-rwxr-xr-x 1 root root 8624 Mar 29 01:56 watchdog-simple
-rw-r--r-- 1 root root  382 Mar 27 13:41 watchdog-simple.c
[root@VM_0_11_centos watchdog]# make clean
rm -fr watchdog-simple
[root@VM_0_11_centos watchdog]# ll
total 8
-rw-r--r-- 1 root root 127 Mar 27 13:41 Makefile
-rw-r--r-- 1 root root 382 Mar 27 13:41 watchdog-simple.c
[root@VM_0_11_centos watchdog]#

3、Kconfig

Kconfig的作用:Kconfig用来配置内核,它就是各种配置界面的源文件,内核的配置工具读取各个Kconfig文件,生成配置界面供开发人员配置内核,最后生成配置文件.config

# SPDX-License-Identifier: GPL-2.0-only
#
# Network configuration
#

menuconfig NET
        bool "Networking support"
        select NLATTR
        select GENERIC_NET_UTILS
        select BPF
        ---help---
          Unless you really know what you are doing, you should say Y here.
          The reason is that some programs need kernel networking support even
          when running on a stand-alone machine that isn't connected to any
          other computer.

          If you are upgrading from an older kernel, you
          should consider updating your networking tools too because changes
          in the kernel and the tools often go hand in hand. The tools are
          contained in the package net-tools, the location and version number
          of which are given in <file:Documentation/Changes>.

          For a general introduction to Linux networking, it is highly
          recommended to read the NET-HOWTO, available from
          <http://www.tldp.org/docs.html#howto>.

if NET

config WANT_COMPAT_NETLINK_MESSAGES
        bool
        help
          This option can be selected by other options that need compat
          netlink messages.

config COMPAT_NETLINK_MESSAGES
        def_bool y
        depends on COMPAT
        depends on WEXT_CORE || WANT_COMPAT_NETLINK_MESSAGES
        help
          This option makes it possible to send different netlink messages
          to tasks depending on whether the task is a compat task or not. To
          achieve this, you need to set skb_shinfo(skb)->frag_list to the
          compat skb before sending the skb, the netlink code will sort out
          which message to actually pass to the task.

          Newly written code should NEVER need this option but do
          compat-independent messages instead!

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值