ARM SBC Support Discussion

It has a gigabit which is not saturated at all.

1 Like

Is this correct? As idk what build_arch it is using as there is not information before it starts to compile,

I will try again today. I doubt it just be due to use logout which shouldn’t be the case though.

I think the argument needs to come before the command.

I always type ./make.sh --target=aarch64 build.

It is documented here.

https://git.ipfire.org/?p=ipfire-2.x.git;a=blob;f=doc/make.sh-usage;h=78a73efacbbce7c881805c9c499a650c474911c8;hb=HEAD

However, this will probably build a lot slower than on native ARM hardware.

Hello,
Thanks for updating on the argument.
Looks like it have some problem with chroot

Checking for necessary space on disk                                 [ DONE ]
chroot: failed to run command 'env': No such file or directory
stage1                             

You will need to download the toolchain first, because you cannot build it on your system:

./make.sh --target=aarch64 gettoolchain
1 Like

Oh yea that is what I was wondering it is only getting X86_64 toolchain, Now it have fetched the toolchain and I cleaned the build dir and tried to build again with correct target and it still failed with same error base_build.log have a single ling chroot: failed to run command 'env': Exec format error

Sorry for bugging you, Once I get the hang of it then I will be able to work on it myself.

Update1: I removed the toolchain and doing gettoolchain again for aarch64.
Stil it failed to build stage2 which is the first package to build in the list.
chroot: failed to run command env: Exec format error.

I have updated the whole system so make sure all packages are latest.

Update2: I am on Manjaro Arch Linux so I will look into it as the native chroot is not working i guess.

No worries. We are here to help.

What does this give you?

