#StackBounty: #gcc #raspberry-pi #linker #arm #cross-compiling segfault before main() is called in cross-compiled armhf

Bounty: 50

I’ve finally cross-compiled and linked a binary on an Ubuntu Xenial x86_64 host to run on the Raspberry Pi 4’s armhf.

My toolchain’s from ARM and placed in $TOOLCHAIN.

My sysroot is a loop-mounted Raspberry OS image placed in $RASPBIAN_ROOT.

This is a sample compilation line:

$TOOLCHAIN/gcc-arm-8.3-2019.03/bin/arm-linux-gnueabihf-g++ -std=c++11 --sysroot=$RASPBIAN_ROOT 
  -D_ARM_ -DOTHER_DEFINES 
  -v -w -fexceptions -fpermissive -pipe 
  -mcpu=cortex-a72 -mfpu=neon-vfpv4 -mfloat-abi=hard 
  -Wabi-tag -D_GLIBCXX_USE_CXX11_ABI=0 
  -fno-use-cxa-atexit 
  -g 
  -I . -I .. -I extlib1/include -I extlib2/include -I $RASPBIAN_ROOT/usr/include/libxml2 
  -I $TOOLCHAIN/gcc-arm-8.3-2019.03/arm-none-linux-gnueabihf/libc/usr/include 
  -I $RASPBIAN_ROOT/usr/include/arm-linux-gnueabihf 
  -I $RASPBIAN_ROOT/usr/include 
  -c File.cpp -o obj/linux/armhf/debug/File.o

There are also some .c files. And this is the linking line:

$TOOLCHAIN/gcc-arm-8.3-2019.03/bin/arm-linux-gnueabihf-ld.gold 
-L ../localdependency 
-L $RASPBIAN_ROOT/opt/vc/lib 
-L $RASPBIAN_ROOT/usr/lib/arm-linux-gnueabihf 
-L $RASPBIAN_ROOT/lib 
-L$RASPBIAN_ROOT/usr/lib 
-L $RASPBIAN_ROOT/usr/lib/gcc/arm-linux-gnueabihf/8 -o bin/linux/armhf/debug/executable obj/linux/armhf/debug/File.o ... 
$RASPBIAN_ROOT/usr/lib/gcc/arm-linux-gnueabihf/8/crtbegin.o 
$RASPBIAN_ROOT/usr/lib/gcc/arm-linux-gnueabihf/8/crtend.o 
$RASPBIAN_ROOT/usr/lib/gcc/arm-linux-gnueabihf/8/libgcc_eh.a 
--verbose --sysroot=$RASPBIAN_ROOT 
-lbcm_host -lvcos -lvchiq_arm -lcurl -lxml2 
-lpthread -lz -lm -ldl -lstdc++ -lc -lgcc -lgcc_s

…which seems to produce an executable. (Both lines edited for readability.)

However, when running on the pi, i get a segfault:

$ ./executable param1 param2
Segmentation fault

If i try to debug, it’s not even reaching main():

$ gdb executable
GNU gdb (Raspbian 8.2.1-2) 8.2.1

...

(gdb) b main
Breakpoint 1 at 0x2c7c74: file main.cpp, line 7029.
(gdb) r param1 param2
Starting program: /home/user/executable param1 param2
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
0xb6f97420 in __libc_enable_asynccancel () at ../nptl/cancellation.c:33
33  ../nptl/cancellation.c: No such file or directory.
(gdb) bt
#0  0xb6f97420 in __libc_enable_asynccancel () at ../nptl/cancellation.c:33
#1  0xb6f77968 in __GI___libc_write (nbytes=407, buf=0xb6fdc838 <banner>, fd=1) at ../sysdeps/unix/sysv/linux/write.c:26
#2  __GI___libc_write (fd=fd@entry=1, buf=0xb6fdc838 <banner>, nbytes=nbytes@entry=407) at ../sysdeps/unix/sysv/linux/write.c:24
#3  0xb6ec98d8 in __libc_print_version () at version.c:71
#4  __libc_main () at version.c:71
#5  0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

While i see the "warning: Unable to find dynamic linker breakpoint function." (and am trying to figure out where in the packages does ld.so come from) i’m more inclined to believe my toolchain/sysroot/libs is not properly configured.

A simple helloWorld cross-compiles and executes fine:

