summaryrefslogtreecommitdiff
path: root/md
diff options
context:
space:
mode:
Diffstat (limited to 'md')
-rw-r--r--md/notes/kernel/create_sysfs_entry.md16
-rw-r--r--md/notes/kernel/irq_handler.md64
-rw-r--r--md/notes/kernel/topics.md25
3 files changed, 99 insertions, 6 deletions
diff --git a/md/notes/kernel/create_sysfs_entry.md b/md/notes/kernel/create_sysfs_entry.md
new file mode 100644
index 0000000..2af3cca
--- /dev/null
+++ b/md/notes/kernel/create_sysfs_entry.md
@@ -0,0 +1,16 @@
+title:Create sysfs entry
+keywords:kernel,linux,threads
+
+# Create sysfs entry
+
+## Starting point
+
+
+## Links
+
+https://man7.org/linux/man-pages/man5/sysfs.5.html
+https://embetronicx.com/tutorials/linux/device-drivers/sysfs-in-linux-kernel/
+https://elixir.bootlin.com/linux/v6.1.64/source/include/linux/sysfs.h
+https://docs.kernel.org/filesystems/sysfs.html
+
+
diff --git a/md/notes/kernel/irq_handler.md b/md/notes/kernel/irq_handler.md
new file mode 100644
index 0000000..a4ce3cd
--- /dev/null
+++ b/md/notes/kernel/irq_handler.md
@@ -0,0 +1,64 @@
+title:IRQ handler
+keywords:kernel,linux,irq
+
+# IRQ handler
+
+Lets extend hello world driver.
+
+## Starting point
+
+__Makefile__
+```Makefile
+obj-m += procfs_entry.o
+
+KDIR ?= /lib/modules/$(shell uname -r)/build
+
+all:
+ make -C $(KDIR) M=$(PWD) modules
+
+clean:
+ make -C $(KDIR) M=$(PWD) clean
+```
+
+__procfs_entry.c__
+```c
+#include <linux/module.h> /* Needed by all modules */
+#include <linux/kernel.h>
+
+int procfs_entry_init( void )
+{
+ printk(KERN_DEBUG "Hello Procfs!\n");
+ return 0;
+}
+
+void procfs_entry_exit( void )
+{
+ printk(KERN_DEBUG "Exit Procfs!\n");
+}
+
+module_init( procfs_entry_init );
+module_exit( procfs_entry_exit );
+
+MODULE_LICENSE("GPL");
+```
+
+
+
+## List of procfs functions used
+
+| Function name | Note |
+|---|---|
+| proc_mkdir | Create procfs directory |
+| proc_create | Create procfs file |
+| proc_remove | Remove procfs entry |
+
+## Final result
+
+
+
+## Links
+
+
+
+
+
diff --git a/md/notes/kernel/topics.md b/md/notes/kernel/topics.md
index 5f39355..86ce50c 100644
--- a/md/notes/kernel/topics.md
+++ b/md/notes/kernel/topics.md
@@ -3,20 +3,33 @@ keywords:blog,projects
#
-Linux kernel programming topics
+Linux kernel programming topics, mostly for those who have some programming
+experience and linux command line expertise. Making notes on all fundamental
+kernel API's.
## Topic
+### Basics
+
[Compile kernel](/writeup/compile_linux_kernel.md)
[Hello world driver](/writeup/kernel_hello_world.md)
-<!-- DMA programming -->
[Create thread](/notes/kernel/create_thread.md)
-<!-- Sysfs -->
+[Sysfs](/notes/kernel/create_sysfs_entry.md)
[Procfs](/notes/kernel/create_procfs_entry.md)
+[User mode helpers](/notes/kernel/usermode_helper.md)
+
<!-- Ramfs -->
-<!-- Systemcalls -->
+<!-- Add new syscall -->
<!-- Write files to user space -->
<!-- Read files from user space -->
+<!-- Create character device -->
+<!-- Create netfilter firewall -->
+<!-- DMA programming -->
+
+### Intermediate
+
+[Kernel /dev/hwrng](/writeup/kernel_dev_hwrng.md)
<!-- Netlink -->
-<!--[User mode helpers](/notes/kernel/usermode_helper.md) -->
-[Kernel /dev/hwrng](/writeup/kernel_dev_hwrng.md)
+
+### Deep into kernel
+