[SOLVED] RPi 4- aarch64 enable USB early in boot process

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

[SOLVED] RPi 4- aarch64 enable USB early in boot process

Postby mrtux » Wed Aug 12, 2020 5:24 pm

Hello all,
Now that Arch has provided an aarch64 rootfs for our Raspberry Pi's, I decided to switch over to it. It works great on the SD card, however on the 32-bit build I was using a powered external bay with a solid state for the filesystem, and a HDD for storage, I can't seem to get this to work with the 64 bit build, although I'm not sure if it is due to U-boot, the firmware or the kernel loading the necessary modules last. I have udev and systemd in initrd image. The beta firmware for the USB boot support is installed, however on the 32-bit build i was still using the SD card for boot, and mounting it with fstab, I found this faster and more reliable than full USB booting.

Has anyone had any experience with this, or seen this issue? It appears USB is not available until the kernel is fully booted and we are in the userspace, a keyboard/mouse experiences the same behavior. I have never used U-boot prior to aarch64, so I don't know where to begin, and was not very successful finding much about it online.

Is there a reason we must use U-boot in place of the pi bootloader that was used prior to this? Could the mainline kernel be built and used with the cmdline.txt and config.txt like it was previously (I know the manjaro version does this but with a much older kernel)

Thank you for reading, and my apologies if it is a jumbled mess to get through.
Last edited by mrtux on Thu Aug 20, 2020 9:16 pm, edited 2 times in total.
mrtux
 
Posts: 32
Joined: Wed Aug 12, 2020 4:06 am

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby livello » Wed Aug 12, 2020 10:08 pm

Thank you for your post!
I confirm the problem with usb devices during booting process with u-boot.

