blob: eadc28872bbbd731190bfbc1cec52f52b9a1ee25 [file] [log] [blame]
From 32fdf519125a828c6fbbbc8dfdfda22791e710e6 Mon Sep 17 00:00:00 2001
From: Sam Shih <sam.shih@mediatek.com>
Date: Fri, 2 Jun 2023 13:06:24 +0800
Subject: [PATCH] [adv-feature][999-2540-cmdline-boot-parameters.patch]
---
kernel/Makefile | 2 ++
kernel/boot_param.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
create mode 100644 kernel/boot_param.c
diff --git a/kernel/Makefile b/kernel/Makefile
index d038b0de8..be219c6ca 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -12,6 +12,8 @@ obj-y = fork.o exec_domain.o panic.o \
notifier.o ksysfs.o cred.o reboot.o \
async.o range.o smpboot.o ucount.o
+obj-y += boot_param.o
+
obj-$(CONFIG_MODULES) += kmod.o
obj-$(CONFIG_MULTIUSER) += groups.o
diff --git a/kernel/boot_param.c b/kernel/boot_param.c
new file mode 100644
index 000000000..3dfe828bc
--- /dev/null
+++ b/kernel/boot_param.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+* Copyright (C) 2022 MediaTek Inc. All rights reserved.
+ *
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/moduleparam.h>
+
+#define BOOT_PARAM_STR_MAX_LEN 256
+
+static bool dual_boot;
+module_param(dual_boot, bool, 0444);
+
+static bool no_split_rootfs_data;
+module_param(no_split_rootfs_data, bool, 0444);
+
+static bool reserve_rootfs_data;
+module_param(reserve_rootfs_data, bool, 0444);
+
+static uint boot_image_slot;
+module_param(boot_image_slot, uint, 0444);
+
+static uint upgrade_image_slot;
+module_param(upgrade_image_slot, uint, 0444);
+
+static char rootfs_data_part[BOOT_PARAM_STR_MAX_LEN];
+module_param_string(rootfs_data_part, rootfs_data_part, BOOT_PARAM_STR_MAX_LEN, 0644);
+
+static char boot_kernel_part[BOOT_PARAM_STR_MAX_LEN];
+module_param_string(boot_kernel_part, boot_kernel_part, BOOT_PARAM_STR_MAX_LEN, 0444);
+
+static char boot_rootfs_part[BOOT_PARAM_STR_MAX_LEN];
+module_param_string(boot_rootfs_part, boot_rootfs_part, BOOT_PARAM_STR_MAX_LEN, 0444);
+
+static char upgrade_kernel_part[BOOT_PARAM_STR_MAX_LEN];
+module_param_string(upgrade_kernel_part, upgrade_kernel_part, BOOT_PARAM_STR_MAX_LEN, 0444);
+
+static char upgrade_rootfs_part[BOOT_PARAM_STR_MAX_LEN];
+module_param_string(upgrade_rootfs_part, upgrade_rootfs_part, BOOT_PARAM_STR_MAX_LEN, 0444);
+
+static char env_part[BOOT_PARAM_STR_MAX_LEN];
+module_param_string(env_part, env_part, BOOT_PARAM_STR_MAX_LEN, 0444);
--
2.34.1