#include <iostream>

int main(int argc, char* argv[]) {
    int i = 1;
    std::cout << "hello world " << i << std::endl;
    return 0;
}
$ ./rpihello 
hello world 1

$ ldd rpihello 
    linux-vdso.so.1 (0xbef33000)
    /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6f90000)
    libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6e30000)
    libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6dae000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6d81000)
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6c33000)
    /lib/ld-linux-armhf.so.3 (0xb6fa5000)

Edit 1

Since nptl/cancellation.c seems to come from libc, i double-checked i had all the necessary packages, and i believe i do (otherwise i’d be having widespread problems with the Pi):

pi$ cat /etc/ld.so.conf.d/*
/opt/vc/lib
# Multiarch support
/usr/local/lib/arm-linux-gnueabihf
/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf/libfakeroot
# libc default configuration
/usr/local/lib

pi$ apt list --installed | grep ^libc
libc-ares2/now 1.14.0-1 armhf [installed,upgradable to: 1.14.0-1+deb10u1]
libc-bin/stable,now 2.28-10+rpi1 armhf [installed]
libc-dev-bin/stable,now 2.28-10+rpi1 armhf [installed,automatic]
libc-l10n/stable,now 2.28-10+rpi1 all [installed,automatic]
libc6-dbg/stable,now 2.28-10+rpi1 armhf [installed]
libc6-dev/stable,now 2.28-10+rpi1 armhf [installed]
libc6-pic/stable,now 2.28-10+rpi1 armhf [installed]
libc6/stable,now 2.28-10+rpi1 armhf [installed]
libcc1-0/stable,now 8.3.0-6+rpi1 armhf [installed,automatic]

pi$ apt list --installed | grep ^libgcc
libgcc-6-dev/stable,now 6.5.0-1+rpi1+b1 armhf [installed,automatic]
libgcc-8-dev/stable,now 8.3.0-6+rpi1 armhf [installed,automatic]
libgcc1-dbg/stable,now 1:8.3.0-6+rpi1 armhf [installed,automatic]
libgcc1/stable,now 1:8.3.0-6+rpi1 armhf [installed]

So i still think i borked the cross-compilation/linking somehow.


Edit 2

I’ve managed to compile my codebase on the raspberry pi and the produced binary exhibits the same results as the cross-compiled one. So either i’ve misscompiled or i have both my sysroot and the pi’s system a bit borked.


Edit 3

rpi $ readelf -dW myexecutable

Dynamic section at offset 0x664e58 contains 48 entries:
  Tag        Type                         Name/Value
 0x00000003 (PLTGOT)                     0x6716d4
 0x00000002 (PLTRELSZ)                   5856 (bytes)
 0x00000017 (JMPREL)                     0x2d940
 0x00000014 (PLTREL)                     REL
 0x00000011 (REL)                        0x2d2e0
 0x00000012 (RELSZ)                      1632 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000006 (SYMTAB)                     0x8148
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000005 (STRTAB)                     0xfb48
 0x0000000a (STRSZ)                      94185 (bytes)
 0x6ffffef5 (GNU_HASH)                   0x26b34
 0x00000004 (HASH)                       0x2930c
 0x00000001 (NEEDED)                     Shared library: [libbcm_host.so]
 0x00000001 (NEEDED)                     Shared library: [libvcos.so]
 0x00000001 (NEEDED)                     Shared library: [libvchiq_arm.so]
 0x00000001 (NEEDED)                     Shared library: [libjson.so]
 0x00000001 (NEEDED)                     Shared library: [libmylocallib.so]
...
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000019 (INIT_ARRAY)                 0x66dd60
 0x0000001b (INIT_ARRAYSZ)               244 (bytes)
 0x0000001a (FINI_ARRAY)                 0x66de54
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x6ffffff0 (VERSYM)                     0x2c1b0
 0x6ffffffe (VERNEED)                    0x2d0f0
 0x6fffffff (VERNEEDNUM)                 9
 0x00000000 (NULL)                       0x0

I found this interesting:

rpi $ file myexecutable
myexecutable: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /usr/lib/libc.so.1, with debug_info, not stripped
rpi $ file `which ls`
/bin/ls: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=67a394390830ea3ab4e83b5811c66fea9784ee69, stripped

Shouldn’t my executable be using ld as the interpreter?


Edit 4

I added[2] --dynamic-linker=/lib/ld-linux-armhf.so.3 to my linker line, but now i get no stack:

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
(gdb) 

Running strace executable the last lines are these:

rt_sigprocmask(SIG_BLOCK, NULL, ~[ILL TRAP BUS FPE KILL SEGV STOP RTMIN RT_1], 8) = 0
rt_sigaction(SIGILL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0xb5e55120}, NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
clock_gettime(CLOCK_MONOTONIC_COARSE, {tv_sec=6336, tv_nsec=768744979}) = 0
gettimeofday({tv_sec=1631533208, tv_usec=497816}, NULL) = 0
openat(AT_FDCWD, "/dev/urandom", O_RDONLY) = 3
read(3, "3144bJn3616240f203216I257306251r202v232263210374222276TN33,[3A233", 32) = 32
close(3)                                = 0
openat(AT_FDCWD, "/dev/urandom", O_RDONLY) = 3
read(3, "301231203~G6Ey_262Y24134216F2448w2365Z213376223260322zwo334+e", 32) = 32
close(3)                                = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
Segmentation fault

/dev/urandom does exist though.


Edit 5

$ readelf -h executable
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          40514564 (bytes into file)
  Flags:                             0x5000400, Version5 EABI, hard-float ABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         37
  Section header string table index: 36

I don’t think entry point address should be 0x0.


Edit 6

I’ve compiled the code on a pi3 and on an arm-qemu chroot – same result.


Get this bounty!!!

#StackBounty: #c++ #arm #embedded #std #cortex-m Dynamic memory allocation in STD

Bounty: 100

Working a lot with microcontrollers and C++ it is important for me to know that I do not perform dynamic memory allocations. However I would like to get the most out of the STD lib. What would be the best strategy to determine if a function/class from STD uses dynamic memory allocation?

So far I come up with these options:

  1. Read and understand the STD code. This is of course possible but lets be honest, it is not the easiest code to read and there is a lot of it.
  2. A variation on reading the code could be to have a script search for memory allocation and highlight those parts to it make it easier to read. This still would require figuring out where functions allocating memory are used, and so forts.
  3. Just testing what I would like to use and watch the memory with the debugger. So far I have been using this method but this is a reactive approach. I would like to know before hand when designing code what I can use from STD. Also what is there to say that there are some (edge) cases where memory is allocated. Those might not show up in this limited test.
  4. Finally what could be done is regularly scan the generated assembler code for memory allocations. I suspect this could be scripted and included in the toolchain but again this is a reactive method.

If you see any other options or have experience doing something similar, please let me know.

p.s. I work mainly with ARM Cortex-Mx chips at this moment compiling with GCC.


Get this bounty!!!

#StackBounty: #arm Install pyarrow on ARM

Bounty: 50

I am not able to install pyarrow on ARM processor using the instructions found here…

https://gist.github.com/heavyinfo/04e1326bb9bed9cecb19c2d603c8d521

I am getting this error:

-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/arrow-apache-arrow-0.15.1/cpp/release/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/arrow-apache-arrow-0.15.1/cpp/release/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'install'.  Stop.

Is there any easy way to install pyarrow on ARM?


Get this bounty!!!

#StackBounty: #apt #arm #21.04 Error running apt update E: Unable to determine file size for fd 7 – fstat

Bounty: 50

I have set up Ubuntu 21.04 Base image in Termux. When I run apt update, I get the following error.

root@localhost:~# apt update
Get:1 http://ports.ubuntu.com/ubuntu-ports hirsute InRelease [269 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports hirsute-updates InRelease [109 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports hirsute-backports InRelease [90.7 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports hirsute-security InRelease [101 kB]
Reading package lists... Done
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository 'http://ports.ubuntu.com/ubuntu-ports hirsute InRelease' provides only weak security information.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository 'http://ports.ubuntu.com/ubuntu-ports hirsute-updates InRelease' provides only weak security information.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository 'http://ports.ubuntu.com/ubuntu-ports hirsute-backports InRelease' provides only weak security information.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository 'http://ports.ubuntu.com/ubuntu-ports hirsute-security InRelease' provides only weak security information.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

How to fix this?
This error is absent in the 20.04.2 base image.


Get this bounty!!!

#StackBounty: #performance #zfs #zfsonlinux #arm ZFS 2.0: How can I lower CPU-load on write with very slow disks and weak CPU?

Bounty: 50

I have a small 32bit-ARM-based board with three disk attached via USB 2.0. This has been running fine with ZFS 0.7.1 and 0.6.x for a long time, and I do not mind the reduced disk performance. (I am using ZFS elsewhere, I like to have this compatible and available when the real servers go down). However, I had to upgrade the distribution, 0.7.1 does not install nicely anymore, 0.8.5/6 is not stable under load, but 2.0.1 is completely stable again (features are still 0.7.1 compatible). I am not using ZVOLs on this device, just regular datasets.

My problem: The CPU load gets very high on writes. I am under the impression that the slow disks cause the CPU load and iowaits to increase massively causing other tasks on the CPU to get interrupted too. I had a look at this guide which addresses latency, but that does not solve my problem.

Which ZFS parameters should I address, if I know my theoratical maximum write rates, to avoid high CPU-loads?


Get this bounty!!!

#StackBounty: #20.04 #docker #raspberrypi #gnupg #arm apt update throws signature error in Ubuntu 20.04 container on arm

Bounty: 50

I am trying to build Raspberry Pi docker images but I am always having the same error, similar to this one, this one and this one.

While running the command apt update as root in a arm32v7/ubuntu:20.04 (or just ubuntu:latest), I get the following output:

root@273d63597ce6:/# apt update
Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
  At least one invalid signature was encountered.
Err:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
  At least one invalid signature was encountered.
Err:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

I have tried the suggested solutions of cleaning apt, cleaning docker and removing/recreating /var/lib/apt/lists without success. The SD card is 32G and the OS is a fresh install. df shows 26G free.

Some more information:

  • This is happening on a fresh install of 2020-05-27-raspios-buster-lite-armhf on a raspberry pi 4 B
  • The same error happens on another Raspberry Pi 4 B running HypriotOS
  • The same command in the same image works fine on a raspberry pi 3 B that has Arch linux installed
  • The error does not happen if I use an older version of ubuntu (ubuntu:18.04, 16.04, 14.04)


Get this bounty!!!

#StackBounty: #ubuntu #kernel #arm #cpu-frequency How can I get the current CPU frequency of an ARM processor on Ubuntu?

Bounty: 50

How can I get the current CPU frequency of an ARM processor on Ubuntu? Neither /proc/cpuinfo nor /sys/devices/system/cpu/cpu*/cpufreq helps.

