diff mbox series

[OpenWrt-Devel] how to add/package kernel module?

Message ID 85184f76-f727-1adf-a5af-dbbeeefb2423@mbox200.swipnet.se
State Changes Requested
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel] how to add/package kernel module? | expand

Commit Message

Torbjörn Jansson July 27, 2018, 3:26 p.m. UTC
Hello.

Probably over a year ago i built a rasperry pi and made a custom build of 
openwrt and added a small patch for myself to make module for htu21 temp and 
humidity sensor available.

the patch i made i'm not sure if it is correct or not and even if it still 
works with all the changes that has been done but it would be nice to have the 
kernel module (kmod-iio-htu21) built and available as an option preferably in 
some future release.

i use the htu21 kernel module with a small shell script to push the data out to 
an mqtt server for further handling.
there is probably more iio modules that could be useful to others but for now 
i'm happy if i can make a new version of openwrt with the kernel module added 
and preferably also get it included so i don't need a custom build.


below is my old patch.

Comments

John Crispin July 30, 2018, 6:24 a.m. UTC | #1
On 27/07/18 17:26, Torbjorn Jansson wrote:
> Hello.
>
> Probably over a year ago i built a rasperry pi and made a custom build 
> of openwrt and added a small patch for myself to make module for htu21 
> temp and humidity sensor available.
>
> the patch i made i'm not sure if it is correct or not and even if it 
> still works with all the changes that has been done but it would be 
> nice to have the kernel module (kmod-iio-htu21) built and available as 
> an option preferably in some future release.
>
> i use the htu21 kernel module with a small shell script to push the 
> data out to an mqtt server for further handling.
> there is probably more iio modules that could be useful to others but 
> for now i'm happy if i can make a new version of openwrt with the 
> kernel module added and preferably also get it included so i don't 
> need a custom build.
>
>
> below is my old patch.
>

Patch looks ok at first glance, but there are a few formal errors, the 
Signed-off-by is missing and the patch headline needs to be prefixed and 
a proper description needs to be written -> 
https://openwrt.org/submitting-patches

     John

>
> diff --git a/package/kernel/linux/modules/other.mk 
> b/package/kernel/linux/modules/other.mk
> index 38b98f3..3770510 100644
> --- a/package/kernel/linux/modules/other.mk
> +++ b/package/kernel/linux/modules/other.mk
> @@ -329,6 +329,29 @@ endef
>  $(eval $(call KernelPackage,iio-dht11))
>
>
> +define KernelPackage/iio-htu21
> +  SUBMENU:=$(OTHER_MENU)
> +  DEPENDS:=kmod-i2c-core kmod-iio-core
> +  TITLE:=Measurement Specialties HTU21 humidity & temperature sensor
> +  KCONFIG:= \
> +   CONFIG_HTU21 \
> +   CONFIG_IIO_MS_SENSORS_I2C
> +  FILES:= \
> +   $(LINUX_DIR)/drivers/iio/humidity/htu21.ko \
> +   $(LINUX_DIR)/drivers/iio/common/ms_sensors/ms_sensors_i2c.ko
> +  AUTOLOAD:=$(call AutoLoad,56,htu21)
> +endef
> +
> +define KernelPackage/iio-htu21/description
> + support for the Measurement Specialties HTU21 humidity and
> + temperature sensor.
> + This driver is also used for MS8607 temperature, pressure & humidity
> + sensor
> +endef
> +
> +$(eval $(call KernelPackage,iio-htu21))
> +
> +
>  define KernelPackage/lp
>    SUBMENU:=$(OTHER_MENU)
>    TITLE:=Parallel port and line printer support
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Torbjörn Jansson July 30, 2018, 8:30 a.m. UTC | #2
On 2018-07-30 08:24, John Crispin wrote:
> 
> 
> On 27/07/18 17:26, Torbjorn Jansson wrote:
>> Hello.
>>
>> Probably over a year ago i built a rasperry pi and made a custom build of 
>> openwrt and added a small patch for myself to make module for htu21 temp and 
>> humidity sensor available.
>>
>> the patch i made i'm not sure if it is correct or not and even if it still 
>> works with all the changes that has been done but it would be nice to have 
>> the kernel module (kmod-iio-htu21) built and available as an option 
>> preferably in some future release.
>>
>> i use the htu21 kernel module with a small shell script to push the data out 
>> to an mqtt server for further handling.
>> there is probably more iio modules that could be useful to others but for now 
>> i'm happy if i can make a new version of openwrt with the kernel module added 
>> and preferably also get it included so i don't need a custom build.
>>
>>
>> below is my old patch.
>>
> 
> Patch looks ok at first glance, but there are a few formal errors, the 
> Signed-off-by is missing and the patch headline needs to be prefixed and a 
> proper description needs to be written -> https://openwrt.org/submitting-patches
> 
>      John
> 

thanks, i'll take a look there.
and i will try and figure out how to get git sendmail to work, i know i had 
problems last time i used it.

i will refresh my patch and also move the module from Other to IIO sub menu 
since that's where it belongs.

one more question, in the case of htu21 it depends on another module, 
ms_sensors_i2c and as i wrote the patch they both get included in the same package.
right now i don't think any other kernel module package uses ms_sensors_i2c.
is it ok to put both modules in same package or should i make ms_sensors_i2c go 
in its own package with a dependency between them?
diff mbox series

Patch

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index 38b98f3..3770510 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -329,6 +329,29 @@  endef
  $(eval $(call KernelPackage,iio-dht11))


+define KernelPackage/iio-htu21
+  SUBMENU:=$(OTHER_MENU)
+  DEPENDS:=kmod-i2c-core kmod-iio-core
+  TITLE:=Measurement Specialties HTU21 humidity & temperature sensor
+  KCONFIG:= \
+   CONFIG_HTU21 \
+   CONFIG_IIO_MS_SENSORS_I2C
+  FILES:= \
+   $(LINUX_DIR)/drivers/iio/humidity/htu21.ko \
+   $(LINUX_DIR)/drivers/iio/common/ms_sensors/ms_sensors_i2c.ko
+  AUTOLOAD:=$(call AutoLoad,56,htu21)
+endef
+
+define KernelPackage/iio-htu21/description
+ support for the Measurement Specialties HTU21 humidity and
+ temperature sensor.
+ This driver is also used for MS8607 temperature, pressure & humidity
+ sensor
+endef
+
+$(eval $(call KernelPackage,iio-htu21))
+
+
  define KernelPackage/lp
    SUBMENU:=$(OTHER_MENU)
    TITLE:=Parallel port and line printer support