Linux Essentials
编译 使用 LLVM 编译内核 (需要安装 llvm 工具链): make mrproper make LLVM=1 ARCH=arm defconfig make LLVM=1 ARCH=arm Image -j12 生成 compile_commands.json: cd scripts/clang-tools/ ./gen_compile_commands.py -d ../.. # linux根目录 mv compile_commands.json ../.. NOT indexed include <asm/xxx.h> 先找 arch/xxx/include/xxx.h,没有的话就找/include/asm-generic/xxx.h 从 dts 中获取 regs 地址并映射到 virtual address: linux5.10: void __iomem *devm_platform_get_and_ioremap_resource(struct platform_device *pdev, unsigned int index, struct resource **res) linux5.4: void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev, unsigned int index) 相当于 platform_get_resource + devm_request_mem_region + devm_ioremap...