3 Pages V   1 2 3 >  
Reply to this topic
 Patching UFD sectors with grub4dos
post Jul 31 2009, 08:19 PM
Post #1
online
Silver Member   ****
Group: Advanced user

  Joined: 28-July 07
Posts: 777
Thank(s): 41


I usually format my UFD with more than 1 partition with XP Disk Management Console.
The firts reason is due to the fact that I almost always run Full XP from the 2nd partition of my UFD, then encrypting (with TrueCrypt) my system drive.
And to the fact... that is on top of my signature.
The second reason is due to either so many reports and my (little) experience pointing to its (MMC) greater booting compatibility (please read: bootability).
Furthermore I can freely and handly choose the most appropriate size of my partitions depending on different needs.
Afterwards also I reserve the 1st partition to a lot of img, ima, dsk and iso loading them through grub4dos.

So, since my personal preferences are as far manual/freedom-oriented as possible, I actually still prefer to format my UFD under XP (contemporarely using a Filter Driver) with MMC (Microsoft Management Console) and with at least 2 partitions.

Also, I like to use - as far as possible - the Windows default parameters for file-systems, partition maximum size, clusters size, and so on.

Well, after reading an interesting reply of wimb here, I thought about this topic that could possibly collect/share application's requests and/or pointings for (further) tool's deployment and a kind of summa of patches, ideas and findings, interesting news and related issues.

About the patches that I can remember there are (at least) the following

Edit: please note that "cdob and ktp statement/findings" really result as the same, and they derive - as already mentioned in other posts/boards - from here.

About the developers/tools that I can remember (excluding at least for the moment Bean123 and fuwi) as in my opinion possibly oriented to this specific stuff there obviously are (strictly in alphabetical order)

Currently, the UFD Patching Tool of my dreams is which that allows me - after formatting my UFD with MMC - to patch its MBR and its BootSector with the best known "compatible" patches and the most effective ones achieved with the great help of all of us.
And possibly in one single, simple and strictly-dedicated tool.
Does this interest somehow any directly interested guys/developers too?
Hoping in the affirmative...

Thank you all. cheers.gif


--------------------


+Quote Post
post Aug 1 2009, 07:49 AM
Post #2
was_jaclaz
Finder   ******
Group: Advanced user

  Joined: 14-July 06 From: Gone in the mist

Posts: 7,230
Thank(s): 564


Italy


Not what you asked scared9.gif , but an idea that you might like (or completely fail to like) wink.gif.

Why instead of asking other people to do the work for you, you don't start doing something yourself?

I mean, you know most if not all the "tricks" found here and there.

Why don't you try putting all of them together? I mean not assembling only the links to them, but also giving some background and explanation for each, in order to have a single document covering the topic (and that could later possibly be added to the newly founded library?
http://www.boot-land.net/forums/index.php?...ic=8583&hl=

Then, since what you are looking for is more a "post-processor" than an actual formatting utility, the single patches/changes could be, once "found" and "assembled" together, implemented in a script for an existing engine, a very suitable app could be Tiny Hexer, that has a very nice scripting language.

cheers.gif

jaclaz


--------------------
+Quote Post
post Aug 1 2009, 11:06 AM
Post #3
ktp
Silver Member   ****
Group: Advanced user

  Joined: 16-February 07
Posts: 653
Thank(s): 37


@online
Why do not use grubinst_gui.exe (which requires grubinst.exe)? I always use it. Unless you prefer bootlace.com :-).
+Quote Post
post Aug 1 2009, 12:40 PM
Post #4
steve6375
Frequent Member   ***
Group: Developer

  Joined: 31-August 08 From: UK

Posts: 477
Thank(s): 129


United Kingdom


Hi
RMPRepUSB has some patched VBR code already. If you try RMPRepUSB and find that it does not work, but that you can make it work with a patch, please let me know and I will put the patch in as standard.

I appreciate RMPrepUSB does not create multiple partitions, but it could with a bit of work (if enough demand). However, you can create a smaller bootable partition and then create the other partitions with WIndows DIsk Manager and filter driver?

