Apply the patch to android_system_core
repository (located at <android source root>/system/core
for CM10), then compile as usual.
In root shell, use setprop [persist.]sys.adbse.<service name> <0/1>
to toggle adb services. It will be immediately effective to new adb connections. Existing connections won't be affected.