I am a new user of QNX. I am picking up a project which uses QNX6. My project applies QNX on PC104.
The project has built a boot file already. However, I need to modify this boot file. I am planning to rewrite everything onto a new Compact Flash (CF) card. That lead me to following questions.
The old thesis told me that they build the OS image through Neutrino. What command should I use to mount the CF card through a USB card reader?
I understand I need to format and initialize the compact flash. How should I confirm I am formatting the CF drive ? and how to set it into type 77?
What is the command to build the OS image into compact flash?
I have tried to Google the above information for a week. But I still cannot find the above information (may be I am too stupid >.<). If my questions are too basic, would you mind giving some links about that to read it?
This statement is a little ambiguous. It could mean that they built the OS image using Neutrino/Momentics, which probably means on a Windows machine using the Eclipse IDE.
If that’s the case, someone else will have to help you.
If on the other hand they mean they built the OS on a QNX Neutrino machine, the command is mkifs. Look for a directory /boot and within it a directory build. It may have one more .build files. These are script files used to define the boot image as well as run a startup script from within it.
On QNX 6.5, if you plug in a USB reader with CF card, you should find it auto-mounted, probably at /fs/usb0. That is if it has a QNX file system on it.
You would not format the CF drive. I think you might want to initialize it.
If it is mounted at /fs/usb0 you would first want to unmount it:
You would then want to look in /dev
If you find /dev/umass0t77 then you know it is type 77. Otherwise unmount it:
and run fdisk:
In the program you can modify the partition however you like. My guess is you want to delete any partition that is there, create a 77 with the full disk space, and mark it bootable.
At this point you could enumerate the partitions with “mount -e” and mount it manually or just remove the device and re-insert it.
After that you can initialize the partition as follows:
dinit -h /dev/umass0t77
You build the OS image separately using mkifs. You then copy the file you create to root on the drive, eg:
Thank you very much for your help maschoen. I made some more progression from your help.
I still have a small problem of create a type 77 drive.
I have followed your steps:
I used fdisk to chose the partition type as 77 and make it as boot. Then I physically remove the card reader and plug it in again. But I cannot find umass1t77 in /dev . did I miss any step to build a type 77 drive?
Thank you very much maschoen. Now I have done up to “mount -e” as you mentioned.
I have do “fdisk /dev/umass1” and created it as 77 and bootable.
Then I used “mount -e /dev/umass1”
after that I phically disconnect and plug the CF to the computer but I still cannot find umass1t77.
Did I do any step wrong?
Well, I’m not sure what you found. Here are two possibilities
In this case the system didn’t enumerate the drive, so you can do that yourself:
mount -e /dev/umass#
After that you can mount it anywhere you like, although the convention is usually in /fs
mount /dev/umass#t77 /fs/umass#
The other possibility is that you are seeing nothing in /dev. That would be pretty strange.
It suggests that your system isn’t auto-mounting the usb drive. You could try starting the usb disk driver directly. I think it might be devb_umass or something similar.
denkelly is correct that /dev/umass1t77 does not appear (/dev/umass1 appears) so I cannot dinit /dev/umass1t77
I have tried this approach, but umass1t77 still does not appear.
However I have found another trick to make umass1t77 to appear.
I remembered that denkelly said usb card reader may appear as /dev/hd1# and I found this appears everytime I restart my desktop with the card reader connected to it. I did the following steps
dd if=/dev/zero of=/dev/umass0
and create one t77 partition.
reboot the desktop
and /dev/hd11t77 appears
dinit -h /dev/hd11t77
from now on, if I pull the card reader and re-insert it, it come up as /dev/umass1 and /dev/umass1t77
after that, I use dloader to /dev/umass1 and /dev/umass1t77 it boot up correctly as what I want in PC104
The fact that a partition table entry 77 does not show up in /dev as a “t77” is a bug (as we all can see). The roots of the issue lie in the fact that QNX does not REQUIRE a partition table to mount a filesystem - certainly a difference from the early days of the PC. For example, you can dinit /dev/umass0 as qnx4fs and then “mount -tqnx4 /dev/umass0”. (Of course, without a partition table, the disk would be totally foreign to an MS o/s.) In this case, the qnx4fs filesystem has to be detected by examining only the CONTENTS of the partition.
So apparently, the logic sees the partition type 77 as a “hint”, looks AT THE CONTENT which does not match t77, and correctly chooses not to automount the filesystem. However, it also removes the “t77” entry from /dev - which it should not do, since now you cannot dinit the partition!
That is why I suggested using “dd” to clear the partition contents.