S


--------------------
Steve
Visit the RMPrepUSB website --> RMPrepUSB for partitioning, formatting, testing, imaging and making bootable your USB Flash Drive under Windows (supports FAT16/FAT32/NTFS, MSDOS/FreeDOS/XP/Vista, boot as Hard disk or floppy disk).
+Quote Post
post Aug 2 2009, 09:54 PM
Post #5
online
Silver Member   ****
Group: Advanced user

  Joined: 28-July 07
Posts: 777
Thank(s): 41


@jaclaz

Great reply, very appreciated: I will try to figure out a way, many thanks! thumbsup.gif


@ktp

Many thanks for your suggestion, I take it into account.
And... if you find other interesting/improving patches, please post here again. cheers.gif


@steve6375

I like your RMPrepUSB and I'm just trying your latest release 1.9.75. smile.gif

Well, if I format with RMPrepUSB my UFD (creating the 2nd partition) then under MMC it is not visible even if I assign a drive letter under Paragon Partition Manager and/or Acronis Disk Director Suite (they see it, indeed).

I appreciate your utility (and your reply) also when I can set a size for my (1st) partition... then with MMC and a Filter Driver however I can do almost what I want... so I will do more trials with it for a better experience (meanwhile trying to collect - and to compare - the further best patches possibly existing out of there).
Many thanks. cool.gif


@All

Please, post here your findings about USB Flash Drive MBR & BS patching to improve your UFD bootability.
Thank you! cheers.gif


--------------------
+Quote Post
post Aug 4 2009, 09:28 AM
Post #6
online
Silver Member   ****
Group: Advanced user

  Joined: 28-July 07
Posts: 777
Thank(s): 41


@jaclaz

About the topic, I was thinking: it would be even possible to use the command "write" of grub4dos (in a similar way compared to the "cmdcons" one) in order to set some (hex) bytes in the MBR and/or in the BootSector of my UFD through the "menu.lst"? unsure.gif

