Merge "Fix MonkeyRunner SDK documentation generation."
diff --git a/core/Makefile b/core/Makefile
index 37ddf37..f66710c 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -627,6 +627,10 @@
 ifdef BOARD_KERNEL_BASE
   INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
 endif
+BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
+ifdef BOARD_KERNEL_PAGESIZE
+  INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
+endif
 
 # Keys authorized to sign OTA packages this build will accept.  The
 # build always uses test-keys for this; release packaging tools will
@@ -997,6 +1001,9 @@
 ifdef BOARD_KERNEL_BASE
 	$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
 endif
+ifdef BOARD_KERNEL_PAGESIZE
+	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
+endif
 	@# Components of the boot image
 	$(hide) mkdir -p $(zip_root)/BOOT
 	$(hide) $(call package_files-copy-root, \
@@ -1014,6 +1021,9 @@
 ifdef BOARD_KERNEL_BASE
 	$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
 endif
+ifdef BOARD_KERNEL_PAGESIZE
+	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
+endif
 	$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
 	            mkdir -p $(zip_root)/RADIO; \
 	            $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
@@ -1058,6 +1068,9 @@
 	$(hide) echo "partition_type=MTD" >> $(zip_root)/META/misc_info.txt
 endif
 	$(hide) echo "$(tool_extensions)" > $(zip_root)/META/tool-extensions.txt
+ifdef mkyaffs2_extra_flags
+	$(hide) echo "$(mkyaffs2_extra_flags)" > $(zip_root)/META/mkyaffs2-extra-flags.txt
+endif
 	@# Zip everything up, preserving symlinks
 	$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
 	@# Run fs_config on all the system files in the zip, and save the output
@@ -1073,6 +1086,7 @@
 ifneq ($(TARGET_SIMULATOR),true)
 ifneq ($(TARGET_PRODUCT),sdk)
 ifneq ($(TARGET_DEVICE),generic)
+ifneq ($(TARGET_NO_KERNEL),true)
 
 name := $(TARGET_PRODUCT)
 ifeq ($(TARGET_BUILD_TYPE),debug)
@@ -1086,7 +1100,7 @@
 
 $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
 	@echo "Package OTA: $@"
-	$(hide) ./build/tools/releasetools/ota_from_target_files \
+	$(hide) ./build/tools/releasetools/ota_from_target_files -v \
 	   -p $(HOST_OUT) \
            -k $(KEY_CERT_PAIR) \
            $(BUILT_TARGET_FILES_PACKAGE) $@
@@ -1094,6 +1108,7 @@
 .PHONY: otapackage
 otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
 
+endif    # TARGET_NO_KERNEL != true
 endif    # TARGET_DEVICE != generic
 endif    # TARGET_PRODUCT != sdk
 endif    # TARGET_SIMULATOR != true
@@ -1234,7 +1249,7 @@
 
 $(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
 	@echo "Package: $@"
-	$(hide) ./build/tools/releasetools/img_from_target_files \
+	$(hide) ./build/tools/releasetools/img_from_target_files -v \
 	   -s $(extensions) \
 	   -p $(HOST_OUT) \
 	   $(addprefix --fs_type ,$(INTERNAL_USERIMAGES_EXT_VARIANT)) \
diff --git a/tools/droiddoc/templates/assets/customizations.js b/tools/droiddoc/templates/assets/customizations.js
index 26eb59f..5258902 100644
--- a/tools/droiddoc/templates/assets/customizations.js
+++ b/tools/droiddoc/templates/assets/customizations.js
@@ -9,3 +9,6 @@
     $("#naMessage").hide();
   }
 }
+
+// Direct searches to search.html
+HAS_SEARCH_PAGE = true;
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 18ba842..4db9095 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -36,6 +36,7 @@
 OPTIONS.tempfiles = []
 OPTIONS.device_specific = None
 OPTIONS.extras = {}
+OPTIONS.mkyaffs2_extra_flags = None
 
 
 # Values for "certificate" in apkcerts that mean special things.
@@ -103,6 +104,17 @@
       raise
 
 
+def LoadMkyaffs2ExtraFlags():
+  """Load mkyaffs2 extra flags."""
+  try:
+    fn = os.path.join(OPTIONS.input_tmp, "META", "mkyaffs2-extra-flags.txt");
+    if os.access(fn, os.F_OK):
+      OPTIONS.mkyaffs2_extra_flags = open(fn).read().rstrip("\n")
+  except IOError, e:
+    if e.errno == errno.ENOENT:
+      pass
+
+
 def BuildAndAddBootableImage(sourcedir, targetname, output_zip):
   """Take a kernel, cmdline, and ramdisk directory from the input (in
   'sourcedir'), and turn them into a boot image.  Put the boot image
@@ -155,6 +167,11 @@
     cmd.append("--base")
     cmd.append(open(fn).read().rstrip("\n"))
 
+  fn = os.path.join(sourcedir, "pagesize")
+  if os.access(fn, os.F_OK):
+    cmd.append("--pagesize")
+    cmd.append(open(fn).read().rstrip("\n"))
+
   cmd.extend(["--ramdisk", ramdisk_img.name,
               "--output", img.name])
 
diff --git a/tools/releasetools/img_from_target_files b/tools/releasetools/img_from_target_files
index d180998..b1f67a6 100755
--- a/tools/releasetools/img_from_target_files
+++ b/tools/releasetools/img_from_target_files
@@ -77,8 +77,11 @@
     if "userdata.img" in OPTIONS.max_image_size:
       build_command.append(str(OPTIONS.max_image_size["userdata.img"]))
   else:
-    build_command = ["mkyaffs2image", "-f",
-                     user_dir, img.name]
+    build_command = ["mkyaffs2image", "-f"]
+    if OPTIONS.mkyaffs2_extra_flags is not None:
+      build_command.append(OPTIONS.mkyaffs2_extra_flags);
+    build_command.append(user_dir)
+    build_command.append(img.name)
 
   p = common.Run(build_command);
   p.communicate()
@@ -122,8 +125,11 @@
     if "system.img" in OPTIONS.max_image_size:
       build_command.append(str(OPTIONS.max_image_size["system.img"]))
   else:
-    build_command = ["mkyaffs2image", "-f",
-                     os.path.join(OPTIONS.input_tmp, "system"), img.name]
+    build_command = ["mkyaffs2image", "-f"]
+    if OPTIONS.mkyaffs2_extra_flags is not None:
+      build_command.append(OPTIONS.mkyaffs2_extra_flags);
+    build_command.append(os.path.join(OPTIONS.input_tmp, "system"))
+    build_command.append(img.name)
 
   p = common.Run(build_command)
   p.communicate()
@@ -174,6 +180,8 @@
     print "  image size limits."
     print
 
+  common.LoadMkyaffs2ExtraFlags()
+
   output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
 
   common.AddBoot(output_zip)