QNX 6.2: failing to boot using IDE compact flash

QNX 6.2
/dev/hd1 is a 256MB compact flash using physical mode for IDE.

I perform the following:

umount /dev/hd1
fdisk /dev/hd1 delete -a
fdisk /dev/hd1 add -t 79 -b -p 100
fdisk /dev/hd1 loader
fdisk /dev/hd1 show

Then reboot and perform the following:

umount /dev/hd1
mount -e /dev/hd1
dinit -q -f vcs.ifs -h /dev/hd1t79
mount /dev/hd1t79 /fs/hd1-qnx4
cpbk x86 /fs/hd1-qnx4/x86

x86 is a copy of /x86

Then shutdown. Disconnect hard drive and make flash primary HD on IDE.
Setup BIOS so the only one drive is present in physical mode.

When the system is powered up, I get the request for a partition
selection. Then after a short delay, I get the normal “Hit Esc for
…altboot” followed by the normal "…"s.

Then nothing. It just hangs.

Any ideas?


PS: With a slight change to my build file, I can use the .altboot on the
HD to mount the compact flash as /. And all is well. It seems that
something is wrong from the second-stage loader to the boot image. I
have also attempted the following just after the dinit above to try the
other second-stage loader:
dinit -b -B /x86/boot/sys/ipl-diskpc2 -r -h -m “VCS Booting” /dev/hd1t79
chkfsys -uP /dev/hd1t79

Dan Kneip wrote:

When the system is powered up, I get the request for a partition
selection. Then after a short delay, I get the normal “Hit Esc for
.altboot” followed by the normal "…"s.

Then nothing. It just hangs.

We ran into a similar problem booting from compact flash and
disabling LBA mode in the bios caused the system to boot
normally. You may want to try that.

-Sean


Sean Gustafson Astra Network
sean@astra.mb.ca QNX Consulting and Custom Programming

Unfortunately, I am already setting up bios for physical (not LBA) for
the IDE device.

Thanks anyway!
Dan


Sean Gustafson wrote:

Dan Kneip wrote:

When the system is powered up, I get the request for a partition
selection. Then after a short delay, I get the normal “Hit Esc for
.altboot” followed by the normal "…"s.

Then nothing. It just hangs.


We ran into a similar problem booting from compact flash and
disabling LBA mode in the bios caused the system to boot
normally. You may want to try that.

-Sean


Sean Gustafson Astra Network
sean@astra.mb.ca > QNX Consulting and Custom Programming

Dan Kneip <dan@kneip.net> wrote:

Then shutdown. Disconnect hard drive and make flash primary HD on IDE.
Setup BIOS so the only one drive is present in physical mode.
When the system is powered up, I get the request for a partition
selection. Then after a short delay, I get the normal “Hit Esc for
.altboot” followed by the normal "…"s.
Then nothing. It just hangs.

Sounds like the secondary loader is started. Since you made the disk
bootable as the second hard drive and it is now the first (you shouldn’t
do this), it’s possible that you have the wrong drive number in the
loader. I think this field was moved in the QNX6 loader. Look at the
byte at offset 0x4 in the first block of your (t79) partition … if it
is 0x81 then you need to change it to 0x80 …

John Garvey <jgarvey@qnx.com> wrote in article <ak1aqa$8lf$1@nntp.qnx.com>…

Dan Kneip <> dan@kneip.net> > wrote:
Then shutdown. Disconnect hard drive and make flash primary HD on IDE.
Setup BIOS so the only one drive is present in physical mode.
When the system is powered up, I get the request for a partition
selection. Then after a short delay, I get the normal “Hit Esc for
.altboot” followed by the normal "…"s.
Then nothing. It just hangs.

Sounds like the secondary loader is started. Since you made the disk
bootable as the second hard drive and it is now the first (you shouldn’t
do this), it’s possible that you have the wrong drive number in the
loader. I think this field was moved in the QNX6 loader. Look at the
byte at offset 0x4 in the first block of your (t79) partition … if it
is 0x81 then you need to change it to 0x80 …