In fact, there is no /sys/devices/system/cpu/cpu*/cpufreq directory on my Ubuntu system. And there is no CPU MHz information in /proc/cpuinfo either.

Could anybody give some hints on acquiring the current CPU frequency of an ARM processor?

part output of <code>cat /proc/cpuinfo</code>


Get this bounty!!!

#StackBounty: #arch-linux #x11 #arm X11 crashing on login (Arch ARM)

Bounty: 50

I am using Arch Linux on a Chromebook C201 (ARM). Since I recently upgraded the system, the desktop environment seems to be crashing shortly after I login (before the upgrade it was working fine). I have both LXDE and MATE installed and I am seeing similar crashes on both. The two DEs are using different Window Managers (Openbox and marco), so I suspect there may be an issue with X server.

When the system crashes, the screen freezes and the desktop completely locks up. There is no response to mouse or keyboard input and I am unable to use CTL-ALT-F2 etc. to switch to a console tty. After a few minutes it dumps me back in the lightdm login screen.

I have found the following errors (which seem to be relevant) in ~/.cache/lxsession/LXDE/run.log:

** (lxpanel:524): WARNING **: 21:18:33.907: The directory '~/Templates' doesn't exist, ignoring it

** (pcmanfm:525): WARNING **: 21:18:33.907: The directory '~/Templates' doesn't exist, ignoring it
Openbox-Message: Unable to find a valid menu file "/usr/share/lxde/openbox/menu.xml"

