How to build last kernel linux(6.6.6) for JP6?

WIP:
There are some errors in driver.c and mem_mgmt_utils.c with linux 6.6.7 that I fixed. When I have all errors fixed in drivers, and kernel working I will share it.
errors:
Error in driver.c: The error struct class has no member named ‘owner’ suggests that the class structure in the kernel you are compiling against does not have an owner field. This field was removed in recent Linux kernel versions. To resolve this, you can simply remove the line setting the owner field, as it’s no longer needed.

So, in your driver.c file, you can comment out or remove the line:
FIX:

hwpm_linux->class.owner = THIS_MODULE;

Error in mem_mgmt_utils.c: The error related to get_user_pages function indicates a change in the API of this function in newer kernel versions. The newer get_user_pages function has a reduced number of arguments. You’ll need to update the usage of get_user_pages to match the current kernel API.
FIX:

/* ... [previous code] ... */

/* Calculate the number of pages */
alist_buf_size = tegra_hwpm_safe_add_u64(offset, alist_buf_size);
alist_buf_size = tegra_hwpm_safe_sub_u64(
    tegra_hwpm_safe_add_u64(alist_buf_size, PAGE_SIZE), 1ULL);
hwpm->alist_map->num_pages = alist_buf_size / PAGE_SIZE;

/* Allocate memory for the pages array */
hwpm->alist_map->pages = (struct page **)tegra_hwpm_kcalloc(
    hwpm, hwpm->alist_map->num_pages, sizeof(struct page *));
if (!hwpm->alist_map->pages) {
    tegra_hwpm_err(hwpm, "Couldn't allocate memory for pages array");
    err = -ENOMEM;
    goto fail;
}

/* Set up get_user_pages call */
unsigned int gup_flags = 0; // Modify as needed based on your use case
pinned_pages = get_user_pages(user_va & PAGE_MASK, hwpm->alist_map->num_pages, gup_flags, hwpm->alist_map->pages);
if (pinned_pages != hwpm->alist_map->num_pages) {
    tegra_hwpm_err(hwpm, "Requested %llu pages / Got %ld pages",
        hwpm->alist_map->num_pages, pinned_pages);
    err = -ENOMEM;
    goto fail;
}

/* ... [rest of the function] ... */

WIP:

error oot driver:

  1. vm_flags Assignment Error:
  • The error assignment of read-only member ‘vm_flags’ suggests that the code is trying to modify a read-only structure member. Recent kernel versions may have made vm_flags read-only to prevent direct modification.
  • Solution: You might need to modify the driver code to use appropriate kernel APIs or mechanisms to achieve the desired functionality without directly modifying vm_flags.
  1. pci_disable_pcie_error_reporting Implicit Declaration:
  • This error suggests that the function pci_disable_pcie_error_reporting is not available or declared in the current kernel headers.
  • Solution: Check if this function is available in your kernel version. If not, you may need to update the driver code to use an alternative method or conditional compilation.
  1. iommu_map Function Signature Mismatch:
  • The iommu_map function’s signature has changed in recent kernel versions, and your driver code seems to be using an outdated signature.
  • Solution: Update the calls to iommu_map in the driver code to match the signature in your kernel version. Check the iommu.h header file for the correct signature.
  1. register_shrinker Signature Mismatch:
  • Similar to iommu_map, it seems that register_shrinker’s signature in your driver does not match that in the kernel.
  • Solution: Update the register_shrinker call in the driver code to match the kernel’s expected signature.