file writing in image

hi friends i have a requirement to open a file in write mode to write data in qnx image, what my doubt is can we write data in a file in qnx image(i am creating image using mkifs)…

No you can’t.

then how can i write data in file(which is open in write mode)…please suggest me

You need a writable file system. There are many choices depending on your hardware. HD, FLASH, RAMDISK.

i am having two different hardwares 1. FLASH 2.HD … However first one is main priority, so please tell me how to create writable file system for FLASH and HD

For a hard drive, start the driver, fdisk the drive device, usually /dev/hd0, then enumerate the drive with mount, dinit the partition, and mount the partition as part of the file system.

thank you for your quick reply…still i am unable to solve the issue
what i am doing is
#mount -e /dev/hd0t78
#dinit -h /dev/hd0t78
#mount -t /dev/hd0t78 /mnt/fs
i dont know where i am doing wrong … will you please tell me where it going wrong

When you fdisk, you need to create a partition. That is not clear from your reply. It is possible to make the partition either in full screen mode, or using command line parameters.

When you enumerate I think you just want to do this:

mount -e /dev/hd0t78

Then /dev/hd0t78 or whatever partition is on the drive should show up.

If you want to use the -t option for the 2nd mount it should be -t qnx4.

I think you need to use mount -e /dev/hd0 to enumerate.

Oppse, that is what I meant to say.

while i am using 2 nd mount as shown below it is saying that can’t mount possible reason is resource is busy

#mount -t qnx4 /dev/hd0t78 /fs/

I think it means that /fs/ is busy. Try something like /fs/q4.

thank you for your quick responses … now i am explain you what i am doing clearly in OS and imge so that i will get solution quickly

  1. i am creating a disk partition using <fdisk /dev/hd0 >command and create a partition hd0t78

  2. then i enumerating the HD as <mount -e /dev/hd0>

  3. after that i am doing <dinit -h /dev/hd0t78>

4.after that again i am mounting the hd0t78 as
<mount -t qnx4 /dev/hd0t78 /fs/>

5.after restarting the system i see a drive hd0-qnx4-2 in /fs/ path and i copying my ifs image in /fs/hd0-qnx4-2/.boot file what i am doing in image build file is i am starting devb-eide as

<waitfor /dev/hd0>

what my requirement is i have a executable file in image which is named “file”, on executing this my name i.e hansikarao will add to a file named “hansikarao” both are in root path only

in image i am doing as shown below
#cd root
#cat hansikarao

but nothing is added to that file.
i think you people understood my requirement clearly now.please suggest me where i am doing wrong.thanks in advance

It is not at all clear to me what you are doing wrong. Does the program “./file” run? Do you have an evidence that it does? Does it give you feedback, eg. “File hansikarao has been created”? Maybe you should post the source to “./file”.

My personal guess is that raohansikarao has not actually put anything on his newly formatted drive.

In other words:

In these 2 steps the only thing that appears to be written to the newly formatted drive is a .boot file.

At no time was a /root directory created, nor was an executable called file copied to the /root directory etc.

Formatting and initializing a drive doesn’t copy any files to it.


when i am giving path to create “hansikarao” file in /dev/shmem and execute ./file from root then file is creating and my name is also append to that existing file as many times as i executing the path, but /dev/shmem is a ram file system when i reboot the system the file is lost. what i am thinking is devb-eide is not started correctly how to know whether it is started or not(by pidin i am watching devb-eide process is running but killing that process should not effect the image system but wheni kill the devb-eide process in OS is resulting nothing is working (all commands) what is the difference between OS and image).

If the EIDE driver is starting and it finds a drive you will find a device /dev/hd#. There are other drivers that can create a device with this name, but I think all of them are permanent storage.

ya now i am able to save my files in image, thank you for guiding me in proper direction