The invention discloses a compatible operation method for an Android camera HAL in a container based on memory access
virtualization, and the method comprises the steps: taking a DMA-Buf memory heap of a
Linux kernel host
system as a target memory heap, taking an
ION memory heap of an Android container
system as a source memory heap, building a process exclusive
memory management context, an FD cache table and a synchronous fence
pool, and carrying out the execution of the process exclusive
memory management context, the FD cache table and the synchronous fence
pool; kernel registration and node binding of virtual
ION equipment, pre-allocation of a first
memory pool and access hook registration of kernel layer equipment are completed, and when an
ION file descriptor is obtained in an HAL process, legality of a container process is verified, and context binding is initialized to the
file descriptor; intercepting a memory allocation request of the HAL process, analyzing and adapting parameters, and preferentially
multiplexing first
memory pool resources to obtain an ION
handle; when a
data sharing request is processed, matching an FD cache or generating a new FD through an ION
handle; when the HAL process releases the memory, resources are recycled according to a memory source, and when the HAL process exits, the context is cached or destroyed, so that cross-
system memory operation compatibility is realized.