From d8125877cb7e4e071520c00768233874c9f66b69 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Fri, 27 Sep 2019 22:18:19 -0700 Subject: [PATCH] init: Export Android version from kernel command line This flag will be provided by our flasher to facilitate support for both Android Pie and 10 in the same kernel. Signed-off-by: Danny Lin Signed-off-by: Oktapra Amtono Signed-off-by: RyuujiX Signed-off-by: Kneba Signed-off-by: negrroo --- include/linux/android_version.h | 3 +++ init/main.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 include/linux/android_version.h diff --git a/include/linux/android_version.h b/include/linux/android_version.h new file mode 100644 index 000000000000..0c7565fd81a3 --- /dev/null +++ b/include/linux/android_version.h @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +unsigned int get_android_version(void); diff --git a/init/main.c b/init/main.c index 6fce605c6caf..c179e9fecc36 100644 --- a/init/main.c +++ b/init/main.c @@ -129,6 +129,20 @@ static char *initcall_command_line; static char *execute_command; static char *ramdisk_execute_command; +static unsigned int android_version = 9; + +static int __init set_android_version(char *val) +{ + get_option(&val, &android_version); + return 0; +} +__setup("androidboot.version=", set_android_version); + +unsigned int get_android_version(void) +{ + return android_version; +} + /* * Used to generate warnings if static_key manipulation functions are used * before jump_label_init is called.