From 0d7259fe81e8c41fa3c98789dd6500ac6a7f81e3 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sat, 11 Nov 2017 11:11:06 +0000 Subject: [PATCH] Remove runqemu from build... document platform_device.c a bit further, add a modprobe.conf test --- build | 1 - kernel_module/params.c | 8 ++++++++ kernel_module/platform_device.c | 11 +++++++++-- rootfs_overlay/etc/modprobe.conf | 4 ++++ 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 rootfs_overlay/etc/modprobe.conf diff --git a/build b/build index 5baac1a..943e4d5 100755 --- a/build +++ b/build @@ -74,4 +74,3 @@ time \ all \ ; cd .. -./runqemu "$@" diff --git a/kernel_module/params.c b/kernel_module/params.c index a01f13d..5e17416 100644 --- a/kernel_module/params.c +++ b/kernel_module/params.c @@ -19,6 +19,14 @@ Those parameters can also be read and modified at runtime from /sys. modinfo /params.ko # Output contains MODULE_PARAM_DESC descriptions. + +modprobe insertion can also set default parameters via the /etc/modprobe.conf file. So: + + modprobe params + +Outputs: + + 12 34 */ #include /* usleep_range */ diff --git a/kernel_module/platform_device.c b/kernel_module/platform_device.c index e0347de..005eda3 100644 --- a/kernel_module/platform_device.c +++ b/kernel_module/platform_device.c @@ -1,7 +1,12 @@ /* Only works for ARM. -Uses the hw/misc/lkmc_platform_device.c minimal device added in our QEMU fork. +Uses: + +- hw/misc/lkmc_platform_device.c minimal device added in our QEMU fork + +- the device tree entry we added to our Linux kernel fork: + https://github.com/cirosantilli/linux/blob/361bb623671a52a36a077a6dd45843389a687a33/arch/arm/boot/dts/versatile-pb.dts#L42 See: https://stackoverflow.com/questions/28315265/how-to-add-a-new-device-in-qemu-source-code/44612957#44612957 @@ -49,7 +54,7 @@ static int lkmc_platform_device_probe(struct platform_device *pdev) dev_info(dev, "probe\n"); - /* Play with our custom poperty. */ + /* Play with our custom device tree poperty. */ if (of_property_read_u32(np, "lkmc-asdf", &asdf) ) { dev_err(dev, "of_property_read_u32\n"); return -EINVAL; @@ -100,6 +105,8 @@ static int lkmc_platform_device_remove(struct platform_device *pdev) } static const struct of_device_id of_lkmc_platform_device_match[] = { + /* This tells our driver which device tree node it will use. + * It matches the kmc_platform_device@XXXX entry that we added to the device tree. */ { .compatible = "lkmc_platform_device", }, {}, }; diff --git a/rootfs_overlay/etc/modprobe.conf b/rootfs_overlay/etc/modprobe.conf new file mode 100644 index 0000000..86f7cab --- /dev/null +++ b/rootfs_overlay/etc/modprobe.conf @@ -0,0 +1,4 @@ +# Default parameters when loading modules. +# Especially important due to loading module dependencies: +# how else would you specify their parameters? +options params i=12 j=34