Boot up from Compact Flash

Hi all,

    I have a SBC with model PCM 9572 from advantech and compact flash SDCFB-64 from Sandisk, I am trying to make a boot-up CF but unsuccess.

    the procedure is as below:

    1, Delete the old CF partition
        fdisk /dev/hd1
                delete->save->quit
    2, power off ,power on and reboot
    3, Create a new partition in CF
        fdisk /dev/hd1
               change->type(77)->start cyl(0)->end syl(489)->loader
               ->boot->save->quit
    4, power off, power on and reboot
    5, dinit -h -f /tmp/test.ifs /dev/hd1t77
    6, pwer off and remove the hard disk with QNX 6.2.1.B 
      
    The start up information is as follows:

        Boot Partition 1?1	
        Hit Esc for .altboot .............................S  
   
     The CF type recognised by bios is CHS ,Mode 64 , 64M .

     I will be very apprecited for your help and instruction.

Best regards,
shilunz

Hi all,

    I have a SBC with model PCM 9572 from advantech and compact flash SDCFB-64 from Sandisk, I am trying to make a boot-up CF but unsuccess.

    the procedure is as below:

    1, Delete the old CF partition
        fdisk /dev/hd1
                delete->save->quit
    2, power off ,power on and reboot
    3, Create a new partition in CF
        fdisk /dev/hd1
               change->type(77)->start cyl(0)->end syl(489)->loader
               ->boot->save->quit
    4, power off, power on and reboot
    5, dinit -h -f /tmp/test.ifs /dev/hd1t77
    6, pwer off and remove the hard disk with QNX 6.2.1.B 
    7, power on and reboot SBC with the made CF
      
    The start up information is as follows:

        Boot Partition 1?1	
        Hit Esc for .altboot .............................S  
   
     The CF type recognised by bios is CHS ,Mode 64 , 64M .

     I will be very apprecited for your help and instruction.

Best regards,
shilunz

Hi,

Forget your current procedure.

If you are using a USB-CF reader, make sure that io-usb and devb-umass are started to access your CF reader. The CF will be listed as /dev/hd[x].

Then you do the following:

  1. dd if=/dev/zero of=/dev/hd[x] count=100

  2. fdisk /dev/hd[x] delete all

  3. fdisk /dev/hd[x] add -s1 -t77 -p100

  4. fdisk /dev/hd[x] boot -s1

  5. fdisk /dev/hd[x] loader

  6. mount -e /dev/hd[x] (this works for me)

  7. dinit -hb /dev/hd[x]t77

8) dinit -h /dev/hd[x]/t77
  1. answer yes to the question asked
  2. mount /dev/hd[x]t77 /fs/cf1
  3. copy a valid bootimage (.boot) to the compact flash

You can do these steps to attaching your CF to the IDE controller.

The ‘…s’ means that your bootimage was not recognized as a QNX image.

Good luck.
Freddy

It is certainly acting like QNX and the bios are looking at the disk differently. Check the CHS displayed from QNX while in fdisk and compare it with the settings in the bios. I would bet they are different. Since it is probably easier, change the bios to match QNX’s settings.

Rick…

I spent a lot of time trying to boot off a Sandisk CF. One thing I noticed is that it uses PIO mode 4 and I never had one of those to work. Lexar and Verbatim are my trusty choices.

Hi All,

Thanks very much for your instructions.
I did by Freddy's suggestion but with the same problem.
And the bios setting for CF:
  Hard Disks: secondary slave
  Cyls: 490
  Heads: 8
  Sec/track: 32
  Total Sectors: 125440    

I found one more thing that the compact flash is ready two minutes later than the boot-up hard disk at the SBC start up. 
After the SBC start up, I used the command ls as follwing:
       ls -l /dev/hd*
       only /dev/hd0, /dev/hd0t79 appears on the screen.
two minutes later, use the same commamd :

      ls -l /dev/hd*
      both /dev/hd0,/hd0t79 and /dev/hd1,/hd1t77 appear on the screen

 I am wondering whether it is some problem with the compact flash lazy for ready at boot up phase.          

Regards,
shilunz

Rick is correct. Because BIOS routines are used to perform loading of the .boot file and I assume those routines will talk in CHS terms then the CHS totals of both QNX and BIOS will need to match.

You must be running the driver, devb-eide, yourself, right? CF card controllers don’t map to the same addresses as an IDE controller, especially when a real IDE controller is also present in the onboard chipset.

When you run up the driver for the CF card you can match QNX’s viewpoint to the same as BIOS by specifying the “translation” option.

