From e748480324d18efb368aa576ac4782990a9fe736 Mon Sep 17 00:00:00 2001 From: Ryan Herbst Date: Tue, 13 Feb 2024 11:26:10 -0800 Subject: [PATCH] Update state --- data_gpu/driver/nvidia-ko-to-module-symvers | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 data_gpu/driver/nvidia-ko-to-module-symvers diff --git a/data_gpu/driver/nvidia-ko-to-module-symvers b/data_gpu/driver/nvidia-ko-to-module-symvers new file mode 100755 index 0000000..662731b --- /dev/null +++ b/data_gpu/driver/nvidia-ko-to-module-symvers @@ -0,0 +1,24 @@ +#!/bin/bash + +syms=() +syms+=(nvidia_p2p_init_mapping) +syms+=(nvidia_p2p_destroy_mapping) +syms+=(nvidia_p2p_get_pages) +syms+=(nvidia_p2p_put_pages) +syms+=(nvidia_p2p_free_page_table) +syms+=(nvidia_p2p_dma_map_pages) +syms+=(nvidia_p2p_dma_unmap_pages) + +nvidia_ko_fn="$1" +symvers_fn="$2" + +touch "${symvers_fn}" +for sym in "${syms[@]}"; do + crc="$(objdump -t "${nvidia_ko_fn}" | grep "__crc_${sym}" | awk '{print $1}')" + if [ -z "${crc}" ]; then + echo "Warning: Can't find symbol ${sym} in ${nvidia_ko_fn}; assuming CONFIG_MODVERSIONS=n so setting CRC=0" + crc=00000000 + fi + sed -i '/${sym}/d' "${symvers_fn}" + echo "0x${crc} ${sym} ${nvidia_ko_fn} EXPORT_SYMBOL" >> ${symvers_fn} +done