flat assembler
Message board for the users of flat assembler.

Index > OS Construction > How to transfer a bootable image to the USB flash drive

Author
Thread Post new topic Reply to topic
Mike Gonta



Joined: 26 Dec 2010
Posts: 243
Mike Gonta 06 Jan 2011, 23:24
On Windows, the easiest way is with the free USB Image Tool.
Another excellent free Windows tool is HxD - Hexeditor with which you can raw "copy and paste" the image file to the
USB drive.
For advanced users dd for Windows (also available for Linux).

It is important to transfer the image to the physical drive and not the volume drive letter. If the flash drive is partitioned
the volume will not start at LBA 0.
Code:
C:\dd --list
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by terms of the GPL Version 2.

Win32 Available Volume Information
\\.\Volume{e3462114-b73a-11de-b06d-806d6172696f}\
  link to \\?\Device\HarddiskVolume1
  fixed media
  Mounted on \\.\c:

\\.\Volume{35217742-b73c-11de-97ae-806d6172696f}\
  link to \\?\Device\CdRom0
  CD-ROM
  Mounted on \\.\d:

\\.\Volume{35217743-b73c-11de-97ae-806d6172696f}\
  link to \\?\Device\Floppy0
  removeable media
  Mounted on \\.\a:

\\.\Volume{39050e5c-fd25-11df-9239-0050ba5ccaa9}\
  link to \\?\Device\Harddisk1\DP(1)0-0+3
  removeable media
  Mounted on \\.\e:


NT Block Device Objects
\\?\Device\CdRom0
  size is 2147483647 bytes
\\?\Device\Floppy0
\\?\Device\Harddisk0\Partition0
  link to \\?\Device\Harddisk0\DR0
  Fixed hard disk media. Block size = 512
  size is 32044482560 bytes
\\?\Device\Harddisk0\Partition1
  link to \\?\Device\HarddiskVolume1
\\?\Device\Harddisk1\Partition0
  link to \\?\Device\Harddisk1\DR2
  Removable media other than floppy. Block size = 512
  size is 8409579520 bytes
\\?\Device\Harddisk1\Partition1
  link to \\?\Device\Harddisk1\DP(1)0-0+3
  Removable media other than floppy. Block size = 512
  size is 8409579520 bytes

Virtual input devices
 /dev/zero   (null data)
 /dev/random (pseudo-random data)
 -           (standard input)

Virtual output devices
 -           (standard output)
 /dev/null   (discard the data)    
The list option will list the devices on the PC.
In this example, there is one physical hard drive installed, drive C: which is physical disk 0, so the the flash drive will
be physical disk 1.
Code:
\\?\Device\Harddisk1\Partition0
  link to \\?\Device\Harddisk1\DR2
  Removable media other than floppy. Block size = 512
  size is 8409579520 bytes     
Code:
  set disk =
  dd --filter=removable if=your.img of=\\?\Device\Harddisk%disk%\Partition0    
Code:
  set disk = 1    
The filter=removable option prevents dd from writing to your hard drive should you set the wrong disk number. See the
web site for more details.
If for example, the one physical hard drive installed has only one partition - drive C:, and you have one CD/DVD installed
- drive D:, then the flash drive will be drive E:. After transferring the image, remove and re-insert the flash drive so that
Windows will recognize the new file system on the flash drive.

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com


Last edited by Mike Gonta on 08 Jan 2011, 16:22; edited 1 time in total
Post 06 Jan 2011, 23:24
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 07 Jan 2011, 15:55
I coded a window program to do this (only tested in xp), its written in fasm.
Let me know if anyone want to take a look.
Post 07 Jan 2011, 15:55
View user's profile Send private message Reply with quote
Coty



Joined: 17 May 2010
Posts: 553
Location: &#9216;
Coty 08 Jan 2011, 02:06
@Mike Gonta: I just tested Alex's USB image tool, great tool! Thanks for posting! Everything does really boot now Smile

