OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Nov 23, 2020 7:37 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Hd image manipulation
PostPosted: Fri Mar 13, 2020 7:30 pm 
Offline

Joined: Fri Nov 01, 2019 1:17 am
Posts: 13
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...


Top
 Profile  
 
 Post subject: Re: Hd image manipulation
PostPosted: Sat Mar 14, 2020 3:45 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1014
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


Top
 Profile  
 
 Post subject: Re: Hd image manipulation
PostPosted: Sat Mar 14, 2020 7:15 am 
Offline

Joined: Fri Nov 01, 2019 1:17 am
Posts: 13
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.


Top
 Profile  
 
 Post subject: Re: Hd image manipulation
PostPosted: Sat Mar 14, 2020 6:54 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 739
Location: USA
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


Top
 Profile  
 
 Post subject: Re: Hd image manipulation
PostPosted: Sun Mar 15, 2020 5:40 pm 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 383
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 link pending. code pending. design pending. plans in a state of flux! everything pending! choice of language still up in the air! why is nothing coming together?!?


Top
 Profile  
 
 Post subject: Re: Hd image manipulation
PostPosted: Mon Mar 16, 2020 5:05 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1014
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


Top
 Profile  
 
 Post subject: Re: Hd image manipulation
PostPosted: Mon Mar 16, 2020 7:30 am 
Offline

Joined: Fri Nov 01, 2019 1:17 am
Posts: 13
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: thewrongchristian and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group