Rockpro64 and stock arch linux
#1
I've gotten the stock rootfs running on the Rockpro64 SBC, using steps from a variety of sources. If desired, I'll try to hunt down the locations. Steps below:

Section 1 - Making a Good SPL

0. Perform these steps from a functional image, on the board, such as Armbian
    -note: may need to "apt-get install gcc-arm-none-eabi binutils-arm-none-eabi"

1. Get u-boot, cd into the folder
    #git clone https://gitlab.denx.de/u-boot/u-boot.git
    #cd u-boot
    #make clean

2. Get, make the Trusted code, copy it into the u-boot folder
    #git clone https://github.com/ARM-software/arm-trus...rmware.git atf
    #make -C atf PLAT=rk3399 bl31
    #cp bl31.elf ../

3. Make u-boot
    #make rockpro64-rk3399_defconfig
    #make ARCH=arm -j7


4. Write loaders to disk, or copy them to storage for Section 2
    #tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl-dtb.bin tpl-spl.img
    #cat spl/u-boot-spl-dtb.bin >> tpl-spl.img
    #dd if=tpl-spl.img of=/dev/mmcblkN seek=64 conv=fsync
    #dd if=u-boot.itb of=/dev/mmcblkN seek=16384 conv=fsync

Section 2 - Install Arch

0. This must be performed from a different computer, make sure uboot-tools is installed

1. Zero the beginning of the SD card:

    #dd if=/dev/zero of=/dev/sdX bs=1M count=32

2. Start fdisk to partition the SD card:

    #fdisk /dev/sdX

3. At the fdisk prompt, create the new partition:

    Type o. This will clear out any partitions on the drive.
    Type n, then p for primary, 1 for the first partition on the drive, 32768 for the first sector, and then +4G
    -this creates a 4G partition
    Write the partition table and exit by typing w.

4 . Create the ext4 filesystem:

    #mkfs.ext4 /dev/sdX1

5. Mount the filesystem:

    #mkdir something
    #mount /dev/sdX1 something

5. Download and extract the root filesystem (as root, not via sudo):

    #wget http://os.archlinuxarm.org/os/ArchLinuxA...est.tar.gz
    #tar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C something

6. Use this as boot.txt, place in something/boot/
    
 
Code:
   # MAC address (use spaces instead of colons)
    setenv macaddr da 19 c8 7a 6d f4
    
    part uuid ${devtype} ${devnum}:${bootpart} uuid
    setenv bootargs console=ttyS2,1500000 root=PARTUUID=${uuid} rw rootwait
    setenv fdtfile rockchip/rk3399-rockpro64.dtb
    
    if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/Image; then
      if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
        fdt addr ${fdt_addr_r}
        fdt resize
        fdt set /ethernet@fe300000 local-mac-address "[${macaddr}]"
        if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
          # This upstream Uboot doesn't support compresses cpio initrd, use kernel option to
          # load initramfs
          setenv bootargs ${bootargs} initrd=${ramdisk_addr_r},20M ramdisk_size=10M
        fi;
        booti ${kernel_addr_r} - ${fdt_addr_r};
      fi;
    fi

7. in the something/boot/ directory, generate boot.scr from the boot.txt

    #mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr

8. Unmount the partition

    #umount something

9. Write the bootloader to the sd card

    #dd if=tpl-spl.img of=/dev/sdX seek=64 conv=fsync
    #dd if=u-boot.itb of=/dev/sdX seek=16384 conv=fsync

10. Insert SD, apply voltage

11. Initialize the pacman keyring and populate the Arch Linux ARM package signing keys:

    #pacman-key --init
    #pacman-key --populate archlinuxarm

12. Update

    #pacman -Syu
    #pacman -S uboot-tools

Further Notes: hdmi may be kinda weird from the supplied boot.txt, depending on the monitor used.
  Reply
#2
Thanks for the write-up TaborFife. I repeated your steps and everything worked out fine. I did cross-compile u-boot and the trusted-firmware on another computer however. Currently the kernel version is:
Code:
$ uname -a
Linux RockPro64 5.3.13-1-ARCH #1 SMP Sun Nov 24 17:44:14 UTC 2019 aarch64 GNU/Linux
  Reply
#3
@TaborFife, have you managed to get this working using an eMMC module instead of a SD card? I tried it, but it doesn't boot:


Code:
U-Boot TPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Channel 1: LP
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to

U-Boot SPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57 +0100)
Trying to boot from MMC2
unable to select a mode
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMmmc_load_image_raw_sector: mmc block read error
Trying to boot mmc_load_image_raw_sector: mmc block read error
SPL: failed to rd ###

FATAL: read from port failed: Device not configured
  Reply
#4
(01-02-2020, 09:25 AM)Yoast Wrote: @TaborFife, have you managed to get this working using an eMMC module instead of a SD card? I tried it, but it doesn't boot:


Code:
U-Boot TPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Channel 1: LP
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to

U-Boot SPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57 +0100)
Trying to boot from MMC2
unable to select a mode
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMmmc_load_image_raw_sector: mmc block read error
Trying to boot mmc_load_image_raw_sector: mmc block read error
SPL: failed to rd ###

