Android emulator crash due to missing initial system image path

39 views
Skip to first unread message

Mike Yeh

unread,
Aug 2, 2013, 2:03:22 PM8/2/13
to adt...@googlegroups.com
Dear Android Emulator Developer,
 
I got a problem after I copied system.img to /.android/avd/AVD_NAME/ and renamed it to system-qemu.img.
After I pressed "start" button from AVD Manager to start the emulator the error message "Missing initial system image path" is shown.
 
I tried to trace the code found that in main.c (external/qemu/android/main.c)
        if (rwImage != NULL) {
            /* Use the read/write image file directly */
            hw->disk_systemPartition_path     = rwImage;
            hw->disk_systemPartition_initPath = NULL;
            D("Using direct system image: %s", rwImage);
        } else if (initImage != NULL) {
            hw->disk_systemPartition_path = NULL;
            hw->disk_systemPartition_initPath = initImage;
            D("Using initial system image: %s", initImage);
       }
it initalizes the hw->disk_systemPartition_path and hw->disk_systemPartition_initPath.
 
In vl-android.c (external/qemu)
    /* Initialize system partition image */
    {
        char        tmp[PATH_MAX+32];
        const char* sysImage = android_hw->disk_systemPartition_path;
        const char* initImage = android_hw->disk_systemPartition_initPath;
        uint64_t    sysBytes = android_hw->disk_systemPartition_size;
         ...
        if (sysImage && *sysImage) {
            if (filelock_create(sysImage) == NULL) {
                fprintf(stderr,"WARNING: System image already in use, changes will not persist!\n");
                /* If there is no file= parameters, nand_add_dev will create
                 * a temporary file to back the partition image. */
            } else {
                pstrcat(tmp,sizeof(tmp),",file=");
                pstrcat(tmp,sizeof(tmp),sysImage);
            }
        }
        if (initImage && *initImage) {
            if (!path_exists(initImage)) {
                PANIC("Invalid initial system image path: %s", initImage);
            }
            pstrcat(tmp,sizeof(tmp),",initfile=");
            pstrcat(tmp,sizeof(tmp),initImage);
        } else {
            PANIC("Missing initial system image path!");
        }
        nand_add_dev(tmp);
    }
It will check system-qemu.img is exist or not then check system.img is exist or not.
 
My question is why the initImage path is null then the emulator is died ?
 
Should this checking rule be modified to
 
if (sysImage && *sysImage) {
}
else if (initImage && *initImage) {
}
else {
}
 
Please kindly help me to solve this problem.
 
TKS & Regards,
MIKE
Reply all
Reply to author
Forward
0 new messages