You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ARMv8-a架构Raspbian编译PTEditor模块遇kmap_atomic隐式声明错误求助

Fixing kmap_atomic Implicit Declaration Error on ARMv8-a (Raspbian Buster)

This error pops up because kmap_atomic isn't required (and isn't exposed) on ARM64/ARMv8-a architectures. Unlike x86, ARM64's memory model keeps kernel page table pages permanently mapped in the virtual address space—so you don't need a temporary atomic mapping to access them.

Here's how to fix the issue while keeping cross-architecture compatibility:

  1. Update the __pte_map macro
    Replace your existing macro with a conditional version that handles both x86 and ARM64:

    #ifdef CONFIG_ARM64
    #define __pte_map(pmd) ((pte_t *)pmd_page_vaddr(*(pmd)))
    #else
    #define __pte_map(pmd) (pte_t *)kmap_atomic(pmd_page(*(pmd)))
    #endif
    

    pmd_page_vaddr() directly returns the virtual address of the page referenced by the PMD entry, which works natively on ARM64 without needing kmap_atomic.

  2. Clean up the unmap macro (if used)
    If your code includes a __pte_unmap macro to pair with kmap_atomic, add a conditional for ARM64 too (since no unmap operation is needed here):

    #ifdef CONFIG_ARM64
    #define __pte_unmap(pte) do { } while (0)
    #else
    #define __pte_unmap(pte) kunmap_atomic(pte)
    #endif
    
  3. Double-check your build configuration
    Ensure your Makefile targets ARM64 correctly. If cross-compiling, set these variables:

    ARCH=arm64
    CROSS_COMPILE=aarch64-linux-gnu-
    

    If building directly on the Raspberry Pi running Raspbian Buster, just make sure ARCH=arm64 is set in your build command or Makefile.

This change will keep your module working on x86 while resolving the ARMv8-a compilation error.

内容的提问来源于stack exchange,提问作者alireza sadeghpour

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 09:00:43