$this->bbcode_second_pass_code('', '❯ cat boot.txt
# After modifying, run ./mkscr

# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:2 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=/dev/sdb3 rw rootwait smsc95xx.macaddr="${usbethaddr}"

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /Image; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
booti ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi
❯ cat config.txt
enable_uart=1

')

$this->bbcode_second_pass_code('', 'U-Boot 2020.07-2 (Aug 09 2020 - 02:00:40 +0000) Arch Linux ARM

DRAM: 3.9 GiB
RPI 4 Model B (0xc03111)
MMC: emmc2@7e340000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In: serial
Out: vidconsole
Err: vidconsole
Net: eth0: genet@7d580000
starting USB...
No working controllers found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
701 bytes read in 20 ms (34.2 KiB/s)
## Executing script at 02c00000
37171712 bytes read in 1607 ms (22.1 MiB/s)
32503 bytes read in 28 ms (1.1 MiB/s)
21400871 bytes read in 941 ms (21.7 MiB/s)
## Flattened Device Tree blob at 02e00000
Booting using the fdt blob at 0x2e00000
Using Device Tree in place at 0000000002e00000, end 0000000002e0aef6

Starting kernel ...

�f��~����`f���~�����f���')
This is serial console during boot. As you see there is a mess after starting kernel.
No way to use console via serial or via usb.

$this->bbcode_second_pass_quote('', 'd')evice /deb/sdb3 not found. skipping fsck.

Image

This is how booting process stops. Kernel does not see usb devices.

I want to switch from Manjaro ARM to Arch Linux as it has more recent software and more packages.
I succesfully boot Arch Linux using boot partition and it's Manjaro kernel. It works just fine, but no way to upgrade kernel.
$this->bbcode_second_pass_code('', '❯ cat cmdline.txt_arch
root=/dev/sdb2 rootfstype=btrfs rootflags=subvol=@archlinux rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg
.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop snd-bcm2835.enable_compat_alsa=0')
livello
 
Posts: 4
Joined: Wed Aug 12, 2020 9:58 pm

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby mrtux » Wed Aug 12, 2020 10:49 pm

Hi Livello, thanks for posting your experience as well. That is the same issue I have. I should have mentioned I have also attempted to limit the amount of ram during boot as I had found that to be an issue in some of the other posts/research I did with no avail. It appears to be tied to the uboot process. I also modified the boot.txt and removed the bit about setting the root to the second partition, and used "root=UUID=" with the devices UUID and had the same result. If anyone has any insight how to work around this issue, it would be very much appreciated. Thanks!
mrtux
 
Posts: 32
Joined: Wed Aug 12, 2020 4:06 am

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby livello » Thu Aug 13, 2020 10:32 am

I think the problem is inside the kernel!
> sudo pacman -Ss linux-aarch64
core/linux-aarch64 5.8.0-1 [installed]
The Linux Kernel and modules - AArch64 multi-platform

This is generic kernel. So usb controller support is within module, not in kernel image. And to fix it we need to recompile kernel with appropriate flag (y), not (m).
livello
 
Posts: 4
Joined: Wed Aug 12, 2020 9:58 pm

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby mrtux » Thu Aug 13, 2020 5:26 pm

Which module is it that is used for the pcie bus?
$this->bbcode_second_pass_code('', 'lspci -knn

00:00.0 PCI bridge [0604]: Broadcom Inc. and subsidiaries Device [14e4:2711] (rev 10)
Kernel driver in use: pcieport
01:00.0 USB controller [0c03]: VIA Technologies, Inc. VL805 USB 3.0 Host Controller [1106:3483] (rev 01)
Subsystem: VIA Technologies, Inc. VL805 USB 3.0 Host Controller [1106:3483]
Kernel driver in use: xhci_hcd')
Any idea where pcieport comes from? Adding it to initrd doesn't work. If we could find the proper modules that are used for enabling the usb controller we could make the modules load early in the kernel boot process, that would rule that out. Although I think with udev it should be loading the module early enough as is, I think the issue may be U-boot is not powering on the USB controller, because I can see a U-boot message about "No USB Controller Found" when it is first booting, and this would be before the kernel has even been loaded. If there was a way to force uboot to enable the controller, it would likely stay on through the kernel process and whether it was a module or built into the the kernel likely wouldn't matter.

Here is a list of used modules from my Pi after boot.
$this->bbcode_second_pass_code('', 'lsmod

Module Size Used by
joydev 32768 0
btsdio 20480 0
bcm2835_v4l2 69632 0
brcmfmac 344064 0
hci_uart 159744 0
btqca 20480 1 hci_uart
broadcom 24576 1
btbcm 24576 1 hci_uart
videobuf2_vmalloc 20480 1 bcm2835_v4l2
brcmutil 20480 1 brcmfmac
btintel 32768 1 hci_uart
bcm_phy_lib 28672 1 broadcom
videobuf2_memops 20480 1 videobuf2_vmalloc
bluetooth 696320 6 btqca,btsdio,btintel,hci_uart,btbcm
videobuf2_v4l2 36864 1 bcm2835_v4l2
videobuf2_common 61440 2 videobuf2_v4l2,bcm2835_v4l2
mdio_bcm_unimac 20480 0
cfg80211 872448 1 brcmfmac
ecdh_generic 16384 1 bluetooth
ecc 32768 1 ecdh_generic
videodev 278528 3 videobuf2_v4l2,bcm2835_v4l2,videobuf2_common
rfkill 40960 3 bluetooth,cfg80211
genet 73728 0
pcie_brcmstb 24576 0
pwm_bcm2835 16384 0
snd_bcm2835 32768 0
i2c_bcm2835 20480 0
bcm2835_wdt 20480 0
raspberrypi_hwmon 16384 0
mc 65536 3 videodev,videobuf2_v4l2,videobuf2_common
bcm2711_thermal 16384 0
drm 655360 0')
mrtux
 
Posts: 32
Joined: Wed Aug 12, 2020 4:06 am

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby livello » Thu Aug 13, 2020 8:45 pm

I fixed the problem. I build kernel 5.8 used config from manjaro pi4 aarch64 kernel 5.7.11.
You can built it by your self. I attached archive with patched PKG and needed files.

But I think you are in the right way.
$this->bbcode_second_pass_code('', '
/etc/mkinitcpio.conf
# in this array. For instance:
# MODULES=(piix ide_disk reiserfs)
MODULES=()')

we need add these modules here. And

$this->bbcode_second_pass_code('', 'mkinitcpio -P')

https://ri48.ru/nextcloud/index.php/s/pXk7t33Qp37wtT9
livello
 
Posts: 4
Joined: Wed Aug 12, 2020 9:58 pm

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby livello » Fri Aug 14, 2020 1:54 pm

I tried to add xhci_hcd to MODULES section in /etc/mkinitcpio.conf
This does not work. No usb devices on boot.

Anyway. There is second problem with arch linux on raspberry pi 4. No graphical target, xorg is not working.
Did you try to start a graphical desktop environment?
livello
 
Posts: 4
Joined: Wed Aug 12, 2020 9:58 pm

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby lightirius » Mon Aug 17, 2020 4:06 pm

Hello all,
I managed to boot the official aarch64 rootfs on raspberry pi4 from external SSD without a custom kernel.
To do that I had to:
1) Manually update uboot-raspberrypi to the latest RC (2020.10rc2) to fix "No USB Controller Found" error in U-boot
2) Add pcie_brcmstb into MODULES in /etc/mkinitcpio.conf
3) Rebuild initrd with mkinitcpio -P

If you have /boot on SD card it may be enough to just add pcie_brcmstb in /etc/mkinitcpio.conf and rebuild initrd

For u-boot I just got official PKGBUILD and other files from https://archlinuxarm.org/packages/armv7h/uboot-raspberrypi/files and modified some variables in PKGBUILD:
1) pkgname to uboot-raspberrypi-rc
2) pkgver to 2020.10rc2
3) first checksum int md5sums to 'bae5280c7ce49961c3722fa9019535bf'

Then makepkg -si to build and install it
lightirius
 
Posts: 1
Joined: Mon Aug 17, 2020 3:21 pm

Re: Raspberry Pi 4 - aarch64, enable USB early in boot proce

Postby mrtux » Thu Aug 20, 2020 9:14 pm

Thanks to you both for your contributions, I finally figured out the pcie_brcmstb module was the one that was required, and you are correct, it technically does allow you to boot properly if you use the SD card as /boot. I went ahead and used the RC uboot as you suggested and have found it actually slightly increases boot speed since the drives are ready during boot. Thank you both. I'm glad we were all able to find a solution to the problem. Thanks a lot!
mrtux
 
Posts: 32
Joined: Wed Aug 12, 2020 4:06 am

Re: [SOLVED] RPi 4- aarch64 enable USB early in boot process

Postby cadilhac » Fri Sep 18, 2020 3:41 am

FWIW, I have the exact same problem, and none of the solutions worked, including rebuilding the kernel with Manjaro's config. This kernel is compiled with PCIE_BRCMSTB=y and XHCI_HCD=y, so there does not lie the problem. Still no way I can access anything USB… This is from a fresh install, plus pacman -Syu. The -110 error is also reported by U-Boot.

For reference, these are all the errors reported by journalctl:
$this->bbcode_second_pass_code('', ' bcm2835-aux-uart fe215040.serial: unable to register 8250 port - -28
xhci_hcd 0000:01:00.0: can't setup: -110
xhci_hcd 0000:01:00.0: init 0000:01:00.0 fail, -110
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04
')
cadilhac
 
Posts: 7
Joined: Thu Aug 31, 2017 7:48 am

Next

Return to ARMv8

Who is online

Users browsing this forum: No registered users and 3 guests