KBUILD_NAME

阅读数:180 评论数:0

跳转到新版页面

分类

Linux

正文

这个宏定义,可以在内核源码的script目录查看Makefile.lib文件。

# These flags are needed for modversions and compiling, so we define them here
# $(modname_flags) defines KBUILD_MODNAME as the name of the module it will
# end up in (or would, if it gets compiled in)
# Note: Files that end up in two or more modules are compiled without the
#       KBUILD_MODNAME definition. The reason is that any made-up name would
#       differ in different configs.
name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)
basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
modname_flags  = $(if $(filter 1,$(words $(modname))),\
                 -DKBUILD_MODNAME=$(call name-fix,$(modname)))

而modname参考Makefile.build文件

# Default for not multi-part modules
modname = $(basetarget)
$(multi-objs-m)         : modname = $(modname-multi)
$(multi-objs-m:.o=.i)   : modname = $(modname-multi)
$(multi-objs-m:.o=.s)   : modname = $(modname-multi)
$(multi-objs-m:.o=.lst) : modname = $(modname-multi)
$(multi-objs-y)         : modname = $(modname-multi)
$(multi-objs-y:.o=.i)   : modname = $(modname-multi)
$(multi-objs-y:.o=.s)   : modname = $(modname-multi)
$(multi-objs-y:.o=.lst) : modname = $(modname-multi)

而basetarget位于Kbuild.include

# filename of target with directory and extension stripped
basetarget = $(basename $(notdir $@))

modname-multi位于Makefile.lib

# Finds the multi-part object the current object will be linked into
modname-multi = $(sort $(foreach m,$(multi-used),\
        $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))

 




相关推荐

mainline 、longterm、stable、linux-next、snapshot这些名词,都是linux kernel sou

__CONCAT,连接两个参数,##用于粘贴两个参数,#用于替换参数 #define __CONCAT(a, b) a ##

<img src="http://123.56.17.129:2177/images/linux_kernel.png" alt="" /

在编程中,一个符号symbol是一个程序的创建块,它是一个变量名或一个函数名。 内核符号表(Kernel Symbol Table) 内核并不使用符号名。它是通过

在Kernel_path/Makefile中可以查看到 # SPDX-License-Identifier: GPL

内核通过 printk() 输出的信息具有日志级别 #define KERN_SOH "\001" /* ASCI

一、概述  在日常工作中,经常会需要对内核进行Debug、或者进行优化工作。一些简单的问题,可以通过dmesg/printk查看,优化借助一些工具进行。 但是当问题逻辑复杂,优化面宽泛的时候,往往无从

这个宏的作用是保持参数在stack中。查看arch/x86/include/asm/linkage.h里面的定义 #ifdef

上图是Intel手册中对标志寄存器的图示,几个

一、概述 自从Linux内核代码迁移到Git以来,Linux内核配置/构建系统(也称为Kconfig / kbuild)已存在很长时间了。 二、Kconfig (Kernel config) menu