在内核顶层Makefile中增加软链接

系统 Linux
由于最新内核头文件位置的改变,一些原有的驱动所包含的头文件会找不到,为了肢解使用旧有的驱动而不做太大改动,可以增加一个软连接......

由于***内核头文件位置的改变,一些原有的驱动所包含的头文件会找不到,为了肢解使用旧有的驱动而不做太大改动,可以增加一个软连接:

cd ../include/asm-arm/

ln -sf ../../arch/arm/mach-lpc32xx/include/mach/ arch

将arch/arm/mach-lpc32xx/include/mach/链接为include/asm-arm/arch,即

include/asm-arm/arch-->arch/arm/mach-lpc32xx/include/mach

这样,原有驱动中#include <mach/xxx.h>就可以使用了。

可以在编译之前手工建立这个链接,但是,一旦make distclean,这个手工建立的链接就会被清除掉,下次还得继续手工建立。这样很麻烦,为了方便,可以直接修改内核顶层的Makefile文件,增加蓝色部分的语句:

980 # We create the target directory of the symlink if it does

981 # not exist so the test in chack-symlink works and we have a

982 # directory for generated filesas used by some architectures.

983 define create-symlink

984     if [ ! -L include/asm ]; then                              \

985             echo '  SYMLINK $@ -> include/asm-$(SRCARCH)';     \

986             if [ ! -d include/asm-$(SRCARCH) ]; then           \

987                 mkdir -p include/asm-$(SRCARCH);           \

988             fi;                                                \

989             ln -fsn asm-$(SRCARCH) $@;                         \

990     fi

991     if [ ! -L include/asm-arm/arch ]; then \

992         cd $(TOPDIR)/include/asm-arm;\

993         ln -fs ../../arch/arm/mach-lpc32xx/include/mach  arch; \

994         cd $(TOPDIR)/; \

995     fi

996 endef

这样,在Make的时候就会自动建立这个软连接了。

【编辑推荐】

  1. 探索Linux内核虚拟机——学习KVM架构及其优点
  2. Linux下用gdb检测内核rootkit的方法
  3. Linux内核中的DeviceMapper机制
责任编辑:赵宁宁 来源: chinaitlab
相关推荐

2021-03-08 11:47:34

内核Linux内核模块

2010-03-01 16:40:40

Linux Makef

2010-02-25 15:11:48

Linux Makef

2011-08-16 16:20:33

Linuxkconfigmakefile

2011-06-03 09:26:11

2017-02-27 16:22:52

2023-11-15 08:27:46

Linux系统

2010-02-24 16:01:39

Linux Makef

2020-06-01 19:00:42

Linux软链接硬链接

2011-05-10 10:58:00

反向链接SEO

2021-12-15 10:02:25

鸿蒙HarmonyOS应用

2022-10-21 08:18:54

Linuxln 命令

2011-06-13 18:07:57

反向链接

2021-08-10 16:50:37

内核内存管理

2011-04-25 09:20:05

Linux内核

2010-02-25 17:56:39

Linux操作系统

2011-05-24 15:48:24

linux软路由路由

2021-06-18 08:15:37

Linux软链接硬链接

2011-06-23 15:56:46

反向链接

2018-02-24 12:17:56

C程序内存方式
点赞
收藏

51CTO技术栈公众号