Also, setting BIOS to use LBA sizing instead of CHS sizing should achieve optimal utilisation.

Hi evanh and rick,

A while back, I ran into the same issue too. I tossed the Sandisk CF and got me another one (Apacer). Evanh, you are saying that when you run into this problem, you have 2 options namely:

  1. use LBA with the CF (this is a bios option)
  2. use the translation option with devb-eide. The values that you should give with the translation option should match the BIOS right?

Should I use the translation option too in my bootimage on the CF or is it only needed when I ‘initialize and fdisk’ my CF.

TIA,
Freddy

Hey Freddy,

If you use translation or any other options with the devb-eide driver when installing software, you will need the same option in the bootimage. And they have to match what the bios thinks, since the bootimage is loaded by the bios.

With respect to the slow recognition of the disk, this is often caused by the driver trying to probe for other ports (primary/secondary ide, master and slave). Basically if you are running the driver only for the cf, use the appropriate options to not probe for all the non-existent other ports.

Rick…

Hi all,

I restarted the procedure of making boot up flash disk from the scratch by your suggestion.

1, Change the bios setting for CF:
Size : 64M
Cyls: 62
Heads: 32
LANDZ:489
Sec: 63
Mode: LBA

2, Delete the old CF partition
fdisk /dev/hd1
delete->save->quit
3, power off ,power on and reboot
4, Create a new partition in CF
fdisk /dev/hd1
change->type(77)->start cyl(0)->end cyl(61)->loader
->boot->save->quit
5, dinit -h -f root/tmp/test.ifs -B ipl-diskpc2 /dev/hd1t77
6, pwer off and remove the hard disk with QNX 6.2.1.B
7, power on and reboot SBC with the made CF

The start up information is different from the previous as follows:

Boot Partition 1?1
Hit Esc for .altboot …





… hang here.

the buildfile is imported from the bios.ide.build with a bit of modification:

Start up some consoles

devc-con -n4 &
reopen /dev/con1

display_msg Welcome to Neutrino on an PC compatible BIOS system 

Start the pci server

seedres	
pci-bios &
waitfor /dev/pci

Disk drivers (The default one and some fun others for your pleasure…)

devb-eide blk automount=hd0t79:/,automount=hd0t77:/usr/qnx4 &

#180904
devb-eide eide nomaster nobmstr blk automount=hd0t77:/afc:qnx4 &

devb-eide blk automount=hd0t79:/,cache=2m,delwri=5 &

Wait for a bin for the rest of the commands (up to 60 secs)

waitfor /x86/bin 60

Some common servers

pipe &
mqueue &
devc-ser8250 &
devc-pty &

Start a debug server for debugging programs

waitfor /dev/ser1
[+session] pdebug /dev/ser1 &

These env variables inherited by all the programs which follow

SYSNAME=nto
TERM=qansi

Start some extra shells on other consoles

reopen /dev/con2
[+session] sh &
reopen /dev/con3
[+session] sh &

Start a high priority shell just in case…

reopen /dev/con4
[pri=25 +session] sh &

Start the main shell

reopen /dev/con1
[+session] sh

[+session] login -p

Regards,
shilunz

You need to tell devb-eide where to find the CF card. pin lists such infomation, what is your output from pin?

I use something like: devb-eide eide ioport=0x300,irq=3

Hi Rick and Evanh and shilunz,

Rick and evanh, thanks for your explanations. I undestand what is going on. I need to find some time to try it all out.

shilunz, you don’t need to reboot that often ;-) Further, try this:
a) dd if=/dev/zero of=/dev/hd[cf]
b) fdisk /dev/hd[cf] delete all
c) fdisk /dev/hd[cf] add -s1 -t77 -p100
d) fdisk /dev/hd[cf] boot -s1
e) fdisk /dev/hd[cf] loader
f) mount -e /dev/hd[cf]
!!! g) dinit -hb /dev/hd[cf]t77
!!! h) dinit -h /dev/hd[cf]t77
i) mount /dev/hd[cf]t77 /fs/cf
j) cp root/test.ifs /fs/cf/.boot
k) umount /fs/cf
l) – reboot –

Your results sounds familiar to me, I ran into the same issue too. I redid the CF using the above procedure and it worked fine then. Also try to use LBA as suggested before by someone else.

Freddy

Setting LBA in BIOS is more likely than CHS to be correct, it should be used in addition to translation. Translation is a correction to let QNX programs know what BIOSs view is.

Yes, use the same translation setting at every occurance of starting the driver.