OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Oct 26, 2020 7:22 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Write .iso to hard disk image
PostPosted: Sat Jul 11, 2020 7:27 am 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 253
Hi.
This question is not really related to programming...
After compiling the kernel, I will convert it to a .iso file.
It contains the boot folder and the boot.cfg file (I use GRUB). I'm going to upload the image to a flash drive(using balenaEther) and upload from it.
I had an idea that it would be nice to be able to manage files on the same flash drive using the file system driver.

I have this idea: write it down .iso as a hard disk image, for example, 4 GB in size, and then upload this hard disk image to a flash drive. I would like to be able to immediately write some files to the flash drive image and then use them in the OS.

What tools can you use to implement this?

P.S. when using balenaEther or other programs, the file system is "damaged" even after writing .iso on a flash drive I can't access it.


Top
 Profile  
 
 Post subject: Re: Write .iso to hard disk image
PostPosted: Sat Jul 11, 2020 8:56 am 
Online
Member
Member
User avatar

Joined: Fri Nov 22, 2019 5:46 am
Posts: 369
You seem to try to write a CD files system to a flash drive.

And writing files to an existing file system: Simply mount it with the OS you are developing on (You probably just have to plug it in and Windows or Linux will mount the drive.) Then you can write files to it using the shell or script(s) or the file manager.

Greetings
Peter

_________________
https://wiki.osdev.org/User:PeterX


Top
 Profile  
 
 Post subject: Re: Write .iso to hard disk image
PostPosted: Sat Jul 11, 2020 9:46 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 945
mrjbom wrote:
Hi.
This question is not really related to programming...
After compiling the kernel, I will convert it to a .iso file.
It contains the boot folder and the boot.cfg file (I use GRUB). I'm going to upload the image to a flash drive(using balenaEther) and upload from it.
You should not use that program, it has serious privacy concerns (sad, but true).
mrjbom wrote:
I had an idea that it would be nice to be able to manage files on the same flash drive using the file system driver.

I have this idea: write it down .iso as a hard disk image, for example, 4 GB in size, and then upload this hard disk image to a flash drive. I would like to be able to immediately write some files to the flash drive image and then use them in the OS.

What tools can you use to implement this?
That's exactly what my mkbootimg tool does. It creates a hybrid CDROM ISO / flash drive image out of a directory. Then you can use dd or my other tool, USBImager to write it to a flash drive (both available as portable executable for Windows, Linux and MacOS).

Note: my mkbootimg tool uses my boot loader, so either you switch to that, or (being MIT licensed) you could study the code to write your own image creator using any boot loader you'd like. The code is well written, easy to follow, and full of comments. It currently supports creating FAT, tar and FS/Z partitions from directory contents, and any file system with a partition image. Study the code if you'd like. The part where it creates a FAT16/32 partition and copies the loader files to it is here. Use esp_mkdir() and esp_addfile() to put any files you'd like there. Other partitions are created using a very simple fs interface, described in the README.

mrjbom wrote:
P.S. when using balenaEther or other programs, the file system is "damaged" even after writing .iso on a flash drive I can't access it.
Yet another reason why not to use that spyware. Not because I wrote it, but you should really check out USBImager.

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: Write .iso to hard disk image
PostPosted: Sat Jul 11, 2020 2:49 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 253
bzt wrote:
mrjbom wrote:
Hi.
This question is not really related to programming...
After compiling the kernel, I will convert it to a .iso file.
It contains the boot folder and the boot.cfg file (I use GRUB). I'm going to upload the image to a flash drive(using balenaEther) and upload from it.
You should not use that program, it has serious privacy concerns (sad, but true).
mrjbom wrote:
I had an idea that it would be nice to be able to manage files on the same flash drive using the file system driver.

I have this idea: write it down .iso as a hard disk image, for example, 4 GB in size, and then upload this hard disk image to a flash drive. I would like to be able to immediately write some files to the flash drive image and then use them in the OS.

What tools can you use to implement this?
That's exactly what my mkbootimg tool does. It creates a hybrid CDROM ISO / flash drive image out of a directory. Then you can use dd or my other tool, USBImager to write it to a flash drive (both available as portable executable for Windows, Linux and MacOS).

Note: my mkbootimg tool uses my boot loader, so either you switch to that, or (being MIT licensed) you could study the code to write your own image creator using any boot loader you'd like. The code is well written, easy to follow, and full of comments. It currently supports creating FAT, tar and FS/Z partitions from directory contents, and any file system with a partition image. Study the code if you'd like. The part where it creates a FAT16/32 partition and copies the loader files to it is here. Use esp_mkdir() and esp_addfile() to put any files you'd like there. Other partitions are created using a very simple fs interface, described in the README.

mrjbom wrote:
P.S. when using balenaEther or other programs, the file system is "damaged" even after writing .iso on a flash drive I can't access it.
Yet another reason why not to use that spyware. Not because I wrote it, but you should really check out USBImager.

Cheers,
bzt


I expected that there are tools that can do this using GRUB.
It is a pity that I will have to give up GRUB in this case and write my own loader...
Thanks you.


Top
 Profile  
 
 Post subject: Re: Write .iso to hard disk image
PostPosted: Sat Jul 11, 2020 10:32 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 2415
mrjbom wrote:
I expected that there are tools that can do this using GRUB.

It sounds like you're using grub-mkrescue, which is designed to create a read-only rescue disk.

Have you tried taking your partitioned/formatted disk and using grub-install to install GRUB on it? That way the disk will remain writable.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 3 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