John,
it was at offset 0x11 in QNX6.1. AFAIK the secondary loader is the same in QNX6.2NC, is the loader
different in 6.2PE(SE)? Does dinit really write 0x81 while initializing second hard drive? I have
seen a lot of reports on newsgroups about the next trouble: during installation of QNX (incl.6.2)
onto second hard drive the resulting drive number in loader (bootsector) is 0x80 (it’s unexpected
by any 3rd multisystem loader)…
Cheers,

Eduard.
ed1k at ukr dot net

John,

It appears as though Eduard is correct about the position of 0x80.
Below is a binary dump of the beginning of /dev/hd1t79.

00000000: EB 25 90 DA 20 00 00 00 00 00 00 00 40 00 00 08 .%… …@…
00000010: 20 80 48 69 74 20 45 73 63 20 66 6F 72 20 2E 61 .Hit Esc for .a
00000020: 6C 74 62 6F 6F 74 00 E8 00 00 5E 81 EE 2A 00 0E ltboot…^…*…

Unfortunately, the value is already 0x80.

Any other suggestions?

Thanks,
Dan

ed1k wrote:

John Garvey <> jgarvey@qnx.com> > wrote in article <ak1aqa$8lf$> 1@nntp.qnx.com> >…

Dan Kneip <> dan@kneip.net> > wrote:

Then shutdown. Disconnect hard drive and make flash primary HD on IDE.
Setup BIOS so the only one drive is present in physical mode.
When the system is powered up, I get the request for a partition
selection. Then after a short delay, I get the normal “Hit Esc for
.altboot” followed by the normal "…"s.
Then nothing. It just hangs.

Sounds like the secondary loader is started. Since you made the disk
bootable as the second hard drive and it is now the first (you shouldn’t
do this), it’s possible that you have the wrong drive number in the
loader. I think this field was moved in the QNX6 loader. Look at the
byte at offset 0x4 in the first block of your (t79) partition … if it
is 0x81 then you need to change it to 0x80 …


John,
it was at offset 0x11 in QNX6.1. AFAIK the secondary loader is the same in QNX6.2NC, is the loader
different in 6.2PE(SE)? Does dinit really write 0x81 while initializing second hard drive? I have
seen a lot of reports on newsgroups about the next trouble: during installation of QNX (incl.6.2)
onto second hard drive the resulting drive number in loader (bootsector) is 0x80 (it’s unexpected
by any 3rd multisystem loader)…
Cheers,

Dan,
Did you make sure (quite enough time before rebooting) that .boot&.altboot files are written to
flash correctly? Please compare .boot on flash with vcs.ifs on hard drive.

Dan Kneip <dan@kneip.net> wrote in article <3D64E629.8090304@kneip.net>…

John,

It appears as though Eduard is correct about the position of 0x80.
Below is a binary dump of the beginning of /dev/hd1t79.

00000000: EB 25 90 DA 20 00 00 00 00 00 00 00 40 00 00 08 .%… …@…
00000010: 20 80 48 69 74 20 45 73 63 20 66 6F 72 20 2E 61 .Hit Esc for .a
00000020: 6C 74 62 6F 6F 74 00 E8 00 00 5E 81 EE 2A 00 0E ltboot…^…*…

Unfortunately, the value is already 0x80.

I’m wondering why :slight_smile: From common sense it should be 0x81…

Eduard.
ed1k at ukr dot net

Any other suggestions?

Thanks,
Dan

After performing the dinit and a copy of the x86 files, I performed a
system reboot. I then performed a binary compare of the vcs.ifs and
…boot files. They were identical.

ed1k wrote:

Dan,
Did you make sure (quite enough time before rebooting) that .boot&.altboot files are written to
flash correctly? Please compare .boot on flash with vcs.ifs on hard drive.

