Pages

Saturday, September 28, 2024

Fedora 42 : testing programming for ARM - part 001.

Today I tested the creation of a program that works on ARM processors and tested with QEMU emulator in Fedora 42.
I install with dnf5 these fedora packages:
[root@fedora mythcat]# dnf5 clean all
[root@fedora mythcat]# dnf5 install qemu-system-arm
[root@fedora mythcat]# dnf5 install arm-none-eabi-gcc gcc-arm-linux-gnu gcc-c++-arm-linux-gnu
[root@fedora mythcat]# dnf5 install arm-none-eabi-newlib.noarch 
...
[root@fedora mythcat]# dnf5 install binutils-devel
I create a new folder into may pagure account to test this issue with QEMU:
[mythcat@fedora mythcat]$ mkdir ARMProjects
[mythcat@fedora mythcat]$ cd ARMProjects/
[mythcat@fedora ARMProjects]$ qemu-system-arm --version
QEMU emulator version 9.1.0 (qemu-9.1.0-2.fc42)
I create a default assembly file for ARM named hello.s:
[mythcat@fedora ARMProjects]$ cat hello.s 
.global _start

_start:
    mov r0, #1     
    mov r7, #4     
    str r0, [r7]
    bx lr
Let's see how this means:
  • global _start: This declares the _start label as global, making it accessible from outside the file.
  • _start:: This marks the beginning of the program.
  • mov r0, #1: Moves the immediate value 1 into register R0.
  • mov r7, #4: Moves the immediate value 4 into register R7. This represents the system call number for write().
  • str r0, [r7]: Stores the contents of R0 (which contains 1) into the memory address pointed to by R7.
  • bx lr: Branches to the address in Link Register (LR). In this case, it loops indefinitely because there's no return instruction.
The compile of the file:
[mythcat@fedora ARMProjects]$ arm-none-eabi-gcc -nostartfiles -lc hello.s -o hello.o
[mythcat@fedora ARMProjects]$ ls
hello.o  hello.s
Let's see the hello.o file:
[mythcat@fedora ARMProjects]$ nm hello.o
00008000 t $a
00009010 T __bss_end__
00009010 T _bss_end__
00009010 T __bss_start
00009010 T __bss_start__
00009010 T __data_start
00009010 T _edata
00009010 T __end__
00009010 T _end
00080000 B _stack
00008000 T _start
[mythcat@fedora ARMProjects]$ objdump -f hello.o

hello.o:     file format elf32-little
architecture: UNKNOWN!, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00008000

Fedora 42 : ima: Error Communicating to TPM chip ... cannot be fixed.

I found this error and I tried to fix on my laptop HP 6710b:
[mythcat@fedora ~]$ sudo dmesg | grep Error
[    1.274790] tpm tpm0: [Hardware Error]: Adjusting reported timeouts: A 750->750000us B 2000->2000000us C 750->750000us D 750->750000us
[    2.240276] ima: Error Communicating to TPM chip
[    2.243913] ima: Error Communicating to TPM chip
[    2.246923] ima: Error Communicating to TPM chip
[    2.249919] ima: Error Communicating to TPM chip
[    2.253088] ima: Error Communicating to TPM chip
[    2.255923] ima: Error Communicating to TPM chip
[    2.258921] ima: Error Communicating to TPM chip
[    2.261938] ima: Error Communicating to TPM chip
[    2.415255] RAS: Correctable Errors collector initia
I update and nistall with the dnf5 tool
[root@fedora mythcat]# dnf5 upgrade 
...
[root@fedora mythcat]# dnf install tpm-tools
...
I reboot the Fedora and I try to test it:
[mythcat@fedora ~]$ lsmod | grep tpm
tpm_infineon           20480  0
To see all commands, use:
[mythcat@fedora ~]$ tpm_
tpm_changeownerauth  tpm_nvwrite          tpm_setclearable
tpm_clear            tpm_resetdalock      tpm_setenable
tpm_createek         tpm_restrictpubek    tpm_setoperatorauth
tpm_getpubek         tpm_restrictsrk      tpm_setownable
tpm_nvdefine         tpm_revokeek         tpm_setpresence
tpm_nvinfo           tpm_sealdata         tpm_takeownership
tpm_nvread           tpm_selftest         tpm_unsealdata
tpm_nvrelease        tpm_setactive        tpm_version
[root@fedora mythcat]#  dnf install tcsd
...
[root@fedora mythcat]# systemctl daemon-reload
[root@fedora mythcat]# systemctl start tcsd
[root@fedora mythcat]#  systemctl status tcsd

Fedora 42 : Fedora game project with pygame and agentpy - part 003.

I have upgraded the source code with the following changes:
  • added agent with logic using the python agentpy module;
  • I increased the grid to 16 x 16;
  • I kept the win condition at 8 pieces aligned in any direction;
  • I added conditions for displaying the equality message;
The game is hard to win, you can try on my pagure account.