View topic - file writing in image

file writing in image

Discussion about the general applications that run on QNX6

file writing in image

Postby raohansikarao » Fri Mar 05, 2010 5:03 am

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)....
raohansikarao
Active Member
 
Posts: 34
Joined: Thu Feb 25, 2010 4:25 am

RE: file writing in image

Postby mario » Fri Mar 05, 2010 1:09 pm

No you can't.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: file writing in image

Postby raohansikarao » Sat Mar 06, 2010 4:26 am

then how can i write data in file(which is open in write mode).........please suggest me
raohansikarao
Active Member
 
Posts: 34
Joined: Thu Feb 25, 2010 4:25 am

RE: file writing in image

Postby maschoen » Sun Mar 07, 2010 5:25 pm

You need a writable file system. There are many choices depending on your hardware. HD, FLASH, RAMDISK.
maschoen
QNX Master
 
Posts: 2720
Joined: Wed Jun 25, 2003 5:18 pm

RE: file writing in image

Postby raohansikarao » Mon Mar 08, 2010 4:14 am

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
raohansikarao
Active Member
 
Posts: 34
Joined: Thu Feb 25, 2010 4:25 am

Re: RE: file writing in image

Postby maschoen » Mon Mar 08, 2010 4:42 am

raohansikarao wrote: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.
maschoen
QNX Master
 
Posts: 2720
Joined: Wed Jun 25, 2003 5:18 pm

RE: Re: RE: file writing in image

Postby raohansikarao » Mon Mar 08, 2010 7:32 am

thank you for your quick reply........still i am unable to solve the issue
what i am doing is
#fdisk/dev/hd0
#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
raohansikarao
Active Member
 
Posts: 34
Joined: Thu Feb 25, 2010 4:25 am

RE: Re: RE: file writing in image

Postby maschoen » Mon Mar 08, 2010 4:22 pm

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.
maschoen
QNX Master
 
Posts: 2720
Joined: Wed Jun 25, 2003 5:18 pm

RE: Re: RE: file writing in image

Postby mario » Mon Mar 08, 2010 5:13 pm

I think you need to use mount -e /dev/hd0 to enumerate.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Re: RE: file writing in image

Postby maschoen » Mon Mar 08, 2010 6:29 pm

Oppse, that is what I meant to say.
maschoen
QNX Master
 
Posts: 2720
Joined: Wed Jun 25, 2003 5:18 pm

RE: Re: RE: file writing in image

Postby raohansikarao » Tue Mar 09, 2010 5:16 am

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/
raohansikarao
Active Member
 
Posts: 34
Joined: Thu Feb 25, 2010 4:25 am

RE: Re: RE: file writing in image

Postby maschoen » Tue Mar 09, 2010 6:18 am

I think it means that /fs/ is busy. Try something like /fs/q4.
maschoen
QNX Master
 
Posts: 2720
Joined: Wed Jun 25, 2003 5:18 pm

RE: Re: RE: file writing in image

Postby raohansikarao » Tue Mar 09, 2010 9:21 am

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

6.here what i am doing in image build file is i am starting devb-eide as
<devb-eide blk auto=partition dos exe=all cam quite>
<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
#./file
#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
raohansikarao
Active Member
 
Posts: 34
Joined: Thu Feb 25, 2010 4:25 am

RE: Re: RE: file writing in image

Postby maschoen » Tue Mar 09, 2010 4:38 pm

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".
maschoen
QNX Master
 
Posts: 2720
Joined: Wed Jun 25, 2003 5:18 pm

Postby Tim » Tue Mar 09, 2010 11:00 pm

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

In other words:

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

6.here what i am doing in image build file is i am starting devb-eide as
<devb-eide blk auto=partition dos exe=all cam quite>
<waitfor /dev/hd0>


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.

Tim
Tim
Senior Member
 
Posts: 1505
Joined: Wed Mar 10, 2004 12:28 am

Next

Return to QNX6 - Applications

Who is online

Users browsing this forum: No registered users and 0 guests