Common QNX commands

Source: Internet
Author: User
Tags clear screen network function sin

Common QNX commands

0. # Use -- print a usage message (QNX neutrino) (view the help of each command)
# Use ls

1. # pidin -- display system statistics (QNX neutrino) (view system information)
# Pidin A # pidin mem # pidin info # pidin fa...
Pid tid name PRIO state blocked
1 1/sys/procnto-instr 0f ready
1 3/sys/procnto-instr 10R running
1 4/sys/procnto-instr 12r receive 1
2 1 sbin/tinit 10o Reply 1
3 1 proc/boot/slogger 10o receive 1
5 1 proc/boot/PCI-bios 10o receive 1
6 1 ROC/boot/DEVB-Eide 10o sigwaitinfo
6 2 ROC/boot/DEVB-Eide 21R receive 1

2. # hogs -- list the processes that are hogging the CPU (view CPU usage)
$ Hogs-n-% 10
PID name msec PIDs System
1 451 41% 15%
6 DEVB-Eide 141 13% 4%
8 FS-PKG 391 36% 13%

3. # Sin -- Display System Information
$ Sin-u techpubs
Procnto 1 0 0 0 268759990
Devc-con 2 36 K 68 K 128 M 128 M 614
PCI-bios 3 28 K 60 K 4 K 516 K 16
Tinit 4 8 K 44 K 4 K 516 K 4
......

4. # coreinfo -- display information about a QNX neutrino Core File
# Coreinfo test_g.core

5. # dumpifs -- dump an image filesystem
# Dumpefs -- dump an embedded filesystem

$ Dumpifs shell. Ifs
Offset size name
0 288 *. boot
288 100 Startup-header flags1 = 0x1 paddr_bias = 0
388 6008 startup .*
6390 59 image-header mountpoint =/
63ec 1ac image-directory
---- Root-dirent
6598 8C proc/boot/data1
6624 5C proc/boot/. Script
6680 14 proc/boot/data2
7000 2c02c proc/boot/procnto
34000 12ad0 proc/boot/devc-con
47000 b66c proc/boot/esh
53000 d7fc proc/boot/ls
61000 7394 proc/boot/cat
Checksums: Image = 0x6d5fb484 startup = 0x274d7c89

6. # showmem -- Display memory information (view memory information)

7. qconfig -- Query and display QNX installations and configurations (view version and other installation information)

Common tips for QNX

1. Skip Login
Skip graphics:
Add/usr/photon/bin/photon-L '/usr/photon/bin/phlogin-o-uuser: password' to/etc/rc. d/rc. Local'
Skip the command line:
Modify the/etc/config/TTYs file, con1 "/bin/login-F root" qansi-m on

2. Use pindows
Remove this sentence from the/etc/inetd. conf file: phrelay stream tcp Nowait root/usr/bin/phrelay-x

Kill and run inetd again: 1. # slay inetd 2. # inetd

