linux内核模块的编译,Linux内核模块编译方式

一、加入Konfig方式,make menuconfig添加

Konfig

#

# 802.1d Ethernet Bridging

#

config BRIDGE

tristate "802.1d Ethernet Bridging"

select LLC

select STP

depends on IPV6 || IPV6=n

---help---

If you say Y here, then your Linux box will be able to act as an

Ethernet bridge, which means that the different Ethernet segments it

is connected to will appear as one Ethernet to the participants.

Several such bridges can work together to create even larger

networks of Ethernets using the IEEE 802.1 spanning tree algorithm.

As this is a standard, Linux bridges will cooperate properly with

other third party bridge products.

In order to use the Ethernet bridge, you'll need the bridge

configuration tools; see for location. Please read the Bridge mini-HOWTO for more

information.

If you enable iptables support along with the bridge support then you

turn your bridge into a bridging IP firewall.

iptables will then see the IP packets being bridged, so you need to

take this into account when setting up your firewall rules.

Enabling arptables support when bridging will let arptables see

bridged ARP traffic in the arptables FORWARD chain.

To compile this code as a module, choose M here: the module

will be called bridge.

If unsure, say N.

config BRIDGE_IGMP_SNOOPING

bool "IGMP/MLD snooping"

depends on BRIDGE

depends on INET

default y

---help---

If you say Y here, then the Ethernet bridge will be able selectively

forward multicast traffic based on IGMP/MLD traffic received from

each port.

Say N to exclude this support and reduce the binary size.

If unsure, say Y.Makefile

#

# Makefile for the IEEE 802.1d ethernet bridging layer.

#

obj-$(CONFIG_BRIDGE) += bridge.o

bridge-y:= br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \

br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o \

br_stp_if.o br_stp_timer.o br_netlink.o

bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o

bridge-$(CONFIG_BRIDGE_NETFILTER) += br_netfilter.o

bridge-$(CONFIG_BRIDGE_IGMP_SNOOPING) += br_multicast.o

obj-$(CONFIG_BRIDGE_NF_EBTABLES) += netfilter/

二、直接make

obj-m := bridge.o

bridge-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o br_stp_if.o br_stp_timer.o br_netlink.o

PWD := $(shell pwd)

KERNELDIR := ~/mt5860_cn_android_512/rel/obj/kernel/chiling/kernel/linux-3.0/mt5880_android_smp_mod_defconfig_modules

#注意上处路径为编译过的kernel路径,不能为没编译过的

CROSS_COMPILE := /mtkoss/gnuarm/vfp_4.5.1_2.6.27_cortex-a9-rhel4/i686/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-

#注意上述为交叉编译时指定

ARCH:=arm

default:

$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(PWD) modules

# cp -rf mini.ko ../module/

# cp -rf lddbus.ko ../module/

clean:

rm *.mod.c *.o *.ko *.bak modules.* Module.*

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值