Currently, there is no DOS/Linux utility to format a partition to use the NTFS file system -- The NTFS drivers for linux are still experimental. There is no DOS utility, which can format a partition to use the ext2 file system. But, we dont want to partition the hard disk twice. For example, if we partition using some DOS utilities, linux fdisk will complain that the partitions are not cylinder aligned...
What we do, is to partition the hard disk, and format all the partitions using linux. Only catch, is that instead of an NTFS file system, we create an FAT32 file system. Infact, FAT32 is the only file system, which both linux and windows can read and write and can be large (FAT16 has a size limitation -- 2GB I think). Then we ask windows, to convert this to an NTFS file system during the installation process. However, we need to ensure, that the FAT32 partition, is prepared correctly, so that the NTFS conversion, will not lead to much loss of efficiency. This is accomplished, by setting the cluster size of the FAT32 partition to 4KB (same as in NTFS).
Now we have solved the partitioning and the formatting problems. One main problem which remains is the boot sector problem. One can use fdisk, to drop a DOS MBR on the hard disk and set the Windows partition active. This only solves half the problem. This ensures that during bootup, the BIOS loads the boot sector found on the windows partition (FAT32 partition).
A DOS/Windows boot sector consists of two main parts, the Bios Parameter Block (called BPB) and the boot code itself. The BPB, describes the geometry of that partition. The geometry of a hard disk, is now a logical concept. So it is possible for two OSes to use different geometries to access the same partition of the hard disk. In effect, the BPB as well as the boot code information, which was put by the linux mkdosfs, is not usable.
OK. So what does the first phase of the windows installation do? Since, we did not partition the hard disk using the windows installation program, it is not going to touch the MBR (which is good news). During the first phase of the install, it copies over lots of files to the hard disk, and boots off the hard disk, to complete the installation. So, it does modify the boot sector of the appropriate partition, so that the next boot will be sucessful. Well, almost. Since it assumes that you already have an OS (Windows/DOS) there, it only overwrites the boot code of the boot sector and uses the same BPB information which was already present. In our case, there is no valid BPB information, so the next time you try to boot off the hard disk, it wont be sucessful. Infact, even if you boot into a windows recovery console, and use the commands "fixboot" and "fixmbr", it wont help, since the fixboot does not touch the BPB area, and the fixmbr rewrites only the MBR.
So, after we prepare the hard disk, using linux, and before we start the windows installation, we need to modify the boot sector of the FAT32 partition, especially the BPB area. To, do this we install the DOS portion of Windows 98 on the hard disk. This amounts to booting off a Win98 DOS floppy image, and running "sys C:". This will overwrite the BPB and the boot code, and put command.com, io.sys and msdos.sys on the C: drive. Once this is over, we can start the actual windows setup, which will copy the required files and then overwrite the boot code. Now, when we boot off the hard disk, the boot will succeed.
Finally, when you finish installing windows, you will see the windows boot loader giving you an option to boot into "Windows XP" or "Microsoft Windows", which is the Win98 DOS, which we installed, and has been overwritten by now. So, if you choose "Microsoft Windows", the system will hang. So, you need to remove the "Microsoft Windows" options from the boot loader menu, by editing C:\boot.ini (it will be a hidden, system file) and removing the line containing "Microsoft Windows". This can also, be done through the Control Panel, or by a VB/Python script (which is what we do).