(lxpanel:524): GLib-GObject-CRITICAL **: 21:18:34.467: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(lxpanel:524): GLib-GObject-CRITICAL **: 21:18:34.467: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(lxpanel:524): GLib-GObject-CRITICAL **: 21:18:34.476: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

** (lxpanel:524): WARNING **: 21:18:34.544: Battery entry BAT0 not found, using sbs-20-000b

(lxpanel:524): GLib-GObject-CRITICAL **: 21:18:34.547: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(lxpanel:524): GLib-GObject-CRITICAL **: 21:18:34.547: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

** (lxpanel:524): WARNING **: 21:18:34.736: launchbar: desktop entry does not exist

(nm-applet:541): libnotify-WARNING **: 21:18:38.692: Failed to connect to proxy

(nm-applet:541): nm-applet-WARNING **: 21:18:38.698: Failed to show notification: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files
lxterminal

(lxpanel:524): Wnck-WARNING **: 21:18:40.000: Unhandled action type _OB_WM_ACTION_UNDECORATE

(lxpanel:524): Wnck-WARNING **: 21:19:12.727: Unhandled action type _OB_WM_ACTION_UNDECORATE

(lxpanel:524): Wnck-WARNING **: 21:19:12.861: Unhandled action type _OB_WM_ACTION_UNDECORATE
/usr/lib/firefox/firefox 