FATAL: read from port failed: Device not configured
Hi, I'm able to boot from eMMC using the latest ROOTFS tarball. The latest kernel update seems to have nuked my setup though.
  Reply
#5
There is indeed a regression in linux kernel > 5.4.6
details here: https://gitlab.manjaro.org/manjaro-arm/p...4/issues/5
This impact both manjaro and arch linux.
If your system is impacted, there is a work around:
remove stmmac-platform.ko and rebuild it with this patch

diff -Naur linux-5.4-7/./drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c linux-5.4-6/./drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
--- linux-5.4-7/./drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c 2020-01-07 11:17:04.817218153 +0100
+++ linux-5.4-6/./drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c 2020-01-07 11:16:25.770550353 +0100
@@ -320,7 +320,7 @@
static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
struct device_node *np, struct device *dev)
{
- bool mdio = false;
+ bool mdio = true;
static const struct of_device_id need_mdio_ids[] = {
{ .compatible = "snps,dwc-qos-ethernet-4.10" },
{},

They are urrently testing a fix and discussing it here:
https://lkml.org/lkml/2020/1/7/375


By the way, you have to know that there is an another issue an archlinux:
They think they are applying patches but then dont. They use git apply outside of a git repo : linux kernel is a .xz file and patches applied with git apply.
They just dropped my pull request: https://github.com/archlinuxarm/PKGBUILDs/pull/1749
I m currently using manjaro, so I didnt care about that.
  Reply
#6
(01-07-2020, 03:12 PM)dragop Wrote:
(01-02-2020, 09:25 AM)Yoast Wrote: @TaborFife, have you managed to get this working using an eMMC module instead of a SD card? I tried it, but it doesn't boot:


Code:
U-Boot TPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Channel 1: LP
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to

U-Boot SPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57 +0100)
Trying to boot from MMC2
unable to select a mode
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMmmc_load_image_raw_sector: mmc block read error
Trying to boot mmc_load_image_raw_sector: mmc block read error
SPL: failed to rd ###

FATAL: read from port failed: Device not configured
Hi, I'm able to boot from eMMC using the latest ROOTFS tarball. The latest kernel update seems to have nuked my setup though.

Good to know that it worked for you. Can you confirm the U-Boot version you are using? Is it also the 2020.01-rc5 version?
  Reply
#7
(01-13-2020, 03:15 PM)Yoast Wrote:
(01-07-2020, 03:12 PM)dragop Wrote:
(01-02-2020, 09:25 AM)Yoast Wrote: @TaborFife, have you managed to get this working using an eMMC module instead of a SD card? I tried it, but it doesn't boot:


Code:
U-Boot TPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Channel 1: LP
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to

U-Boot SPL 2020.01-rc5-00042-g6cb87cbb14 (Jan 02 2020 - 15:30:57 +0100)
Trying to boot from MMC2
unable to select a mode
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMmmc_load_image_raw_sector: mmc block read error
Trying to boot mmc_load_image_raw_sector: mmc block read error
SPL: failed to rd ###

FATAL: read from port failed: Device not configured
Hi, I'm able to boot from eMMC using the latest ROOTFS tarball. The latest kernel update seems to have nuked my setup though.

Good to know that it worked for you. Can you confirm the U-Boot version you are using? Is it also the 2020.01-rc5 version?

I cloned the master at the time. Since it booted right away, I didn't really try a proper release.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  slarm64 (unofficial slackware) ROCKPro64 RK3399 (aarch64) mara 32 9,350 09-26-2020, 03:39 AM
Last Post: mara
Thumbs Up Batocera for RockPro64 Luke 11 4,081 09-18-2020, 01:52 AM
Last Post: Wizzard
  First Lakka image for ROCKPro64 Ntemis 12 4,457 09-18-2020, 01:50 AM
Last Post: Wizzard
Question Mainline Debian Buster on RockPro64 ? chrestomanci 15 2,428 09-05-2020, 03:21 PM
Last Post: kuleszdl
  Accessing UART4 on RockPro64 (Armbian) antonlyap 0 127 08-27-2020, 01:36 PM
Last Post: antonlyap
  Xen EFI with Alpine Linux dom0 sir.lami 0 164 08-26-2020, 12:25 PM
Last Post: sir.lami
  Problems with my RockPro64 tuxd3v 0 174 08-19-2020, 11:47 AM
Last Post: tuxd3v
  Linux Host - QEMU Android Guest? rik-shaw 0 224 07-09-2020, 08:02 PM
Last Post: rik-shaw
  RETRO GAMING BATOCERA LINUX + ROSHAMBO CASE - Tutoriel Fr TheMiniCakeTV 0 946 07-02-2020, 12:45 PM
Last Post: TheMiniCakeTV
  Arch Linux on RockPro64 mmatyas 30 14,407 05-30-2020, 12:08 PM
Last Post: mmatyas

Forum Jump:


Users browsing this thread: 1 Guest(s)