Wednesday, May 07, 2025

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04

I am planning to run qemu-system-ppc to play around QEMU and PPC with networking support. The quest and U-Boot will need to interact with external services, namely, tftp. The recommended network is to have TUN/TAP virtual network interface configured on the host. My host is Xubuntu 24.04/Ubuntu 24.04.

Let's start by creating tap0 using systemd
u1@m18:~$ sudo nvim /etc/systemd/system/tap0.service
Copy/paste content below Change u1 to the user who needs access to tap0

Run command below to create tap0. This should also presist after reboot
u1@m18:~$ sudo systemctl daemon-reexec
u1@m18:~$ sudo systemctl enable --now tap0.service
Create a backup of existing netplan configuration
u1@m18:~$ mkdir ~/backup
u1@m18:~$ cd /etc/netplan
u1@m18:~$ sudo mv * ~/backup
Create new netplan configuration, let us call it 01-netcfg.yaml
u1@m18:~$ sudo touch /etc/netplan01-netcfg.yaml
u1@m18:~$ sudo chmod 600 /etc/netplan/01-netcfg.yaml
u1@m18:~$ sudo nvim /etc/netplan/01-netcfg.yaml
Copy/paste gist below into 01-netcfg.yaml. Note that ens33 is my interface name, so update that as appropriate.

Now disable Network Manager and enable networkd. The command below will reconfure your network, so you need to be on the console and not via ssh.
u1@m18:~$ sudo systemctl stop NetworkManager.service
u1@m18:~$ sudo systemctl disable NetworkManager.service
u1@m18:~$ sudo systemctl start systemd-networkd.service
u1@m18:~$ sudo systemctl enable systemd-networkd.service
Now apply netplan configuration
u1@m18:~$ sudo netplan apply
Running QEMU below and issuing dhcp at U-boot prompt should allow the guest to get IP address from DHCP server. Of course, I am assuming that there is DHCP server in the network.
u1@m18:~$ qemu-system-ppc -M mpc8544ds -cpu mpc8540 -m 512 -nographic -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device e1000,netdev=net0 -serial mon:stdio

Installing QNX 6.5.1 on Ubuntu 24.04

Installing QNX 6.5.1 on Ubuntu 24.04

Install pre-requisites
$: sudo dpkg --add-architecture i386
$: sudo apt update
$: sudo apt install libc6:i386 default-jre-headless:i386 libgtk2.0-0:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libatk-adaptor:i386 gtk2-engines-pixbuf:i386 gtk2-engines:i386 libasound2-plugins:i386 libxtst6:i386
Mount QNX 6.5.0 (I am using qnxsdp-6.5.0-201007091524-dvd.iso), then install like so:
$: cd /media/$USER/QNXSDP650
$: sudo -E ./qnxsdp-6.5.0-201007091524-linux.bin -silent
Logout and then log back in, then run Momentics IDE. This is to verify that installation of QNX 6.5.0 was successful.
$: qde
Mount QNX 6.5 SP1 (I am using qnxsdp-6.5.0SP1.iso), then install like so:
$: cd cd /media/$USER/qnxsdp-6.5.0SP1
$: sudo -E ./qnxsdp-6.5.0SP1-201206271006-linux.bin -silent
Verify that SP1 was installed using qconfig
u1@m18:/media/u1/qnxsdp-6.5.0SP1$ qconfig
QNX Installations 

  Installation Name: QNX Software Development Platform 6.5.0
            Version: 6.5.0
     Base Directory: /opt/qnx650
           QNX_HOST: /opt/qnx650/host/linux/x86
         QNX_TARGET: /opt/qnx650/target/qnx6

Additional Packages

	  Package Name: QNX Software Development Platform
	       Version: 6.5.0SP1
	          Base: QNX SDP 6.5.0
	  Installation Path: /opt/qnx650

Tuesday, April 29, 2025

Running QNX on emulated cortex-a15 using QEMU

Running QNX on emulated cortex-a15 using QEMU

General information:
- Host (for running QEMU) OS: Ubuntu 24.04.2 LTS
- QEMU: QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.6)
- QNX 6.5 SP1 on Windows 10 LTSC

Build minimal QNX Image File System (IFS) on Windows 10

