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