diff --git a/tools/Android.mk b/tools/Android.mk
new file mode 100644
index 0000000..6571161
--- /dev/null
+++ b/tools/Android.mk
@@ -0,0 +1 @@
+include $(all-subdir-makefiles)
diff --git a/tools/ota/Android.mk b/tools/ota/Android.mk
index 43e2135..b7a57d6 100644
--- a/tools/ota/Android.mk
+++ b/tools/ota/Android.mk
@@ -18,3 +18,25 @@
 LOCAL_MODULE := make-update-script
 LOCAL_SRC_FILES := make-update-script.c
 include $(BUILD_HOST_EXECUTABLE)
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+include $(CLEAR_VARS)
+LOCAL_FORCE_STATIC_EXECUTABLE := true
+LOCAL_MODULE := add-property-tag
+LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
+LOCAL_MODULE_TAGS := debug
+LOCAL_SRC_FILES := add-property-tag.c
+LOCAL_STATIC_LIBRARIES := libc
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_FORCE_STATIC_EXECUTABLE := true
+LOCAL_MODULE := check-lost+found
+LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
+LOCAL_MODULE_TAGS := debug
+LOCAL_SRC_FILES := check-lost+found.c
+LOCAL_STATIC_LIBRARIES := libcutils libc
+include $(BUILD_EXECUTABLE)
+
+endif  # !TARGET_SIMULATOR
diff --git a/tools/ota/add-property-tag.c b/tools/ota/add-property-tag.c
new file mode 100644
index 0000000..5277edd
--- /dev/null
+++ b/tools/ota/add-property-tag.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ctype.h>
+#include <errno.h>
+#include <getopt.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * Append a tag to a property value in a .prop file if it isn't already there.
+ * Normally used to modify build properties to record incremental updates.
+ */
+
+// Return nonzero if the tag should be added to this line.
+int should_tag(const char *line, const char *propname) {
+    const char *prop = strstr(line, propname);
+    if (prop == NULL) return 0;
+
+    // Make sure this is actually the property name (not an accidental hit)
+    const char *ptr;
+    for (ptr = line; ptr < prop && isspace(*ptr); ++ptr) ;
+    if (ptr != prop) return 0;  // Must be at the beginning of the line
+
+    for (ptr += strlen(propname); *ptr != '\0' && isspace(*ptr); ++ptr) ;
+    return (*ptr == '=');  // Must be followed by a '='
+}
+
+// Remove existing tags from the line, return the following number (if any)
+int remove_tag(char *line, const char *tag) {
+    char *pos = strstr(line, tag);
+    if (pos == NULL) return 0;
+
+    char *end;
+    int num = strtoul(pos + strlen(tag), &end, 10);
+    strcpy(pos, end);
+    return num;
+}
+
+// Write line to output with the tag added, adding a number (if >0)
+void write_tagged(FILE *out, const char *line, const char *tag, int number) {
+    const char *end = line + strlen(line);
+    while (end > line && isspace(end[-1])) --end;
+    if (number > 0) {
+        fprintf(out, "%.*s%s%d%s", end - line, line, tag, number, end);
+    } else {
+        fprintf(out, "%.*s%s%s", end - line, line, tag, end);
+    }
+}
+
+int main(int argc, char **argv) {
+    const char *filename = "/system/build.prop";
+    const char *propname = "ro.build.fingerprint";
+    const char *tag = NULL;
+    int do_remove = 0, do_number = 0;
+
+    int opt;
+    while ((opt = getopt(argc, argv, "f:p:rn")) != -1) {
+        switch (opt) {
+        case 'f': filename = optarg; break;
+        case 'p': propname = optarg; break;
+        case 'r': do_remove = 1; break;
+        case 'n': do_number = 1; break;
+        case '?': return 2;
+        }
+    }
+
+    if (argc != optind + 1) {
+        fprintf(stderr,
+            "usage: add-property-tag [flags] tag-to-add\n"
+            "flags: -f /dir/file.prop (default /system/build.prop)\n"
+            "       -p prop.name (default ro.build.fingerprint)\n"
+            "       -r (if set, remove the tag rather than adding it)\n"
+            "       -n (if set, add and increment a number after the tag)\n");
+        return 2;
+    }
+
+    tag = argv[optind];
+    FILE *input = fopen(filename, "r");
+    if (input == NULL) {
+        fprintf(stderr, "can't read %s: %s\n", filename, strerror(errno));
+        return 1;
+    }
+
+    char tmpname[PATH_MAX];
+    snprintf(tmpname, sizeof(tmpname), "%s.tmp", filename);
+    FILE *output = fopen(tmpname, "w");
+    if (output == NULL) {
+        fprintf(stderr, "can't write %s: %s\n", tmpname, strerror(errno));
+        return 1;
+    }
+
+    int found = 0;
+    char line[4096];
+    while (fgets(line, sizeof(line), input)) {
+        if (!should_tag(line, propname)) {
+            fputs(line, output);  // Pass through unmodified
+        } else {
+            found = 1;
+            int number = remove_tag(line, tag);
+            if (do_remove) {
+                fputs(line, output);  // Remove the tag but don't re-add it
+            } else {
+                write_tagged(output, line, tag, number + do_number);
+            }
+        }
+    }
+
+    fclose(input);
+    fclose(output);
+
+    if (!found) {
+        fprintf(stderr, "property %s not found in %s\n", propname, filename);
+        remove(tmpname);
+        return 1;
+    }
+
+    if (rename(tmpname, filename)) {
+        fprintf(stderr, "can't rename %s to %s: %s\n",
+            tmpname, filename, strerror(errno));
+        remove(tmpname);
+        return 1;
+    }
+
+    return 0;
+}
diff --git a/tools/ota/check-lost+found.c b/tools/ota/check-lost+found.c
new file mode 100644
index 0000000..f856275
--- /dev/null
+++ b/tools/ota/check-lost+found.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/klog.h>
+#include <sys/reboot.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
+
+#include "private/android_filesystem_config.h"
+
+// Sentinel file used to track whether we've forced a reboot
+static const char *kMarkerFile = "/data/misc/check-lost+found-rebooted-2";
+
+// Output file in tombstones directory (first 8K will be uploaded)
+static const char *kOutputDir = "/data/tombstones";
+static const char *kOutputFile = "/data/tombstones/check-lost+found-log";
+
+// Partitions to check
+static const char *kPartitions[] = { "/system", "/data", "/cache", NULL };
+
+/*
+ * 1. If /data/misc/forced-reboot is missing, touch it & force "unclean" boot.
+ * 2. Write a log entry with the number of files in lost+found directories.
+ */
+
+int main(int argc, char **argv) {
+    mkdir(kOutputDir, 0755);
+    chown(kOutputDir, AID_SYSTEM, AID_SYSTEM);
+    FILE *out = fopen(kOutputFile, "a");
+    if (out == NULL) {
+        fprintf(stderr, "Can't write %s: %s\n", kOutputFile, strerror(errno));
+        return 1;
+    }
+
+    // Note: only the first 8K of log will be uploaded, so be terse.
+    time_t start = time(NULL);
+    fprintf(out, "*** check-lost+found ***\nStarted: %s", ctime(&start));
+
+    struct stat st;
+    if (stat(kMarkerFile, &st)) {
+        // No reboot marker -- need to force an unclean reboot.
+        // But first, try to create the marker file.  If that fails,
+        // skip the reboot, so we don't get caught in an infinite loop.
+
+        int fd = open(kMarkerFile, O_WRONLY|O_CREAT, 0444);
+        if (fd >= 0 && close(fd) == 0) {
+            fprintf(out, "Wrote %s, rebooting\n", kMarkerFile);
+            fflush(out);
+            sync();  // Make sure the marker file is committed to disk
+
+            // If possible, dirty each of these partitions before rebooting,
+            // to make sure the filesystem has to do a scan on mount.
+            int i;
+            for (i = 0; kPartitions[i] != NULL; ++i) {
+                char fn[PATH_MAX];
+                snprintf(fn, sizeof(fn), "%s/%s", kPartitions[i], "dirty");
+                fd = open(fn, O_WRONLY|O_CREAT, 0444);
+                if (fd >= 0) {  // Don't sweat it if we can't write the file.
+                    write(fd, fn, sizeof(fn));  // write, you know, some data
+                    close(fd);
+                    unlink(fn);
+                }
+            }
+
+            reboot(RB_AUTOBOOT);  // reboot immediately, with dirty filesystems
+            fprintf(out, "Reboot failed?!\n");
+            exit(1);
+        } else {
+            fprintf(out, "Can't write %s: %s\n", kMarkerFile, strerror(errno));
+        }
+    } else {
+        fprintf(out, "Found %s\n", kMarkerFile);
+    }
+
+    int i;
+    for (i = 0; kPartitions[i] != NULL; ++i) {
+        char fn[PATH_MAX];
+        snprintf(fn, sizeof(fn), "%s/%s", kPartitions[i], "lost+found");
+        DIR *dir = opendir(fn);
+        if (dir == NULL) {
+            fprintf(out, "Can't open %s: %s\n", fn, strerror(errno));
+        } else {
+            int count = 0;
+            struct dirent *ent;
+            while ((ent = readdir(dir))) {
+                if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, ".."))
+                    ++count;
+            }
+            closedir(dir);
+            if (count > 0) {
+                fprintf(out, "OMGZ FOUND %d FILES IN %s\n", count, fn);
+            } else {
+                fprintf(out, "%s is clean\n", fn);
+            }
+        }
+    }
+
+    char dmesg[131073];
+    int len = klogctl(KLOG_READ_ALL, dmesg, sizeof(dmesg) - 1);
+    if (len < 0) {
+        fprintf(out, "Can't read kernel log: %s\n", strerror(errno));
+    } else {  // To conserve space, only write lines with certain keywords
+        fprintf(out, "--- Kernel log ---\n");
+        dmesg[len] = '\0';
+        char *saveptr, *line;
+        int in_yaffs = 0;
+        for (line = strtok_r(dmesg, "\n", &saveptr); line != NULL;
+             line = strtok_r(NULL, "\n", &saveptr)) {
+            if (strstr(line, "yaffs: dev is")) in_yaffs = 1;
+
+            if (in_yaffs ||
+                    strstr(line, "yaffs") ||
+                    strstr(line, "mtd") ||
+                    strstr(line, "msm_nand")) {
+                fprintf(out, "%s\n", line);
+            }
+
+            if (strstr(line, "yaffs_read_super: isCheckpointed")) in_yaffs = 0;
+        }
+    }
+
+    return 0;
+}
diff --git a/tools/ota/make-update-script.c b/tools/ota/make-update-script.c
index 0fb7ed0..225dc52 100644
--- a/tools/ota/make-update-script.c
+++ b/tools/ota/make-update-script.c
@@ -171,7 +171,7 @@
     printf("assert compatible_with(\"0.2\") == \"true\"\n");
 
     // if known, make sure the device name is correct
-    const char *device = getenv("TARGET_PRODUCT");
+    const char *device = getenv("TARGET_DEVICE");
     if (device != NULL) {
         printf("assert getprop(\"ro.product.device\") == \"%s\" || "
                 "getprop(\"ro.build.product\") == \"%s\"\n", device, device);