Dan Kneip <> dan@kneip.net> > wrote in article <> 3D64E629.8090304@kneip.net> >…

John,

It appears as though Eduard is correct about the position of 0x80.
Below is a binary dump of the beginning of /dev/hd1t79.

00000000: EB 25 90 DA 20 00 00 00 00 00 00 00 40 00 00 08 .%… …@…
00000010: 20 80 48 69 74 20 45 73 63 20 66 6F 72 20 2E 61 .Hit Esc for .a
00000020: 6C 74 62 6F 6F 74 00 E8 00 00 5E 81 EE 2A 00 0E ltboot…^…*…

Unfortunately, the value is already 0x80.


I’m wondering why > :slight_smile: > From common sense it should be 0x81…

Success!
I exchanged the Lexar 256MB with a SanDisk 256MB and the SanDisk works!
I also tried a different Lexar 256MB and it worked.
Must be a bad Lexar 256MB compact flash. Weird, chkfsys even checked
out the filesystem when mounted as secondary IDE device.
Thanks to everyone for your help.
-Dan

Dan Kneip wrote:

QNX 6.2
/dev/hd1 is a 256MB compact flash using physical mode for IDE.

I perform the following:

umount /dev/hd1
fdisk /dev/hd1 delete -a
fdisk /dev/hd1 add -t 79 -b -p 100
fdisk /dev/hd1 loader
fdisk /dev/hd1 show

Then reboot and perform the following:

umount /dev/hd1
mount -e /dev/hd1
dinit -q -f vcs.ifs -h /dev/hd1t79
mount /dev/hd1t79 /fs/hd1-qnx4
cpbk x86 /fs/hd1-qnx4/x86

x86 is a copy of /x86

Then shutdown. Disconnect hard drive and make flash primary HD on IDE.
Setup BIOS so the only one drive is present in physical mode.

When the system is powered up, I get the request for a partition
selection. Then after a short delay, I get the normal “Hit Esc for
.altboot” followed by the normal "…"s.

Then nothing. It just hangs.

Any ideas?


PS: With a slight change to my build file, I can use the .altboot on the
HD to mount the compact flash as /. And all is well. It seems that
something is wrong from the second-stage loader to the boot image. I
have also attempted the following just after the dinit above to try the
other second-stage loader:
dinit -b -B /x86/boot/sys/ipl-diskpc2 -r -h -m “VCS Booting” /dev/hd1t79
chkfsys -uP /dev/hd1t79

ed1k <ed1k@spamerstrap.com> wrote:

it was at offset 0x11 in QNX6.1.

Yep, my mistake, was looking at the wrong structure and confusingly my
t79 partition is at offset xxxxxx80 sectors :-/

Does dinit really write 0x81 while initializing second hard drive?

Wishful thinking, I see it only writes 0x00 or 0x80 (based on guesswork
or command-line overrides). Mind you, I don’t think there is a way for it
to know, devb-eide doesn’t export information on target/path/lun (which
may provide a means to make a better guess). But then again, a lot of
people (recklessly, IMHO) seem to set up a bootable drive as a secondary
on an existing system with the express intent of making it the primary
on a new system, so automatic guessing would cause as much / more trouble
than it would solve … :frowning:

I have seen a lot of reports on newsgroups about the next trouble: during
installation of QNX (incl.6.2) onto second hard drive the resulting drive
number in loader (bootsector) is 0x80 (it’s unexpected by any 3rd
multisystem loader)…

The secondary loader? You’re saying that some things do actually expect
0x81? I can add another flag to dinit/dloader to allow explicit passing
of the boot source, which may help some people (but refer again to above
comments re hazards of auto-guessing) …

Hello John,
Thank you for answering… it helps me (and I hope an others) to understand things right :slight_smile:

John Garvey <jgarvey@qnx.com> wrote in article <ak3qb4$brk$1@nntp.qnx.com>…

