Permalink
Browse files

auto import from //depot/cupcake/@135843

  • Loading branch information...
The Android Open Source Project
The Android Open Source Project committed Mar 4, 2009
1 parent ffb48f6 commit c24a8e688a6312764254beac2b2520bb0c5e998d
Showing with 14,368 additions and 0 deletions.
  1. +60 −0 Android.mk
  2. +53 −0 amend/Android.mk
  3. +32 −0 amend/amend.c
  4. +25 −0 amend/amend.h
  5. +198 −0 amend/ast.c
  6. +165 −0 amend/ast.h
  7. +273 −0 amend/commands.c
  8. +96 −0 amend/commands.h
  9. +315 −0 amend/execute.c
  10. +25 −0 amend/execute.h
  11. +43 −0 amend/lexer.h
  12. +299 −0 amend/lexer.l
  13. +195 −0 amend/main.c
  14. +24 −0 amend/parser.h
  15. +430 −0 amend/parser_y.y
  16. +270 −0 amend/permissions.c
  17. +111 −0 amend/permissions.h
  18. +394 −0 amend/register.c
  19. +23 −0 amend/register.h
  20. +132 −0 amend/symtab.c
  21. +34 −0 amend/symtab.h
  22. +538 −0 amend/test_commands.c
  23. +347 −0 amend/test_permissions.c
  24. +146 −0 amend/test_symtab.c
  25. +1 −0 amend/tests/001-nop/expected.txt
  26. +2 −0 amend/tests/001-nop/info.txt
  27. +17 −0 amend/tests/001-nop/run
  28. 0 amend/tests/002-lex-empty/SKIP
  29. +1 −0 amend/tests/002-lex-empty/expected.txt
  30. +1 −0 amend/tests/002-lex-empty/info.txt
  31. 0 amend/tests/002-lex-empty/input
  32. +17 −0 amend/tests/002-lex-empty/run
  33. +13 −0 amend/tests/003-lex-command/expected.txt
  34. +1 −0 amend/tests/003-lex-command/info.txt
  35. +6 −0 amend/tests/003-lex-command/input
  36. +1 −0 amend/tests/003-lex-command/input2
  37. +1 −0 amend/tests/003-lex-command/input3
  38. +1 −0 amend/tests/003-lex-command/input4
  39. +20 −0 amend/tests/003-lex-command/run
  40. +5 −0 amend/tests/004-lex-comment/expected.txt
  41. +1 −0 amend/tests/004-lex-comment/info.txt
  42. +4 −0 amend/tests/004-lex-comment/input
  43. +17 −0 amend/tests/004-lex-comment/run
  44. +13 −0 amend/tests/005-lex-quoted-string/expected.txt
  45. +1 −0 amend/tests/005-lex-quoted-string/info.txt
  46. +5 −0 amend/tests/005-lex-quoted-string/input
  47. +2 −0 amend/tests/005-lex-quoted-string/input2
  48. +2 −0 amend/tests/005-lex-quoted-string/input3
  49. +19 −0 amend/tests/005-lex-quoted-string/run
  50. 0 amend/tests/006-lex-words/SKIP
  51. +6 −0 amend/tests/006-lex-words/expected.txt
  52. +1 −0 amend/tests/006-lex-words/info.txt
  53. +5 −0 amend/tests/006-lex-words/input
  54. +2 −0 amend/tests/006-lex-words/input2
  55. +2 −0 amend/tests/006-lex-words/input3
  56. +17 −0 amend/tests/006-lex-words/run
  57. +11 −0 amend/tests/007-lex-real-script/expected.txt
  58. +1 −0 amend/tests/007-lex-real-script/info.txt
  59. +10 −0 amend/tests/007-lex-real-script/input
  60. +17 −0 amend/tests/007-lex-real-script/run
  61. +74 −0 amend/tests/008-parse-real-script/expected.txt
  62. +1 −0 amend/tests/008-parse-real-script/info.txt
  63. +10 −0 amend/tests/008-parse-real-script/input
  64. +17 −0 amend/tests/008-parse-real-script/run
  65. 0 amend/tests/XXX-long-token/SKIP
  66. 0 amend/tests/XXX-stack-overflow/SKIP
  67. +150 −0 amend/tests/one-test
  68. +69 −0 amend/tests/run-all-tests
  69. +267 −0 bootloader.c
  70. +59 −0 bootloader.h
  71. +1,148 −0 commands.c
  72. +28 −0 commands.h
  73. +94 −0 common.h
  74. +8 −0 etc/META-INF/com/google/android/update-script
  75. +33 −0 etc/init.rc
  76. +127 −0 firmware.c
  77. +32 −0 firmware.h
  78. +186 −0 install.c
  79. +25 −0 install.h
  80. +12 −0 minui/Android.mk
  81. +82 −0 minui/events.c
  82. +214 −0 minui/font_10x18.h
  83. +312 −0 minui/graphics.c
  84. +70 −0 minui/minui.h
  85. +54 −0 minui/mkfont.c
  86. +202 −0 minui/resources.c
  87. +19 −0 minzip/Android.mk
  88. +357 −0 minzip/Bits.h
  89. +280 −0 minzip/DirUtil.c
  90. +51 −0 minzip/DirUtil.h
  91. +390 −0 minzip/Hash.c
  92. +186 −0 minzip/Hash.h
  93. +25 −0 minzip/Inlines.c
  94. +207 −0 minzip/Log.h
  95. +212 −0 minzip/SysUtil.c
  96. +61 −0 minzip/SysUtil.h
  97. +1,098 −0 minzip/Zip.c
  98. +206 −0 minzip/Zip.h
  99. +26 −0 minzip/inline_magic.h
  100. +23 −0 mtdutils/Android.mk
  101. +140 −0 mtdutils/flash_image.c
  102. +214 −0 mtdutils/mounts.c
  103. +31 −0 mtdutils/mounts.h
  104. +510 −0 mtdutils/mtdutils.c
  105. +54 −0 mtdutils/mtdutils.h
  106. +471 −0 recovery.c
  107. BIN res/images/icon_error.bmp
  108. BIN res/images/icon_firmware_error.bmp
  109. BIN res/images/icon_firmware_install.bmp
  110. BIN res/images/icon_installing.bmp
  111. BIN res/images/icon_unpacking.bmp
  112. BIN res/images/indeterminate1.bmp
  113. BIN res/images/indeterminate2.bmp
  114. BIN res/images/indeterminate3.bmp
  115. BIN res/images/indeterminate4.bmp
  116. BIN res/images/indeterminate5.bmp
  117. BIN res/images/indeterminate6.bmp
  118. BIN res/images/progress_bar_empty.bmp
  119. BIN res/images/progress_bar_empty_left_round.bmp
  120. BIN res/images/progress_bar_empty_right_round.bmp
  121. BIN res/images/progress_bar_fill.bmp
  122. BIN res/images/progress_bar_left_round.bmp
  123. BIN res/images/progress_bar_right_round.bmp
  124. +370 −0 roots.c
  125. +63 −0 roots.h
  126. +81 −0 test_roots.c
  127. +1 −0 tools/Android.mk
  128. +42 −0 tools/ota/Android.mk
  129. +141 −0 tools/ota/add-property-tag.c
  130. +144 −0 tools/ota/check-lost+found.c
  131. +79 −0 tools/ota/convert-to-bmp.py
  132. +228 −0 tools/ota/make-update-script.c
  133. +542 −0 ui.c
  134. +361 −0 verifier.c
  135. +30 −0 verifier.h