file build/bin/bash
file build/bin/bash
build/bin/bash: cannot open `build/bin/bash' (No such file or directory)

Please don’t tell me I have to download src for target =aarch64 ? coz I suppose src will be common for all arch.
As it takes alot of time to download src coz of the slow download speed.

Then qemu-user-static or binfmt is not configured for aarch64 binaries.

Oh. make.sh should automatically do this for you. I have never tested it with aarch64.

The magic for aarch64 is missing in qemu_find_build_helper_name() and also in qemu_is_required() aarch64 in not handled yet.

We have never used this for aarch64.

Thank you for informing, I am still reading the huge make.sh script, I will see if I can do any local changes to make it build over chroot.

If you find any more hints then please do shared as with my limited knowledge of the content in make.sh it will take sometime for me to correct it, while you might know a quick fix as you have been working on it since long time.

Thanks.

https://git.ipfire.org/?p=people/ms/ipfire-2.x.git;a=commitdiff;h=f5637566d81b39bcda42e8943a313474869b5979

Pull this commit into your branch and you can run it as described.

1 Like

Thanks alot.

That was so fast.

Ill try it now.

Hi @ms Ive tried using this patch and get the same error with chroot even after patching the make script and make script usage.
Ok, I am following the codes as it flows, so we need to add x86_65aarch64 in qemu_is_required call, then it gives me
ERROR: Could not find a binfmt_misc helper entry for aarch64 [ FAIL ]
We also need to add aarch64 in qemu_environ call I tried to define cortex-a57 as per the qemu arm documentation but I think there is something else needed to make it work.
I am still following the codes. If you have any hint please share when free.

Update:
The above error points me back to qemu_find_build_helper_name so I am in a loop to know what wrong in the codes.

Update:
I think there is something to do here
Or maybe the qemu-${target-arch} is not defined somewhere. Cannot find much now.

Thanks.

Make sure that the qemu static and binfmt helpers are installed and registered on your host os.

On linux mint i need to install qemu qemu-user-static and binfmt-support.
apt-get install qemu qemu-user-static binfmt-support

See “Use Qemu user mode” - Arm64Qemu - Debian Wiki

Yes I have qemu and qemu static for aarch64 and binfmt I am on manjaro which is based on arch linux.

This package was enough for me to install on Debian for testing.

Do you have this set up properly? There should be some virtual file system being mounted:

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)

This is what I have in there:

root@michael:/build/ipfire.org# ll /proc/sys/fs/binfmt_misc
total 0
-rw-r--r-- 1 root root 0 Aug  5 16:52 python2.7
-rw-r--r-- 1 root root 0 Aug  5 16:52 python3.7
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-aarch64
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-alpha
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-arm
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-armeb
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-cris
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-hppa
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-m68k
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-microblaze
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-mips
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-mips64
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-mips64el
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-mipsel
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-ppc
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-ppc64
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-ppc64abi32
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-ppc64le
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-riscv32
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-riscv64
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-s390x
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-sh4
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-sh4eb
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-sparc
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-sparc32plus
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-sparc64
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-xtensa
-rw-r--r-- 1 root root 0 Aug  5 16:52 qemu-xtensaeb
--w------- 1 root root 0 Aug  5 16:52 register
-rw-r--r-- 1 root root 0 Aug  5 16:52 status

Debian created these automatically for me. make.sh searches through this directory to find the correct executable for aarch64.

Searching for “manjaro” and “binfmt” shows a couple of articles where people are struggling and need additional packages: Is a re-install needed after a cpu/main board swap? - Support - Manjaro Linux Forum

I do have the same, as I checked it before also we do package arm stuff using a similar approach with qemu.
This is the tool we use to build packages and also images for arm64 devices.
Even we need binfmt service to build package using our tools as explained in the git project link whic I quote below.

Install binfmt-qemu-static package and make sure systemd-binfmt is running

AFAIR we have binfmt as a service which is enabled when we install the package.

I will look into this again once I get home.

If it is working on your side with debian then I am sure there is some issue on my build server maybe location of the files are not the same, I will also try to build a package using manjaro-arm-tool and then test ipfire make script.

Thank you for the response.

The /proc file system should always look the same.

make.sh is looking for the executable in that directory. That can be anywhere and hence we run the search function.

Please post the error messages in full. make.sh performs some more checks on qemu to check if it is suitable for use. Maybe that fails.

1 Like

Hello,
Here is what I have which is similar to yours.

ls -l /proc/sys/fs/binfmt_misc
total 0
-rw-r--r-- 1 root root 0 Aug  6 23:16 appimage-type1
-rw-r--r-- 1 root root 0 Aug  6 23:16 appimage-type2
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-aarch64
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-alpha
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-arm
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-armeb
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-cris
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-m68k
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-microblaze
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-mips
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-mipsel
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-ppc
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-ppc64
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-ppc64abi32
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-riscv64
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-s390x
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-sh4
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-sh4eb
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-sparc
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-sparc32plus
-rw-r--r-- 1 root root 0 Aug  6 23:16 qemu-sparc64
--w------- 1 root root 0 Aug  6 23:16 register
-rw-r--r-- 1 root root 0 Aug  6 23:16 status

Also I just build uboot for rockpi4c over our manjaro-arm-tools which uses qemu too and it was built without any problem.
Log Here
After this build is complete I will try again with ipfire build process.

Update:
Build complete on our tools.

  CC      tpl/drivers/sysreset/sysreset-uclass.o
  CC      spl/lib/uuid.o
  CC      spl/lib/rand.o
  CC      spl/lib/panic.o
  LD      tpl/lib/built-in.o
  CC      tpl/drivers/serial/ns16550.o
  CC      spl/lib/tiny-printf.o
  CC      spl/lib/strto.o
  CC      tpl/drivers/sysreset/sysreset_rockchip.o
  CC      spl/lib/date.o
  CC      spl/lib/elf.o
  LD      tpl/drivers/sysreset/built-in.o
  LD      spl/lib/built-in.o
  LD      tpl/drivers/serial/built-in.o
  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
  CAT     spl/u-boot-spl-dtb.bin
  COPY    spl/u-boot-spl.bin
  LD      tpl/drivers/ram/rockchip/built-in.o
  LD      tpl/drivers/ram/built-in.o
  LD      tpl/drivers/built-in.o
  LD      tpl/u-boot-tpl
  OBJCOPY tpl/u-boot-tpl-nodtb.bin
  CAT     tpl/u-boot-tpl-dtb.bin
  COPY    tpl/u-boot-tpl.bin
  MKIMAGE tpl/u-boot-tpl-rockchip.bin
  CAT     idbloader.img
  CAT     u-boot-rockchip.bin
  CFGCHK  u-boot.cfg
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "uboot-rockpi4c"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Adding install file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: uboot-rockpi4c 2020.07-2 (Thu Aug  6 20:41:05 2020)
==> Cleaning up...
==> Package Succeeded...
  -> Extracting finished package out of rootfs...
==> Package saved as {uboot-rockpi4c} in {/var/cache/manjaro-arm-tools/pkg/aarch64}...
  -> Cleaning build files from rootfs
==> Time : 11.68 minutes...

Next is ipfire.

This is what I get

sudo ./make.sh --target=aarch64 clean
[sudo] password for spikerguy: 

ERROR: Could not find a binfmt_misc helper entry for aarch64                      [ FAIL ]
    Check /home/spikerguy/Desktop/pkg-build/ipfire-2.x/log/_build.preparation.log for errors if applicable                                                                   [ FAIL ]
[spikerguy@spikerguy-gtr ipfire-2.x]$ 

There is no log file though.

[spikerguy@spikerguy-gtr log]$ ls
[spikerguy@spikerguy-gtr log]$ 

I removed all my changed that I had done to the make script in
#Set default qemu options where I added QEMU Cpu with cortex-a57 and in qemu_is_required call to added x86_64,aarch64

After that I get env error.

cat _build.base.log 
Aug  6 21:55:36: Building stage2 chroot: failed to run command 'env': No such file or directory

I tried binfmt-user-static from aur as well as Manjaro-user-static package but still no luck :frowning:

Thank you.