Manual: Howto cross-compile Upstream U-Boot for rock64
#1
Information 
Step 1: Get the file bl31.elf
You can build ATF with Upstream arm-trusted-firmware repository to get the file "bl31.elf" (Way 1) or you use the rk322xh_bl31_vXXX.elf file from rockchip rkbin repository (Way 2)

Way 1 (build ATF with Upstream arm-trusted-firmware repository to get "bl31.elf")
Install the required packages (Debian / Ubuntu):
sudo apt-get install device-tree-compiler build-essential gcc make git libssl-dev

Go into your Download folder and open Terminal there, then run:
git clone https://github.com/ARM-software/arm-trus...rmware.git

cd arm-trusted-firmware

Check the integrity of the cloned repository:
git status
git fsck
git log

Open the file „platform_def.h“ (its in /plat/rockchip/rk3328/include/platform_def.h)
Change in this file the Line:
#define BL31_BASE (TZRAM_BASE + 0x40000)
to
#define BL31_BASE (TZRAM_BASE + 0x10000)

cd arm-trusted-firmware

make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3328 DEBUG=1 bl31

Go into your Download folder and open Terminal, then run:
git clone git://git.denx.de/u-boot.git
or Download U-Boot source tree from ftp://ftp.denx.de/pub/u-boot/
(How to verify downloaded file with .sig file: https://stackoverflow.com/questions/1533...h-sig-file)

Search now the "bl31.elf" file  in the arm-trusted-firmware build folder and copy it in the U-Boot folder.

Way 2 (use "bl31.elf" file from rockchip rkbin repository)
Go into your Download folder and open Terminal, then run:
git clone git://git.denx.de/u-boot.git
or Download U-Boot source tree from ftp://ftp.denx.de/pub/u-boot/
(How to verify downloaded file with .sig file: https://stackoverflow.com/questions/1533...h-sig-file)

Go back into your Download folder and open Terminal, then run:
git clone https://github.com/rockchip-linux/rkbin
cd rkbin

Check the integrity of the cloned repository:
git status
git fsck
git log

Search the file „rk322xh_bl31_v1.42.elf“ in the rkbin folder (current version is v1.42, this file is in bin/rk33/) and change the name of this file to „bl31.elf“ and copy it in the U-Boot folder.

Step 2: Compile U-Boot
Install the required packages (Debian / Ubuntu)
sudo apt-get install bison flex bc libssl-dev make gcc gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf

Apply required patches (according: https://forum.pine64.org/showthread.php?tid=6299):
https://patchwork.ozlabs.org/patch/1172554/
https://patchwork.ozlabs.org/patch/1172555/

To apply a patch create a textfile (filename.patch) in the  U-Boot folder with the text from the patch, then run inside the U-Boot folder in terminal:
git apply filename.patch

cd u-boot

make CROSS_COMPILE=aarch64-linux-gnu- BL31=bl31.elf rock64-rk3328_defconfig

make CROSS_COMPILE=aarch64-linux-gnu- BL31=bl31.elf all u-boot.itb

Flash U-Boot to microSD card
Create a ext4 partition with e.g. gparted which begins at 16 mb.
Open Terminal in the U-Boot folder and flash U-Boot to microSD card with following commands (you can find the name of your microSD card with e.g. gparted, we search for example /dev/sdc (without number! not /dev/sdc1))

sudo dd if=./idbloader.img of=/dev/sdcard seek=64

sudo dd if=./u-boot.itb of=/dev/sdcard seek=16384


Good to know:
Alpine Linux on rock64: https://forum.pine64.org/showthread.php?tid=5881&page=2

This page has been archived:
www.archive.ph/kTfmj
www.web.archive.org/web/20191102210056/https://forum.pine64.org/showthread.php?tid=8174
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Thumbs Up A guide for how I made RetroPie, RetroArch, and EmulationStation Work on the Rock64 Mrfixit2001 4 5,155 12-17-2018, 03:52 AM
Last Post: va88
  Install Standard Debian (upstream) Catbot 1 1,541 08-24-2018, 05:34 PM
Last Post: tllim
  Using the Movidius NCS with rock64 markjay 0 1,546 07-02-2018, 09:51 AM
Last Post: markjay

Forum Jump:


Users browsing this thread: 1 Guest(s)