ed1k <> ed1k@spamerstrap.com> > wrote:
it was at offset 0x11 in QNX6.1.

Yep, my mistake, was looking at the wrong structure and confusingly my
t79 partition is at offset xxxxxx80 sectors :-/

Ok, but why this information (structure of bootsector) isn’t documented anywhere? Or point me,
please, the appropriate document on the web/QNX6NCsystem. Such information is well knowen for FAT
and, I believe, other file systems. It might clear up the things and help to understand what’s
wrong if there is problem with booting.

Does dinit really write 0x81 while initializing second hard drive?

Wishful thinking, I see it only writes 0x00 or 0x80 (based on guesswork
or command-line overrides). Mind you, I don’t think there is a way for it
to know, devb-eide doesn’t export information on target/path/lun (which
may provide a means to make a better guess).

But devb-eide uses this information for naming:
dinit (dloader) [options] /dev/fd0 means drive# 0x00
dinit (dloader) [options] /dev/fd1 means drive# 0x01
dinit (dloader) [options] /dev/hd0* means drive# 0x80
dinit (dloader) [options] /dev/hd1* means drive# 0x81

No? Also I believe it’s a good idea to overwrite this guessing by some option of dinit/dloader.

But then again, a lot of
people (recklessly, IMHO) seem to set up a bootable drive as a secondary
on an existing system with the express intent of making it the primary
on a new system, so automatic guessing would cause as much / more trouble
than it would solve … > :frowning:

Yes, I agree. I suppose option (see above) will good for such trick. And they must use that option,
it should be well documented. But I don’t understand how does work the primary loader which
supports loading from different drives… Beat me, I thought it reads MBR of second drive and
passes control to that startup, of course, if second drive is selected for booting… Then MBR on
second drive looks for active partition, looads bootsector to memory and just passes control to
that bootsector. But it’s wrong… Ok, the primary loader can itself parse through partition table
of second drive’s MBR, then load selected bootsector to memory and jumps into it. But it’s also
wrong… In this way system will hang because the bootsector includes wrong drive number… What
I’m missing :slight_smile:?

I have seen a lot of reports on newsgroups about the next trouble: during
installation of QNX (incl.6.2) onto second hard drive the resulting drive
number in loader (bootsector) is 0x80 (it’s unexpected by any 3rd
multisystem loader)…

The secondary loader? You’re saying that some things do actually expect
0x81?

Yes, look at

From: Flynn <flynnieboySPAMISLAME@yahoo.com>
Newsgroups: qdn.public.qnxrtp.installation
Subject: Dual boot Win2000/QNX 6.2
Date: 13 Aug 2002 01:02:03 GMT
X-Trace: inn.qnx.com 1029200523 9870 217.128.131.133 (13 Aug 2002 01:02:03 GMT)
NNTP-Posting-Date: 13 Aug 2002 01:02:03 GMT
User-Agent: Xnews/5.04.25
Xref: inn.qnx.com qdn.public.qnxrtp.installation:5325

Discussed there tool ‘bootpart’ allows to read/pass control to any bootsector in windows NT system
as to boot alternative operation system. ntldr uses files (images) of bootsectors, so it can be
easily edited by hex editor (but there is no documentation where is drive number in bootsector)…
But I know one loader at least which reads selected bootsector (even if it’s in extended
partition:) and just jumps into it.

I can add another flag to dinit/dloader to allow explicit passing
of the boot source, which may help some people (but refer again to above
comments re hazards of auto-guessing) …

Installation procedure will much more smoothly :slight_smile: But only if non-QNX primary loader is used… I
don’t know which trick the new “multidisk” QNX loader is doing. Or it just does not work? LOL, I
never used it to boot system from second drive.
Cheers,

Eduard.
ed1k at ukr dot net

ed1k <ed1k@spamerstrap.com> wrote:

Ok, but why this information (structure of bootsector) isn’t documented

