QNX4 Copy old CF to a new CF model

Hi maschoen,

Thank you for your time, yes I’m quite sure it’s the main reason I can’t boot properly the OS.
I saw -B option but the problem is I don’t know where to find a loader file. Under /boot/sys/ there is a file named “boot” but I’m not sure what it is.
Concerning your proposition to do a cp from original to the new disk, I suppose it means that I need two USB adaptors right ? Which I don’t have. Or maybe I create a raw disk image of original disk with dd and then copy to the new disk with dd again juste like that ?

Hi sieudot,

Thank you for your links but I think I quite covered the steps to an OS image. I have a small experience to build an image but with QNX6 version.
See attached my build file:

I don’t think this is the root cause as discussed with maschoen, it seems to be the boot loader. In one link you shared they use dloader as we do in QNX6.X but it doesn’t exist in QNX4.

I was looking around for loader files too and did not find them. I imagine, but am not sure that a dump from the first 512 bytes of the disk would suffice, but I’m not sure at all.

If QNX 4 has dd that would be much better than cp. Yes, use dd to copy the first sector to a file and then back should work. After doing this, use fdisk to put the partitions on.

This is speculative but I would definitely give it a try.

So to understand correctly I can try the following :

  • Backup bootloader from original CF with : dd if=/dev/usb0 of=/tmp/bootloader.img bs=512 count=1
  • Copy back to the new CF with : dd if=/tmp/bootloader.img of=/dev/usb0 bs=512 count=1
  • Clear/Create partition table with:
    • fdisk /dev/usb0 delete -a
    • fdisk /dev/usb0 add -t77 -p100
    • fdisk /dev/usb0 boot -t77
  • Mount partition with : mount -p /dev/usb0
  • Initialize QNX filesystem with my boot image: dinit -hf /boot/images/mybootimage.1 /dev/usb0t77

Do you think dinit will overwrite the bootloader segment ?

dinit will not overwrite the bootloader segment if run with the correct parameters. You need to point it at the partion, not the root device, as in your example. I would not use the -f parameter, just copy the boot file in after dinit. It might be correct but I’ve never needed it nor used it before.

I think you should answer some questions below:

  • Is your CF formatted correctly ?
  • Is your boot partition bootable ?
  • Does your boot partition have a correct boot-image file (.boot)?

Another solution which I have done successfully before, you may use a raw disk copy tool to make a new ‘same’ CF. It may be quicker and more convenient than you did above. The only problem is the new CF must be larger than the old one, i.e. the new CF must have more sectors than the old CF.
You also can use a 256Mb new one.
Try some apps:

  • Norton Ghost 1.15
  • HDD raw copy
  • R-drive image

This is how we did it at a prior company I worked for so I know this method works.

Clonezilla which is free should also work.

Tim

Hi all,

I’ve tried what we discussed (dinit with and without the -f option) and unfortunately I still got “Operating system not found”. My original CF has the following configuration in fdisk :

However if I try to copy orignal CF image to a bigger CF (512MB or 1GB) I got “Missing operating system”…

  • Is your CF formatted correctly ? I don’t know. I connect the new CF to a Linux VM and I do a zero write all over the CF with dd if=/dev/zero of=/dev/sdb (CF)
  • Is your boot partition bootable ? I guess so, I marked the partition as “Boot”
  • Does your boot partition have a correct boot-image file (.boot)? I can’t say really but I think yes it’s ok. See previous message, I did a snapshot of the boot file configuration.

I tried what you said with HDD raw copy with a 512MB and 1GB. Unfortunately it’s not working for me :cry:

If you connect your original CF card to your Linux VM and run fdisk in Linux do you see the same info you showed in the QNX screen shot?

Assuming you do, if you connect your new CF card to your Linux VM (after doing the HDD Raw copy), what does fdisk show? It should show the same thing as your original CF card (it may have some extra block / 4th partition at the end since it’s a bigger CF but that shouldn’t matter).

One other thing. When you say the new CF that you did the HDD Raw Copy doesn’t work, do you mean it doesn’t work in a new machine? Or that it doesn’t work in the machine that the original CF is installed in? You should be testing on the machine your original CF is installed in.

Tim

This suggests that you are missing something significant. If you have two LBA drives, one larger than the other, you copy the smaller one sector by sector to the larger, the smaller one boots but the larger one doesn’t, you’ve defined the laws of the computer universe.

Something else must be going on.

I have done well with all these tools: R-Drive Image, Ghost, Acronis True Image, HDD raw copy. It worked well both for CF or cFAST.
You should try some ones, but remember, when you doing the raw copy, you need to select “sector by sector” option.
But I have a little doubt, is the main board itself having a card reading error? Is it still working fine with the old card?

Hi guys,

@Tim I have the following information with fdisk in Linux with original CF:
cf_config_linux

And after I did a HDD Raw copy with the new CF (1GB):
new_cf_config_linux

I mean it doesn’t work with the same machine where the original CF is installed. For information, I’m using a MSM800BEV PC/104 from Kontron (MSM800BEV User manual) with a deported CF card holder connected through X60 connector (IDE interface).

