How to disable bootloader USB detection?

I have a legacy USB input device (a Minipac, specifically) plugged in to an AML-s905x-cc. The bootloader does not like this device if it’s plugged in during boot (it crashes the board), but if it’s plugged in after booting it works correctly.

In this thread, there was a reference to disabling USB detection by the bootloader. How is that done specifically? I wasn’t able to find any information about that. I did update the bootloader as suggested later in the thread, but that didn’t resolve the issue.

For completeness, here are the relevant errors shown before the device crashes and reboots itself.

...
Hit any key to stop autoboot: 1 WARN halted endpoint, queueing URB anyway.
Unexpected XHCI event TRB, skipping... (3bebbbc0 00000000 13000000 02008400)

You can try using the latest bootloader first.

git clone https://github.com/libre-computer-project/libretech-flash-tool.git lft
sudo lft/lft.sh bl-flash aml-s905x-cc mmcblk1 force
1 Like

Thanks. I’ve done exactly that - I now see some slightly different output during the boot, but ultimately I still get the same error messages and a reboot loop, which is why I’m looking for another workaround like preventing it from interacting with the USB during the boot.

Then you have to use libretech-builder-simple and build your own u-boot and disable USB support via configs.

LBS_UBOOT_MENUCONFIG=1 ./build.sh aml-s905x-cc

Then manually dd it with bs=512 seek=1

Okay, I will give that a try and see how it goes.

Is there a particular distro this build process is known to work on? I tried it on an existing Debian 11 (64-bit) virtual machine and a clean Debian 12 (64-bit) and got the following compiler errors both times.

<lots more output...>
+ CROSS_COMPILE=aarch64-elf-
+ make -C atf -j1 PLAT=gxl DEBUG=0 bl31
make: Entering directory '/home/username/libretech-builder-simple/atf'
  CC      bl31/bl31_context_mgmt.c
/home/username/libretech-builder-simple/gcc/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin/aarch64-elf-gcc: 1: cannot open @@: No such file
/home/username/libretech-builder-simple/gcc/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin/aarch64-elf-gcc: 2: Syntax error: ")" unexpected
make: *** [Makefile:1469: /home/username/libretech-builder-simple/atf/build/gxl/release/bl31/bl31_context_mgmt.o] Error 2
make: Leaving directory '/home/username/libretech-builder-simple/atf'

Following up, I’ve looked closer at aarch64-elf-gcc and found that Debian does not recognize it as a valid executable for some reason.

username@debian11:~/libretech-builder-simple/gcc/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin$ ./aarch64-elf-gcc --version
bash: ./aarch64-elf-gcc: cannot execute binary file: Exec format error
username@debian11:~/libretech-builder-simple/gcc/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin$ ^C
username@debian11:~/libretech-builder-simple/gcc/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin$ file aarch64-elf-gcc
aarch64-elf-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=80f8b844b1c4ba69a6d3112c97607ae51df76dd7, stripped

It looks like perhaps this is being built for AMD even though I am on i386?

username@debian11:~/libretech-builder-simple/gcc/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin$ readelf -h aarch64-elf-gcc
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x403cbe
  Start of program headers:          64 (bytes into file)
  Start of section headers:          971296 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         10
  Size of section headers:           64 (bytes)
  Number of section headers:         30
  Section header string table index: 29

It’s meant to run on x86, not ARM.

I was on i386, not ARM, but I tried an amd64 virtual machine and that seems to have got me past it. Thanks!