-DBACKPORTS_VERSION=\"$(BACKPORTS_VERSION)\" \
-DBACKPORTED_KERNEL_VERSION=\"$(BACKPORTED_KERNEL_VERSION)\" \
-DBACKPORTED_KERNEL_NAME=\"$(BACKPORTED_KERNEL_NAME)\" \
+ $(BACKPORTS_GIT_TRACKER_DEF) \
$(CFLAGS)
obj-y += compat/
include versions
export BACKPORTS_VERSION BACKPORTED_KERNEL_VERSION BACKPORTED_KERNEL_NAME
+ifdef BACKPORTS_GIT_TRACKED
+export BACKPORTS_GIT_TRACKER_DEF=-DBACKPORTS_GIT_TRACKED=\"$(BACKPORTS_GIT_TRACKED)\"
+else
+export BACKPORTS_GIT_TRACKER_DEF=
+endif
# disable built-in rules for this file
.SUFFIXES:
#endif
static char *backported_kernel_name = BACKPORTED_KERNEL_NAME;
-static char *backported_kernel_version = BACKPORTED_KERNEL_VERSION;
-static char *backports_version = BACKPORTS_VERSION;
module_param(backported_kernel_name, charp, 0400);
MODULE_PARM_DESC(backported_kernel_name,
"The kernel tree name that was used for this backport (" BACKPORTED_KERNEL_NAME ")");
+#ifdef BACKPORTS_GIT_TRACKED
+static char *backports_tracker_id = BACKPORTS_GIT_TRACKED;
+module_param(backports_tracker_id, charp, 0400);
+MODULE_PARM_DESC(backports_tracker_id,
+ "The version of the tree containing this backport (" BACKPORTS_GIT_TRACKED ")");
+#else
+static char *backported_kernel_version = BACKPORTED_KERNEL_VERSION;
+static char *backports_version = BACKPORTS_VERSION;
+
module_param(backported_kernel_version, charp, 0400);
MODULE_PARM_DESC(backported_kernel_version,
"The kernel version that was used for this backport (" BACKPORTED_KERNEL_VERSION ")");
MODULE_PARM_DESC(backports_version,
"The git version of the backports tree used to generate this backport (" BACKPORTS_VERSION ")");
+#endif
+
void backport_dependency_symbol(void)
{
}
backport_system_workqueue_create();
backport_init_mmc_pm_flags();
- printk(KERN_INFO "Loading modules backported from " BACKPORTED_KERNEL_NAME " version " BACKPORTED_KERNEL_VERSION "\n");
+ printk(KERN_INFO "Loading modules backported from " BACKPORTED_KERNEL_NAME
+#ifndef BACKPORTS_GIT_TRACKED
+ " version " BACKPORTED_KERNEL_VERSION
+#endif
+ "\n");
+#ifdef BACKPORTS_GIT_TRACKED
+ printk(KERN_INFO BACKPORTS_GIT_TRACKED "\n");
+#else
printk(KERN_INFO "Backport generated by backports.git " BACKPORTS_VERSION "\n");
+#endif
return 0;
}
*/
void backport_dependency_symbol(void);
+#ifdef BACKPORTS_GIT_TRACKED
+#define BACKPORT_MOD_VERSIONS MODULE_VERSION(BACKPORTS_GIT_TRACKED);
+#else
+#define BACKPORT_MOD_VERSIONS \
+ MODULE_VERSION("backports: " BACKPORTS_VERSION); \
+ MODULE_VERSION("backported from: " \
+ BACKPORTED_KERNEL_NAME " (" \
+ BACKPORTED_KERNEL_VERSION ")");
+#endif
+
#undef module_init
#define module_init(initfn) \
static int __init __init_backport(void) \
return initfn(); \
} \
int init_module(void) __attribute__((alias("__init_backport")));\
- MODULE_VERSION("backports: " BACKPORTS_VERSION); \
- MODULE_VERSION("backported from: " \
- BACKPORTED_KERNEL_NAME " (" \
- BACKPORTED_KERNEL_VERSION ")");
+ BACKPORT_MOD_VERSIONS
/*
* Each compat file represents compatibility code for new kernel
failure = gentree.process(kernelobjdir, wdir, open(args.copy_list, 'r'),
git_revision=kernel_rev,
base_name=tree, logwrite=logwrite,
- kernel_version_name="(see git)",
- backport_version_name="(see git)")
+ git_tracked_version=True)
newline = '\n'
if failure:
def process(kerneldir, outdir, copy_list_file, git_revision=None,
clean=False, refresh=False, base_name="Linux", gitdebug=False,
verbose=False, extra_driver=[], logwrite=lambda x:None,
- kernel_version_name=None, backport_version_name=None):
+ git_tracked_version=False):
class Args(object):
def __init__(self, kerneldir, outdir, copy_list_file,
git_revision, clean, refresh, base_name,
git_debug_snapshot(args, "convert select to depends on")
# write the versioning file
- backports_version = backport_version_name or git.describe(tree=source_dir)
- kernel_version = kernel_version_name or git.describe(rev=args.git_revision or 'HEAD',
- tree=args.kerneldir)
+ if git_tracked_version:
+ backports_version = "(see git)"
+ kernel_version = "(see git)"
+ else:
+ backports_version = git.describe(tree=source_dir)
+ kernel_version = git.describe(rev=args.git_revision or 'HEAD',
+ tree=args.kerneldir)
f = open(os.path.join(args.outdir, 'versions'), 'w')
f.write('BACKPORTS_VERSION="%s"\n' % backports_version)
f.write('BACKPORTED_KERNEL_VERSION="%s"\n' % kernel_version)
f.write('BACKPORTED_KERNEL_NAME="%s"\n' % args.base_name)
+ if git_tracked_version:
+ f.write('BACKPORTS_GIT_TRACKED="backport tracker ID: $(shell git rev-parse HEAD 2>/dev/null || echo \'not built in git tree\')"\n')
f.close()
symbols = configtree.symbols()