05-07-2023, 09:19 AM
(04-01-2023, 09:04 AM)runyor Wrote: I have an AHCI adapter with two SSDs mounted on it. Eventually I want to set them in RAID1.
Debian installation was flawless, installed on sda, sdb was available as well.
After rebooting post installation, when u-boot starts I get this output and an infinite boot loop:
Any idea what is going on? Thanks!
I encountered this issue using the SATA adapter ASMedia Technology Inc. Device 1064 (rev 02) on a ROCKPRO64. However, it seems that compiling the latest version of u-boot fixed this issue (specifically, it worked in version 2023.04).
It is fairly easy to compile this on Manjaro ARM on the ROCKPRO64 itself (because I believe all dependencies are in the official repos). On Arch Linux ARM, you will have to compile arm-none-eabi-gcc and arm-none-eabi-newlib on your own, which is not very easy, but is possible (let me know if you want instructions on this).
1. So, to compile on Manjaro, install the following packages:
Code:
sudo pacman -S bc git arm-none-eabi-gcc arm-none-eabi-newlib python-setuptools swig dtc python-pyelftools
2. Download and compile the ARM Trusted Firmware (start in some known folder, like your home directory):
Code:
wget https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot/trusted-firmware-a-lts-v2.8.6.tar.gz
tar -xvf trusted-firmware-a-lts-v2.8.6.tar.gz
cd trusted-firmware-a-lts-v2.8.6
make distclean
make -j6 PLAT=rk3399 bl31
3. Download and compile u-boot (start in the same known folder, like your home directory):
Code:
wget https://ftp.denx.de/pub/u-boot/u-boot-2023.04.tar.bz2
tar -xvf u-boot-2023.04.tar.bz2
# Copy over the bl31 file from the ARM Trusted Firmware and rename to atf-bl31 since that is what u-boot looks for.
cp trusted-firmware-a-ltx-v2.8.6/build/rk3399/release/bl31/bl31.elf u-boot-2023.04/atf-bl31
cd u-boot-2023.04
make distclean
# set some custom config options in u-boot
make rockpro64-rk3399_defconfig
# For Arch Linux ARM, but you can set a custom string if you want.
echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
# Enable support for device tree overlay files. You can skip this if you don't use device tree overlays.
echo 'CONFIG_OF_LIBFDT_OVERLAY=y' >> .config
# Enable SATA support (specifically the 'sata' command in the u-boot command line).
echo 'CONFIG_CMD_SATA=y' >> .config
# Test flags - I enabled these during build because they seemed interesting, but I don't think they do anything useful here.
echo 'CONFIG_SATA_BOOT=y' >> .config
#echo 'CONFIG_SPL_SATA=y' >> .config
echo 'CONFIG_SYS_SATA_MAX_DEVICE=10' >> .config
make -j6 EXTRAVERSION=-1
4. Install u-boot to your ROCKPRO64. In the code below, I copy u-boot to the emmc module. This will overwrite the existing version on the emmc module. You can restore it later by reflashing an OS (from another PC) to the emmc module or Micro SD card (if you are using one) or just be re-copying the original u-boot.itb and idbloader.img to the emmc module and Micro SD card. The following commands assume you start out in the same known folder, which could be your home directory.
Code:
cd u-boot-2023.04
# These require root permission because you are directly writing to blocks on the emmc module.
sudo dd if=idbloader.img of=/dev/mmcblk2 seek=64 conv=notrunc
sudo dd if=u-boot.itb of=/dev/mmcblk2 seek=16384 conv=notrunc
Note that if you are using a Micro SD card, then I assume the 'of=' part would be 'of=/dev/mmcblk1'. You can check what is currently available by running 'lsblk'.
5. Now, reboot your ROCKPRO64. Keep pressing keys on your keyboard until you get a u-boot command line prompt. Run the 'pci' command to initialize the pci interface. Now, run the 'scsi scan' command to list scsi devices. The system should now not crash. If your SATA drive shows up, then you are good to continue booting (run the 'boot' command to continue booting as normal - you don't need to normally run these commands but it can be helpful when debugging).