LOGGER_RADIO_BUFFER_SIZE ?= 256
LOGGER_SYSTEM_BUFFER_SIZE ?= 256
+TIZEN_INFORM_PATH ?= "/mnt/inform/reboot-param.bin"
+
# See commit 0b999ae3614d0 ("Merge tag 'compiler-attributes-for-linus-v5.0-rc7'"[..]) for rationale
CFLAGS_logger.o += -Wno-error=missing-attributes \
-DLOGGER_MAIN_BUFFER_SIZE=$(LOGGER_MAIN_BUFFER_SIZE) \
-DLOGGER_RADIO_BUFFER_SIZE=$(LOGGER_RADIO_BUFFER_SIZE) \
-DLOGGER_SYSTEM_BUFFER_SIZE=$(LOGGER_SYSTEM_BUFFER_SIZE)
CFLAGS_proc-tsm.o += -Wno-error=missing-attributes
+CFLAGS_inform-reboot.o += -DTIZEN_INFORM_PATH="\"$(TIZEN_INFORM_PATH)\""
# Build is disabled by default so that when new module is added to this repository (and -source package),
# it won't get automatically build in packages using it (that would break these automatically as file list
# would no longer match).
+BUILD_inform_reboot ?= n
BUILD_logger ?= n
BUILD_proc_tsm ?= n
BUILD_kdbus ?= n
BUILD_zlogger ?= n
+obj-$(BUILD_inform_reboot) += inform-reboot.o
obj-$(BUILD_logger) += logger.o
obj-$(BUILD_proc_tsm) += proc-tsm.o
obj-$(BUILD_kdbus) += kdbus/
--- /dev/null
+/*
+ * Tizen reboot parameter passing notifier
+ *
+ * Written by: Junghoon Kim <jhoon20.kim@samsung.com>
+ *
+ * Copyright (C) 2017 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/notifier.h>
+#include <linux/reboot.h>
+#include <linux/syscalls.h>
+#include <linux/file.h>
+#include <linux/fcntl.h>
+#include <linux/uaccess.h>
+
+static int inform_reboot_notifier(struct notifier_block *nb,
+ unsigned long val, void *buf)
+{
+ char *cmd = buf;
+ char *filename = TIZEN_INFORM_PATH;
+ struct file *file;
+ loff_t pos = 0;
+
+ file = filp_open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644);
+ if (!IS_ERR(file)) {
+ struct super_block *sb = file->f_path.dentry->d_sb;
+
+ if (cmd) {
+ if (!strncmp(cmd, "fota", 4))
+ cmd = "upgr";
+ else if (!strncmp(cmd, "recovery", 8))
+ cmd = "rcvr";
+ else if (!strncmp(cmd, "download", 8))
+ cmd = "dwnl";
+ else
+ cmd = "ndef";
+ } else
+ cmd = "norm";
+
+ kernel_write(file, cmd, strlen(cmd), &pos);
+
+ down_read(&sb->s_umount);
+ sync_filesystem(sb);
+ up_read(&sb->s_umount);
+
+ fput(file);
+ } else {
+ pr_err("Reboot parameter passing is failed.\n"
+ "Inform file path should be described correctly in config.\n");
+ }
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block nb_inform_reboot_block = {
+ .notifier_call = inform_reboot_notifier,
+ .priority = 256,
+};
+
+static int __init inform_reboot_init(void)
+{
+ /* to support reboot parameter passing */
+ register_reboot_notifier(&nb_inform_reboot_block);
+ return 0;
+}
+
+subsys_initcall(inform_reboot_init);
+
+MODULE_LICENSE("GPL");