zephyr: serial_recovery: Make receive buffers configurable

This allows making the number of receive buffers configurable
instead of being fixed at 2.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
diff --git a/boot/zephyr/Kconfig.serial_recovery b/boot/zephyr/Kconfig.serial_recovery
index 5671247..26eca87 100644
--- a/boot/zephyr/Kconfig.serial_recovery
+++ b/boot/zephyr/Kconfig.serial_recovery
@@ -71,6 +71,13 @@
 	help
 	  Maximum length of received commands via the serial port.
 
+config BOOT_LINE_BUFS
+	int "Number of receive buffers"
+	range 2 128
+	default 2
+	help
+	  Number of receive buffers for data received via the serial port.
+
 config BOOT_SERIAL_DETECT_PORT
 	string "GPIO device to trigger serial recovery mode (DEPRECATED)"
 	default GPIO_0 if SOC_FAMILY_NRF
diff --git a/boot/zephyr/serial_adapter.c b/boot/zephyr/serial_adapter.c
index 309d72a..9b6e76c 100644
--- a/boot/zephyr/serial_adapter.c
+++ b/boot/zephyr/serial_adapter.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Nordic Semiconductor ASA
+ * Copyright (c) 2017-2023 Nordic Semiconductor ASA
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@
 };
 
 static struct device const *uart_dev;
-static struct line_input line_bufs[2];
+static struct line_input line_bufs[CONFIG_BOOT_LINE_BUFS];
 
 static sys_slist_t avail_queue;
 static sys_slist_t lines_queue;