Checkout bsp-qnx65-qemu-virt-a15 and build on Windows 10 with QNX 6.5 SP1
C:\prj>git clone https://github.com/myQNX/bsp-qnx65-qemu-virt-a15.git
C:\prj>cd bsp-qnx65-qemu-virt-a15
C:\prj\bsp-qnx65-qemu-virt-a15>make
This will generate, among many other things, "C:\prj\bsp-qnx65-qemu-virt-a15\images\bsp-qemu-virt.bin"

Build u-boot that supports virtualized Cortex-A15 machine on Ubuntu 24.04
Install dependencies
$ sudo apt update
$ sudo apt install build-essential gcc-arm-linux-gnueabihf flex bison libssl-dev device-tree-compiler qemu-system-arm libgnutls28-dev
Get U-Boot source and checkout latest stable. As of this writing, the latest is v2025.04
$ git clone https://source.denx.de/u-boot/u-boot.git
$ cd u-boot
$ git checkout v2025.04
Set cross compiler
$ export CROSS_COMPILE=arm-linux-gnueabihf-
Confirm cross compiler
$ ${CROSS_COMPILE}gcc --version
My machine shows
arm-linux-gnueabihf-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Configure U-Boot for virt
$ make qemu_arm_defconfig
This will generate .config in u-boot git repo root.
Edit .config
u1@m1:~/u-boot$ nvim .config
Add a line of CONFIG_BOOTCOMMAND
CONFIG_BOOTCOMMAND="virtio scan; fatload virtio 0:1 0x40200000 bsp-qemu-virt.bin; go 0x40200000"
Modify CONFIG_BOOTDELAY to zero, default is 2. This loads QNX directly without delay.
CONFIG_BOOTDELAY=0
Save .config and quit your editor. Below is my Github gist for .config, see line 414 for the CONFIG_BOOTDELAY and line 437 for CONFIG_BOOTCOMMAND Then do a build
u1@m1:~/u-boot$ make -j$(nproc)
Create a VM files to be used by QEMU
u1@m1:~/u-boot$ mkdir -p ~/vmtest/images
u1@m1:~/u-boot$ cp u-boot.bin ~/vmtest/images
Copy "C:\prj\bsp-qnx65-qemu-virt-a15\images\bsp-qemu-virt.bin" from Windows 10 to ~/vmtest/images/bsp-qemu-virt.bin
~/vmtest/images should have files like below -
u1@m1:~/vmtest$ ls images
bsp-qemu-virt.bin  u-boot.bin
Run it
u1@m1:~/vmtest$ qemu-system-arm -M virt -m 256 -cpu cortex-a15 -bios ./images/u-boot.bin -hda fat:rw:./images -vga none -serial mon:stdio -nographic
Mines shows something like below-
u1@m1:~/vmtest$ qemu-system-arm -M virt -m 256 -cpu cortex-a7 -bios ./images/u-boot.bin -hda fat:rw:./images -vga none -serial mon:stdio -nographi
c
WARNING: Image format was not specified for 'json:{"fat-type": 0, "dir": "./images", "driver": "vvfat", "floppy": false, "rw": true, "write-target": {"driver"
: "qcow", "file": {"driver": "file", "filename": "/var/tmp/vl.TH4052"}}}' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
Bloblist at 0 not found (err=-2)
alloc space exhausted ptr 400 limit 0
Bloblist at 0 not found (err=-2)


U-Boot 2025.04 (Apr 29 2025 - 12:45:47 -0500)

DRAM:  256 MiB
using memory 0x4e69b000-0x4f6db000 for malloc()
Core:  51 devices, 14 uclasses, devicetree: board
Flash: 64 MiB
Loading Environment from Flash... *** Warning - bad CRC, using default environment

In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
No USB controllers found
Net:   eth0: virtio-net#32

starting USB...
No USB controllers found
Net:   eth0: virtio-net#32