3. Remove shelf [photon shelf manager -- border
Run # shelf-e
Or a more permanent approach is to set the phshelf_disable environment variable to 1. You can do this in your. profile file, with export phshelf_disable = 1

4. Command Line Mode during logon
/Etc/rc. d/RC. sysinit runs tinit. [If the-P option is specified, tinit starts photon.] by default, the system starts photon, But if you create a file called/etc/system/config/nophoton, then RC. sysinit tells tinit to use text mode.

5. automatically run the program
If you want to run a photon application whenever photon starts, put it in your $ home /. PH/phapps file. put each command on a separate line. for example, to start the photon editor when you start photon, include this line: ped &
[Note: phapps requires executable permissions, such as # chmod + x/root/. Ph/phapps]

6. logon records
The login utility also updates system accounting information in var/log/utmp,/var/log/wtmp, And/var/log/lastlog. if they already exist. the login utility doesn' t create/var/log/utmp,/var/log/wtmp, And/var/log/lastlog if they don't already exist. these files
Can quickly become very big, which isn't good on an embedded system with limited resources.

7. TCP/IP network settings
Set the IP address and use Phlip on the graphic interface.
Available on the command line: Make sure that network I/O is running: IO-net-dne2000-ptcpip
Specify IP ifconfig en0 10.0.0.100
Route entry: Route add default 10.0.0.1
Use DHCP to automatically obtain ip dhcp. Client-I en0-m-u-t 1

Start the second instance of the TCP/IP stack by invoking io-net as follows:
Io-net-I1-del900 PCI = 0x1-ptcpip prefix =/sock2

The-I option in the second instance of TCP/IP tells io-net to register itself as/dev/io-net1. the prefix option to npm-tcpip.so causes the Second stack to be registered as/sock2/dev/socket instead of the default,/dev/socket. TCP/IP applications that wish
To use the Second stack must specify the environment variable sock. For example: sock =/sock2 netstat-in
Are io-net and the drivers running? Pidin-P io-net mem
Is the TCP/IP protocol stack or Ethernet driver installed? Ls/dev/IO-Net
How do I map hostnames to IP addresses/etc/hosts
How do I get the network status? Netstat-in
List the interfaces, including the Mac and IP addresses that they 've been configured with. netstat-Rn
Display the network routing tables that determine how the stack can reach another host. netstat-
List information about TCP/IP connections to or from your system. for the tiny TCP/IP stack, you have to use the following command as it doesn't support netstat: CAT/proc/ipstats
How do I display information about an interface controller? /Usr/sbin/nicinfo/dev/IO-net/en0

QNX-Getting Started from 4 to 6

By Nicolas Zhou

Part 1: installation and use of the QNX System

QNX microkernel, not including process management, only provides inter-process communication (Software Bus ). However, in the actual compilation system, it is still compiled in the same executable file, such as process scheduling, synchronization, and inter-process communication. It is/boot/sys/procnto (qnx6 ).
QNX 4.x only supports x86, QNX 6.x supports PowerPC, etc.
QNX 4.x only has process, no thread, and QNX 6.x, Which is synchronized with POSIX 1003-2001.
How to Create a boot image: (qnx4)
In/boot/build, install.1 is the configuration file for starting the image.
CD/boot
Make B = install.1
The above steps will successfully compile the/boot/images/install.1 image file (which is a MS-DOS executable ), it contains the images of all executable files specified in the/boot/build/install.1 configuration file (such as proc32 and slib32 ).
Copy install.1 to/. boot.
Clear screen, use Ctrl + L
Driver of the file system/block device. qnx4 is in/bin, such as fsys. Eide, while qnx6 is in the/sbin directory.
Block device name, which can be specified through the device driver loading parameters of/boot/build/install.1, usually hd0.0 (corresponding to primary master) and hd0.1 (corresponding to primary slave), h1.0 (corresponding to secondary master), hd1.1 (corresponding to secondary slave ).
Hd0t79, where t79 refers to type and type ID
After adding a block device, you can use fdisk for partitioning, such as fdisk/dev/hd0.1. After partitioning, you can only view/dev/hd0.1 in/dev/HD, to find the new partition, use Mount-P/dev/hd0.1 (PROBE ).
Startup Process

How to Create a floppy boot system (qnx4)
CD/boot
Make B = floppy
Format the disk drive fdformat/dev/fd0. initialize the disk drive dinit-HB/dev/fd0. Mount the disk to/FD-mount/dev/fd0/FD.
CP/boot/images/floppy/FD/. boot, just start the image.
Mkdir etc; mkdir ETC/config; mkdir bin; mkdir USR; mkdir/usr/bin
CP/etc/config/sysinit. Floppy/FD/etc/config/sysinit
CP/etc/logo. f/FD/etc/
Copy necessary binary files from/bin/or/usr/bin to/FD/bin or/FD/usr/bin (corresponding ), such as LS, Pax, fcat, esh, sh, Echo, Vi, Dev, and fsys. eide, mount, RM, rmdir, MV, melt, fsys, Dev, Dev. con, chkfsys, PS, prefix, emu87, mount, RTC, DF, dinit, fdformat, etc.
Modify/etc/config/sysinit to load the hard drive and add the following line:
/Bin/fsys. Eide fsys-ndsk0-N0 = hd0.-n5 = cd0.eide-a1f0-i14
Restart and load from a floppy disk.
Shutdown command: shutdown-B (completely shut down without restarting)
User Environment
Boot Image->/etc/config/sysinit. node->/etc/profile-> $ home/. Profile

Compression and decompression
Melt/freeze, the former releases ABC. F to ABC, and the latter compresses ABC to ABC. F (only for qnx4)
Gzip/gunzip
Copy
CP
Cpio
Part 2: QNX Network

QNX has a strong network function. The most distinctive feature is its fleet networking. This technical framework can directly link nodes across different networks (such as Ethernet + token, the user program only needs to use msg_send to communicate with any QNX node on the network.

The configuration of fleet network needs to be modified:

Configure node number
Change/boot/build/install.1 to install. X (X for your ID, such as 2, the same below), modify $/boot/sys/proc32-L 1 in install.2 to $/boot/sys/proc32-L 2, the following 2 is the node number.

Generate a new image
CD/boot
Make B = install.2
CP images/install.2/. boot
Modify configuration file
CD/etc/config
CP sysinit.1 sysinit.2
CP inetd.1 inetd.2
CD Bin
CP input.1 input.2
CP ph.1 ph.2
CP tcpip.1 tcpip.2
Modify tcpip.2. The IP address is used. To use DHCP, comment out/usr/UCB/ifconfig EN1 10.1.1.119 node $ node up and replace it with/usr/UCB/DHCP. client
Modify/. Licenses and add the license
Finally, modify/etc/config/netmap and add the nodes in the network.
Use netmap-F to instantly update the network node table, use netmap to view existing nodes, and use alive to view the online status of each node
If the network card is not working, run the following command to restart the service.
Slay net
Net &
Net. ether2100-L1-p0x1080-I9 &
Slay socklet
Socklet node2 &
Other network-related components

1. How to control the remote machine: Ditto-N3-K to control the remote node3.
2. How to view the NIC status: netstat-in
3. How to view the route table: netstat-Rn
4. How to Use the Remote Desktop: phindows-N/dev/photon. Activate phrelay (inetd) on the QNX side ).
5. How to check the IO address and interrupt of the PCI Card: Show PCI
6. How to enter another server: On-F 3/bin/sh
7. How to check the network listener: netstat-
8. How to view the Command executed by the system after startup: sin ar
9. Sin mem: Virtual Address Allocation of the current process
10. Sin-T: view the CPU time used by each process.

QNX Network Architecture --
From driver to Application Layer: Net-> net. Ether-> socket/socklet-> inetd-> nfsd
Configuration tools: ifconfig, route, hostname, and netmap
Query tools: netstat and alive

Part 3: qnx6 Basics

Build Boot Image
/Boot/build is still the configuration file of the build startup Image
BiOS. Build is General for x86
Mkifs-V bios. Build bios. img
Generate a startup image in momentics (hard disk and qnx4 file system supported)
Generate the QNX System Builder project. In the build file generation section, select the Import/boot/build/bios. Build File.
Double-click Project. BLD and add DEVB-Eide to binaries.
Add cam-disk.so, io-blk.so, and fs-qnx4.so to the DLL.
Add libcam. so.2 to share Library
Click bios, right-click the menu to bring up the Properties window, and add the necessary paths to system path and LD_LIBRARY_PATH, including/bin:/sbin:/usr/bin: /usr/sbin and/lib:/usr/lib.
Modify bios. bsh and add the hard drive section after the section of PCI.
I. # Start ide drive
Ii. DEVB-Eide &
Iii. waitfor/dev/hd0t79
Iv. Mount/dev/hd0t79/
V. waitfor/bin
Modify bios. bsh and add the/etc/system/sysinit script at the end.
I. [+ session] Sh-c "/etc/system/sysinit"

Ii. Finally, comment out the other part between the IDE driver and this.

Compile bios. Ifs and copy the file to/. boot.
Others
The qnx6 STARTUP script is more like Linux/Unix, including sysinit and rc. d. The driver of qnx6 is far more flexible than that of qnx6-by the way, qnx4 does not even provide DDK to users, almost all qnx4 device drivers are developed by QNX (or commissioned by the customer ). Qnx6 has changed this situation-and qnx6 is fully open-source, and qnx6 users are no longer subject to those license issues. Normal individual users can directly download and install qnx6's RTOS and development environment, including the use of qnet -- you know, qnx4 fleet network cannot be used if there are no more than two licenses.

Part 4: qnx6 network architecture and qnet

The qnx6 network, especially qnet, is as unique as qnx4. Relatively speaking, the fleet network of qnx4 is complicated and remote in terms of configuration and usage. Qnx6 greatly simplifies the configuration complexity and makes remote access more normal.

First, the qnx6 network driver is different from the qnx4 net + net. Ether + socket/socklet or netmap method. Instead, it adopts a more modular, flexible, and consistent method. This change should be due to the upgrade of the qnx6 underlying architecture.

From the qnx6 startup perspective, on x86, the BIOS first starts startup-BIOS (a Binary Package), and then starts the microkernel procnto, then, load some drivers in the startup script. The first load is usually a console, devc-con; then the PCI-bios should be loaded, and the PCI bus should be tested to start work; then the hard drive and file system should be loaded; finally, start some process communication management programs, such as mqueue and pipe.

In qnx6, the network and hard disk are managed by an IO-xxx program like other devices (such as audio). The hard disk is Io-BLK, and the network is Io-net, the audio is Io-audio. However, there are also differences between them, such as hard disks. the executable program is DEVB-Eide (the common character devices and Block devices seem to be in this way ), the network is Io-Net (the net and audio seem to be the same), which seems a little weird.

Go far and return to io-net.

Io-net startup usually includes some parameters. These parameters can load various protocol stacks, including TCPIP and qnet, while loading the NIC Driver. For example:

# Io-net-dpcnet-ptcpip-pqnet

In this step, the NIC Driver, TCPIP protocol stack, and qnet protocol stack can be successfully loaded in the qnx6 running on the vmwarevm. Run the following command to check the status of IO-net loading:

# Ls/dev/IO-Net

En0 ip0 ip_en qnet_en

In addition, you can add device drivers and protocol stacks to the started io-net. For example:

# Slay io-Net

# Io-Net

# Mount-tio-net devn-pcnet.so

# Mount-tio-net npm-tcpip.so

# Mount-tio-net npm-qnet.so

These three operations add the pcnet NIC Driver, TCPIP, and qnet protocol stack to io-net.

Other commands:

View the loaded drivers in io-Net: ls/dev/IO-Net
View other qnet nodes in the Network: ls/Net
Access other qnet nodes in the Network: CD/NET/nodename (switch to the root directory of the target node). As for the node name, it is set through hostname.
Finally, add that msg_send is blocked in QNX.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.