README.md 4.08 KB
Newer Older
1
# Repo Manifest for Systemready IR compliant rk3399 firmware
ankuraltran's avatar
ankuraltran committed
2

3
4
The information provided here provides the configuration and build setup for
ARM SystemReady compliant firmware for some Rockchip RK3399 based platforms.
ankuraltran's avatar
ankuraltran committed
5
6
7
8
9

There are three Evaluation Platforms being used as platform for the verification

| Target  | Manifest XML  | Device |
| :------------: |:---------------:| :-----:|
ankuraltran's avatar
ankuraltran committed
10
11
| Toy Brick      | TB-RK3399proD.xml | RK3399 Pro |
| Lenovo Leez     | Leez-P710.xml        |  Leez-p710 |
ankuraltran's avatar
ankuraltran committed
12
| Pine 64 | RockPro64.xml |    RockPro 64 |
ankuraltran's avatar
ankuraltran committed
13

Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
```
Note: The guide below has been extensively tested with the TB_RK3399ProD but is expected 
to work with all of the above platforms.
```

## 1. Prepare Host machine
The following package installations and steps are required to be completed to build and install the firmware binaries.

```
sudo apt-get install -y cmake python3 python-is-python3 git gnupg bison flex
sudo apt-get install -y libssl-dev device-tree-compiler

# Configure git with your details
git config --global user.email "you@example.com"
git config --global user.name "Your Name"

# Install repo
#   Option 1 - package manager
sudo apt-get install repo

##   Option 2 - manual download
##  curl https://storage.googleapis.com/git-repo-downloads/repo > /opt/repo
##  chmod +x /opt/repo
##  export PATH=$PATH:/opt
```


## 2. Clone the repositories
```
mkdir <New_Dir>
cd <New_Dir>
repo init -u https://gitlab.arm.com/systemready/firmware-build/rk3399-manifest -m TB-RK3399proD.xml
repo sync -j4 --no-clone-bundle
```

## 3. Get the Toolchains
If you dont have an aarch64-linux-gnu cross compiler already installed on your host machine, there are 2 ways of suppling the toolkits required to build the firmware and u-boot binaries.

* Option 1: Package install the cross-compilers on the host machine OS.
* Option 2: Use the toolchain installer thats provided by the makefile
ankuraltran's avatar
ankuraltran committed
54

Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
55
### Option 1: PREFERRED
ankuraltran's avatar
ankuraltran committed
56
57

```
Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
58
59
sudo apt-get install gcc-aarch64-linux-gnu arm-none-eabi-gcc
which aarch64-linux-gnu-gcc
ankuraltran's avatar
ankuraltran committed
60
```
Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
61
Copy the path reported by the above command (excluding the tailing `bin/aarch64-linux-gnu-gcc`) and paste it after the command below:
ankuraltran's avatar
ankuraltran committed
62
63

```
Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
64
export AARCH64_PATH=
ankuraltran's avatar
ankuraltran committed
65
```
Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
66
For example:
ankuraltran's avatar
ankuraltran committed
67
68

```
Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
69
70
71
72
73
$ which aarch64-linux-gnu-gcc
/usr/bin/aarch64-linux-gnu-gcc
$ export AARCH64_PATH=/usr
$ echo $AARCH64_PATH
/usr
ankuraltran's avatar
ankuraltran committed
74
```
ankuraltran's avatar
ankuraltran committed
75

Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
76
77
78
79
80
81
### Option 2: ALTERNATIVE (skip this if using option 1)

```
cd build/
make -j2 toolchains
```
82

Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
83
84
85
86
87
88
## 4. Build u-boot binaries for target
```
cd build/
make -j `nproc`
```
Amongst other things the above command will generate the following files of interest in the `../out/bin/u-boot/` directory:
ankuraltran's avatar
ankuraltran committed
89

ankuraltran's avatar
ankuraltran committed
90
```
Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
91
92
93
94
u-boot.itb
idbloader.img
```
Check the above by running:
ankuraltran's avatar
ankuraltran committed
95
```
Umair Jameel Hashim's avatar
Umair Jameel Hashim committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
ls -ltr ../out/bin/u-boot/
```



## 5. Building the FW binaries
```
cd ../rkbin
./tools/boot_merger  ./RKBOOT/RK3399PROMINIALL.ini
```
The above command will generate the miniloader file: eg. `rk3399pro_loader_v1.25.126.bin`

## 6. Flashing the FW binaries and U-Boot

### 6-a: Preparing the host-machine
To succesgfully detect and flash the board the following packages are required to be installed on the host machine

```
sudo apt-get install pkg-config libudev-dev libusb-1.0-0-dev libusb-1.0
```


### 6-b: Put the board in MaskROM mode
1. Power-off the board
2. Keep the Maskrom button pressed for 10 seconds
3. Power on the board (either by long-pressing the power button OR plugging in the Power connector)
4. Release maskrom button after 5 seconds
5. The device should now be in Maskrom mode ready for flashing
6. Check if the board has entered MaskROM mode:

```
# Check if the following device is detected:
#    Fuzhou Rockchip Electronics Company RK3399 in Mask ROM mode
lsusb
```


### 6-c: Writing the binaries to device
```
sudo ./tools/rkdeveloptool db rk3399pro_loader_v1.25.126.bin && sleep 2
sudo ./tools/rkdeveloptool wl 0x40 ../out/bin/u-boot/idbloader.img && sleep 2
sudo ./tools/rkdeveloptool wl 0x4000 ../out/bin/u-boot/u-boot.itb && sleep 2
sudo ./tools/rkdeveloptool rd
```

The TB_RK3399ProD board should restart and boot into u-boot

If you have a bootable storage device with LINUX installed connected to USB or installed in MMCslot the board should start booting the linux kernel.