Artix Linux Forum

Artix Linux => System => Topic started by: kiblaster on 05 March 2024, 17:42:25

Title: [SOLVED] Set ARMtix chroot to cross compile
Post by: kiblaster on 05 March 2024, 17:42:25
I downloaded and extracted the tarball.

When I used artix-chroot:
Code: [Select]
==> WARNING: Documents/iso/armtix/armtix-dinit-20240303 is not a mountpoint. This may have undesirable side effects.

I got an error about missing space in cache when I started using it:
Code: [Select]
pacman -S git
...
:: Proceed with installation? [Y/n]
error: could not determine cachedir mount point /var/cache/pacman/pkg
error: failed to commit transaction (not enough free disk space)
Errors occurred, no packages were upgraded.

How do I make something to chroot into? To build packages.
Title: Re: Set ARMtix chroot to cross compile
Post by: phoenix_king_rus on 06 March 2024, 06:53:07
Just bind mount chroot to itself, like so: mount -o bind <path> <path>
Title: Re: [SOLVED] Set ARMtix chroot to cross compile
Post by: kiblaster on 06 March 2024, 17:16:01
That works, thanks.
Title: Re: [SOLVED] Set ARMtix chroot to cross compile
Post by: kiblaster on 15 May 2024, 19:36:08
After updating I cannot chroot:
Code: [Select]
chroot: failed to run command '/bin/bash': Exec format error
That should be the error when you do not have the necessary things.

Not sure to how check what's wrong:
Code: [Select]
dinitctl status binfmt
Service: binfmt
    State: STARTED
    Activation: start due to dependent(s)

world/qemu-user 9.0.0-1 [installed]
    QEMU user mode emulation
world/qemu-user-binfmt 9.0.0-1
    Binary format rules for QEMU user mode emulation
world/qemu-user-static 9.0.0-1 [installed]
    QEMU static user mode emulation
world/qemu-user-static-binfmt 9.0.0-1 [installed]

Title: Re: Set ARMtix chroot to cross compile
Post by: kiblaster on 23 May 2024, 20:43:07
https://www.kernel.org/doc/html/v5.9/admin-guide/binfmt-misc.html
https://wiki.archlinux.org/title/Binfmt_misc_for_Java

I had to mount it:
Code: [Select]
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc

After I restart binfmt service but again error so I did it manually:
Code: [Select]
cat /usr/lib/binfmt.d/qemu-aarch64-static.conf
:qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64-static:FP

echo ':qemu-aarch64 [...] static:FP' > /proc/sys/fs/binfmt_misc/register

I wonder if something is wrong here locally or "/lib/artix/binfmt.sh" or something has a bug.
Title: Re: Set ARMtix chroot to cross compile
Post by: artoo on 23 May 2024, 22:03:39

I wonder if something is wrong here locally or "/lib/artix/binfmt.sh" or something has a bug.


This is not on openrc, right?

If so, could you please do a test?

In your /usr/lib/artix/ binfmt.sh, remove
Code: [Select]
"%d"
from the printf:

https://gitea.artixlinux.org/artix/artix-cgroups/src/branch/master/src/binfmt.sh.in#L36

Report back please.
Title: Re: Set ARMtix chroot to cross compile
Post by: kiblaster on 24 May 2024, 21:27:37
Right, I use dinit.

Now binfmt_misc is mounted but I have to write manually as before:

Code: [Select]
echo ':qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64-static:FP' >  /proc/sys/fs/binfmt_misc/register
Title: Re: Set ARMtix chroot to cross compile
Post by: konimex on 25 May 2024, 05:43:36
I think I can reproduce it. I pushed a fix. Wait for artix-cgroups-0.7.2 to hit the nearest mirror.
Title: Re: Set ARMtix chroot to cross compile
Post by: kiblaster on 26 May 2024, 08:38:14
I updated artix-cgroups and the system and now I can chroot.

For some reason cryptsetup service was disabled in the process.
I see some warning or error about dinit that cannot open /etc/dinit.d/live.d for tinydm service, which indeed does not exist.
I think that I did not have that before.
Maybe related to the update?
Title: Re: Set ARMtix chroot to cross compile
Post by: replabrobin on 26 May 2024, 10:32:48
Hi, I also use armtix much kudos to phoenix_king_rus (https://forum.artixlinux.org/index.php?action=profile;u=84). I use distcc to compile some packages including the linux kernel, but I always start the build on an aarch64  machine (rpi4/5). I have a couple of x86_64 machines where I offload some of the compilation. A late kernel (6.6.30) still takes a couple of hours, but I get it with an armtix logo :)

I have tried running qemu armv8 on an x86_64 box before, but it seemed fairly slow.

I tried to follow this thread, but have lost track a bit. I think it would be very helpful if someone could summarise what is actually needed to setup an aarch64 chroot on a an x86_x64 artix.
Title: Re: Set ARMtix chroot to cross compile
Post by: kiblaster on 28 May 2024, 20:57:31
https://forum.artixlinux.org/index.php/topic,6921.0.html
I have been thinking about doing a guide, here you go I use that handy script.

Can you freely register on https://wiki.artixlinux.org/?
Title: Re: Set ARMtix chroot to cross compile
Post by: replabrobin on 28 May 2024, 21:50:48
https://forum.artixlinux.org/index.php/topic,6921.0.html
I have been thinking about doing a guide, here you go I use that handy script.
thanks I will try and compare with distcc