(lxpanel:524): Wnck-WARNING **: 21:19:36.058: Unhandled action type _OB_WM_ACTION_UNDECORATE
(END)

The equivalent errors for MATE (from ~/.xsession-errors) are:

mate-session[1216]: WARNING: Unable to find provider '' of required component 'dock'
Window manager warning: Log level 128: unsetenv() is not thread-safe and should not be used after threads are created

(caja:1299): Gtk-WARNING **: 21:22:12.818: Failed to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register client

(mate-power-manager:1337): Gdk-CRITICAL **: 21:22:14.720: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
Gdk-Message: 21:25:19.408: mate-power-manager: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.408: evolution-alarm-notify: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.409: mate-session: Fatal IO error 104 (Connection reset by peer) on X server :0.

Gdk-Message: 21:25:19.409: marco: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.415: caja: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.413: polkit-mate-authentication-agent-1: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.409: mate-maximus: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.408: mate-volume-control-status-icon: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.408: nm-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.409: mate-screensaver: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.415: mate-settings-daemon: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Gdk-Message: 21:25:19.423: mate-panel: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Contents of Xorg.0.log:

[    10.124] 
X.Org X Server 1.20.7
X Protocol Version 11, Revision 0
[    10.124] Build Operating System: Linux Arch Linux
[    10.124] Current Operating System: Linux leeLibrebook 5.5.6-1-ARCH #1 SMP PREEMPT Wed Feb 26 00:56:53 UTC 2020 armv7l
[    10.124] Kernel command line: cros_secure console=tty0 init=/sbin/init root=PARTUUID=1b19e700-f9cb-f247-bc7f-207dece4cdb7/PARTNROFF=1 rootwait rw noinitrd 
[    10.124] Build Date: 16 January 2020  05:49:11PM
[    10.124]  
[    10.124] Current version of pixman: 0.38.4
[    10.124]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[    10.124] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    10.124] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Mar 17 21:57:41 2020
[    10.125] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    10.125] (==) No Layout section.  Using the first Screen section.
[    10.125] (==) No screen section available. Using defaults.
[    10.125] (**) |-->Screen "Default Screen Section" (0)
[    10.125] (**) |   |-->Monitor "<default monitor>"
[    10.125] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
[    10.125] (==) Automatically adding devices
[    10.125] (==) Automatically enabling devices
[    10.125] (==) Automatically adding GPU devices
[    10.125] (==) Automatically binding GPU devices
[    10.125] (==) Max clients allowed: 256, resource mask: 0x1fffff
[    10.126] (WW) The directory "/usr/share/fonts/misc" does not exist.
[    10.126]    Entry deleted from font path.
[    10.126] (WW) The directory "/usr/share/fonts/OTF" does not exist.
[    10.126]    Entry deleted from font path.
[    10.126] (WW) The directory "/usr/share/fonts/Type1" does not exist.
[    10.126]    Entry deleted from font path.
[    10.126] (WW) The directory "/usr/share/fonts/100dpi" does not exist.
[    10.126]    Entry deleted from font path.
[    10.126] (WW) The directory "/usr/share/fonts/75dpi" does not exist.
[    10.126]    Entry deleted from font path.
[    10.126] (==) FontPath set to:
    /usr/share/fonts/TTF
