Page 1 of 1

John Fines bootf02 in *NIX?

Posted: Sat Oct 21, 2006 4:02 pm
by Brynet-Inc
Hey, I've noticed John Fines boot loader needed to be written using his "Closed Source" DOS PARTCOPY application.

Apparently, It writes the first 3 bytes of the boot sector to the beginning of the disk and the rest to offset 3E.

Code: Select all

partcopy bootf.bin 0 3 -f0 0
partcopy bootf.bin 3E 1C2 -f0 3E
Could someone tell me how to do this using the dd command? or can recommend another *NIX tool, I'll forever be in your debt 8)

Posted: Sat Oct 21, 2006 5:00 pm
by muisei
You coud create a simple C/C++ program to write the MBR to a file and then use dd if=[input file] of=[output file] to copy the MBR image file to where you want.
The another way is to read the whole manual page.

C/C++ sample program I wrote for you:

Code: Select all


#include <sys/types.h> /* unistd.h needs this */
#include <stdio.h>
#include <unistd.h> /* contains read/write */
#include <fcntl.h>

int main(int argc, char *argv[])
{
  int image_desc, mbr_desc;
  char *boot_buf[512];

  image_desc = open(argv[1], O_RDRW);
  mbr_desc = open(argv[1], O_RDONLY);

  read(mbr_desc, &boot_buf,512);

  lseek(image_desc, 0, SEEK_SET);
  write(image_desc,&boot_buf, 3);

  lseek(image_desc,0x3e,SEEK_SET);
  write(image_desc,&boot_buf+3,512-3);

  close(mbr_desc);
  close(image_desc);
}


Posted: Sat Oct 21, 2006 5:20 pm
by Brynet-Inc
Changing one of the argv[1]'s to argv[2]'s worked.. *PEACE :D *


Thanks a lot pal :wink:

Posted: Sat Oct 21, 2006 6:12 pm
by B.E
You could of done

dd bs=1 count=3 if=boot.bin of=/dev/fd0
dd bs=1 count=450 seek=62 skip=62 if=boot.bin of=/dev/fd0

Posted: Sat Oct 21, 2006 6:25 pm
by Brynet-Inc
Gosh I'm slow today..:roll:

dd bs=1 if=boot.bin of=/dev/fd0a seems to work perfectly fine..

Posted: Sun Oct 22, 2006 6:12 am
by gaf
dd bs=1 if=boot.bin of=/dev/fd0a seems to work perfectly fine..
If you just overwrite the whole bootsector your FAT headers will get lost. This means that the disk won't be recognized as FAT formated by most systems althought the structures themself are still functional.

regards,
gaf