<commit_before>From 06bd7e9b490575096a7c04c97e3c14d8c12daac8 Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Wed, 4 Jan 2017 15:58:42 +0100
Subject: Add resin specific environment configuration

This patch defines all the needed bits on which resinhup relies when swiching
the root partition. The interface with uboot is done through a file called
uEnv.txt located in the first partition which, if it exists, might overwrite the
default root partition index (by default 2). In order to overwrite this,
uEnv.txt must define `resin_root_part`.

Signed-off-by: <NAME> <<EMAIL>>

Upstream-Status: Inappropriate [configuration]

---
 include/env_resin.h | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 include/env_resin.h

diff --git a/include/env_resin.h b/include/env_resin.h
new file mode 100644
index 0000000..ef8a2b0
--- /dev/null
+++ b/include/env_resin.h
@@ -0,0 +1,39 @@
+#ifndef HEADER_ENV_RESIN_H
+#define HEADER_ENV_RESIN_H
+
+/*
+ * Assumes defined:
+ *		resin_kernel_load_addr - kernel load address as we use the same to load the env file
+ *		resin_mmcdev - current MMC device to use
+ *		resin_root_part - existing in the env file to import
+ * Defines:
+ *		resin_set_kernel_root - needs to be integrated with board specific configuration
+ *		resin_kernel_root - the root kernel argument 
+ */
+#define RESIN_ENV \
+	"resin_env_file=uEnv.txt\0" \
+	"resin_boot_part=1\0" \
+	"resin_root_part=2\0" \
+	\
+	"resin_find_root_part_uuid=" \
+		"part uuid mmc ${resin_mmcdev}:${resin_root_part} root_part_uuid\0" \
+	\
+	"resin_load_env_file=" \
+		"echo Loading ${resin_env_file} from mmc device ${resin_mmcdev} partition ${resin_boot_part};" \
+		"fatload mmc ${resin_mmcdev}:${resin_boot_part} ${resin_kernel_load_addr} ${resin_env_file};\0" \
+	\
+	"resin_import_env_file=" \
+		"echo Import ${resin_env_file} in environment;" \
+		"env import -t ${resin_kernel_load_addr} ${filesize}\0" \
+	\
+	"resin_inject_env_file=" \
+		"if run resin_load_env_file; then " \
+			"run resin_import_env_file;" \
+		"fi;\0" \
+	\
+	"resin_set_kernel_root=" \
+		"run resin_inject_env_file;" \
+		"run resin_find_root_part_uuid;" \
+		"setenv resin_kernel_root root=PARTUUID=${root_part_uuid}\0"
+
+#endif /* HEADER_ENV_RESIN_H */
-- 
2.7.4

<commit_msg>u-boot: Implement based on https://github.com/resin-io/hq/pull/521<commit_after>From 20c288af1e401549f434f22e420dfa1409c57078 Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Wed, 4 Jan 2017 15:58:42 +0100
Subject: [PATCH] Add resin specific environment configuration

This patch defines all the needed bits on which resinhup relies when swiching
the root partition. The interface with uboot is done through an env file
(resinOS_uEnv.txt) located in the first partition which, if it exists, might
overwrite the default root partition index. In order to overwrite this, the env
file must define `resin_root_part`.

Signed-off-by: <NAME> <<EMAIL>>

Upstream-Status: Inappropriate [configuration]
---
 include/env_resin.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 include/env_resin.h

diff --git a/include/env_resin.h b/include/env_resin.h
new file mode 100644
index 0000000..dfef80c
--- /dev/null
+++ b/include/env_resin.h
@@ -0,0 +1,61 @@
+#ifndef HEADER_ENV_RESIN_H
+#define HEADER_ENV_RESIN_H
+
+/*
+ * Assumes defined:
+ *     resin_kernel_load_addr - kernel load address as we use the same
+ *                              to load the env file
+ *     resin_root_part        - existing in the env file to import (optional)
+ * Defines:
+ *     resin_set_kernel_root  - needs to be integrated with board
+ *                              specific configuration
+ *     resin_kernel_root      - the root kernel argument
+ *     resin_mmcdev          - MMC device index to be used at boot
+ */
+
+#include <config_resin.h>
+
+#define RESIN_ENV \
+	"resin_env_file=" __stringify(RESIN_ENV_FILE) "\0" \
+	"resin_flasher_external_flag_file=" __stringify(RESIN_FLASHER_EXTERNAL_FLAG_FILE) "\0" \
+	"resin_boot_part=" __stringify(RESIN_BOOT_PART) "\0" \
+	"resin_root_part=" __stringify(RESIN_DEFAULT_ROOT_PART) "\0" \
+	\
+	"resin_find_root_part_uuid=" \
+		"part uuid mmc ${resin_mmcdev}:${resin_root_part} resin_root_part_uuid\0" \
+	\
+	"resin_load_env_file=" \
+		"echo Loading ${resin_env_file} from mmc device ${resin_mmcdev} partition ${resin_boot_part};" \
+		"fatload mmc ${resin_mmcdev}:${resin_boot_part} ${resin_kernel_load_addr} ${resin_env_file};\0" \
+	\
+	"resin_import_env_file=" \
+		"echo Import ${resin_env_file} in environment;" \
+		"env import -t ${resin_kernel_load_addr} ${filesize}\0" \
+	\
+	"resin_flasher_detect=" \
+		"fatload mmc " __stringify(RESIN_EXTERNAL_MMC) ":${resin_boot_part} ${resin_kernel_load_addr} ${resin_flasher_external_flag_file};\0" \
+	\
+	"resin_set_mmcdev=" \
+		"if test -n " __stringify(RESIN_EXTERNAL_MMC) "; then " \
+			"if run resin_flasher_detect; then " \
+				"setenv resin_mmcdev " __stringify(RESIN_EXTERNAL_MMC) "; "\
+			"else; " \
+				"setenv resin_mmcdev " __stringify(RESIN_INTERNAL_MMC) "; "\
+			"fi; " \
+		"else; "\
+			"setenv resin_mmcdev " __stringify(RESIN_INTERNAL_MMC) "; "\
+		"fi;\0" \
+	\
+	"resin_inject_env_file=" \
+		"if run resin_load_env_file; then " \
+			"run resin_import_env_file;" \
+		"fi;\0" \
+	\
+	"resin_set_kernel_root=" \
+		"run resin_set_mmcdev;" \
+		"run resin_inject_env_file;" \
+		"run resin_find_root_part_uuid;" \
+		"setenv resin_kernel_root root=PARTUUID=${resin_root_part_uuid}\0"
+
+#endif /* HEADER_ENV_RESIN_H */
+
--
2.7.4


{'fraction_non_alphanumeric': 0.14417942328230687, 'fraction_numerical': 0.03595585617657529, 'mean_word_length': 4.3260663507109, 'pattern_counts': {'":': 1, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '422886', 'n_tokens_mistral': 2361, 'n_tokens_neox': 2186, 'n_words': 479}