RuslanYanyuk / qnx660-qemu-bsp

0 stars 1 forks source link

cannot run it with qemu #1

Open pgawlowicz opened 1 year ago

pgawlowicz commented 1 year ago

Hi,

First of all, thank you for this project. This is something that I need for testing qnx and I almost got it running but there are some issues and I hope you could help me.

Specifically, I managed to compile the project with qnx660 (it required to change the bootstrup in the build file). Then I tried to start the generate images following the approach described here : https://github.com/xabrs/bsp-qemu-arm i.e. i copied the u-boot.bin file and use the following commands:

qemu-system-arm -M virt -m 256 -cpu cortex-a15 -bios ./images/u-boot.bin -hda fat:rw:./images -vga none -serial stdio

Then inside qemu:

virtio scan fatload virtio 0:1 0x40400000 ifs-qemu-virt-arm-a15.bin go 0x40400000

Unfortunately, I get the following output:

## Starting application at 0x40400000 ... main.c: END

Shutdown[0,0] S/C/F=10/3/5 C/D=fe0257a0/fe0b26d0 state(4c00)= now lock QNX Version 6.6.0 Release 2014/02/22-19:07:53EST KSB:00000000 armle context[fe0ab118]: 0000: 00001000 00000e80 00001000 effff000 00000000 00000180 00000001 00000000 0020: effff180 fe0b2960 fe0ac310 fe0ab3a4 00000000 fe0ab160 fe04ce44 fe05fdc8 0040: 200000d3 instruction[fe05fdc8]: 05 10 83 17 06 00 00 ea 01 00 56 e3 e1 ff ff 1a 9c 32 9f e5 00 30 93 e5 00 00 stack[fe0ab160]: 0000:>00000000 00000000 fe05f658 00000000 00000000 effff000 fe0b2960 fe0b2960 0020: fe0b2964 fe0b2968 fe0b296c 00000000 00000000 00000000 00000000 fe0b2960 0040: fe0b2960 fe0b2964 fe0b2968 fe0b296c 00000000 00000000 00000000 00000000 0060: 7f5ec000 00000180 fe0a9130 00000000 fe0a9f80 007f61ab 0000000f fe0ac310

Note that I added a print just before the main() function (in main.c) returns, so it seems that it is executed (correctly?) till the end.

Also I have changed procnto to procnto-smp but get a similar output:

=> virtio scan => fatload virtio 0:1 0x40400000 ifs-qemu-virt-arm-a15.bin 10661932 bytes read in 12 ms (847.3 MiB/s) => go 0x40400000 ## Starting application at 0x40400000 ... main.c: END VFPv3: fpsid=410430f0 coproc_attach(10): attach fe06f210 (fe071144) coproc_attach(11): attach fe06f210 (fe071144)


Welcome to QNX Neutrino 6.6.0


Shutdown[0,0] S/C/F=10/3/5 C/D=fe025580/fe09fcc0 state(f00)= now lock exit specret QNX Version 6.6.0 Release 2014/02/22-19:07:50EST KSB:effe7000 [0]PID-TID=1-6 P/T FL=00019001/05020000 "proc/boot/procnto-smp" [0]ASPACE PID=2 PF=00008012 armle context[effddddc]: 0000: 0804d000 00000000 00001000 0804d000 00000000 00000000 00000000 00002000 0020: 0804f000 effe62e8 e0770040 0804efff 00000000 effd2c0c fe056200 fe08e36c 0040: 2000001f instruction[fe08e36c]: 70 10 a3 e8 10 20 42 e2 10 00 52 e3 fb ff ff aa 70 00 bd e8 01 00 00 ea 04 10 stack[effd2c0c]: 0000:>0804d000 e0770040 effd2d70 effca030 0804d000 effd2d70 00002000 0804d000 0020: fe05627c 0804d000 00002000 00002000 0804d000 effdf4d0 bfffe000 0804b000 0040: 0804d000 0804d000 fe056f40 effe62e8 bfffe000 00000200 00000000 e0770040 0060: 0804efff effe62e8 00000000 0804f000 01080332 00000000 e0770060 effd2d70

Did you maybe encounter similar issues? Best, Piotr

RuslanYanyuk commented 1 year ago

Hi

Thanks for your interest in this project! It's been a while since I ran this project. As far as I remember I used tftpboot command in the u-boot shell to boot it up. I used Linux Debian 11 to run this project so I installed this package u-boot-qemu to have this file /usr/lib/u-boot/qemu_arm/u-boot.bin in my system as well as an FTP server and configured it to point to the directory with images with anonymous access ( the root dir). Then I ran qemu like this qemu-system-arm -M virt -m 2g -cpu cortex-a15 -bios /usr/lib/u-boot/qemu_arm/u-boot.bin -monitor telnet:127.0.0.1:6299,server,nowait -serial mon:stdio

and inside the u-boot shell