[    10.126] (==) ModulePath set to "/usr/lib/xorg/modules"
[    10.126] (II) The server relies on udev to provide the list of input devices.
    If no devices become available, reconfigure udev or disable AutoAddDevices.
[    10.126] (II) Module ABI versions:
[    10.126]    X.Org ANSI C Emulation: 0.4
[    10.126]    X.Org Video Driver: 24.1
[    10.126]    X.Org XInput driver : 24.1
[    10.126]    X.Org Server Extension : 10.0
[    10.127] (++) using VT number 7

[    10.127] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[    10.129] (II) xfree86: Adding drm device (/dev/dri/card0)
[    10.143] (II) xfree86: Adding drm device (/dev/dri/card1)
[    10.144] (II) no primary bus or device found
[    10.144]    falling back to /sys/devices/platform/display-subsystem/drm/card0
[    10.144] (II) LoadModule: "glx"
[    10.144] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    10.148] (II) Module glx: vendor="X.Org Foundation"
[    10.148]    compiled for 1.20.7, module version = 1.0.0
[    10.148]    ABI class: X.Org Server Extension, version 10.0
[    10.148] (==) Matched modesetting as autoconfigured driver 0
[    10.148] (==) Matched fbdev as autoconfigured driver 1
[    10.148] (==) Assigned the driver to the xf86ConfigLayout
[    10.148] (II) LoadModule: "modesetting"
[    10.148] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[    10.149] (II) Module modesetting: vendor="X.Org Foundation"
[    10.149]    compiled for 1.20.7, module version = 1.20.7
[    10.149]    Module class: X.Org Video Driver
[    10.149]    ABI class: X.Org Video Driver, version 24.1
[    10.149] (II) LoadModule: "fbdev"
[    10.150] (WW) Warning, couldn't open module fbdev
[    10.150] (EE) Failed to load module "fbdev" (module does not exist, 0)
[    10.150] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[    10.160] (II) modeset(0): using drv /dev/dri/card0
[    10.160] (II) modeset(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
[    10.160] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[    10.160] (==) modeset(0): RGB weight 888
[    10.160] (==) modeset(0): Default visual is TrueColor
[    10.160] (II) Loading sub module "glamoregl"
[    10.160] (II) LoadModule: "glamoregl"
[    10.161] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[    10.173] (II) Module glamoregl: vendor="X.Org Foundation"
[    10.173]    compiled for 1.20.7, module version = 1.0.1
[    10.173]    ABI class: X.Org ANSI C Emulation, version 0.4
[    10.193] (EE) 
[    10.193] (EE) Backtrace:
[    10.193] (EE) 
[    10.193] (EE) Segmentation fault at address 0xdda8
[    10.193] (EE) 
Fatal server error:
[    10.193] (EE) Caught signal 11 (Segmentation fault). Server aborting
[    10.193] (EE) 
[    10.193] (EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
[    10.193] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[    10.193] (EE) 
[    10.200] (EE) Server terminated with error (1). Closing log file.

Does anyone have any idea what might be causing this? I have run memtester (as suggested in the comments) and it didn’t identify any issues with the RAM. The system seems perfectly stable in a console terminal.

It’s possible the issue is just a bad package from Arch ARM, which has broken the system during the last update. Does anyone have any thoughts on what package is likely to be broken? (if so, I’ll try rolling back)


Get this bounty!!!

#StackBounty: #android #bitmap #arm #endianness #bytebuffer Packing Java bitmap into ByteBuffer – byte order doesn't match pixel fo…

Bounty: 50

I’m a bit puzzled with internal representation of Bitmap’s pixels in ByteBuffer (testing on ARM/little endian):

1) In the Java layer I create an ARGB bitmap and fill it with 0xff112233 color:

Bitmap sampleBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(sampleBitmap);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);

paint.setColor(Color.rgb(0x11,0x22, 0x33));
canvas.drawRect(0,0, sampleBitmap.getWidth(), sampleBitmap.getHeight(), paint);

To test, sampleBitmap.getPixel(0,0) indeed returns 0xff112233 that matches ARGB pixel format.

2) The bitmap is packed into direct ByteBuffer before passing to the native layer:

 final int byteSize = sampleBitmap.getAllocationByteCount();
 ByteBuffer byteBuffer = ByteBuffer.allocateDirect(byteSize);
 //byteBuffer.order(ByteOrder.LITTLE_ENDIAN);// See below
 sampleBitmap.copyPixelsToBuffer(byteBuffer);

