toolbox: Avoid linking toolbox tools to dd

Having the twrp_dd module definition right within the build rules
for the toolbox symlinks causes the toolbox tools (getprop, ...)
to be linked to dd instead of toolbox.

This happens because the symlinks are created using variables
from the "toolbox_recovery" module (e.g. LOCAL_MODULE_STEM).
Those are changed by the twrp_dd module definition.

Move the twrp_dd module definition to the end of the make file
(after the build rules for the symlinks) to fix this.

Fixes https://github.com/omnirom/android_bootable_recovery/issues/257

Change-Id: I44973920898fe8a21bc32d621500fe38f9d1ebdd
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index 6698491..9267438 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -289,6 +289,33 @@
 $(TOOLS_H):
 	$(transform-generated-source)
 
+# toolbox setenforce is used during init in non-symlink form, so it was
+# required to be included as part of the suite above. if busybox already
+# provides setenforce, we can omit the toolbox symlink
+TEMP_TOOLS := $(filter-out $(RECOVERY_BUSYBOX_TOOLS), $(ALL_TOOLS))
+ALL_TOOLS := $(TEMP_TOOLS)
+
+# Make /sbin/toolbox launchers for each tool
+SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(ALL_TOOLS))
+$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE_STEM)
+$(SYMLINKS): $(LOCAL_INSTALLED_MODULE)
+	@echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
+	@mkdir -p $(dir $@)
+	@rm -rf $@
+	$(hide) ln -sf $(TOOLBOX_BINARY) $@
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := toolbox_symlinks
+LOCAL_MODULE_TAGS := optional
+LOCAL_ADDITIONAL_DEPENDENCIES := $(SYMLINKS)
+include $(BUILD_PHONY_PACKAGE)
+
+ifneq (,$(filter $(PLATFORM_SDK_VERSION),16 17 18))
+    # Only needed if the build system lacks support for LOCAL_ADDITIONAL_DEPENDENCIES
+    ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
+    ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
+        $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
+endif
 
 ifeq ($(TW_USE_TOOLBOX), true)
     ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23; echo $$?),0)
@@ -320,34 +347,6 @@
     endif
 endif
 
-# toolbox setenforce is used during init in non-symlink form, so it was
-# required to be included as part of the suite above. if busybox already
-# provides setenforce, we can omit the toolbox symlink
-TEMP_TOOLS := $(filter-out $(RECOVERY_BUSYBOX_TOOLS), $(ALL_TOOLS))
-ALL_TOOLS := $(TEMP_TOOLS)
-
-# Make /sbin/toolbox launchers for each tool
-SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(ALL_TOOLS))
-$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE_STEM)
-$(SYMLINKS): $(LOCAL_INSTALLED_MODULE)
-	@echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
-	@mkdir -p $(dir $@)
-	@rm -rf $@
-	$(hide) ln -sf $(TOOLBOX_BINARY) $@
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := toolbox_symlinks
-LOCAL_MODULE_TAGS := optional
-LOCAL_ADDITIONAL_DEPENDENCIES := $(SYMLINKS)
-include $(BUILD_PHONY_PACKAGE)
-
-ifneq (,$(filter $(PLATFORM_SDK_VERSION),16 17 18))
-    # Only needed if the build system lacks support for LOCAL_ADDITIONAL_DEPENDENCIES
-    ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
-    ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
-        $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
-endif
-
 SYMLINKS :=
 ALL_TOOLS :=
 BSD_TOOLS :=