@Dex4u: I have tested your Dex to USB, if you would be willing to post source so I could write my own boot sector that would be nice Smile (Unless you don't want to.)

--
Cheers!
Post 08 Jan 2011, 02:06
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 08 Jan 2011, 16:42
Coty wrote:

@Dex4u: I have tested your Dex to USB, if you would be willing to post source so I could write my own boot sector that would be nice Smile (Unless you don't want to.)

--
Cheers!


Sure, but remember its only my second win32 asm program, so it not very good code.
Also you need to know if your usb boot supports floppy or hdd emulation or both.
The floppy emulation turns your usb fob in to a 1.44 mb size, but a format will restore, the original size.
As for hdd, the usb fobs need to be fat16 formated, this is for safety, you can change this.



It should work ok by puting a floppy img and hdd boot sector into the folder FddHddImages
Note: the hdd boot sector needs to be for fat16 or 32 depending on how you formated the fob.
Any ? just ask.


Last edited by Dex4u on 14 Jan 2011, 15:21; edited 1 time in total
Post 08 Jan 2011, 16:42
View user's profile Send private message Reply with quote
Coty



Joined: 17 May 2010
Posts: 553
Location: &#9216;
Coty 08 Jan 2011, 17:35
Cool thanks, I'll open it up and play with it, I'd like to make a small simple GUI for it, (im all about interfaces being simple.). Thanks again!
Post 08 Jan 2011, 17:35
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 243
Mike Gonta 09 Jan 2011, 14:30
Dex4u wrote:
As for hdd, the usb fobs need to be fat16 formated, this is for safety, you can change this.
Code:
Fat16ErrorMes db 'Error!, For safety, the removable  ',13
            db 'drive needs to be formated FAT16.  ',13
               db 'Please read the ReadMe file for the',13
               db 'best tool to use, as XP does not   ',13
               db 'format it right,Then try again.    ',0    
XP does not partition format removable drives since Windows only recognizes the first partition of a removable drive.
HDD FAT16 format does not require MBR. Usb HDD emulation works fine with FAT12 and is the universal USB booting
format, see USB Booting Secrets.

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com
Post 09 Jan 2011, 14:30
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 09 Jan 2011, 17:05
I do not see your point ?.
Why would anyone want at best a 2.88Mb hdd emulation, if the fob is 1 GB ?
Post 09 Jan 2011, 17:05
View user's profile Send private message Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 14 Jan 2011, 02:50
Thanks Mike Smile

I found USBIT works well, but it seems to write the bootsector directly to absolute sector 0, whether the device is partitioned or not i.e. it does not recognise logical sectors.

I also tried the portable version of HxDen, but it refused to write to my pendrive even when I ran the program as administrator in Windoze Vista Sad

However HxDen does give the option of absolute (physical) and logical sectors. I found it useful for checking what USBIT does.

I haven't tried dd yet. Syntax looks a bit daunting!

_________________
FAMOS - the first memory operating system
Post 14 Jan 2011, 02:50
View user's profile Send private message Visit poster's website Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 243
Mike Gonta 14 Jan 2011, 11:23
Hi neville,
neville wrote:
I found USBIT works well, but it seems to write the bootsector directly to absolute sector 0, whether the device is partitioned or not i.e. it does not recognise logical sectors.
The default is "Device Mode", this can be changed to "Volume Mode" in the upper left.
neville wrote:
I also tried the portable version of HxDen, but it refused to write to my pendrive even when I ran the program as administrator in Windoze Vista Sad
This is a technical issue with Vista/Win7.
neville wrote:
I haven't tried dd yet. Syntax looks a bit daunting!
It's best used in a script.

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com
Post 14 Jan 2011, 11:23
View user's profile Send private message Visit poster's website Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 14 Jan 2011, 23:18
Yes Mike G, Vista is a real pain Crying or Very sad

_________________
FAMOS - the first memory operating system
Post 14 Jan 2011, 23:18
View user's profile Send private message Visit poster's website Reply with quote
steve6375



Joined: 30 Jan 2011
Posts: 3
Location: GB
steve6375 30 Jan 2011, 10:22
My utility RMPrepUSB can write an image to any position on a USB drive from Win7 (GUI based, or use RMPartUSB for command line utility).

_________________
Try RMPrepUSB for all your bootable USB formatting needs.
Post 30 Jan 2011, 10:22
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 30 Jan 2011, 15:40
That's a very useful app steve6375, also theres a lot of good info on your site, thanks.
Post 30 Jan 2011, 15:40
View user's profile Send private message Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 30 Jan 2011, 19:56
correct me if im wrong, but shouldnt this 'dd' use \\?\globalroot\ prefix?
Post 30 Jan 2011, 19:56
View user's profile Send private message Reply with quote
steve6375



Joined: 30 Jan 2011
Posts: 3
Location: GB
steve6375 30 Jan 2011, 23:47
If you want to write to the physical device (starting at LBA0/MBR) then use something like

of=\\?\Device\Harddisk1\DR2

(taken from --list example above).
Post 30 Jan 2011, 23:47
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.