view rathaxes_fix_lkm_sample_build.patch @ 7:eead270c9bb6

WIP on the LKM sample, we just need #include to work to make it compile
author Louis Opter <louis@lse.epitech.net>
date Fri, 06 Jan 2012 11:45:25 +0100
parents
children
line wrap: on
line source

# HG changeset patch
# Parent 563beffa32c982c746f6e26be2c89cab7b3608a4
rathaxes: fix the necessary bits in the LKM sample to build a minimal linux LKM

diff --git a/rathaxes/samples/lkm/lkm.blt b/rathaxes/samples/lkm/lkm.blt
--- a/rathaxes/samples/lkm/lkm.blt
+++ b/rathaxes/samples/lkm/lkm.blt
@@ -12,8 +12,13 @@
         {
             #include <linux/module.h>
             #include <linux/kernel.h>
-            typedef int  lkm_headers_include_stamp;
 
+            typedef int  include_linux_module_stamp;
+            typedef int  include_linux_kernel_stamp;
+        }
+
+        chunk   LKM::data()
+        {
             MODULE_DESCRIPTION(${config.description});
             MODULE_AUTHOR(${config.author});
             MODULE_LICENSE(${config.license});
@@ -25,7 +30,7 @@
              * Rathaxes doesn't yet support arbitrary "decorators" like __init
              * or __exit.
              */
-            static int __attribute__((__section__(.init.text)))  rtx_module_init(void)
+            static int __attribute__((__section__(".init.text")))  rtx_module_init(void)
             {
                 ${pointcut ::IMPLEMENTATION};
             }
@@ -38,12 +43,12 @@
     {
         chunk   LKM::code()
         {
-            static void __attribute((__section__(.exit.text)))   rtx_module_exit(void)
+            static void __attribute__((__section__(".exit.text")))   rtx_module_exit(void)
             {
                 ${pointcut ::IMPLEMENTATION};
             }
 
-            module_exit(rtx_module_init);
+            module_exit(rtx_module_exit);
         }
     }
 }
diff --git a/rathaxes/samples/lkm/lkm.rtx b/rathaxes/samples/lkm/lkm.rtx
--- a/rathaxes/samples/lkm/lkm.rtx
+++ b/rathaxes/samples/lkm/lkm.rtx
@@ -27,6 +27,6 @@
     LKM::description = "Hello World Loadable Kernel Module (LKM)";
     LKM::license = "BSD";
 
-    PCI::vendor_id = "0x8080";
-    PCI::product_id = "0x42";
+    PCI::vendor_id = 0x8080;
+    PCI::product_id = 0x42;
 }
diff --git a/rathaxes/samples/lkm/pci.blt b/rathaxes/samples/lkm/pci.blt
--- a/rathaxes/samples/lkm/pci.blt
+++ b/rathaxes/samples/lkm/pci.blt
@@ -2,14 +2,12 @@
 {
     template type   PCI::Device()
     {
-        /*
-         * chunk   LKM::includes()
-         * {
-         *     #include <linux/pci.h>
-         *
-         *     typedef int include_linux_pci_stamp;
-         * }
-         */
+        chunk   LKM::includes()
+        {
+            #include <linux/pci.h>
+
+            typedef int include_linux_pci_stamp;
+        }
 
         chunk   ::decl()
         {
@@ -65,7 +63,7 @@
                 typedef int ${PCI::Device};
 
                 int             err;
-                ${PCI::Device}  dev = NULL; /* Doesn't work with a pointer */
+                ${PCI::Device}  *dev = NULL;
 
                 err = pci_enable_device(pdev);
 //              if (err < 0) /* `if' doesn't work */