I’m attempting to remain ignorant of certain things :wink: But, if I was
pushed to reverse-engineer, I would say: Earlier boot loaders just used
the (well-documented) DOS BPB format. Incidentally this is why certain
Windows versions would insist on scandisk/corrupting QNX partitions, not
a billg plot at all :wink: Later versions, pressed for space to accomodate
the INT13X parameter block, threw that out in favour of a more compact
(but undocumented) format. You’ve managed to find the ‘drive’ field :wink:

Does dinit really write 0x81 while initializing second hard drive?
Wishful thinking, I see it only writes 0x00 or 0x80 (based on guesswork
But devb-eide uses this information for naming:
dinit (dloader) [options] /dev/fd0 means drive# 0x00

Again, dinit/dloader writes only 0x00/0x80. Period. But refer to my
previous posting as to why this is not necessarily a bad thing. I think
I’ll add an option to override this though, may save some spatching,
though will only be useful in certain/specialised situations?

LOL, I never used it to boot system from second drive.

Me neither. I’m one of those people that puts the final hardware in a
system and then formats the drives once they’re in their proper place
(so the BIOS and the driver are all in agreement) and you know what - it
always boots afterwards :wink:

John Garvey <jgarvey@qnx.com> wrote:

LOL, I never used it to boot system from second drive.

Me neither. I’m one of those people that puts the final
hardware in a system and then formats the drives once they’re
in their proper place (so the BIOS and the driver are all in
agreement) and you know what - it always boots afterwards > :wink:

John,

Point taken, but often times embedded systems use flash IDE
drives that are less than 256M in size. As well I am not
comfortable in using the package manager in embedded systems. So
my question to you would be, if we can’t use the stanadard
installer, how are we supposed to embed QNX on such devices?

We could put the new device on the secondard IDE chain as the
primary device, but that would still not answer your concerns on
not using the target computer to install the software.

As well, many applications, such as the one Dan K. was working
on, a floppy drive or CD ROM is not possible on the target system.

I have not read the embedding documentation lately, but I can
never remember this topic, using compact flash cards, really
being dicusessed. Might make a good project for someone up
there?

regards,
Tom

Thomas Emberson <temberson@softwareremodeling.com> wrote:
: I have not read the embedding documentation lately, but I can
: never remember this topic, using compact flash cards, really
: being dicusessed. Might make a good project for someone up
: there?

I’ll add it to the list. Thanks for the suggestion.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

John Garvey <jgarvey@qnx.com> wrote in article <ak557u$2s7$1@nntp.qnx.com>…

ed1k <> ed1k@spamerstrap.com> > wrote:
Ok, but why this information (structure of bootsector) isn’t documented

I’m attempting to remain ignorant of certain things > :wink: > But, if I was
pushed to reverse-engineer, I would say: Earlier boot loaders just used
the (well-documented) DOS BPB format. Incidentally this is why certain
Windows versions would insist on scandisk/corrupting QNX partitions, not
a billg plot at all > :wink:

Probably, you’re telling about QNX6.0 versions. As far as I remember I had troubles during update
to 6.1 release, because I use NT loader and it uses images of bootsectors, and old loader was
unable to load new image :slight_smile: There was no any word in readme or release notes… I spent a bit of
time to figure what happened :slight_smile:

Later versions, pressed for space to accomodate
the INT13X parameter block, threw that out in favour of a more compact
(but undocumented) format. You’ve managed to find the ‘drive’ field > :wink:

It is good format > :slight_smile: > but unfortunately undocumented. I have done reverse-engineering work and I

explain why. I had the QNX system in its own partition on first drive. After some reordering I put
that hard drive as second one. It could not boot. I recall about drive number in INT 13H parameter
block and type ‘dloader /dev/hd1t79’. Surprise. It also could not boot. Even there is no difference
in bootsectors, now I know why :slight_smile:

Does dinit really write 0x81 while initializing second hard drive?
Wishful thinking, I see it only writes 0x00 or 0x80 (based on guesswork
But devb-eide uses this information for naming:
dinit (dloader) [options] /dev/fd0 means drive# 0x00

Again, dinit/dloader writes only 0x00/0x80. Period. But refer to my
previous posting as to why this is not necessarily a bad thing. I think
I’ll add an option to override this though, may save some spatching,
though will only be useful in certain/specialised situations?

It will useful for QNX installator.
Currently installation procedure allows to install QNX onto second hard drive. Installation is
often done by newcomers… they often don’t know what’s spatching,… If I’m putting custom system
to flash or another second drive which is to be first drive in target system, I know what I’m
doing… and probably I am not a newbie, I can put appropriate option into dinit’s command line.

Eduard.
ed1k at ukr dot net

Thomas Emberson <temberson@softwareremodeling.com> wrote:

John Garvey <> jgarvey@qnx.com> > wrote:
LOL, I never used it to boot system from second drive.

Me neither. I’m one of those people that puts the final
hardware in a system and then formats the drives once they’re
in their proper place (so the BIOS and the driver are all in
agreement) and you know what - it always boots afterwards > :wink:

John,

Point taken, but often times embedded systems use flash IDE
drives that are less than 256M in size. As well I am not
comfortable in using the package manager in embedded systems. So
my question to you would be, if we can’t use the stanadard
installer, how are we supposed to embed QNX on such devices?

Generally you would pick and choose those components which
are relevant/usefull for you and hand-craft an installation
based on a full stock installation (ie where you made your
initial boot image). The installation packages include all
sorts of things (docs, examples, source, tools) which you
would never use on your embedded system.

We could put the new device on the secondard IDE chain as the
primary device, but that would still not answer your concerns on
not using the target computer to install the software.

As well, many applications, such as the one Dan K. was working
on, a floppy drive or CD ROM is not possible on the target system.

I have not read the embedding documentation lately, but I can
never remember this topic, using compact flash cards, really
being dicusessed. Might make a good project for someone up
there?

Again you have to have some mechanism to transfer data
across. Either you have physically transfer the device
from host to target after transferring the files, or you
can use another filesystem such as what is available to
you in your system.

Thomas

Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Core OS Technology Group
(613)-591-0931 http://www.qnx.com/

thomasf@qnx.com wrote:

Thomas,

Don’t get me wrong, I’ve create boot disks for many embedded
boxes. I’ve only had a couple instances where a HD was large
enough that 2 bios had different translations.

My point was, that I believe it is unrealistic to ignore the
need to create a bootable IDE type device on a machine other
than the target. For example, here at work I have an extra Ampro
box that I use for system level regression tests, and of course
loading the OS on Sandisk/Lexar compact IDE drives.

Point taken, but often times embedded systems use flash IDE
drives that are less than 256M in size. As well I am not
comfortable in using the package manager in embedded systems.
So my question to you would be, if we can’t use the stanadard
installer, how are we supposed to embed QNX on such devices?

Generally you would pick and choose those components which are
relevant/usefull for you and hand-craft an installation based
on a full stock installation (ie where you made your initial
boot image). The installation packages include all sorts of
things (docs, examples, source, tools) which you would never
use on your embedded system.

Exactly, and of course, even if we wanted to they will not fit
in 256M, the size of compact flash cards we are using here. One
of the gentlemen tried for the heck of it when we got in the
first embedded board.

Again you have to have some mechanism to transfer data across.
Either you have physically transfer the device from host to
target after transferring the files, or you can use another
filesystem such as what is available to you in your system.

I guess the question is, no floppy, no CD rom, if fact no other
bootable devices availible in the system other than the on board
compact IDE slot, how do you get an OS up and running to perform
the fdisk/dinit/cp image? The only way I know is to prepare the
compact IDE card before you put it on the mother board.

regards,
Tom