内核添加第三方驱动遇阻,求BCM2709平台定义文件相关协助
Hey Jonny, let's work through these two stuck points together—they're common hurdles when adding third-party drivers to legacy ARM platforms:
1. Verifying the BCM2709 Platform Definition File
You’re on the right track! For older Linux kernel versions (typically 4.x and earlier) that rely on the legacy platform bus system, the BCM2709 platform definition file is indeed located at arch/arm/mach-bcm2709/bcm2709.c.
A quick way to confirm: Check your kernel source tree’s arch/arm/mach-bcm2709/ directory—if that file exists, you’ve got the correct path. Note that newer kernels (5.x+) often prefer device tree overlays over hardcoded platform definitions, but if your driver guide explicitly references modifying this file, stick with your original assumption.
2. Including the pn5xx_i2c.h Header File
When adding the header include to bcm2709.c, keep these key considerations in mind:
- Path correctness: If
pn5xx_i2c.hcomes with the third-party driver, make sure the include path matches its location. For example:- If it’s integrated into the kernel’s NFC subsystem (e.g.,
drivers/nfc/pn5xx/), use#include <linux/pn5xx_i2c.h> - If it’s an external driver, add its directory to the kernel’s include path via your driver’s Makefile:
ccflags-y += -I$(src)/path/to/header-directory
- If it’s integrated into the kernel’s NFC subsystem (e.g.,
- Dependency checks: Before compiling, ensure the PN5xx driver is enabled in your kernel configuration (use
make menuconfigto find it under the NFC subsystem). Missing config flags can trigger "undefined reference" errors even if the header is included correctly. - Compile workarounds: If you hit incomplete type definition errors, you might need to add forward declarations for structs from
pn5xx_i2c.hinbcm2709.c—though this is a last resort; prioritize fixing the include path first.
内容的提问来源于stack exchange,提问作者Jonny

