0

I'm working on a project where underlying Kernel is from QNX and all the Kernel sources are coming as binary ,for example CAM layer for block drivers is present as libcam.a but could not find the exact kernel binary which should be there in whole source tree of project.

Can anybody tell me what is the way to find it out??

Martin
  • 5,119
  • 3
  • 18
  • 16
Amit Singh Tomar
  • 8,380
  • 27
  • 120
  • 199

1 Answers1

1

The running kernel is going to be the process with PID of 1. Use ps -e to see it.

In my case, it's procnto. If you are running the instrumented kernel (for debugging) it's procnto-instr.

 ps -e
       PID TTY          TIME CMD
         1 ?        12:25:42 procnto
      4098 ?        00:00:00 pci-bios
      4099 ?        03:40:47 io-usb
      4100 ?        00:00:00 io-hid
      4101 ?        00:00:00 devc-con-hid
      4102 ?        00:58:14 devb-eide
     20487 ?        00:00:00 /sbin/tinit
     20488 ?        00:00:00 slogger
     24585 ?        00:00:25 pipe
     28682 ?        00:10:22 mqueue

Depending on how you make your IFS file, you could have a .build file that includes something like the following:

#
# The build file for QNX Neutrino booting on a PC
#
[linker="ntox86-ld -T$QNX_TARGET/x86/lib/nto.link %(h!=0, -Ttext 0x%t%)%(d!=0, -Tdata 0x%d%) -o%o %i %[M -L%^i -uinit_%n -lmod_%n%]"]
[virtual=x86,bios +compress] boot = {
    startup-bios

    # PATH is the *safe* path for executables (confstr(_CS_PATH...))
    # LD_LIBRARY_PATH is the *safe* path for libraries (confstr(_CS_LIBPATH))
    #    i.e. This is the path searched for libs in setuid/setgid executables.
    PATH=/proc/boot:/bin:/usr/bin:/opt/bin LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/opt/lib procnto

} ...

That last procnto is what tells the bootloader which kernel to use. Look at mkifs for more information.

kmort
  • 2,848
  • 2
  • 32
  • 54
  • Thanks @Kmort ,anyways we have found our nto Kernel with same procnto-smp-instr name. – Amit Singh Tomar Mar 08 '13 at 09:41
  • Hi kmort, is there any way to link a Linux kernel binary from this build file ,tried to do so but its saying liker not found – Amit Singh Tomar Mar 08 '13 at 18:53
  • I really doubt it. The QNX loader would probably choke on such a thing. You'd have the whole ELF issue to deal with... Probably best to come up with something else. Why not just use a Linux loader? – kmort Mar 08 '13 at 19:02
  • Our requirment is such we can only modify this build file to support linux kernel booting instead qnx. While building our IFS we are getting error "Can not find required linker for" linux kernel and mostly this has been issued by mkxfs tool ,though we have elf header in our linux kernel bin. Is there any way your really want to suggest to go about it?? – Amit Singh Tomar Mar 08 '13 at 19:18
  • That's pretty tough. You're going to have to dig in to the bootloader. Or talk to the QNX folks at www.QNX.com. Good luck. :-) – kmort Mar 08 '13 at 19:54
  • Thanks Kmort for Your help ,the thing we need to figure out is how to provide Linker to support linking to linux bin and now we know what linker we have with us,we really interested to know first the meaning of [linker="ntox86-ld -T$QNX_TARGET/x86/lib/nto.link %(h!=0, -Ttext 0x%t%)%(d!=0, -Tdata 0x%d%) -o%o %i %[M -L%^i -uinit_%n -lmod_%n%]"]?? where exactly we need to define this line in build so default seeting won't override. – Amit Singh Tomar Mar 09 '13 at 10:35