View
@@ -0,0 +1,60 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+commands_recovery_local_path := $(LOCAL_PATH)
+
+ifneq ($(TARGET_SIMULATOR),true)
+ifeq ($(TARGET_ARCH),arm)
+
+LOCAL_SRC_FILES := \
+ recovery.c \
+ bootloader.c \
+ commands.c \
+ firmware.c \
+ install.c \
+ roots.c \
+ ui.c \
+ verifier.c
+
+LOCAL_SRC_FILES += test_roots.c
+
+LOCAL_MODULE := recovery
+
+LOCAL_FORCE_STATIC_EXECUTABLE := true
+
+# This binary is in the recovery ramdisk, which is otherwise a copy of root.
+# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
+# a (redundant) copy of the binary in /system/bin for user builds.
+# TODO: Build the ramdisk image in a more principled way.
+
+LOCAL_MODULE_TAGS := eng
+
+LOCAL_STATIC_LIBRARIES := libminzip libunz libamend libmtdutils libmincrypt
+LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libcutils
+LOCAL_STATIC_LIBRARIES += libstdc++ libc
+
+# Specify a C-includable file containing the OTA public keys.
+# This is built in config/Makefile.
+# *** THIS IS A TOTAL HACK; EXECUTABLES MUST NOT CHANGE BETWEEN DIFFERENT
+# PRODUCTS/BUILD TYPES. ***
+# TODO: make recovery read the keys from an external file.
+RECOVERY_INSTALL_OTA_KEYS_INC := \
+ $(call intermediates-dir-for,PACKAGING,ota_keys_inc)/keys.inc
+# Let install.c say #include "keys.inc"
+LOCAL_C_INCLUDES += $(dir $(RECOVERY_INSTALL_OTA_KEYS_INC))
+
+include $(BUILD_EXECUTABLE)
+
+# Depend on the generated keys.inc containing the OTA public keys.
+$(intermediates)/install.o: $(RECOVERY_INSTALL_OTA_KEYS_INC)
+
+include $(commands_recovery_local_path)/minui/Android.mk
+
+endif # TARGET_ARCH == arm
+endif # !TARGET_SIMULATOR
+
+include $(commands_recovery_local_path)/amend/Android.mk
+include $(commands_recovery_local_path)/minzip/Android.mk
+include $(commands_recovery_local_path)/mtdutils/Android.mk
+include $(commands_recovery_local_path)/tools/Android.mk
+commands_recovery_local_path :=
View
@@ -0,0 +1,53 @@
+# Copyright 2007 The Android Open Source Project
+#
+
+LOCAL_PATH := $(call my-dir)
+
+amend_src_files := \
+ amend.c \
+ lexer.l \
+ parser_y.y \
+ ast.c \
+ symtab.c \
+ commands.c \
+ permissions.c \
+ execute.c
+
+amend_test_files := \
+ test_symtab.c \
+ test_commands.c \
+ test_permissions.c
+
+# "-x c" forces the lex/yacc files to be compiled as c;
+# the build system otherwise forces them to be c++.
+amend_cflags := -Wall -x c
+
+#
+# Build the host-side command line tool
+#
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ $(amend_src_files) \
+ $(amend_test_files) \
+ register.c \
+ main.c
+
+LOCAL_CFLAGS := $(amend_cflags) -g -O0
+LOCAL_MODULE := amend
+LOCAL_YACCFLAGS := -v
+
+include $(BUILD_HOST_EXECUTABLE)
+
+#
+# Build the device-side library
+#
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(amend_src_files)
+LOCAL_SRC_FILES += $(amend_test_files)
+
+LOCAL_CFLAGS := $(amend_cflags)
+LOCAL_MODULE := libamend
+
+include $(BUILD_STATIC_LIBRARY)
View
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2007 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 <stdlib.h>
+#include "amend.h"
+#include "lexer.h"
+
+extern const AmCommandList *gCommands;
+
+const AmCommandList *
+parseAmendScript(const char *buf, size_t bufLen)
+{
+ setLexerInputBuffer(buf, bufLen);
+ int ret = yyparse();
+ if (ret != 0) {
+ return NULL;
+ }
+ return gCommands;
+}
View
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2007 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.
+ */
+
+#ifndef AMEND_H_
+#define AMEND_H_
+
+#include "ast.h"
+#include "execute.h"
+
+const AmCommandList *parseAmendScript(const char *buf, size_t bufLen);
+
+#endif // AMEND_H_
View
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2007 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 <stdio.h>
+#include "ast.h"
+
+static const char gSpaces[] =
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " ";
+const int gSpacesMax = sizeof(gSpaces) - 1;
+
+static const char *
+pad(int level)
+{
+ level *= 4;
+ if (level > gSpacesMax) {
+ level = gSpacesMax;
+ }
+ return gSpaces + gSpacesMax - level;
+}
+
+void dumpBooleanValue(int level, const AmBooleanValue *booleanValue);
+void dumpStringValue(int level, const AmStringValue *stringValue);
+
+void
+dumpBooleanExpression(int level, const AmBooleanExpression *booleanExpression)
+{
+ const char *op;
+ bool unary = false;
+
+ switch (booleanExpression->op) {
+ case AM_BOP_NOT:
+ op = "NOT";
+ unary = true;
+ break;
+ case AM_BOP_EQ:
+ op = "EQ";
+ break;
+ case AM_BOP_NE:
+ op = "NE";
+ break;
+ case AM_BOP_AND:
+ op = "AND";
+ break;
+ case AM_BOP_OR:
+ op = "OR";
+ break;
+ default:
+ op = "??";
+ break;
+ }
+
+ printf("%sBOOLEAN %s {\n", pad(level), op);
+ dumpBooleanValue(level + 1, booleanExpression->arg1);
+ if (!unary) {
+ dumpBooleanValue(level + 1, booleanExpression->arg2);
+ }
+ printf("%s}\n", pad(level));
+}
+
+void
+dumpFunctionArguments(int level, const AmFunctionArguments *functionArguments)
+{
+ int i;
+ for (i = 0; i < functionArguments->argc; i++) {
+ dumpStringValue(level, &functionArguments->argv[i]);
+ }
+}
+
+void
+dumpFunctionCall(int level, const AmFunctionCall *functionCall)
+{
+ printf("%sFUNCTION %s (\n", pad(level), functionCall->name);
+ dumpFunctionArguments(level + 1, functionCall->args);
+ printf("%s)\n", pad(level));
+}
+
+void
+dumpStringValue(int level, const AmStringValue *stringValue)
+{
+ switch (stringValue->type) {
+ case AM_SVAL_LITERAL:
+ printf("%s\"%s\"\n", pad(level), stringValue->u.literal);
+ break;
+ case AM_SVAL_FUNCTION:
+ dumpFunctionCall(level, stringValue->u.function);
+ break;
+ default:
+ printf("%s<UNKNOWN SVAL TYPE %d>\n", pad(level), stringValue->type);
+ break;
+ }
+}
+
+void
+dumpStringComparisonExpression(int level,
+ const AmStringComparisonExpression *stringComparisonExpression)
+{
+ const char *op;
+
+ switch (stringComparisonExpression->op) {
+ case AM_SOP_LT:
+ op = "LT";
+ break;
+ case AM_SOP_LE:
+ op = "LE";
+ break;
+ case AM_SOP_GT:
+ op = "GT";
+ break;
+ case AM_SOP_GE:
+ op = "GE";
+ break;
+ case AM_SOP_EQ:
+ op = "EQ";
+ break;
+ case AM_SOP_NE:
+ op = "NE";
+ break;
+ default:
+ op = "??";
+ break;
+ }
+ printf("%sSTRING %s {\n", pad(level), op);
+ dumpStringValue(level + 1, stringComparisonExpression->arg1);
+ dumpStringValue(level + 1, stringComparisonExpression->arg2);
+ printf("%s}\n", pad(level));
+}
+
+void
+dumpBooleanValue(int level, const AmBooleanValue *booleanValue)
+{
+ switch (booleanValue->type) {
+ case AM_BVAL_EXPRESSION:
+ dumpBooleanExpression(level, &booleanValue->u.expression);
+ break;
+ case AM_BVAL_STRING_COMPARISON:
+ dumpStringComparisonExpression(level,
+ &booleanValue->u.stringComparison);
+ break;
+ default:
+ printf("%s<UNKNOWN BVAL TYPE %d>\n", pad(1), booleanValue->type);
+ break;
+ }
+}
+
+void
+dumpWordList(const AmWordList *wordList)
+{
+ int i;
+ for (i = 0; i < wordList->argc; i++) {
+ printf("%s\"%s\"\n", pad(1), wordList->argv[i]);
+ }
+}
+
+void
+dumpCommandArguments(const AmCommandArguments *commandArguments)
+{
+ if (commandArguments->booleanArgs) {
+ dumpBooleanValue(1, commandArguments->u.b);
+ } else {
+ dumpWordList(commandArguments->u.w);
+ }
+}
+
+void
+dumpCommand(const AmCommand *command)
+{
+ printf("command \"%s\" {\n", command->name);
+ dumpCommandArguments(command->args);
+ printf("}\n");
+}
+
+void
+dumpCommandList(const AmCommandList *commandList)
+{
+ int i;
+ for (i = 0; i < commandList->commandCount; i++) {
+ dumpCommand(commandList->commands[i]);
+ }
+}
Oops, something went wrong.

0 comments on commit c24a8e6

Please sign in to comment.