OSDev.org
https://forum.osdev.org/

Hd image manipulation
https://forum.osdev.org/viewtopic.php?f=15&t=36578
Page 1 of 1

Author:  Kamal123 [ Fri Mar 13, 2020 7:30 pm ]
Post subject:  Hd image manipulation

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...

Author:  bzt [ Sat Mar 14, 2020 3:45 am ]
Post subject:  Re: Hd image manipulation

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

Author:  Kamal123 [ Sat Mar 14, 2020 7:15 am ]
Post subject:  Re: Hd image manipulation

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.

Author:  BenLunt [ Sat Mar 14, 2020 6:54 pm ]
Post subject:  Re: Hd image manipulation

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

Author:  eekee [ Sun Mar 15, 2020 5:40 pm ]
Post subject:  Re: Hd image manipulation

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.

Author:  bzt [ Mon Mar 16, 2020 5:05 am ]
Post subject:  Re: Hd image manipulation

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

Author:  Kamal123 [ Mon Mar 16, 2020 7:30 am ]
Post subject:  Re: Hd image manipulation

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...

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/