Need help on building image on Compact Flash card of PC104

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.

  1. 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?
  2. 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?
  3. 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?

Thank you very much,

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:

umount /fs/usb0

You would then want to look in /dev

ls /dev/umass*

If you find /dev/umass0t77 then you know it is type 77. Otherwise unmount it:

umount /dev/umass0t??

and run fdisk:

fdisk /dev/umass0

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:

cd /boot

mkifs -v build/ fs/qnxbasesmp.ifs

cp fs/qnxbasesmp.ifs /fs/usb0/.boot

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?

Thanks for your help

Well, I’m not sure what you found. Here are two possibilities

  1. umass#
    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.

In 6.2/6.3 first usb drive may show up as /dev/hd10t77

Thanks denkelly. My QNX is 6.3.2 but I am pretty sure it shows as umass#t## because after I formatted it into FAT32 it shows as /dev/umass1t11

Thanks maschoen. I think I am in case 1. After I disconnect and re-insert the card reader, /dev/umass1 exists but not umass1t77.

I have tried to use

mount -e /dev/umass1


mount /dev/umass1t77 /fs/umass1

it gives me
mount: Can’t mount /fs/umass1 (type qnx4)
mount: Possible reaseon: Invalid argument

However if I try to

mount /dev/umass1 fs/umass1

it gives me a file which is not accessable with Size 0 (I guess this is not the type I want to access, I should access type 77 file)

I don’t know what is going wrong. Did you dinit the partition?

It seems you cannot “dinit -h /dev/umass0t77” without /dev/umass0t77 appearing!

Here’s what I would try… Assuming /dev/umass0 exists…

dd if=zero of=/dev/umass0

You do not need to let this complete (it would take a long time) - just let it run a minute to erase the beginning of the drive.


fdisk /dev/umass0

and create one t77 partition.

Pull the card reader and re-insert.
Verify that /dev/umass0t77 is now present. If so…

dinit -h /dev/umass0t77

mount /dev/umass0t77 /q4

IF my theory is right, I will explain why it was failing. If not, I will keep my theory it to myself :slight_smile:

dd if=zero of=/dev/umass0

I need to correct this line…

dd if=/dev/zero of=/dev/umass0

thanks denkelly and maschoen

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

fdisk /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

Thank you very much to denkelly and maschoen

Glad you got it working Don.

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.