setenv serverip 192.168.0.5 && tftpboot 0x40400000 arm_qnx.ifs && go 0x40400000

where 192.168.0.5 is the address of your network adapter and I use ifs image so the whole filesystem is in the memory at the beginning of the boot process.

If I understand correctly, the error you get is related to the support of the MMC memory which I'm not sure about.

Let me know if you have succeeded with these instructions so I'll add them to the Readme file.

pgawlowicz commented 1 year ago

Hi, Thank you for your quick response! I followed your instructions and it works! Thanks! See the output below:

Bytes transferred = 208822316 (c72602c hex)
## Starting application at 0x40400000 ...
VFPv3: fpsid=410430f0
coproc_attach(10): attach fe079bb8 (fe07a4e0)
coproc_attach(11): attach fe079bb8 (fe07a4e0)
**********************************
Welcome to QNX Neutrino 6.6.0
**********************************
Starting Serial Port driver...
Starting PCI Server...
Starting Ethernet driver...
Unable to init devn-rtl.so: Unknown error

sh: No controlling tty (open /dev/tty: No such device or address)
sh: warning: won't have full job control
root# ls
bin     dev     etc     lib     proc    tmp     usr

One more question, do you think it would be possible to share files between the qnx and host? I managed to compile the IFS with required files, but this solution is not very quick.

It seems that the Ethernet driver do not start, so copying over network is not possible. Maybe some shared directory? but i read that QNX does not support it neither.

Best, Piotr

RuslanYanyuk commented 1 year ago

Hi,

I worked a bit on adapting the RTL ethernet driver from QNX to work with the RTL device in QEMU but I was stuck because of the PCI server. PCI server sources are not open and it looks like it's a proprietary paid feature.

At this time it needs some further investigation to make the ethernet device work. The problem here is that during the boot process, the QNX loader must fill all the necessary PCI information into a specific memory region so the PCI server can use it later and it's not clear how to do it (what data the PCI server expects).

Probably with QEMU you could create some virtual volume so QNX could mount it and the host could access it at the same time but it also requires the investigation of what virtual storage devices QNX supports and if there is any match with QEMU devices.

Best Regards, Ruslan

pgawlowicz commented 1 year ago

Hi Ruslan,

Thank you for your reply. I have played a bit trying to share a virtual storage device between QNX running in QEMU and host. However, without any success. Probably, I do not have enough experience with QNX...

Specifically, I create a virtual volume and pass it to QEMU with the following command:

qemu-system-arm -M virt -m 2g  -cpu cortex-a15 -bios /usr/lib/u-boot/qemu_arm/u-boot.bin -monitor telnet:127.0.0.1:6299,server,nowait -serial mon:stdio -nographic -drive if=none,id=usbstick,format=raw,file=./armdisk.img -usb -device usb-ehci,id=ehci -device usb-storage,bus=ehci.0,drive=usbstick

Then in uboot, I get the following output on execution of the usb info and usb storage commands:

=> usb info
1: Hub,  USB Revision 2.0
 - u-boot EHCI Host Controller 
 - Class: Hub
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x0000  Product 0x0000 Version 1.0
   Configuration: 1
   - Interfaces: 1 Self Powered 0mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 1
     - Class Hub
     - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms

2: Mass Storage,  USB Revision 2.0
 - QEMU QEMU USB HARDDRIVE 1-0000:00:02.0-1
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x46f4  Product 0x0001 Version 0.0
   Configuration: 1
   - Interfaces: 1 Self Powered 0mA
   - String: "High speed config (usb 2.0)"
     Interface: 0
     - Alternate Setting 0, Endpoints: 2
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 In Bulk MaxPacket 512
     - Endpoint 2 Out Bulk MaxPacket 512
=> usb storage
  Device 0: Vendor: QEMU     Rev: 2.5+ Prod: QEMU HARDDISK   
            Type: Hard Disk
            Capacity: 1024.0 MB = 1.0 GB (2097152 x 512)

So I guess, so fat the virtual USB stick is emulated correctly.

Then I boot QNX and execute the following commands to start its USB controller:

io-usb -vvvv -dehci 
waitfor /dev/io-usb/io-usb
sleep 1

The usb -v command gives the following output:

USB 0 (EHCI) v1.10, v1.01 DDK, v1.01 HCD
    Control, Interrupt, Bulk(SG), Isoch(Stream), High speed

Finally, I start storage driver devb-umass but it does not work correctly:

root# devb-umass &
[1] 28683
root# xpt_configure:  No umass interfaces found
[1] + Done                 devb-umass 

Do you maybe have more experience with QNX and could point me towards the correct direction?

Best Regards, Piotr

RuslanYanyuk commented 1 year ago

Hi Piotr,

I didn't play with storage devices on QNX much. I see your device has Isoch(Stream) protocol and HCD type but according to this doc it's not supported. You could try to find some QEMU devices whose types are supported by devb-umass driver.

Best Regards, Ruslan