starting USB...
No USB controllers found
Hit any key to stop autoboot:  0
2700652 bytes read in 4 ms (643.9 MiB/s)
## Starting application at 0x40200000 ...
CPUID=1091551349 ;
> init_intrinfo:
> init_cacheattr:
> init_cpuinfo:
CPUID=1091551349 ;
CPU0: L1 Icache: 512x64
CPU0: L1 Dcache: 512x64 WB
CPU0: L2 Dcache: 36864x64 WB
CPU0: VFP-d32 FPSID=41023075
CPU0: NEON MVFR0=10110222 MVFR1=11111111
CPU0: 410fc075: Cortex A7 rev 5 500MHz
init_hwinfo:Loading IFS...done
elf_map: 1M va=fe000000 pa=40200000 sz=00100000
elf_map: 1M va=fe000000 pa=40200000 sz=00100000
Header size=0x0000009c, Total Size=0x000005d0, #Cpu=1, Type=4
Section:system_private offset:0x000001f0 size:0x00000068
  syspage ptr user:fc404000 kernel:fc404000
  cpupage ptr user:fc404948 kernel:fc404948 spacing:84
  kdebug info:00000000 callback:00000000
  boot pgms: idx=0
    0) base paddr:40211000 start addr:fe043024
  ramsize:00000000 pagesize:00001000
Section:qtime offset:0x00000148 size:0x00000060
  boot:00000000 CPS:00000000016e3600 rate/scale:83333333/-15 intr:1
  flags:00000001 load:0 epoch:1970 rr_mul:0 adj count/inc:0/0
Section:callout offset:0x000000a0 size:0x00000048
  reboot:00000000 power:fc4047ec
  timer_load:fc40480c reload:fc404834 value:fc404850
  0) display:fc404868 poll:fc40488c break:fc4048b0
  1) display:00000000 poll:00000000 break:00000000
Section:cpuinfo offset:0x000001a8 size:0x00000020
  0) cpu:410fc075 flags:c0000076 speed:000001f4 cache i/d:0/1 name:72
Section:cacheattr offset:0x00000590 size:0x00000040
  0) flags:01 size:0040 #lines:0200 control:fc4045d8 next:255
  1) flags:22 size:0040 #lines:0200 control:fc404638 next:255
Section:meminfo offset:0x000005d0 size:0x00000000
Section:asinfo offset:0x00000330 size:0x00000220
  0000) 0000000000000000-00000000ffffffff o:ffff a:0010 p:100 c:00000000 n:21
  0020) 0000000000000000-00000000ffffffff o:0000 a:0010 p:100 c:00000000 n:28
  0040) 0000000048000000-0000000048ffffff o:0000 a:0013 p:100 c:00000000 n:36
  0060) 0000000048000000-0000000048ffffff o:0040 a:0013 p:100 c:00000000 n:44
  0080) 0000000040000000-0000000047ffffff o:0020 a:0037 p:100 c:00000000 n:47
  00a0) 0000000048000000-0000000048ffffff o:0060 a:0037 p:100 c:00000000 n:47
  00c0) 0000000049000000-000000004fffffff o:0020 a:0017 p:100 c:00000000 n:47
  00e0) 0000000000000000-00000000ffffffff o:ffff a:0010 p:100 c:00000000 n:21
  0100) 0000000040000000-0000000047ffffff o:00e0 a:0007 p:100 c:00000000 n:51
  0120) 0000000040210110-000000004049356b o:0000 a:0005 p:100 c:00000000 n:82
  0140) 0000000040200008-000000004021010f o:0000 a:0007 p:100 c:00000000 n:90
  0160) 0000000040210110-000000004049356b o:0000 a:0007 p:100 c:00000000 n:98
  0180) 0000000040000000-0000000040007fff o:0080 a:0007 p:100 c:00000000 n:106
  01a0) 000000004001099c-0000000040200007 o:0080 a:0007 p:100 c:00000000 n:106
  01c0) 000000004049356c-0000000047ffffff o:0080 a:0027 p:100 c:00000000 n:106
  01e0) 0000000048000000-0000000048ffffff o:00a0 a:0027 p:100 c:00000000 n:106
  0200) 0000000049000000-000000004fffffff o:00c0 a:0007 p:100 c:00000000 n:106
Section:hwinfo offset:0x000002e8 size:0x00000048
  0) size:3 tag:3(Group) isize:3, iname:0(hw), owner:65535, kids:1
  12) size:3 tag:17(Bus) isize:3, iname:9(unknown), owner:0, kids:1
  24) size:3 tag:3(Group) isize:3, iname:56(rtc), owner:12, kids:1
  36) size:4 tag:65(Device) isize:4, iname:60(NONE), owner:24, kids:0
     00 00 00 00
Section:typed_strings offset:0x00000258 size:0x00000018
  off:0 type:2 string:'localhost'
