Bonfra wrote:
bzt wrote:
No. You have to create the file system at the starting LBA where the partitioning table (either MBR or GPT) tells to. That's why the wiki creates a /dev/loop device. For example, if that single partition starts at sector 2048, then you have to create a file system starting from offset 1M (2048*512).
Ok, is there another way of doing it? WSL does not have loop module and can't mount devices, so I must find another way...
Since you are using Windows, why not give my utility a try?
Creating a new image is very simple. (I just updated the instructions to be more detailed)
Once the image is created, you can easily modify it for your needs.
1) You can adjust the MBR partition entries
2) You can update the boot code for each partition
3) You can insert/delete files on the partition (Currently only FAT partitions are guaranteed to work. Other file systems are experimental)
For example, you only need to create the image once. If you use my utility, it will create the MBR and place the specified image at a LBA of your choosing.
You will need to update the MBR code, but there is an option to do that.
Once you have the image file created, if you need to update a file on the bootable partition, you simply delete the old file and insert the new file.
This utility will allow you to create MBR or GPT style images.
I have a detailed example for GPT images.
A few notes:
1) The examples shown at the URLs above all show a Windows XP GUI. This is simply because I think the WinXP theme is much more elegant than the new Win10 theme. However, the utility comes in both WinXP (32-bit) and Win10 (64-bit) versions.
2) Whether you choose a MBR or GPT style image, you will need to place code within the first few sectors to boot and parse the partitions. If you have a Legacy BIOS boot, both styles require some form of code to parse these partitions. If you use a UEFI boot, only the MBR requires code, though the UEFI may not recognize the partitions since it will be looking for a GPT.
3) It is perfectly acceptable, and I think it was bzt that mentioned this elsewhere, to have an image that has both a MBR and a GPT allowing for both firmware styles to boot the same image. Simply have the partition tables in the MBR point to the same partitions the GPT points to. However, this has the one assumption that all partitions are within the 32-bit sector range.
Ben
Update:
I have added detailed instructions on how to
create an image file.
Start at the top, then scroll down to the type you wish to create. For the purpose of this thread, you want to scroll down to the
Master Boot Record type. Once you follow those instructions, scroll down to the end of the page for "Ready to Create Image" final instructions.
Then once you have done that, go to the instructions about
what to do with that MBR image.