Jump to content











Photo
- - - - -

Boot a Pendrive from Qemu


Best Answer steve6375 , 22 September 2014 - 10:19 PM

If you download RMPrepUSB - try the QEMU button.

This uses a StartFromUSB.cmd file to run QEMU - so if the button works then you can use code from StartFromUSB.cmd

Also you can use the same version of QEMU.

Go to the full post


  • Please log in to reply
7 replies to this topic

#1 Danixu

Danixu

    Newbie

  • Members
  • 14 posts
  •  
    Spain

Posted 22 September 2014 - 10:03 PM

Hi, first of all i'm sorry for my english.

 

I've one question about testing bootable pendrives with qemu. I've searched a lot in google and all i can find is examples like:

 

qemu.exe -L . -M pc -localtime -boot c -hda \\.\physicaldrive1

qemu.exe -L . -hda x:

qemu.exe -L . -hda \\.\physicaldrive1

....

 

but in all the qemu starts an closes in less than a second (don't show the window). Someone knows a working command to test USB drives?

 

I've tried without any command and qemu starts, then qemu is working...

 

Thanks!!

 



#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 22 September 2014 - 10:12 PM

Try

 

-L . -boot c -m 800 -drive file=\\.\PhysicalDrive1,if=ide,index=0,media=disk,snapshot=on

 

or just use the QEMU button in RMPrepuSB to boot from any USB drive.

 

But VBox+VMUB is better (faster and fully writeable)


  • Danixu likes this

#3 Danixu

Danixu

    Newbie

  • Members
  • 14 posts
  •  
    Spain

Posted 22 September 2014 - 10:17 PM

Thanks for reply... but don't works :mellow:. I don't know what's the problem because it don't show any error, only close.

 

I'm trying to do fully automatic, then i need to make it work with a command line.

I Will try with Vbox+Vmub. Maybe i will learn how to do it ;)

 

Thanks!!



#4 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 22 September 2014 - 10:19 PM   Best Answer

If you download RMPrepUSB - try the QEMU button.

This uses a StartFromUSB.cmd file to run QEMU - so if the button works then you can use code from StartFromUSB.cmd

Also you can use the same version of QEMU.


  • Danixu likes this

#5 Danixu

Danixu

    Newbie

  • Members
  • 14 posts
  •  
    Spain

Posted 22 September 2014 - 10:22 PM

Ok. Tomorrow i will do some tests ;)

 

Thanks again!!



#6 Danixu

Danixu

    Newbie

  • Members
  • 14 posts
  •  
    Spain

Posted 23 September 2014 - 05:54 AM

Finally works, but with your quemu version. I don't know why with the lastest version don't.

 

Thanks for all your help!!! now i've to learn how to get the physicaldrive number with drive letter :lol:

 

Greetings!!

 

Edit: I've found it:

 

Creating a vbs sript with this:

if WScript.Arguments.Count = 0 then
    WScript.Echo "Missing parameters"
else
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    Set colDiskDrives = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive")
    
    For Each objDrive In colDiskDrives
        'Wscript.Echo objDrive.DeviceID & Wscript.Arguments.Item(0)
        Device = objDrive.DeviceID
        strDeviceID = Replace(objDrive.DeviceID, "\", "\\")
        Set colPartitions = objWMIService.ExecQuery _
            ("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & _
                strDeviceID & """} WHERE AssocClass = " & _
                    "Win32_DiskDriveToDiskPartition")
    
        For Each objPartition In colPartitions
            Set colLogicalDisks = objWMIService.ExecQuery _
                ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _
                    objPartition.DeviceID & """} WHERE AssocClass = " & _
                        "Win32_LogicalDiskToPartition")
    
            For Each objLogicalDisk In colLogicalDisks
                if Wscript.Arguments.Item(0) = objLogicalDisk.DeviceID then
                    Wscript.Echo Device
                end if
            Next
        Next
    Next
end if

Then runing this command:

cscript /NoLogo script.vbs i:

i get the physical drive number:

\\.\PHYSICALDRIVE2

One question: Can i use your qemu and part of your batch file in my proyect?

 

Greetings


Edited by Danixu, 23 September 2014 - 06:41 AM.


#7 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 23 September 2014 - 09:34 PM

of course you can use it. 

cheers

Steve

P.S. Some other code you may find useful here


  • Danixu likes this

#8 Danixu

Danixu

    Newbie

  • Members
  • 14 posts
  •  
    Spain

Posted 23 September 2014 - 09:55 PM

of course you can use it. 

cheers

Steve

P.S. Some other code you may find useful here

 

Thanks again!!!.

Yeah, i've found some code in vbs. I've edited the batch and the vbs to work together, and now i can call the batch with physicaldrive number or just with the letter.

 

Tomorrow i'll post the code. Maybe someone will find it useful ;)

 

Greetings!!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users