@maschoen Yes I’m missing something but I can’t point it out. I’ve looked into the BIOS but I don’t see “Access Mode” or something adjustable for LBA mode.

@sieudot I’ve only tried HDD raw copy for the moment as it’s free of use. HDD raw copy is already “sector by sector” copy tool no?
The main board is working fine, when I put back the original CF everything is booting correctly.

  1. A raw copy usually is a sector by sector copy.

  2. The BIOS might be set up with Head/Track/Sector numbers. This can work with an LBA drive. EIDE imbues LBA drives with H/T/S geometry. But that could be the problem. The two CF’s could have different defaults. That would exactly cause the problem you are seeing.

I’ve never seen an old bios where you could not set the geometry, although very old ones will not have LBA as an option.

Thanks for the screen shots. It appears the raw copy went fine in terms of FDisk identifying the partitions and the boot partition (I have no idea if the data is correct but I suspect it is if you did a raw copy).

I notice your new drive is 1 terabyte in size. How old is your original machine? Some older machines could not handle drives that large. Perhaps that’s the problem? Do you have another newer machine to try in just in case (unless you have the motherboard specs for your old machine and can confirm it can handle drives that large)

Tim

Hi all,

@maschoen I can confirm there is no way to set the geometry. It’s a PC/104 embedded CPU with custom optimized BIOS.

@Tim the new drive is 1GB not 1TB. But I also try with a 128MB and 512MB CF.

I was thinking maybe I have to install directly QNX4 from the machine. I have a boot install floppy disk of QNX4. I tried to connect an old floppy reader and boot from it from the embedded machine. Even like this it doesn’t detect the CF… :

I don’t have more ideas. I can rework my build file but it doesn’t seem to be the root cause :frowning:

I see what the others have to say. But just because and old floppy install doesn’t work, may not mean anything if that version of QNX4 is older than the one you have on the CF.

What is curious is that it doesn’t even see an EDIE controller at all. It’s not missing the CF, it’s missing the entire controller. And this is the machine your original CF boots on? (if so, you are using a much newer version of QNX 4 on the CF than on the floppy).

What does the BIOS of that machine show (screen shot) when the CF is installed.

Tim

Hi there,

I finally found a solution to boot from the new CF (1GB) by using a VM and an image of QNX425 installation CD. The idea is to use the boot loader of this installer :

  1. Create a VM and boot from CD image of QNX4.25 Patch G/Update 2011 with USB-Stack
  2. When QNX installer starts press key to set “USB stack” to launch option then press space key
  3. At QNX installer startup page connect the USB CF adapter to the VM
  4. QNX installer doesn’t detects USB mass by default. Press F5 to add USB mass drive
  5. Create bootable QNX partition on the CF and continue installation until the end
  6. Installation of QNX is not necessary you can press F3 to finish installation. Stop the VM.
  7. Start QNX4 VM, connect USB CF adapter to the VM, mount CF partition.
  8. Copy/replace only (no .inodes and .bitmap) .boot file from old CF to the new CF.
  9. Insert new CF to the machine. It should be able to boot QNX system.

@Tim yes I think QNX on the floppy is much older than the QNX I have on CD.

Anyway thank a lot everyone for your time and your help.

Ade

I’m not sure what you do with your QNX 4 system, however I thought I’d give myself a plug. As recently as two years ago I helped a customer convert a QNX 4 system so it would run on a VM. The original system ran with a dot matrix printer which was not available. I built them a spooler with a filter program that converted the dot matrix output into PCL for their laser printer. The point being, I’m a constractor and still am willing to program with QNX 4 if needed.

In other words, I’m a dinosaur.

Hi all,

I’ve continued to go deeper concerning this issue and I found an easier solution thanks to this thread :
https://forums.openqnx.com/t/topic/25298/2

As you understand the root cause is fdisk doesn’t have or doesn’t write correctly the QNX Bootloader and the secondary loader according to the partition table. The work around is to use other loader and as described in the previous thread it’s possible to download them in the contributed software library of QNX4 under /usr/free/qnx4/os/utils/disk/quietloaders.tgz.
For those interested in these files I’ve found the following link :
https://fsck.technology/software/QNX/QNX%204/QNX4/Soft/Free/os/utils/disk/

In conclusion if you need to clone a CF from USB adapter and QNX4.25 VM :

  1. Start USB stack with : # io-usb
  2. Start filesystem with : # Fsys.umass fsys -Nusb -nusb0
  3. Load primary loader (QNX bootloader) : # fdisk -B loader1.bin /dev/usb0 loader
  4. Create a bootable QNX Partition : # fdisk /dev/usb0 add -t77 -p20 boot
  5. Enumerate partitions : # mount -p /dev/usb0
  6. Load secondary loader : # dinit -h -B loader2.bin /dev/usb0t77
  7. Mount qnx partition : # mount /dev/usb0t77 /mnt/part77
  8. Copy your bootimage file : # cp /boot/images/mybootimage.1 /mnt/part77/.boot
  9. Umount everything and plug CF to the machine to test the boot
  10. Plug again to the VM, mount partitions and copy your backup files.

By the way, I’ve noticed also it’s not working for all CF models. I’ve tried this method with another CF and it’s not working at all.

Ade