aboutsummaryrefslogtreecommitdiffstats
path: root/package/goldfish-qemu/patches/110-single_image.patch
blob: 92a9e543dd7cea3ca2cf948b668dde8141f5b615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
--- a/android/cmdline-option.c
+++ b/android/cmdline-option.c
@@ -50,16 +50,6 @@ android_parse_options( int  *pargc, char
         char   arg2_tab[64], *arg2 = arg2_tab;
         int    nn;
 
-        /* process @<name> as a special exception meaning
-         * '-avd <name>'
-         */
-        if (aread[0][0] == '@') {
-            opt->avd = aread[0]+1;
-            nargs--;
-            aread++;
-            continue;
-        }
-
         /* anything that isn't an option past this points
          * exits the loop
          */
--- a/android/cmdline-options.h
+++ b/android/cmdline-options.h
@@ -60,21 +60,16 @@
  */
 
 CFG_PARAM( sysdir,  "<dir>",  "search for system disk images in <dir>" )
-CFG_PARAM( system,  "<file>", "read initial system image from <file>" )
-CFG_PARAM( datadir, "<dir>",  "write user data into <dir>" )
-CFG_PARAM( kernel,  "<file>", "use specific emulated kernel" )
-CFG_PARAM( ramdisk, "<file>", "ramdisk image (default <system>/ramdisk.img" )
-CFG_PARAM( image,   "<file>", "obsolete, use -system <file> instead" )
-CFG_PARAM( init_data, "<file>", "initial data image (default <system>/userdata.img" )
-CFG_PARAM( initdata, "<file>", "same as '-init-data <file>'" )
-CFG_PARAM( data,     "<file>", "data image (default <datadir>/userdata-qemu.img" )
+CFG_PARAM( system,  "<file>", "read system image from <file>, default: <system>/system.img" )
+CFG_PARAM( data,     "<file>", "data image, default: <system>/data.img" )
+CFG_PARAM( kernel,  "<file>", "use specific emulated kernel, default: kernel.bin" )
+CFG_PARAM( ramdisk, "<file>", "ramdisk image (default <system>/ramdisk.bin" )
 CFG_PARAM( partition_size, "<size>", "system/data partition size in MBs" )
 CFG_PARAM( cache,    "<file>", "cache partition image (default is temporary file)" )
 CFG_FLAG ( no_cache, "disable the cache partition" )
 CFG_FLAG ( nocache,  "same as -no-cache" )
 OPT_PARAM( sdcard, "<file>", "SD card image (default <system>/sdcard.img")
 OPT_FLAG ( wipe_data, "reset the use data image (copy it from initdata)" )
-CFG_PARAM( avd, "<name>", "use a specific android virtual device" )
 CFG_PARAM( skindir, "<dir>", "search skins in <dir> (default <system>/skins)" )
 CFG_PARAM( skin, "<name>", "select a given skin" )
 CFG_FLAG ( no_skin, "don't use any emulator skin" )
--- a/android/main.c
+++ b/android/main.c
@@ -1606,6 +1606,7 @@ report_console( const char*  proto_port,
  *       containing 'fileName'. this is *not* the full
  *       path to 'fileName'.
  */
+
 static char*
 _getSdkImagePath( const char*  fileName )
 {
@@ -1617,8 +1618,6 @@ _getSdkImagePath( const char*  fileName 
 
     static const char* const  searchPaths[] = {
         "",                                  /* program's directory */
-        "/lib/images",                       /* this is for SDK 1.0 */
-        "/../platforms/android-1.1/images",  /* this is for SDK 1.1 */
         NULL
     };
 
@@ -1841,25 +1840,7 @@ int main(int argc, char **argv)
         }
     }
 
-    /* legacy support: we used to use -system <dir> and -image <file>
-     * instead of -sysdir <dir> and -system <file>, so handle this by checking
-     * whether the options point to directories or files.
-     */
-    if (opts->image != NULL) {
-        if (opts->system != NULL) {
-            if (opts->sysdir != NULL) {
-                derror( "You can't use -sysdir, -system and -image at the same time.\n"
-                        "You should probably use '-sysdir <path> -system <file>'.\n" );
-                exit(2);
-            }
-        }
-        dwarning( "Please note that -image is obsolete and that -system is now used to point\n"
-                  "to the system image. Next time, try using '-sysdir <path> -system <file>' instead.\n" );
-        opts->sysdir = opts->system;
-        opts->system = opts->image;
-        opts->image  = NULL;
-    }
-    else if (opts->system != NULL && path_is_dir(opts->system)) {
+    if (opts->system != NULL && path_is_dir(opts->system)) {
         if (opts->sysdir != NULL) {
             derror( "Option -system should now be followed by a file path, not a directory one.\n"
                     "Please use '-sysdir <path>' to point to the system directory.\n" );
@@ -1885,49 +1866,11 @@ int main(int argc, char **argv)
     if (opts->noskin)
         opts->no_skin = opts->noskin;
 
-    if (opts->initdata) {
-        opts->init_data = opts->initdata;
-        opts->initdata  = NULL;
-    }
-
-    /* If no AVD name was given, try to find the top of the
-     * Android build tree
-     */
-    if (opts->avd == NULL) {
-        do {
-            char*  out = getenv("ANDROID_PRODUCT_OUT");
-
-            if (out == NULL || out[0] == 0)
-                break;
-
-            if (!path_exists(out)) {
-                derror("Can't access ANDROID_PRODUCT_OUT as '%s'\n"
-                    "You need to build the Android system before launching the emulator",
-                    out);
-                exit(2);
-            }
-
-            android_build_root = path_parent( out, 4 );
-            if (android_build_root == NULL || !path_exists(android_build_root)) {
-                derror("Can't find the Android build root from '%s'\n"
-                    "Please check the definition of the ANDROID_PRODUCT_OUT variable.\n"
-                    "It should point to your product-specific build output directory.\n",
-                    out );
-                exit(2);
-            }
-            android_build_out = out;
-            D( "found Android build root: %s", android_build_root );
-            D( "found Android build out:  %s", android_build_out );
-        } while (0);
-    }
     /* if no virtual device name is given, and we're not in the
      * Android build system, we'll need to perform some auto-detection
      * magic :-)
      */
-    if (opts->avd == NULL && !android_build_out) 
     {
-        char   dataDirIsSystem = 0;
-
         if (!opts->sysdir) {
             opts->sysdir = _getSdkImagePath("system.img");
             if (!opts->sysdir) {
@@ -1945,47 +1888,30 @@ int main(int argc, char **argv)
         }
 
         if (!opts->system) {
-            opts->system = _getSdkSystemImage(opts->sysdir, "-image", "system.img");
-            D("autoconfig: -image %s", opts->image);
+            opts->system = _getSdkSystemImage(opts->sysdir, "-system", "system.img");
+            D("autoconfig: -system %s", opts->system);
         }
 
         if (!opts->kernel) {
-            opts->kernel = _getSdkSystemImage(opts->sysdir, "-kernel", "kernel-qemu");
+            opts->kernel = _getSdkSystemImage(opts->sysdir, "-kernel", "kernel.bin");
             D("autoconfig: -kernel %s", opts->kernel);
         }
 
         if (!opts->ramdisk) {
-            opts->ramdisk = _getSdkSystemImage(opts->sysdir, "-ramdisk", "ramdisk.img");
+            opts->ramdisk = _getSdkSystemImage(opts->sysdir, "-ramdisk", "ramdisk.bin");
             D("autoconfig: -ramdisk %s", opts->ramdisk);
         }
 
-        /* if no data directory is specified, use the system directory */
-        if (!opts->datadir) {
-            opts->datadir   = qemu_strdup(opts->sysdir);
-            dataDirIsSystem = 1;
-            D("autoconfig: -datadir %s", opts->sysdir);
-        }
-
         if (!opts->data) {
             /* check for userdata-qemu.img in the data directory */
-            bufprint(tmp, tmpend, "%s/userdata-qemu.img", opts->datadir);
-            if (!path_exists(tmp)) {
-                derror(
-                "You did not provide the name of an Android Virtual Device\n"
-                "with the '-avd <name>' option. Read -help-avd for more information.\n\n"
-
-                "If you *really* want to *NOT* run an AVD, consider using '-data <file>'\n"
-                "to specify a data partition image file (I hope you know what you're doing).\n"
-                );
-                exit(2);
-            }
+            bufprint(tmp, tmpend, "%s/data.img", opts->sysdir);
 
             opts->data = qemu_strdup(tmp);
             D("autoconfig: -data %s", opts->data);
         }
 
-        if (!opts->sdcard && opts->datadir) {
-            bufprint(tmp, tmpend, "%s/sdcard.img", opts->datadir);
+        if (!opts->sdcard && opts->sysdir) {
+            bufprint(tmp, tmpend, "%s/sdcard.img", opts->sysdir);
             if (path_exists(tmp)) {
                 opts->sdcard = qemu_strdup(tmp);
                 D("autoconfig: -sdcard %s", opts->sdcard);
@@ -2029,19 +1955,6 @@ int main(int argc, char **argv)
     android_avdParams->skinName     = opts->skin;
     android_avdParams->skinRootPath = opts->skindir;
 
-    /* setup the virtual device differently depending on whether
-     * we are in the Android build system or not
-     */
-    if (opts->avd != NULL)
-    {
-        android_avdInfo = avdInfo_new( opts->avd, android_avdParams );
-        if (android_avdInfo == NULL) {
-            /* an error message has already been printed */
-            dprint("could not find virtual device named '%s'", opts->avd);
-            exit(1);
-        }
-    }
-    else
     {
         if (!android_build_out) {
             android_build_out = android_build_root = opts->sysdir;
--- a/android/avd/info.c
+++ b/android/avd/info.c
@@ -1233,10 +1233,8 @@ _getBuildImagePaths( AvdInfo*  i, AvdInf
      ** take care of checking the state
      **/
     imageLoader_set ( l, AVD_IMAGE_INITSYSTEM );
-    imageLoader_load( l, IMAGE_REQUIRED | IMAGE_DONT_LOCK );
-
-    /* force the system image to read-only status */
-    l->pState[0] = IMAGE_STATE_READONLY;
+    l->pState[0] = IMAGE_STATE_MUSTLOCK;
+    imageLoader_load( l, IMAGE_REQUIRED );
 
     /** cache partition handling
      **/