backports: adds regulator and media susbsystems
cover backports: adds regulator and media susbsystems
From: "Luis R. Rodriguez" <[email protected]>
This is just test work I've been doing on the side, that really just started from scratching an itch to see what is possible. In the compat-drivers trees I had actually gotten to run time test the USB video camera driver and that worked fine. Under the new backports tree we are encouraged to just backport the entire subsystem so I gave that a shot and this is where I got up to. It turned out a few drivers required mucking with the regulator and as I started backporting some functionality I realized that the 3.2 regulator was just stubs so ended up trying to port all of the regulator and its drivers as well.
The media drivers should now compile *if* we fix the regulator issues but as it turns out the last issues I ran into hit a gcc segfault :)
These patches depend on the other 9 patches I just posted. I hadn't tested ckmake yet with the other patches...
Note one thing I realize from this exercise is that it'd be nice to be able to rename the upstream target file when being sucked into compat as part of compat-y or perhaps its best to do this always with a _backport prefix ? See core.c from regulator and how it gets pulled into compat/
I do realize that porting the regulator code may not make make sense and if so then perhaps any media drivers that rely on it shoud likley not be ported... But that sounds like a cheap "solution". For mobile for example I do envision it being desirable to port over any media or regulator drivers. One possibility I have only been toying with in thought has been using ksplice... but that seems a bit over kill and likely very fragile for adding new symbols. Can we extend a kernel with backport ELF sections ? If so so, we don't necessarily need to have the functionality to patch a kernel and keep it running at runtime but *if* this is possible perhaps that may allow for us to add our own sections to call on the kernel. The only issue with that of course is that then compat-y as a whole would need to be thrown in there.
CC [M] /home/mcgrof/tmp/build/compat/main.o CC [M] /home/mcgrof/tmp/build/compat/compat-3.3.o CC [M] /home/mcgrof/tmp/build/compat/compat-3.4.o CC [M] /home/mcgrof/tmp/build/compat/compat-3.5.o CC [M] /home/mcgrof/tmp/build/compat/user_namespace.o CC [M] /home/mcgrof/tmp/build/compat/compat-3.6.o CC [M] /home/mcgrof/tmp/build/compat/compat-3.7.o CC [M] /home/mcgrof/tmp/build/compat/compat-3.8.o CC [M] /home/mcgrof/tmp/build/compat/compat-3.9.o CC [M] /home/mcgrof/tmp/build/compat/core.o
Segmentation fault
make[8]: *** [/home/mcgrof/tmp/build/compat/core.o] Error 139
Luis R. Rodriguez (3):
compat: redefine core_initcall() and late_initcall()
backports: add support for voltage / current regulator subsystem
backports: add media subsystem drivers
.blacklist.map | 9 + backport/Makefile.kernel | 8 + backport/Makefile.real | 1 + backport/compat/Kconfig | 18 + backport/compat/main.c | 5 + backport/defconfigs/media | 506 ++++++++++++++++++++ backport/defconfigs/regulator | 63 +++ backport/include/linux/compat-2.6.h | 15 + backport/include/linux/compat-3.3.h | 8 + copy-list | 44 ++ dependencies | 6 + lib/blacklist.sh | 35 ++ .../media/0001-media_entity_info.patch | 67 +++ .../regulator/0001-disable-ftrace.patch | 74 +++ 14 files changed, 859 insertions(+) create mode 100644 .blacklist.map create mode 100644 backport/defconfigs/media create mode 100644 backport/defconfigs/regulator create mode 100755 lib/blacklist.sh create mode 100644 patches/collateral-evolutions/media/0001-media_entity_info.patch create mode 100644 patches/collateral-evolutions/regulator/0001-disable-ftrace.patch
Signature · 1 line
1.7.10.4
PATCH 1/3 compat: redefine core_initcall() and late_initcall()
From: "Luis R. Rodriguez" <[email protected]>
It is questionable if we'd want to backport calls declared through late_initcall() or core_initcall() on the kernel but if this ends up being desired the current of copying kernel code requires either patching or redefining these symbols to make them build.
To avoid having to maintain patches for these components and having to delcare these routines on header files through compat manually use these init macros to help us define symbols we *can* use on the compat module init.
--- backport/include/linux/compat-2.6.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
backport/include/linux/compat-2.6.h +15 -0
@@ -18,6 +18,21 @@#include <linux/init.h> #include <linux/uidgid.h> +#define backport_init_sym (fn) extern void backport_##fn(void); +#define backport_init_call (fn) backport_##fn() + +#define backport_initcall (fn) \ + void backport_##fn(void) \ + { \ + fn(); \ + } + +#undef core_initcall +#undef late_initcall + +#define core_initcall backport_initcall +#define late_initcall backport_initcall +/* * The define overwriting module_init is based on the original module_init * which looks like this:
Signature · 1 line
1.7.10.4
PATCH 2/3 backports: add support for voltage / current regulator subsystem
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This is enabled only for >= 3.2 and enables all regulator drivers. This is required by some media subsystem drivers.
--- backport/Makefile.kernel | 1 + backport/compat/Kconfig | 18 +++++ backport/compat/main.c | 5 ++ backport/defconfigs/regulator | 63 +++++++++++++++++ backport/include/linux/compat-3.3.h | 8 +++ copy-list | 27 +++++++ dependencies | 3 + .../regulator/0001-disable-ftrace.patch | 74 ++++++++++++++++++++ 8 files changed, 199 insertions(+) create mode 100644 backport/defconfigs/regulator create mode 100644 patches/collateral-evolutions/regulator/0001-disable-ftrace.patch
backport/Makefile.kernel +1 -0
@@ -23,3 +23,4 @@ obj-$(CPTCFG_SSB) += drivers/ssb/ obj-$(CPTCFG_BCMA) += drivers/bcma/ obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/ obj-$(CPTCFG_DRM) += drivers/gpu/drm/ +obj-$(CPTCFG_REGULATOR) += drivers/regulator/
backport/compat/Kconfig +18 -0
@@ -156,6 +156,24 @@ config BACKPORT_BUILD_HDMI config BACKPORT_HDMI bool +config BACKPORT_BUILD_REGULATOR + bool + # not possible on kernel < 3.2 + depends on !BACKPORT_KERNEL_3_2 + # don't build if base kernel has it, except on kernel < 3.9 + depends on !HDMI || BACKPORT_KERNEL_3_9 + # build for testing + default y if BACKPORT_USERSEL_BUILD_ALL + # build if a driver needs it + default y if BACKPORT_REGULATOR + #c-file drivers/regulator/core.c + #c-file drivers/regulator/dummy.c + #c-file drivers/regulator/fixed-helper.c + #h-file linux/regulator/consumer.h + +config BACKPORT_REGULATOR + bool + config BACKPORT_USERSEL_BUILD_ALL bool "Build all compat code" help
backport/compat/main.c +5 -0
@@ -38,6 +38,8 @@ void backport_dependency_symbol(void) }EXPORT_SYMBOL_GPL (backport_dependency_symbol); +backport_init_sym (regulator_init); +backport_init_sym (regulator_init_complete);static int __init backport_init (void ) {
@@ -45,6 +47,9 @@ static int __init backport_init(void)backport_system_workqueue_create ();backport_init_mmc_pm_flags (); +backport_init_call (regulator_init); +backport_init_call (regulator_init_complete); +printk (KERN_INFO "Loading modules backported from " BACKPORTED_KERNEL_NAME " version " BACKPORTED_KERNEL_VERSION "\n" );printk (KERN_INFO "Backport generated by backports.git " BACKPORTS_VERSION "\n" );
backport/defconfigs/regulator new file +63 -0
63 lines not on this page · raw message
backport/include/linux/compat-3.3.h +8 -0
@@ -14,6 +14,14 @@#include <linux/mii.h> #include <linux/netdevice.h> +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 )) +/* +* In order to get help the regulatory core.c that gets +* pulled into the compat module get it without any changes +*/ +#include <linux/async.h> +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */ +/* * BQL was added as of v3.3 but some Linux distributions * have backported BQL to their v3.2 kernels or older. To
copy-list +27 -0
@@ -121,3 +121,30 @@ include/uapi/drm/ drivers/platform/x86/intel_ips.h drivers/gpu/drm/ + +# Regulator +# we don't include the whole directory as we need +# to do hackery with linux/regulator/consumer.h +include/linux/regulator/ab8500.h +include/linux/regulator/db8500-prcmu.h +include/linux/regulator/driver.h +include/linux/regulator/fan53555.h +include/linux/regulator/fixed.h +include/linux/regulator/gpio-regulator.h +include/linux/regulator/lp3971.h +include/linux/regulator/lp3972.h +include/linux/regulator/lp872x.h +include/linux/regulator/machine.h +include/linux/regulator/max1586.h +include/linux/regulator/max8649.h +include/linux/regulator/max8660.h +include/linux/regulator/max8952.h +include/linux/regulator/max8973-regulator.h +include/linux/regulator/of_regulator.h +include/linux/regulator/tps51632-regulator.h +include/linux/regulator/tps62360.h +include/linux/regulator/tps6507x.h +include/linux/regulator/userspace-consumer.h + +drivers/regulator/dummy.h -> compat/dummy.h +drivers/regulator/
dependencies +3 -0
@@ -46,6 +46,9 @@ HDMI 3.2 DRM 3.2 DRM_TTM 3.2 +# Regulator +REGULATOR 3.2 + # This requires proc_create(), and that doesn't exist before 2.6.24 LIBIPW_DEBUG 2.6.25
patches/collateral-evolutions/regulator/0001-disable-ftrace.patch new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 3/3 backports: add media subsystem drivers
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This adds backport support for all media subsystem drivers. This is enabled only for >= 3.2.
--- .blacklist.map | 9 + backport/Makefile.kernel | 7 + backport/Makefile.real | 1 + backport/defconfigs/media | 506 ++++++++++++++++++++ copy-list | 17 + dependencies | 3 + lib/blacklist.sh | 35 ++ .../media/0001-media_entity_info.patch | 67 +++ 8 files changed, 645 insertions(+) create mode 100644 .blacklist.map create mode 100644 backport/defconfigs/media create mode 100755 lib/blacklist.sh create mode 100644 patches/collateral-evolutions/media/0001-media_entity_info.patch
.blacklist.map new file +9 -0
@@ -0,0 +1,9 @@ +# Update this map when a driver gets renamed or +# symbols from old drivers get moved to a newer +# driver. If you have the driver on the right +# hand side it will be blacklisted upon installation +# only if you actually installed the driver on the +# left. + +# new-driver old-driver +videodev v4l2-compat-ioctl32
backport/Makefile.kernel +7 -0
@@ -7,6 +7,12 @@ NOSTDINC_FLAGS := \ -I$(M)/include/ \ -I$(M)/include/uapi \ -I$(M)/include/drm \ + -I$(M)/drivers/media/dvb-core/ \ + -I$(M)/drivers/media/tuners/ \ + -I$(M)/drivers/media/dvb-frontends/ \ + -I$(M)/drivers/media/common/siano/ \ + -I$(M)/drivers/media/common/b2c2/ \ + -I$(M)/drivers/media/pci/bt8xx/ \ -include $(M)/include/linux/compat-2.6.h \ $(call backport-cc-disable-warning, unused-but-set-variable) \ $(CFLAGS)
@@ -24,3 +30,4 @@ obj-$(CPTCFG_BCMA) += drivers/bcma/ obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/ obj-$(CPTCFG_DRM) += drivers/gpu/drm/ obj-$(CPTCFG_REGULATOR) += drivers/regulator/ +obj-$(CPTCFG_MEDIA_SUPPORT) += drivers/media/
backport/Makefile.real +1 -0
@@ -82,6 +82,7 @@ install: modules @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) \ INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG) \ modules_install + @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) @/sbin/depmod -ae @echo @echo Your backported driver modules should be installed now.
backport/defconfigs/media new file +506 -0
506 lines not on this page · raw message
copy-list +17 -0
@@ -148,3 +148,20 @@ include/linux/regulator/userspace-consumer.h drivers/regulator/dummy.h -> compat/dummy.h drivers/regulator/ + +# Media +include/media/ + +include/linux/videodev2.h +include/linux/video_output.h + +include/uapi/linux/media.h +include/uapi/linux/dvb/ +include/uapi/linux/v4l2-common.h +include/uapi/linux/v4l2-controls.h +include/uapi/linux/v4l2-dv-timings.h +include/uapi/linux/v4l2-mediabus.h +include/uapi/linux/v4l2-subdev.h +include/uapi/linux/videodev2.h + +drivers/media/
dependencies +3 -0
@@ -49,6 +49,9 @@ DRM_TTM 3.2 # Regulator REGULATOR 3.2 +# Media +MEDIA 3.2 + # This requires proc_create(), and that doesn't exist before 2.6.24 LIBIPW_DEBUG 2.6.25
lib/blacklist.sh new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/bash + +BLACKLIST_CONF="/etc/modprobe.d/backports.conf" +BLACKLIST_MAP=".blacklist.map" + +MODULE_DIR=$1 +MODULE_UPDATES=$2 + +if [[ ! -d $MODULE_DIR ]]; then + exit +fi + +if [[ ! -d $MODULE_UPDATES ]]; then + exit +fi + +mkdir -p $(dirname $BLACKLIST_CONF) +rm -f $BLACKLIST_CONF + +echo "# To be used when using backported drivers" >> $BLACKLIST_CONF + +for i in $(grep -v ^# $BLACKLIST_MAP | cut -f 2); do + MODULE="${i}.ko" + MODULE_UPDATE="$(grep -v ^# $BLACKLIST_MAP | grep $i | cut -f 1 | head -1).ko" + + COUNT=$(find $MODULE_DIR -type f -name ${MODULE} -or -name ${MODULE}.gz | wc -l) + COUNT_REPLACE=$(find $MODULE_UPDATES -type f -name ${MODULE_UPDATE} -or -name ${MODULE_UPDATE}.gz | wc -l) + + if [ $COUNT -ne 0 ]; then + if [ $COUNT_REPLACE -ne 0 ]; then + echo "Blacklisting $MODULE ..." + echo blacklist $i >> $BLACKLIST_CONF + fi + fi +done
patches/collateral-evolutions/media/0001-media_entity_info.patch new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Quoted 2 lines · Luis R. Rodriguez
Segmentation fault
make[8]: *** [/home/mcgrof/tmp/build/compat/core.o] Error 139
And sorry, *this* set should have gone out as RFCs, not PATCH. The other 9 should be fine if we just run ckmake to test them.
Luis
Quoted 4 lines · Luis R. Rodriguez
Quoted 2 lines · Luis R. Rodriguez
Segmentation fault
make[8]: *** [/home/mcgrof/tmp/build/compat/core.o] Error 139
I've narrowed the segfault to a core.c file with just:
#include <linux/async.h>
#include <linux/module.h>
void poo(void)
{
}EXPORT_SYMBOL_GPL(poo);
Removing asynch.h fixes it. Doing this on an standalone module works
Luis