To test, regardless of the buffer’s order setting, in the debugger I see the byte layout which doesn’t quite match ARGB but more like a big endian RGBA (or little endian ABGR!?)

  byteBuffer.rewind();
  final byte [] out = new byte[4];
  byteBuffer.get(out, 0, out.length);
out = {byte[4]@12852} 
 0 = (0x11)
 1 = (0x22)
 2 = (0x33)
 3 = (0xFF)

Now, I’m passing this bitmap to the native layer where I must extract pixels and I would expect Bitmap.Config.ARGB_8888 to be represented, depending on buffer’s byte order as:

a) byteBuffer.order(ByteOrder.LITTLE_ENDIAN):

out = {byte[4]@12852} 
 0 = (0x33)
 1 = (0x22)
 2 = (0x11)
 3 = (0xFF)

or

b) byteBuffer.order(ByteOrder.BIG_ENDIAN):

out = {byte[4]@12852} 
 0 = (0xFF)
 1 = (0x11)
 2 = (0x22)
 3 = (0x33)

I can make the code which extracts the pixels work based on above output but I don’t like it since I can’t explain the behaviour which I hope someone will do 🙂

Thanks!


Get this bounty!!!

#StackBounty: #arm #u-boot How to decompress (extract) U-Boot boot.scr.uimg to boot.scr?

Bounty: 100

I got an ARM dev board (STM32MP157A-DK1) and I’m messing around to see how the Linux Image is built.

I got boot.scr.uimg file in the boot partition. As far as I know boot.scr.uimg is a compressed version of boot.scr.

Is there any way to decompress/extract the original boot.scr from boot.scr.uimg?

Here is the result of file boot.scr.uimg:

boot.scr.uimg: u-boot legacy uImage, , Linux/ARM, Script File (Not compressed), 1489 bytes, Thu Jan  1 00:00:00 1970, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0xC80D8B27, Data CRC: 0x62B32EA2

Here is the boot.scr.uimg file link.

The result of printenv in U-Boot CLI:

STM32MP> printenv
altbootcmd=run bootcmd
arch=arm
autoload=no
baudrate=115200
board=stm32mp1
board_name=stm32mp157c-dk2
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_device=mmc
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_instance=0
boot_net_usb_start=true
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=mmc0
bootcmd=run distro_bootcmd
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_mmc1=setenv devnum 1; run mmc_boot
bootcmd_mmc2=setenv devnum 2; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_ubifs0=setenv devnum 0; run ubifs_boot
bootcount=2
bootdelay=1
bootlimit=0
cpu=armv7
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
ethaddr=00:80:e1:42:5d:63
fdt_addr_r=0xc4000000
fdt_high=0xffffffff
fdtcontroladdr=ddc3c4f8
initrd_high=0xffffffff
kernel_addr_r=0xc2000000
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI)
mtdparts_nor0=256k(fsbl1),256k(fsbl2),2m(ssbl),256k(logo),-(nor_user)
preboot=echo "Boot over ${boot_device}${boot_instance}!"; if test ${boot_device} = serial; then stm32prog serial ${boot_instance}; else if test ${boot_device} = usb; then stm32prog usb ${boot_instance}; else if test ${boot_device} = mmc; then env set boot;
pxefile_addr_r=0xc4200000
ramdisk_addr_r=0xc4400000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0xc4100000
serial#=0038001A3338510A39303435
serverip=192.168.1.1
soc=stm32mp
splashimage=0xc4300000
stderr=serial
stdin=serial
stdout=serial
ubifs_boot=env exists bootubipart || env set bootubipart UBI; env exists bootubivol || env set bootubivol boot; if ubi part ${bootubipart} && ubifsmount ubi${devnum}:${bootubivol}; then setenv devtype ubi; run scan_dev_for_boot; fi
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
usb_pgood_delay=2000
vendor=st

Environment size: 3053/4092 bytes
STM32MP>

I don’t have much experience in U-Boot yet, so I’m not sure if it is the same as boot.scr. Still I would like to know how to extract boot.scr from boot.scr.uimg without accessing U-Boot CLI.


Get this bounty!!!