Hd image manipulation

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
Kamal123
Member
Member
Posts: 97
Joined: Fri Nov 01, 2019 1:17 am

Hd image manipulation

Post by Kamal123 »

After creating and formatting an Hard disk image...how can I copy my bootloaders and kernel to that image?... Currently,my bootloader supports fat12 FS ... Actually I need larger disk size than floppy for testing my os...plz help...
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: Hd image manipulation

Post by bzt »

Hi,
Kamal123 wrote:After creating and formatting an Hard disk image...how can I copy my bootloaders and kernel to that image?... Currently,my bootloader supports fat12 FS ... Actually I need larger disk size than floppy for testing my os...plz help...
You can put the bootloaders in the image, then write the image to an USB stick as-is (if you're not using floppies any more).

- Under Linux and MacOSX, you can use the dd command.
- USBImager is a small and multiplatform tool to write hd images to physical devices.

You can also use "dd" with "conv=notrunc" option to write the boot sector into the image, or you could write an image creator yourself. My BOOTBOOT loader has a simple image creator written in C. You can use that, or learn from its source. It creates a hybrid image, which works as an ISO9660 CDROM image, but also works as a GPT partitioned USB stick. It creates one ESP partition only with FAT16 (or FAT32), copies the 2nd stage there, and installs the boot sector recording the 2nd stage's address in it. You can add more partitions for your OS, or place your files in the first partition, anything you like.

Cheers,
bzt
Kamal123
Member
Member
Posts: 97
Joined: Fri Nov 01, 2019 1:17 am

Re: Hd image manipulation

Post by Kamal123 »

bzt wrote:Hi,
Kamal123 wrote:After creating and formatting an Hard disk image...how can I copy my bootloaders and kernel to that image?... Currently,my bootloader supports fat12 FS ... Actually I need larger disk size than floppy for testing my os...plz help...
You can put the bootloaders in the image, then write the image to an USB stick as-is (if you're not using floppies any more).

- Under Linux and MacOSX, you can use the dd command.
- USBImager is a small and multiplatform tool to write hd images to physical devices.

You can also use "dd" with "conv=notrunc" option to write the boot sector into the image, or you could write an image creator yourself. My BOOTBOOT loader has a simple image creator written in C. You can use that, or learn from its source. It creates a hybrid image, which works as an ISO9660 CDROM image, but also works as a GPT partitioned USB stick. It creates one ESP partition only with FAT16 (or FAT32), copies the 2nd stage there, and installs the boot sector recording the 2nd stage's address in it. You can add more partitions for your OS, or place your files in the first partition, anything you like.

Cheers,
bzt
Thank you bzt :D ... I will try your code.
User avatar
BenLunt
Member
Member
Posts: 934
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: Hd image manipulation

Post by BenLunt »

Out of curiosity, what host operating system are you using?

I have an app I have been using for Windows that allows you to insert files, copy them out, change items, etc., for a few file systems including FAT. It is a work in progress, since I update it as I need the capability, but is mostly intact.

I then use Rufus to write the image to a thumb drive. I haven't given bzt's app a try yet, but it should work just the same.

Ben
- http://www.fysnet.net/ultimate/index.htm
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Hd image manipulation

Post by eekee »

Use 9front, it has everything you need to partition and mount your disk images. ;) I'm mostly joking, 9front doesn't run gcc clang qemu or bochs, and its virtualizer requires the guest OS use virtio drivers. It really does have very adaptable disk & file tools though.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: Hd image manipulation

Post by bzt »

BenLunt wrote:I haven't given bzt's app a try yet, but it should work just the same.
Well, not exactly, they have different goals.

Your app is windowed application to examine, modify and create hd images interactively. It is a real swiss-army knife, I only wish if it would be available on Linux.

My mkimg.c is a very minimalistic tool without any user interface, just creates a hybrid cdrom / hd image with a single partition (and uses mkfs to construct that partition). You can specify the size of the overall image and the partition, but that's all. You can't create any arbitrary partitions with it, just an ESP. The advantage here is that mkimg.c is written in ANSI C without dependencies (assembles the disk image on its own).

My USBImager is a windowed application, but it can't create or alter hd images (except for creating backups from physical disks). It's main purpose is to write images to physical disks (dd with a GUI if you like). The advantage it has is that's much much simpler than Rufus, does not need installation, it is multi-platform, and it can handle compressed hd images (gz, bz2, xz, pkzip, zip64) on-the-fly without shared lib dependencies.

Cheers,
bzt
Kamal123
Member
Member
Posts: 97
Joined: Fri Nov 01, 2019 1:17 am

Re: Hd image manipulation

Post by Kamal123 »

BenLunt wrote:Out of curiosity, what host operating system are you using?

I have an app I have been using for Windows that allows you to insert files, copy them out, change items, etc., for a few file systems including FAT. It is a work in progress, since I update it as I need the capability, but is mostly intact.

I then use Rufus to write the image to a thumb drive. I haven't given bzt's app a try yet, but it should work just the same.

Ben
- http://www.fysnet.net/ultimate/index.htm

I am using windows...
Post Reply