Yes, only one "boot" subdir is a good limitation. I don't expect another one.
Good
though after having reviewed the procedure, it is not "impossible" to have a "free style" set of dirs/subdirs, there is only some complications (that I would gladly avoid) a "penalty" of one added used sector for each (which becomes unavailable as disk space).
Now, we must get to more details.
Right now in the OFS the contents of the inner .img (temporarily called _fake.vhd) are made accessible from the outer image, as an example here is the output of the
outer .img:
L:\>dir /s
Il volume nell'unità L è G4D_BIOSGPT
Numero di serie del volume: 6653-7457
Directory di L:\
24/07/2015 20.07 <DIR> boot
24/07/2015 20.07 977.408 _fake.vhd
24/07/2015 20.07 398.356 bootmgr
24/07/2015 20.07 274.191 grldr
24/07/2015 20.07 4.474 menu.lst
4 File 1.654.429 byte
Directory di L:\boot
24/07/2015 20.07 <DIR> .
24/07/2015 20.07 <DIR> ..
24/07/2015 20.07 262.144 bcd
1 File 262.144 byte
Totale file elencati:
5 File 1.916.573 byte
3 Directory 34.304 byte disponibili
And these are the actual contents of the
inner .img (_fake.vhd):
M:\>dir /s
Il volume nell'unità M è GPTINNER
Numero di serie del volume: 6653-7457
Directory di M:\
24/07/2015 20.06 <DIR> boot
24/07/2015 20.06 398.356 bootmgr
24/07/2015 20.06 274.191 grldr
24/07/2015 20.06 4.474 menu.lst
3 File 677.021 byte
Directory di M:\boot
24/07/2015 20.06 <DIR> .
24/07/2015 20.06 <DIR> ..
24/07/2015 20.06 262.144 bcd
1 File 262.144 byte
Totale file elencati:
4 File 939.165 byte
3 Directory 0 byte disponibili
Now, since the actual same extents are mapped, the contents of each file are the same, which implies that - say - the menu.lst inside the inner .img cannot be different from the menu.lst accessible from the outer .img (which may be not a real problem, as the menu.lst may well contain a "default" entry automatically loading (say) a m
ynu.lst, only if some conditions are met (let's say the UUID of the volume) or this switch coupld be implemented in the embedded menu.lst of grldr, but it creates an issue with the \boot\BCD.
Since space is tight, there is no doubt that grldr and BOOTMGR
need to be OFSed, (which allows to save roughly 398356+274191-36864 bytes in the example, actually 779+536-72=1243 sectors) but the space used by the inner image remains the same no matter if the files in it are re-indexed in the outer image or not, so there is not enough space for a different \boot\BCD in the outer .img, unless the sizes of these \boot\BCD's are dramatically reduced, if I recall correctly by compacting the hive/recreating it with BCDEDIT form scratch or using a third party tool, much smaller \boot\BCD's can be created, which might allow us enough space for this.
We can further save some sectors by:
- "anticipating" the fake partition to sector 34 instead of sector 63
- using a non-standard (1) sector before instead of 63 in the .vhd
- reducing FAT table sizes (both in the inner and outrer images) increasing the cluster size (which now is at 512 bytes, but due to the non-even size of most files possibly this won't be an advantage)
Anyway, try the attached, it still needs a lot of refining and reordering (please read as "currently it is a mess and leaves behind any number of temporary files"), but seemingly it is working.
As a bonus a couple half-@§§ed batches to calculate the checksum of a VHD footer and to actually create the footer are included.
And this opens another question
:
Will the .vhd mounting mechanism accept a .vhd with a geometry of
0/255/63 i.e. smaller than 8.225.280 bytes? (or will another CHS geometry be needed, let's say a 16/63 one? )
@All, please if you are NOT
cdob DO NOT attempt using the attached batch, it still lacks a number of checks/safety measures.
Wonko