Just for fun (?!) I tried to do that with something like the following (placed at the beginning of the "menu.lst", after the setkey's command)
CODE
write (hd0,0) 0x7C07 0x00736E6F

and then it just writes "0x7C07 0x00736E6F" tongue.gif at the beginning of the bootsector (offset 0x00) of my UFD, but I do not know if it is even possible to set an address (since it does not seem to recognize it) and even if it could ever work (possibly without side-effects too)...

How in your (appreciated) opinion? cheers.gif


--------------------
+Quote Post
post Aug 4 2009, 09:54 AM
Post #7
was_jaclaz
Finder   ******
Group: Advanced user

  Joined: 14-July 06 From: Gone in the mist

Posts: 7,230
Thank(s): 564


Italy


Rather than "write" you can use "dd". wink.gif

Read here:
http://www.boot-land.net/forums/index.php?...=6119&st=35
and the README_GRUB4DOS.txt

Take your time on this thread:
http://www.boot-land.net/forums/index.php?...ic=7138&hl=

cheers.gif

jaclaz




--------------------
+Quote Post
post Aug 4 2009, 10:06 AM
Post #8
online
Silver Member   ****
Group: Advanced user

  Joined: 28-July 07
Posts: 777
Thank(s): 41


QUOTE (jaclaz @ Aug 4 2009, 11:54 AM) *
Rather than "write" you can use "dd". wink.gif

Thank you so very much! cheers.gif

I will try it soon, and then I will report here my findings/results... cool.gif


--------------------
+Quote Post
post Aug 6 2009, 10:15 AM
Post #9
online
Silver Member   ****
Group: Advanced user

  Joined: 28-July 07
Posts: 777
Thank(s): 41


The gub4dos's "dd" way does work. cool.gif

Probably, the only way to patch your UFD without using any (additional/manual) tool... innocent.gif

Here is how I did:
considering that "dd" command needs a file from which to start to read and another one - or a device - on which to end to write the first thing that I did was to create a "template" file (from which to read) as reference.
So, open your Physical Drive (UFD) with your Hex Editor and copy just the first 32.772 bytes of it (that's until the 0x8004 offset - 63 sectors) or create a new file with the above size (that will include either the whole MBR & BootSector in size).
Please, note that I've just noticed that the FAT32 BootSector created with XP MMC results as ending to 0x8003 offset (not to 0x7FFF offset - as expected? w00t.gif ), so it is 516 bytes in size? (I thought it had to be just 512 bytes as the MBR dubbio.gif)...
However, then paste it in a new file and save it naming it "patch.dat".
Open that file with your hex editor and "patch" all the occurrences above mentioned then save it.
Now in your gub4dos's menu.lst copy the following entries just at the beginning (without title), note that the following example is referring to a FAT32 previous formatting and to all the patches described in the firts post just applied, and copy the "patch.dat" file in its appropriate directory (the same "patch.dat" file and the same entries in menu.lst - that's the same patches - should work for any UFD).

CODE
dd if=(hd0,0)/boot/fat32x.dat of=(hd0) bs=1 count=1 skip=450 seek=450
#dd if=(hd0,0)/boot/fat32x.dat of=(hd0) bs=1 count=1 skip=466 seek=466
#dd if=(hd0,0)/boot/fat32x.dat of=(hd0) bs=1 count=1 skip=482 seek=482
#dd if=(hd0,0)/boot/fat32x.dat of=(hd0) bs=1 count=1 skip=498 seek=498
dd if=(hd0,0)/boot/fat32x.dat of=(hd0) bs=1 count=1 skip=32320 seek=32320
dd if=(hd0,0)/boot/fat32x.dat of=(hd0) bs=1 count=4 skip=32486 seek=32486


Now, every time you boot your UFD then the "patching" will be effective and "dd" will write directly on your UFD device.
Obviously you can remove or comment those entries if/when you do not more need.
Note that "bs=1" parameter is needed in order to read the "template" file byte-by-byte.

This way appears as very simple and effective (and potentially dangerous: note that if you patch with "0C" an inexistent partition in the Partition Table then your device will be not more accessible (and a BSOD could occur) under Windows with Filter Driver installed due to the consequent errors in its Partition Table; so be care to patch your device just for the existing partitions), it does not need any other tool and it may be useful also in those cases when "something" possibly re-writes in some specific addresses your UFD's MBR (with the Partition Table inside) and/or BootSector.

Enjoy! thumbsup.gif


--------------------
+Quote Post
post Aug 6 2009, 03:38 PM
Post #10
was_jaclaz
Finder   ******
Group: Advanced user

  Joined: 14-July 06 From: Gone in the mist

Posts: 7,230
Thank(s): 564


Italy


The FAT32 "bootsector" is actually several sectors long.
A sector is 512 bytes.
The 4 additional bytes you have "noticed" are the 4 bytes beginning of the second sector.

Wouldn't it be better to use (hd0,0) as target of the dd and avoid the need of the 32256 offset?

I mean not "everything" has 63 hidden sectors.

jaclaz


--------------------
+Quote Post

3 Pages V   1 2 3 >
Reply to this topic
1 User(s) are reading this topic ()



Collapse

  Topic Replies Topic Starter Views Last Action
No New Posts Grub4dos iso Size Limit?
1 sara - pmedia 106 Yesterday, 08:31 AM
Last post by: Wonko the Sane
No new grub4dos booting ubuntu iso
29 mipstien 12,435 27th August 2010 - 10:27 AM
Last post by: Wonko the Sane
No new Topic has attachmentsGRUB4DOS + WinVBlock
47 Sha0 2,744 25th August 2010 - 01:12 PM
Last post by: Wonko the Sane
No New Posts Grub4Dos savedefault does not work
4 davidwolf 1,507 17th August 2010 - 09:13 PM
Last post by: tinybit
No new Pinned: Topic has attachmentsGrub4dos Guide/Tutorial
79 diddy 67,758 15th August 2010 - 08:26 AM
Last post by: Wonko the Sane