Section:strings offset:0x00000270 size:0x00000078
  [0]'hw' [3]'Group' [9]'unknown' [17]'Bus' [21]'memory' [28]'below4G'
  [36]'L4-Ctrl' [44]'io' [47]'ram' [51]'1to1' [56]'rtc' [60]'NONE' [65]'Device'
  [72]'Cortex A7' [82]'imagefs' [90]'startup' [98]'bootram' [106]'sysram'
Section:intrinfo offset:0x00000550 size:0x00000040
  0) vector_base:00000000, #vectors:160, cascade_vector:7fffffff
     cpu_intr_base:00000000, cpu_intr_stride:0, flags:0000
      id => flags:8000, size:005c, rtn:fc4046dc
     eoi => flags:9000, size:003c, rtn:fc404738
     mask:fc404774, unmask:fc4047a8, config:fc4047dc
Section:smp offset:0x000005d0 size:0x00000000
Section:pminfo offset:0x000005d0 size:0x00000000
Section:mdriver offset:0x000005d0 size:0x00000000
Section:boxinfo offset:0x000001c8 size:0x00000028
  hw_flags:00000000
Section:cpu offset:0x00000128 size:0x00000020
  page_flush:fc404688 page_flush_deferred:fc4046d8
  upte_ro:00000e6e upte_rw:00000c7e
  kpte_ro:0000065e kpte_rw:0000045e
  mask_nc:000001cc
  mmu_cr1:00c51870 set:00803c7f clr:00000000 -> 00c53c7f

System page at phys:40010000 user:fc404000 kern:fc404000
Starting next program at vfe043024
cpu_startnext: cpu0 -> fe043024
vstart: 1075845408
flags:1VFPv3: fpsid=41023075
coproc_attach(10): replacing fe05a8b4 with fe06826c
coproc_attach(11): replacing fe05a8b4 with fe06826c
Welcome to QNX Neutrino 6.5.0 on the QEMU ARMv7 virt
Serial opened...
#

Sunday, April 20, 2025

How to configure ftp server on QNX 7.1 with PAM user authentication

How to configure ftp server on QNX 7.1 with PAM user authentication

Create empty folder, I am using vm12
C:\> cd \
C:\> mkdir vms
C:\> cd vms
C:\vms> mkdir vm12
C:\vms> cd vm12
Bootstrap the VM, this creates a VirtualBox VM. Note that you have to install VirtualBox on this computer
C:\vms\vm12>C:\qnx710\host\win64\x86_64\usr\bin\bash C:/qnx710/host/common/bin/mkqnximage --noprompt --hostname=vm12 --type=vbox --arch=x86_64 --build
Update system_files.custom
C:\vms\vm12>nvim C:\vms\vm12\local\snippets\system_files.custom
Below contains more than just FTP but lines 5 to 21 are for FTP server Update ifs_files.custom to sym link /system/xbin/login to /bin/login Update post_start.custom to start super server (inetd) Rebuild and run the VM, like:
C:\vms\vm12>C:\qnx710\host\win64\x86_64\usr\bin\bash C:/qnx710/host/common/bin/mkqnximage --noprompt --hostname=vm12 --type=vbox --arch=x86_64 --build --force --run

Saturday, April 19, 2025

Got "Makefile:8: recurse.mk: No such file or directory" building a project after applying QNX 6.5 SP1

Got "Makefile:8: recurse.mk: No such file or directory" building a project after applying QNX 6.5 SP1

I applied QNX 6.5 SP1 to an existing QNX 6.5 on Raspberry Pi OS (2022-07-01-raspios-bullseye-i386) but I am getting error below when building.
/opt/qnx650/host/linux/x86/usr/bin/make -k CPULIST=x86 all --file=/tmp/QMakefile174511465999353758.tmp
Makefile:8: recurse.mk: No such file or directory
make: *** No rule to make target `recurse.mk'.
make: Failed to remake makefile `recurse.mk'.
make: *** No rule to make target `all'.
I don't know the workaround but I leaned I have to apply SP1 like below -
$ sudo -E ./qnxsdp-6.5.0SP1-201206271006-linux.bin
-E will preserve the environment variables when running the installer, which is required for successful installation.

Fedora install screen chronicle

Fedora install screen chronicle Below are links to Fedora installation screens. It is interesting to see how it has evolved over time. Fe...