diff --git a/buildroot b/buildroot index 083c073..8ce27bb 160000 --- a/buildroot +++ b/buildroot @@ -1 +1 @@ -Subproject commit 083c0735e924e0d534328095a944ae159f661219 +Subproject commit 8ce27bb9fee80a406a4199657ef90e3c315e7457 diff --git a/buildroot_config_fragment b/buildroot_config_fragment index c3525bd..eddd131 100644 --- a/buildroot_config_fragment +++ b/buildroot_config_fragment @@ -1,3 +1,7 @@ +# Must match the Linux kernel source. +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.12" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_12=y + BR2_GLOBAL_PATCH_DIR="../global_patch_dir" BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="../kernel_config_fragment" BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment" diff --git a/kernel_module/anonymous_inode.c b/kernel_module/anonymous_inode.c index 2dd90a6..54d9f56 100644 --- a/kernel_module/anonymous_inode.c +++ b/kernel_module/anonymous_inode.c @@ -10,7 +10,6 @@ This method allows getting multiple file descriptors from a single filesystem, which reduces namespace pollution. */ -#include /* copy_from_user, copy_to_user */ #include #include #include /* EFAULT */ @@ -19,6 +18,7 @@ which reduces namespace pollution. #include /* min */ #include #include /* printk */ +#include /* copy_from_user */ #include "anonymous_inode.h" diff --git a/kernel_module/fops.c b/kernel_module/fops.c index 10e65db..23b4112 100644 --- a/kernel_module/fops.c +++ b/kernel_module/fops.c @@ -17,13 +17,13 @@ in drivers (syscalls being the other one). Here we use debugfs. */ -#include /* copy_from_user, copy_to_user */ #include #include /* EFAULT */ #include /* file_operations */ #include /* min */ #include #include /* printk */ +#include /* copy_from_user, copy_to_user */ #include /* S_IRUSR */ static struct dentry *debugfs_file; diff --git a/kernel_module/ioctl.c b/kernel_module/ioctl.c index e738d03..cd2f9f9 100644 --- a/kernel_module/ioctl.c +++ b/kernel_module/ioctl.c @@ -19,10 +19,10 @@ Documentation/ioctl/ioctl-number.txt has some info: - https://askubuntu.com/questions/54239/problem-with-ioctl-in-a-simple-kernel-module/926675#926675 */ -#include /* copy_from_user, copy_to_user */ #include #include #include /* printk */ +#include /* copy_from_user, copy_to_user */ #include "ioctl.h" diff --git a/kernel_module/irq.c b/kernel_module/irq.c index df23f80..654410f 100644 --- a/kernel_module/irq.c +++ b/kernel_module/irq.c @@ -30,11 +30,11 @@ Then see how clicking the mouse and keyboard affect the interrupts. This will po - 12: mouse click and drags */ -#include /* copy_from_user, copy_to_user */ #include #include #include #include +#include /* copy_from_user, copy_to_user */ #define NAME "lkmc_character_device" #define MAX_IRQS 256 diff --git a/kernel_module/mmap.c b/kernel_module/mmap.c index 72d8a34..140f924 100644 --- a/kernel_module/mmap.c +++ b/kernel_module/mmap.c @@ -14,13 +14,13 @@ Related: - https://github.com/ikwzm/udmabuf */ -#include /* copy_from_user */ #include #include #include /* min */ #include #include #include +#include /* copy_from_user, copy_to_user */ #include static const char *filename = "lkmc_mmap"; @@ -38,13 +38,14 @@ static void vm_close(struct vm_area_struct *vma) } /* First page access. */ -static int vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + int (*fault)(struct vm_fault *vmf); +static int vm_fault(struct vm_fault *vmf) { struct page *page; struct mmap_info *info; pr_info("vm_fault\n"); - info = (struct mmap_info *)vma->vm_private_data; + info = (struct mmap_info *)vmf->vma->vm_private_data; if (info->data) { page = virt_to_page(info->data); get_page(page); diff --git a/kernel_module/pci.c b/kernel_module/pci.c index 990d87b..3e43c79 100644 --- a/kernel_module/pci.c +++ b/kernel_module/pci.c @@ -66,7 +66,6 @@ TODO: does it have any side effects? Set in the edu device at: Use setpci, devmem and /sys. */ -#include /* put_user */ #include /* cdev_ */ #include #include @@ -74,6 +73,7 @@ Use setpci, devmem and /sys. #include #include #include +#include /* put_user */ /* https://stackoverflow.com/questions/30190050/what-is-base-address-register-bar-in-pcie/44716618#44716618 * diff --git a/kernel_module/pci_min.c b/kernel_module/pci_min.c index efcf5b1..76bf0ad 100644 --- a/kernel_module/pci_min.c +++ b/kernel_module/pci_min.c @@ -6,7 +6,6 @@ PCI driver for our minimal pci_min.c QEMU fork device. probe already does a mmio write, which generates an IRQ and tests everything. */ -#include #include #include #include @@ -14,6 +13,7 @@ probe already does a mmio write, which generates an IRQ and tests everything. #include #include #include +#include /* copy_from_user, copy_to_user */ #define BAR 0 #define CDEV_NAME "lkmc_hw_pci_min" diff --git a/kernel_module/poll.c b/kernel_module/poll.c index eebfcb2..8fd8b4d 100644 --- a/kernel_module/poll.c +++ b/kernel_module/poll.c @@ -6,7 +6,6 @@ Outcome: user echoes jiffies every second. https://stackoverflow.com/questions/30035776/how-to-add-poll-function-to-the-kernel-module-code/44645336#44645336 */ -#include /* copy_from_user, copy_to_user */ #include #include /* usleep_range */ #include /* EFAULT */ @@ -17,6 +16,7 @@ https://stackoverflow.com/questions/30035776/how-to-add-poll-function-to-the-ker #include #include #include /* printk */ +#include /* copy_from_user, copy_to_user */ #include /* wait_queue_head_t, wait_event_interruptible, wake_up_interruptible */ #include /* S_IRUSR */ diff --git a/kernel_module/seq_file.c b/kernel_module/seq_file.c index e269904..1e124ad 100644 --- a/kernel_module/seq_file.c +++ b/kernel_module/seq_file.c @@ -24,7 +24,6 @@ Bibliography: - https://stackoverflow.com/questions/25399112/how-to-use-a-seq-file-in-linux-modules */ -#include /* copy_from_user, copy_to_user */ #include #include /* EFAULT */ #include @@ -32,6 +31,7 @@ Bibliography: #include /* pr_info */ #include /* seq_read, seq_lseek, single_release */ #include /* kmalloc, kfree */ +#include /* copy_from_user, copy_to_user */ #include /* S_IRUSR */ static int max = 2; diff --git a/kernel_module/seq_file_single.c b/kernel_module/seq_file_single.c index a4205b4..a6c1708 100644 --- a/kernel_module/seq_file_single.c +++ b/kernel_module/seq_file_single.c @@ -8,13 +8,13 @@ This example behaves like a file that contains: cd */ -#include /* copy_from_user, copy_to_user */ #include #include /* EFAULT */ #include #include #include /* pr_info */ #include /* seq_read, seq_lseek, single_release */ +#include /* copy_from_user, copy_to_user */ #include /* S_IRUSR */ static struct dentry *debugfs_file; diff --git a/linux b/linux index 361bb62..ae140b6 160000 --- a/linux +++ b/linux @@ -1 +1 @@ -Subproject commit 361bb623671a52a36a077a6dd45843389a687a33 +Subproject commit ae140b613d7a51b6fc12ed066db162a2821bb031