Merge "First cut of SpaceCast barebox"
diff --git a/arch/arm/configs/optimus_defconfig b/arch/arm/configs/optimus_defconfig
index b3d9dc4..c5b8b47 100644
--- a/arch/arm/configs/optimus_defconfig
+++ b/arch/arm/configs/optimus_defconfig
@@ -14,6 +14,7 @@
CONFIG_MEM_SIZE=y
CONFIG_PARTITION=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/optimus/env"
+CONFIG_ANTIREBOOTLOOP=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_LOADENV=y
diff --git a/arch/arm/configs/optimus_mfg_defconfig b/arch/arm/configs/optimus_mfg_defconfig
index da58d0b..aa7a301 100644
--- a/arch/arm/configs/optimus_mfg_defconfig
+++ b/arch/arm/configs/optimus_mfg_defconfig
@@ -14,6 +14,7 @@
CONFIG_MEM_SIZE=y
CONFIG_PARTITION=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/optimus/env_mfg"
+CONFIG_ANTIREBOOTLOOP=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_LOADENV=y
diff --git a/commands/bootm.c b/commands/bootm.c
index a76cf6f..bd2f2de 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -647,7 +647,9 @@
puts ("OK\n");
+#ifdef CONFIG_ANTIREBOOTLOOP
antirebootloop_preboot_hook();
+#endif
/* loop through the registered handlers */
list_for_each_entry(handler, &handler_list, list) {
diff --git a/common/Kconfig b/common/Kconfig
index be6871e..42696ce 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -475,6 +475,21 @@
config POLLER
bool "generic polling infrastructure"
+config ANTIREBOOTLOOP
+ bool "Anti reboot loop feature"
+ help
+ The anti reboot loop feature is a communication protocol between the
+ bootloader and the kernel that allows the bootloader to determine if a
+ certain kernel/rootfs image is "good". The way it works is that the
+ bootloader writes a certain bit pattern to a previously agreed memory
+ location. If a userspace app decides that the kernel has booted ok and
+ that the user space environment is sane, it tells the kernel which then
+ flips a bit in DRAM to communicate to the bootloader that this image is
+ considered "good". Now, if the system reboots due to some failure
+ condition before said bit has been flipped, the bootloader is able to
+ detect this situation and switch back to a different kernel/rootfs
+ image.
+
endmenu
menu "Debugging "
diff --git a/common/Makefile b/common/Makefile
index 3b0b94d..bb476ca 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -8,7 +8,7 @@
obj-$(CONFIG_POLLER) += poller.o
obj-$(CONFIG_BLOCK) += block.o
-obj-y += antirebootloop.o
+obj-$(CONFIG_ANTIREBOOTLOOP) += antirebootloop.o
obj-y += memory.o
obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o