Rockchip Developer Guide UBoot Nextdev

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 77

Distro Boot RKIMG Boot SPL/TPL Trust(SPL) AVB
RV1108 Y N Y N N
RK3036 Y N N N N
RK3126C Y Y N N N
RK3128 Y Y N N N
RK3229 Y N Y Y Y
RK3288 Y N Y N N
RK3308 - - - - -
RK3326/PX30 Y Y N N Y
RK3328 Y N Y Y N
RK3368/PX5 Y N Y Y N
RK3399 Y N Y Y N
U-Boot next-dev
1.20
Joseph Chen chenjh@rock-chips.com Kever Yang kever.yang@rock-chips.com Jon Lin jon.lin@ro
ck-chips.com Chen Liang cl@rock-chips.com
2018.11
U-Boot next-dev
feature
2018-02-28 V1.00
2018-06-22 V1.01 fastboot OPTEE Client
2018-07-23 V1.10
2018-07-26 V1.11 Nand SFC SPI Flash
2018-08-08 V1.12 HW-ID
2018-09-20 V1.13 CLK
2018-11-06 V1.20 / defconfig/rktest/probe/interrupt/kernel dtb/uart/atags
U-Boot next-dev
1. U-Boot next-dev
2.
2.1 DM(Driver Model)
2.2 SoC
2.3 board
2.4 defconfig
2.5 dtb
2.5.1 kernel dtb
2.5.2 kernel dtb
2.6
2.7 debug
2.7.1
2.7.1.1 debug
2.7.1.2 Early Debug UART
2.7.1.3 initcall
2.7.2
2.7.2.1 U-Boot
2.7.2.2 md/mw /
2.7.2.3 iomem
2.7.2.4 i2c
2.7.3
2.7.3.1 printf
2.7.3.2 dm
2.7.3.3 panic cpu
2.7.3.4 panic
2.7.3.5 hang relocate
2.7.3.6 crc
2.7.3.7 log
2.7.3.8
2.7.4
2.7.4.1 maskrom/loader
2.8 atags
2.9 probe
3.
3.1
3.1.1 rkbin
3.1.2 gcc
3.1.3 U-Boot
3.1.4 defconfig
3.2
3.2.1 gcc
3.2.2 menuconfig
3.2.3
3.2.4
3.2.5 pack
3.2.6 debug
3.2.7
3.2.8
3.2.8.1
3.2.8.2 loader
3.2.8.3
3.2.9
4. cache
4.1 dcache icache
4.2 dcache
4.3 icache/dcache
5.
5.1
5.1.1
5.1.2
5.2 CLOCK
5.2.1
5.2.2
5.3 GPIO
5.3.1
5.3.2
5.4 Pinctrl
5.4.1
5.4.2
5.5. I2C
5.5.1
5.5.2
5.6
5.6.1
5.6.2
5.6.3 DTS
5.6.4 defconfig
5.7 PMIC/Regulator
5.7.1
5.7.2
5.7.3
5.7.4 debug
5.8
5.8.1
5.8.2
5.8.3 DTS
5.8.4
5.8.5
5.9
5.9.1
5.9.2 DTS
5.9.3 defconfig
5.10
5.10.1
5.10.2 Early Debug UART
5.10.3
5.10.4 Pre-loader serial
5.10.5
5.11
5.11.1
5.11.2
5.12 Vendor Storage
5.12.1
5.12.2
5.12.3
5.12.4
5.13 OPTEE Client
6. USB download
6.1 rockusb
6.2 Fastboot
6.2.1 fastboot
6.2.2 fastboot
7.
7.1
7.1.1
7.1.2
7.2 dtb
7.3 boot/recovery
7.3.1 AOSP Android
7.3.2 RK
7.3.3
7.4 Kernel
7.5 resource
7.6
7.7
7.8 HW-ID
7.8.1 HW-ID
7.8.2 HW-ID
7.8.3
ADC
GPIO
7.8.4
ADC HW_ID dtb
GPIO HW_ID dtb
7.8.5
7.8.6
7.8.7 dtb
8. SPL TPL
9. U-Boot kernel DTB
9.1
9.2 live dt
9.3 fdt live dt
9.4 kernel dtb
9.5 U-Boot dts
10. U-Boot
10.1 trust_merger
10.1.1 trust
10.1.2
10.2 boot_merger
10.2.1 Loader
10.2.2
10.3 resource_tool
10.4 loaderimage
10.5 patman
10.6 buildman
10.7 mkimage
11. rktest
IRAM (SPL/TPL)
U-Boot (relocate )
fastboot
rkbin
gcc
1. U-Boot next-dev
next-dev Rockchip U-Boot v2017.09 RK
RK Android
Android AOSP( GVA)
Linux Distro
Rockchip miniloader SPL/TPL pre-loader
LVDS EDP MIPI HDMI
Emmc Nand Flash SPI Nand flash SPI NOR flash SD U
FAT EXT2 EXT4
GPT RK parameter
logo
I2C PMIC CHARGE GUAGE USB GPIO PWM GMAC EMMC NAND
RockUSB Google Fastboot USB gadget EMMC
Mass storage, ethernet, HID USB
kernel dtb
dtbo
U-Boot doc README U-Boot
2.
2.1 DM(Driver Model)
U-Boot driver-device kernel driver-device U-Boot
DM uclass driver device
Rockchip U-Boot
README
U-Boot DM U-Boot
2.2 SoC
SoC
Terminology
-----------
Uclass - a group of devices which operate in the same way. A uclass provides
   a way of accessing individual devices within the group, but always
   using the same interface. For example a GPIO uclass provides
   operations for get/set value. An I2C uclass may have 10 I2C ports,
   4 with one driver, and 6 with another.
Driver - some code which talks to a peripheral and presents a higher-level
   interface to it.
Device - an instance of a driver, tied to a particular port or peripheral.
./doc/driver-model/README.txt
./arch/arm/include/asm/arch-rockchip/qos_rk3288.h
./arch/arm/include/asm/arch-rockchip/grf_rk3188.h
./arch/arm/include/asm/arch-rockchip/pmu_rk3288.h
./arch/arm/include/asm/arch-rockchip/grf_rk3368.h
./arch/arm/include/asm/arch-rockchip/grf_rk322x.h
......
./arch/arm/mach-rockchip/rk3036/rk3036.c
./arch/arm/mach-rockchip/rk3066/sdram_rk3036.c
./arch/arm/mach-rockchip/rk3128/rk3128.c
./arch/arm/mach-rockchip/rk3188/rk3188.c
./arch/arm/mach-rockchip/rk322x/rk322x.c
......
2.3 board
Upstream U-Boot board board
RK3288 Rockchip kernel dtb
feature U-Boot eMMC dts PMIC/regulator Display IOMUX
kernel dtb U-Boot evb
board
board.c
kenrel dtb
2.4 defconfig
board defconfig
./include/configs/rk3368_common.h
./include/configs/evb_rk3288_rk1608.h
./include/configs/tinker_rk3288.h
./include/configs/evb_rk3288.h
./include/configs/vyasa-rk3288.h
......
./board/rockchip/evb_px5/evb-px5.c
./board/rockchip/evb_rk3036/evb_rk3036.c
./board/rockchip/evb_rk3128/evb_rk3128.c
./board/rockchip/evb_rk3229/evb_rk3229.c
./board/rockchip/sheep_rk3368/sheep_rk3368.c
......
./arch/arm/mach-rockchip/board.c
./board/rockchip/evb_rv1108/README
./board/rockchip/sheep_rk3368/README
./board/rockchip/gva_rk3229/README
./board/rockchip/evb_rk3399/README
./board/rockchip/evb_rk3328/README
......
defconfig defconfig
[board]-[chip]_defconfig
2.5 dtb
2.5.1 kernel dtb
U-Boot
1. relocate U-Boot dtb
emmc nand cru grf uart dts
clk dtb
dtb pinctrl-0 pinctrl-names clock-
names interrupt-parent defconfig CONFIG_OF_SPL_REMOVE_PROPS
"status=okay" "u-boot,dm-pre-reloc;"
[chip]-u-boot.dtsi
./arch/arm/dts/px30-u-boot.dtsi
2. relocate kernel dtb
./configs/evb-rk3328_defconfig
./configs/evb-rk3036_defconfig
./configs/evb-rk3229_defconfig
./configs/firefly-rk3288_defconfig
./configs/evb-rk3399_defconfig
......
./arch/arm/dts/px30-u-boot.dtsi
./arch/arm/dts/rk3399-u-boot.dtsi
./arch/arm/dts/rk3128-u-boot.dtsi
......
......
&nandc0 {
u-boot,dm-pre-reloc;
};
&emmc {
u-boot,dm-pre-reloc;
};
&cru {
u-boot,dm-pre-reloc;
};
......
kernel dtb( CONFIG_USING_KERNEL_DTB
kernel dtb
kernel dtb
9. U-Boot kernel DTB
2.5.2 kernel dtb
kernel dtb U-Boot U-Boot dtb
rk3399 rk3399-evb.dts rk3399_defconfig
rk3399_defconfig CONFIG_USING_KERNEL_DTB
rk3399-evb.dts #include "rk3399-u-boot.dtsi" chosen “u-boot,dm-pre-
reloc;” U-Boot
kernel dts
2.6
rk3399
./include/configs/rockchip-common.h
./include/configs/evb_rk3399.h
./include/configs/rockchip-common.h
./include/configs/evb_rk3399.h
./include/configs/rk3399_common.h
configs/rk3399_defconfig
arch/arm/mach-rockchip/Kconfig
......
#define RKIMG_DET_BOOTDEV \              //
"rkimg_bootdev=" \
"if mmc dev 1 && rkimgtest mmc 1; then " \
"setenv devtype mmc; setenv devnum 1; echo Boot from SDcard;" \
"elif mmc dev 0; then " \
"setenv devtype mmc; setenv devnum 0;" \
"elif rknand dev 0; then " \
"setenv devtype rknand; setenv devnum 0;" \
   "elif rksfc dev 0; then " \
       "setenv devtype rksfc; setenv devnum 0;" \
"fi; \0"
#define RKIMG_BOOTCOMMAND \             // kernel
"boot_android ${devtype} ${devnum};" \      // AOSP
"bootrkp;" \                   // rockchip
"run distro_bootcmd;"              // linux
......
./include/configs/rk3399_common.h
2.7 debug
U-Boot debug kernel dump_stack()
debug
2.7.1
2.7.1.1 debug
debug() DEBUG debug()
U-Boot
common ./include/configs/rkxxx_common.h
......
#ifndef CONFIG_SPL_BUILD
#undef CONFIG_BOOTCOMMAND
#define CONFIG_BOOTCOMMAND RKIMG_BOOTCOMMAND   // U-Boot
RKIMG_BOOTCOMMAND
#endif
......
#define ROCKCHIP_DEVICE_SETTINGS \        //
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
......
......
#ifndef CONFIG_SPL_BUILD
#define ENV_MEM_LAYOUT_SETTINGS \    //
"scriptaddr=0x00500000\0" \
"pxefile_addr_r=0x00600000\0" \
"fdt_addr_r=0x01f00000\0" \
"kernel_addr_r=0x02080000\0" \
"ramdisk_addr_r=0x0a200000\0"
#include <config_distro_bootcmd.h>
#define CONFIG_EXTRA_ENV_SETTINGS \   //
ENV_MEM_LAYOUT_SETTINGS \
"partitions=" PARTS_DEFAULT \    // GPT
ROCKCHIP_DEVICE_SETTINGS \
RKIMG_DET_BOOTDEV \
BOOTENV               // linux
#endif
#define CONFIG_PREBOOT          // CONFIG_BOOTCOMMAND
......
#define DEBUG
2.7.1.2 Early Debug UART
5.10.2 Early Debug UART
2.7.1.3 initcall
U-Boot board_f.c board_r.c init_sequence_f[] init_sequence_r[]
initcall_run_list() debug
printf
initcall_run_list()
initcall
3.2.6 debug
2.7.2
2.7.2.1 U-Boot
U-Boot "?"
./common/board_f.c
./common/board_r.c
./lib/initcall.c
U-Boot 2017.09-01725-g03b8d3b-dirty (Jul 06 2018 - 10:08:27 +0800)
initcall: 0000000000214388
initcall: 0000000000214724
Model: Rockchip RK3399 Evaluation Board
initcall: 0000000000214300
DRAM: initcall: 0000000000203f68
initcall: 0000000000214410
initcall: 00000000002140dc
....
initcall: 00000000002143a8
initcall: 00000000002143cc
3.8 GiB
initcall: 00000000002143b8
initcall: 00000000002141f8
initcall: 00000000002143c0
initcall: 000000000021423c
Relocation Offset is: f5c03000
initcall: 00000000f5e176bc
initcall: 00000000f5e174a8
initcall: 00000000002146a4 (relocated to 00000000f5e176a4)
initcall: 0000000000214668 (relocated to 00000000f5e17668)
initcall: 00000000002146c4 (relocated to 00000000f5e176c4)
initcall: 0000000000202900 (relocated to 00000000f5e05900)
....
U-Boot 2
1. defconfig CONFIG_BOOTDELAY=<seconds> U-Boot
2. U-Boot ctrl + c
2.7.2.2 md/mw /
U-Boot "md" "mw"
1. 0x76000000 0x10 4byte
2. 0x76000000 0xffff0000
=> ?
?    - alias for 'help'
base  - print or set address offset
bdinfo - print Board Info structure
boot  - boot default, i.e., run 'bootcmd'
boot_android- Execute the Android Bootloader flow.
bootd  - boot default, i.e., run 'bootcmd'
bootefi - Boots an EFI payload from memory
bootelf - Boot from an ELF image in memory
......
//
md - memory display
Usage: md [.b, .w, .l, .q] address [# of objects]
//
mw - memory write (fill)
Usage: mw [.b, .w, .l, .q] address value [count]
.b 1 byte;
.w 2 byte;
.l 4 byte; ( )
.q 8 byte;
=> md.l 0x76000000 0x10
76000000: fffffffe ffffffff ffffffff ffffffff  ................
76000010: ffffffdf ffffffff feffffff ffffffff  ................
76000020: ffffffff ffffffff ffffffff ffffffff  ................
76000030: ffffffff ffffffff ffffffff ffffffff  ................
3. 0x76000000 0x10 0xffff0000
4byte
2.7.2.3 iomem
md
iomem dts device iomem
<compatible> grf grf compatible
rockchip,px30-grf” "rockchip,rk3368-grf"
device
=> mw.l 0x76000000 0xffff0000
=> md.l 0x76000000 0x10 //
76000000: ffff0000 ffffffff ffffffff ffffffff  ................
76000010: ffffffdf ffffffff feffffff ffffffff  ................
76000020: ffffffff ffffffff ffffffff ffffffff  ................
76000030: ffffffff ffffffff ffffffff ffffffff  ................
=> mw.l 0x76000000 0xffff0000 0x10
=> md.l 0x76000000 0x10 //
76000000: ffff0000 ffff0000 ffff0000 ffff0000  ................
76000010: ffff0000 ffff0000 ffff0000 ffff0000  ................
76000020: ffff0000 ffff0000 ffff0000 ffff0000  ................
76000030: ffff0000 ffff0000 ffff0000 ffff0000  ................
=> iomem
iomem - Show iomem data by device compatible
Usage:
iomem iomem <compatible> <start offset> <end offset>
eg: iomem -grf 0x0 0x200
=> iomem -grf 0x0 0x50
rockchip,rk3228-grf:
11000000: 00000000 00000000 00004000 00002000
11000010: 00000000 00005028 0000a5a5 0000aaaa
11000020: 00009955 00000000 00000000 00000000
11000030: 00000000 00000000 00000000 00000000
11000040: 00000000 00000000 00000000 00000000
11000050: 0000090f
2.7.2.4 i2c
U-Boot "i2c" i2c
1.
2.
./arch/arm/mach-rockchip/iomem.c
./include/iomem.h
void iomem_show(const char *label, unsigned long base, size_t start, size_t end);
void iomem_show_by_compatible(const char *compat, size_t start, size_t end);
=> i2c
i2c - I2C sub-system
Usage:
i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
i2c dev [dev] - show or set current I2C bus
i2c edid chip - print EDID configuration information
i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device
i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)
i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)
i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)
i2c probe [address] - test for and show device(s) on the I2C bus
i2c read chip address[.0, .1, .2] length memaddress - read to memory
i2c write memaddress chip address[.0, .1, .2] length [-s] - write memory
    to I2C; the -s option selects bulk write in a single transaction
i2c flags chip [flags] - set or get chip flags
i2c olen chip [offset_length] - set or get chip offset length
i2c reset - re-init the I2C Controller
i2c speed [speed] - show or set I2C bus speed
=> i2c dev 0 // i2c0
Setting bus to 0
=> i2c md 0x1b 0x2e 0x20 // i2c 1b(7 ) 0x2e 0x20
002e: 11 0f 00 00 11 0f 00 00 01 00 00 00 09 00 00 0c  ................
003e: 00 0a 0a 0c 0c 0c 00 07 07 0a 00 0c 0c 00 00 00  ................
=> i2c dev 0 // i2c0
Setting bus to 0
=> i2c mw 0x1b 0x2e 0x10 // i2c 1b(7 ) 0x2e 0x10
=> i2c md 0x1b 0x2e 0x20 // "1. "
002e: 10 0f 00 00 11 0f 00 00 01 00 00 00 09 00 00 0c ................
003e: 00 0a 0a 0c 0c 0c 00 07 07 0a 00 0c 0c 00 00 00 ................
2.7.3
2.7.3.1 printf
U-Boot printf
CONFIG_BOOTSTAGE_PRINTF_TIMESTAMP
0 timer
RK3399
[ 0.259266] U-Boot 2017.09-01739-g856f373-dirty (Jul 10 2018 - 20:26:05 +0800)
[ 0.260596] Model: Rockchip RK3399 Evaluation Board
[ 0.261332] DRAM: 3.8 GiB
Relocation Offset is: f5bfd000
Using default environment
[ 0.354038] dwmmc@fe320000: 1, sdhci@fe330000: 0
[ 0.521125] Card did not respond to voltage select!
[ 0.521188] mmc_init: -95, time 9
[ 0.671451] switch to partitions #0, OK
[ 0.671500] mmc0(part 0) is current device
[ 0.675507] boot mode: None
[ 0.683738] DTB: rk-kernel.dtb
[ 0.706940] Using kernel dtb
......
U-Boot
2.7.3.2 dm
U-Boot "dm" dm U-Boot
U-Boot
dm "status=okay" device-driver
device dm driver
probe
uclass device
device parent-child
=> dm
dm - Driver model low level access
Usage:
dm tree Dump driver model tree ('*' = activated)
dm uclass Dump list of instances for each uclass
dm devres Dump list of device resources for each device
1
=> dm tree
Class Probed Driver Name
----------------------------------------------------------
root [ + ] root_driver root_driver
syscon [ ] rk322x_syscon |-- syscon@11000000
serial [ + ] ns16550_serial |-- serial@11030000
clk [ + ] clk_rk322x |-- clock-controller@110e0000
sysreset [ ] rockchip_sysreset | |-- sysreset
reset [ ] rockchip_reset | `-- reset
mmc [ + ] rockchip_rk3288_dw_mshc |-- dwmmc@30020000
blk [ + ] mmc_blk | `-- dwmmc@30020000.blk
ram [ ] rockchip_rk322x_dmc |-- dmc@11200000
syscon [ ] rk322x_syscon |-- syscon@31090000
clk [ + ] fixed_rate_clock |-- oscillator
syscon [ + ] rk322x_syscon |-- syscon@11000000
phy [ ] rockchip_usb2phy | |-- usb2-phy@760
phy [ ] rockchip_usb2phy_port | | |-- otg-port
phy [ ] rockchip_usb2phy_port | | `-- host-port
phy [ ] rockchip_usb2phy | `-- usb2-phy@800
phy [ ] rockchip_usb2phy_port | |-- otg-port
phy [ ] rockchip_usb2phy_port | `-- host-port
serial [ + ] ns16550_serial |-- serial@11020000
i2c [ + ] i2c_rockchip |-- i2c@11050000
......
2
=> dm uclass
uclass 0: root
- * root_driver @ 7be54c88, seq 0, (req -1)
uclass 10: simple_bus
uclass 11: adc
- * saradc@ff100000 @ 7be56220, seq 0, (req -1)
uclass 13: blk
- dwmmc@ff0c0000.blk @ 7be54ea0
- * dwmmc@ff0f0000.blk @ 7be550e8, seq 0, (req -1)
- dwmmc@ff0d0000.blk @ 7be55da0
uclass 14: clk
- * oscillator @ 7be55b50, seq 0, (req -1)
- * clock-controller@ff760000 @ 7be7d058, seq 1, (req -1)
- * external-gmac-clock @ 7be80c58, seq 2, (req -1)
- * xin32k @ 7be814c8, seq 3, (req -1)
uclass 17: display
- * dp@ff970000 @ 7be7d2c8, seq 0, (req -1)
uclass 21: firmware
- psci @ 7be810a8
uclass 22: i2c
- * i2c@ff650000 @ 7be562c8, seq 0, (req 0)
- i2c@ff140000 @ 7be7c838, seq -1, (req 1)
- i2c@ff150000 @ 7be7c890, seq -1, (req 3)
- i2c@ff160000 @ 7be7c8e8, seq -1, (req 4)
- i2c@ff660000 @ 7be7c9b0, seq -1, (req 2)
uclass 24: i2c_generic
uclass 34: mmc
- * dwmmc@ff0c0000 @ 7be54d10, seq 1, (req 1)
- * dwmmc@ff0f0000 @ 7be54f78, seq 0, (req 0)
- dwmmc@ff0d0000 @ 7be55c30
uclass 39: panel
- * edp-panel @ 7be80bd0, seq 0, (req -1)
uclass 40: backlight
- * backlight @ 7be81178, seq 0, (req -1)
uclass 77: key
- rockchip-key @ 7be811f0
......
2.7.3.3 panic cpu
U-Boot panic panic CPU
CPU
* Relocate offset = 000000003db55000
* ELR(PC) = 000000000025bd78
* LR = 000000000025def4
* SP = 0000000039d4a6b0
* ESR_EL2 = 0000000040732550
EC[31:26] == 001100, Exception from an MCRR or MRRC access
IL[25] == 0, 16-bit instruction trapped
* DAIF = 00000000000003c0
D[9] == 1, DBG masked
A[8] == 1, ABORT masked
I[7] == 1, IRQ masked
F[6] == 1, FIQ masked
* SPSR_EL2 = 0000000080000349
D[9] == 1, DBG masked
A[8] == 1, ABORT masked
I[7] == 0, IRQ not masked
F[6] == 1, FIQ masked
M[4] == 0, Exception taken from AArch64
M[3:0] == 1001, EL2h
* SCTLR_EL2 = 0000000030c51835
I[12] == 1, Icaches enabled
C[2] == 1, Dcache enabled
M[0] == 1, MMU enabled
* VBAR_EL2 = 000000003dd55800
* HCR_EL2 = 000000000800003a
* TTBR0_EL2 = 000000003fff0000
x0 : 00000000ff300000 x1 : 0000000054808028
x2 : 000000000000002f x3 : 00000000ff160000
x4 : 0000000039d7fe80 x5 : 000000003de24ab0
......
x28: 0000000039d81ef0 x29: 0000000039d4a910
EC[31:26] panic pc lr sp
3.2.6 debug
2.7.3.4 panic
U-Boot panic dump cru pmucru, grf
pmugrf
CONFIG_ROCKCHIP_CRASH_DUMP
cpu panic
......
* VBAR_EL2 = 000000003dd55800
* HCR_EL2 = 000000000800003a
* TTBR0_EL2 = 000000003fff0000
x0 : 00000000ff300000 x1 : 0000000054808028
x2 : 000000000000002f x3 : 00000000ff160000
......
// dump
rockchip,px30-cru:
ff2b0000: 0000304b 00001441 00000001 00000007
ff2b0010: 00007f00 00000000 00000000 00000000
ff2b0020: 00003053 00001441 00000001 00000007
......
rockchip,px30-grf:
ff140000: 00002222 00002222 00002222 00001111
ff140010: 00000000 00000000 00002200 00000033
ff140020: 00000000 00000000 00000000 00000202
......
vim ./arch/arm/lib/interrupts_64.c
void show_regs(struct pt_regs *regs)
{
......
#ifdef CONFIG_ROCKCHIP_CRASH_DUMP
iomem_show_by_compatible("-cru", 0, 0x400);
iomem_show_by_compatible("-pmucru", 0, 0x400);
iomem_show_by_compatible("-grf", 0, 0x400);
iomem_show_by_compatible("-pmugrf", 0, 0x400);
/* tobe add here ... */
#endif
}
2.7.3.5 hang relocate
U-Boot hang
log JTAG
CONFIG_ROCKCHIP_DEBUGGER U-Boot 5s
kernel 5s dump CPU PANIC
>>> Rockchip Debugger:
* Relocate offset = 000000003db55000
* ELR(PC) = 000000000025bd78
* LR = 000000000025def4
* SP = 0000000039d4a6b0
* ESR_EL2 = 0000000040732550
<NULL> // hang CPU EC[31:26]
IL[25] == 0, 16-bit instruction trapped
* DAIF = 00000000000003c0
D[9] == 1, DBG masked
A[8] == 1, ABORT masked
I[7] == 1, IRQ masked
F[6] == 1, FIQ masked
* SPSR_EL2 = 0000000080000349
D[9] == 1, DBG masked
A[8] == 1, ABORT masked
I[7] == 0, IRQ not masked
2.7.3.6 crc
img CRC U-Boot
CRC
CONFIG_ROCKCHIP_CRC
U-Boot
=Booting Rockchip format image=
kernel image CRC32 verify... okay. // kernel “fail
boot image CRC32 verify... okay. // boot “fail
kernel @ 0x02080000 (0x01249808)
ramdisk @ 0x0a200000 (0x001e6650)
## Flattened Device Tree blob at 01f00000
Booting using the fdt blob at 0x1f00000
'reserved-memory' secure-memory@20000000: addr=20000000 size=10000000
Loading Ramdisk to 08019000, end 081ff650 ... OK
Loading Device Tree to 0000000008003000, end 0000000008018c97 ... OK
Adding bank: start=0x00200000, size=0x08200000
Adding bank: start=0x0a200000, size=0xede00000
Starting kernel ...
CRC U-Boot
2.7.3.7 log
pre-loader => trust => U-Boot => kernel
1
trust U-Boot
trust "INFO: Entry point address = 0x200000" "INF [0x0] TEE-
CORE:init_primary_helper:379: Next entry point address: 0x60000000" U-Boot
3.2.4
U-Boot 64 SDRAM 2M 32 SDRAM 0
64 trust
NOTICE: BL31: v1.3(debug):d98d16e
NOTICE: BL31: Built : 15:03:07, May 10 2018
NOTICE: BL31: Rockchip release version: v1.1
INFO: GICv3 with legacy support detected. ARM GICV3 driver initialized in EL3
INFO: Using opteed sec cpu_context!
INFO: boot cpu mask: 0
INFO: plat_rockchip_pmu_init(1151): pd status 3e
INFO: BL31: Initializing runtime services
INFO: BL31: Initializing BL32
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x200000 // U-Boot
INFO: SPSR = 0x3c9
32 trust
INF [0x0] TEE-CORE:init_primary_helper:378: Release version: 1.9
INF [0x0] TEE-CORE:init_primary_helper:379: Next entry point address: 0x60000000 // U-
Boot
INF [0x0] TEE-CORE:init_teecore:83: teecore inits done
2
U-Boot commit-id
b34f08b 'g'
U-Boot 2017.09-01730-gb34f08b (Jul 06 2018 - 17:47:52 +0800)
"dirty" git
commit b34f08b
U-Boot 2017.09-01730-gb34f08b-dirty (Jul 06 2018 - 17:35:04 +0800)
2.7.3.8
pre-loader loader
SdmmcInit=0 1
StorageInit ok = 30370
tag:LOADER error,addr:0x2000
hdr 032c77e4 + 0x0:0x20534f54,0x20202020,0x00000000,0x00000000,
tag:LOADER error,addr:0x4000
hdr 032c77e4 +
0x0:0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
tag:LOADER error,addr:0x2800
hdr 032c77e4 + 0x0:0x20534f54,0x20202020,0x00000000,0x00000000,
tag:LOADER error,addr:0x4800
......
"part" 7.1
2.7.4
2.7.4.1 maskrom/loader
U-Boot U-Boot
1. recovery loader loader
2. recovery loader maskrom
3.2.8
2.8 atags
kernel loader trust bl31 trust os U-Boot
atags atags
U-Boot kernel bl31 trust os
ddr
./arch/arm/include/asm/arch-rockchip/rk_atags.h
./arch/arm/mach-rockchip/rk_atags.c
2.9 probe
5.
3.
3.1
3.1.1 rkbin
rkbin Rockchip bin trust loader
bin
rkbin U-Boot rkbin U-Boot
rkbin bin U-Boot trust.img
uboot.img loader
rkbin
3.1.2 gcc
gcc-linaro-6.3.1 gcc
32 gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf
64 gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu
3.1.3 U-Boot
U-Boot next-dev
remotes/origin/next-dev
U-Boot ./Makefile v2017-09
SPDX-License-Identifier: GPL-2.0+
VERSION = 2017
PATCHLEVEL = 09
SUBLEVEL =
EXTRAVERSION =
NAME =
3.1.4 defconfig
defconfig commit:58d85a1
kernel dtb board_r[] kernel dtb
clk kernel dtb defconfig
uboot.bin size
kernel dtb defconfig kernel
dtb 9. U-Boot kernel DTB
defconfig kernel dtb
rv1108 evb-rv1108_defconfig N
rk1808 rk1808_defconfig Y
rk3128x rk3128x_defconfig Y
rk3128 evb-rk3128_defconfig N
rk3126 rk3126_defconfig Y
rk322x rk322x_defconfig Y
rk3288 rk3288_defconfig Y
rk3368 rk3368_defconfig Y
rk3328 rk3328_defconfig Y
rk3399 rk3399_defconfig Y
rk3399pro-npu rk3399pro-npu_defconfig Y
rk3308(aarch32) rk3308-aarch32_defconfig Y
rk3308(aarch32) evb-aarch32-rk3308_defconfig N
rk3308(aarch64) evb-rk3308_defconfig Y
px30 evb-px30_defconfig Y
rk3326 evb-rk3326_defconfig Y
3.2
3.2.1 gcc
Rockchip prebuilts U-Boot gcc-linaro-6.3.1
../prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin
../prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin
./make.sh
# debug
ADDR2LINE_ARM32=arm-linux-gnueabihf-addr2line
ADDR2LINE_ARM64=aarch64-linux-gnu-addr2line
# debug
OBJ_ARM32=arm-linux-gnueabihf-objdump
OBJ_ARM64=aarch64-linux-gnu-objdump
#
GCC_ARM32=arm-linux-gnueabihf-
GCC_ARM64=aarch64-linux-gnu-
TOOLCHAIN_ARM32=../prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-
gnueabihf/bin
TOOLCHAIN_ARM64=../prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-
x86_64_aarch64-linux-gnu/bin
3.2.2 menuconfig
U-Boot kernel Kbuild make menuconfig
make savedefconfig
3.2.3
./make.sh --help
./make.sh [board] ---- [board] configs/[board]_defconfig
1.
32 64 defconfig [board]
.config
./make.sh rk3399 ---- build for rk3399_defconfig
./make.sh evb-rk3399 ---- build for evb-rk3399_defconfig
./make.sh firefly-rk3288 ---- build for firefly-rk3288_defconfig
......
Platform RK3399 is build OK, with new .config(make evb-rk3399_defconfig)
2.
32 64 .config [board]
./make.sh
......
Platform RK3399 is build OK, with exist .config
3.2.4
1. trust uboot loader U-Boot
./uboot.img
./trust.img
./rk3126_loader_v2.09.247.bin
2. INI
uboot.img
load addr is 0x60000000! // U-Boot
pack input rockdev/rk3126/out/u-boot.bin
pack file size: 478737
crc = 0x840f163c
uboot version: v2017.12 Dec 11 2017
pack uboot.img success!
pack uboot okay! Input: rockdev/rk3126/out/u-boot.bin
loader
out:rk3126_loader_v2.09.247.bin
fix opt:rk3126_loader_v2.09.247.bin
merge success(rk3126_loader_v2.09.247.bin)
pack loader okay! Input: /home/guest/project/rkbin/RKBOOT/RK3126MINIALL.ini
trust.img
load addr is 0x68400000! // trust
pack file size: 602104
crc = 0x9c178803
trustos version: Trust os
pack ./trust.img success!
trust.img with ta is ready
pack trust okay! Input: /home/guest/project/rkbin/RKTRUST/RK3126TOS.ini
make clean/mrproper/distclean Makefile
bin loader .bin
.bin U-Boot
3.2.5 pack
./make.sh [loader|loader-all|uboot|trust]
U-Boot
.config
./make.sh trust --- trust.img
./make.sh loader --- loader bin
./make.sh loader-all --- loader bin
./make.sh uboot --- uboot.img
loader-all loader
loader spi nor flash...
U-Boot loader loader
"loader-all"
rk3399 "loader-all"
./rk3399_loader_v1.12.112.bin // emmc nand loader
./rk3399_loader_spinor_v1.12.114.bin // spi nor flash loader
3.2.6 debug
./make.sh [elf|map|sym|addr]
.config
./make.sh elf --- -D
./make.sh elf-S --- -S
./make.sh elf-d --- -d
./make.sh map --- u-boot.map
./make.sh sym --- u-boot.sym
./make.sh <addr> --- addr
addr
add
guest@ubuntu:~/u-boot$ ./make.sh 000000000024fb1c
000000000024fb1c l F .text 000000000000004c spi_child_pre_probe
/home/guest/u-boot/drivers/spi/spi-uclass.c:153
guest@ubuntu:~/u-boot$ ./make.sh 000000000024fb1c
??:0
elf
elf[option] elf-d” “elf-D” “elf-S” [option] objdump
[option] “elf “-D” [option]
./make.sh elf-H ----- help
3.2.7
make clean/mrproper/distclean
1. make clean:
Delete most generated files Leave enough to build external modules
2. make mrproper:
Delete the current configuration, and all generated files
3. make distclean:
Remove editor backup files, patch leftover files and the like Directories & files
removed with 'make clean
distclean > mrproper > clean
1
UPD include/config/uboot.release
Using .. as source for U-Boot
.. is not clean, please run 'make mrproper'
in the '..' directory.
CHK include/generated/version_autogenerated.h
UPD include/generated/version_autogenerated.h
make[1]: *** [prepare3] Error 1
make[1]: *** Waiting for unfinished jobs....
HOSTLD scripts/dtc/dtc
make[1]: Leaving directory `/home/guest/uboot-nextdev/u-boot/rockdev'
make: *** [sub-make] Error 2
Makefile
make mrproper
2
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/
config/kernel.release'. Stop.
make mrproper distclean
3.2.8
3.2.8.1
Windows v2.5 ( )
3.2.8.2 loader
USB " +" loader
3.2.8.3
U-Boot
1. "rbrom" maskrom
2. “rockusb 0 mmc 0” loader "rknand"
3.2.9
1. U-Boot RK parameter GPT
2. Nand EMMC
3. GPT RK parameter Rockchip-Parameter-File-Format-Version1.4.md
7.1
4. cache
cache U-Boot
4.1 dcache icache
CONFIG_SYS_ICACHE_OFF icache
CONFIG_SYS_DCACHE_OFF dcache
Rockchip icache dcache
4.2 dcache
CONFIG_SYS_ARM_CACHE_WRITETHROUGH: dcache writethrouch
CONFIG_SYS_ARM_CACHE_WRITEALLOC: dcache writealloc
dcache writeback
Rockchip dcache writeback
4.3 icache/dcache
icache
void icache_enable (void);
void icache_disable (void);
void invalidate_icache_all(void);
dcache
void dcache_disable (void);
void enable_caches(void);
void flush_cache(unsigned long, unsigned long);
void flush_dcache_all(void);
void flush_dcache_range(unsigned long start, unsigned long stop);
void invalidate_dcache_range(unsigned long start, unsigned long stop);
void invalidate_dcache_all(void);
5.
U-Boot DM kernel device-driver
kernel initcall driver probe U-Boot
probe U-Boot probe
5.1
5.1.1
U-Boot
GICv2/v3
U-Boot cpu
CONFIG_ROCKCHIP_DEBUGGER
./drivers/irq/irq-gpio-switch.c
./drivers/irq/irq-gpio.c
./drivers/irq/irq-generic.c
./drivers/irq/irq-gic.c
./include/irq-generic.h
./include/dm/uclass.h
int uclass_get_device(enum uclass_id id, int index, struct udevice **devp);
int uclass_get_device_by_name(enum uclass_id id, const char *name,
int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp);
int uclass_get_device_by_of_offset(enum uclass_id id, int node, struct udevice **devp);
int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node, struct udevice **devp);
int uclass_get_device_by_phandle_id(enum uclass_id id, int phandle_id, struct udevice
**devp);
int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent, struct
udevice **devp);
int uclass_get_device_by_driver(enum uclass_id id, const struct driver *drv, struct
udevice **devp);
int uclass_get_device_tail(struct udevice *dev, int ret, struct udevice **devp);
......
5.1.2
1. CPU
void enable_interrupts(void);
int disable_interrupts(void);
2. IRQ
3 gpio irq
1 gpio struct gpio_desc
int gpio_to_irq(struct gpio_desc *gpio);
* dts
battery {
compatible = "battery,rk817";
......
dc_det_gpio = <&gpio2 7 GPIO_ACTIVE_LOW>;
......
};
2 gpio phandle pin
int phandle_gpio_to_irq(u32 gpio_phandle, u32 pin); --
./drivers/input/rk8xx_pwrkey.c
* dts
rk817 GPIO0_A7
struct gpio_desc *dc_det;
int ret, irq;
ret = gpio_request_by_name_nodev(dev_ofnode(dev), "dc_det_gpio", 0, dc_det,
GPIOD_IS_IN);
if (!ret) {
irq = gpio_to_irq(dc_det);
irq_install_handler(irq, ...);
irq_set_irq_type(irq, IRQ_TYPE_EDGE_FALLING);
irq_handler_enable(irq);
}
rk817: pmic@20 {
compatible = "rockchip,rk817";
reg = <0x20>;
......
interrupt-parent = <&gpio0>; // "gpio0": phandle gpio0
interrupts = <7 IRQ_TYPE_LEVEL_LOW>; // "7": pin
......
};
3 GPIO
int hard_gpio_to_irq(unsigned gpio);
* gpio gpio Rockchip
GPIO0_A0
3. / / handler
u32 interrupt[2], phandle;
int irq, ret;
phandle = dev_read_u32_default(dev->parent, "interrupt-parent", -1);
if (phandle < 0) {
printf("failed get 'interrupt-parent', ret=%d\n", phandle);
return phandle;
}
ret = dev_read_u32_array(dev->parent, "interrupts", interrupt, 2);
if (ret) {
printf("failed get 'interrupt', ret=%d\n", ret);
return ret;
}
irq = phandle_gpio_to_irq(phandle, interrupt[0]);
irq_install_handler(irq, pwrkey_irq_handler, dev);
irq_set_irq_type(irq, IRQ_TYPE_EDGE_FALLING);
irq_handler_enable(irq);
int gpio0_a0, irq;
gpio = RK_IRQ_GPIO(RK_GPIO0, RK_PA0);
irq = hard_gpio_to_irq(gpio0_a0);
irq_install_handler(irq, ...);
irq_handler_enable(irq);
void irq_install_handler(int irq, interrupt_handler_t *handler, void *data);
void irq_free_handler(int irq);
int irq_handler_enable(int irq);
int irq_handler_disable(int irq);
int irq_set_irq_type(int irq, unsigned int type);
5.2 CLOCK
5.2.1
CLK clk-uclass uclass
1. probe rkclk_init PLL CPU SPL
2. probe clk_set_defaults cru assigned-clock
./drivers/clk/rockchip/clk_rk3399.c
static void rkclk_init(struct rk3399_cru *cru)
{
rk3399_configure_cpu(cru, APLL_600_MHZ, CPU_CLUSTER_LITTLE);
/* configure perihp aclk, hclk, pclk */
aclk_div = DIV_ROUND_UP(GPLL_HZ, PERIHP_ACLK_HZ) - 1;
hclk_div = PERIHP_ACLK_HZ / PERIHP_HCLK_HZ - 1;
assert((hclk_div + 1) * PERIHP_HCLK_HZ ==
   PERIHP_ACLK_HZ && (hclk_div <= 0x3));
pclk_div = PERIHP_ACLK_HZ / PERIHP_PCLK_HZ - 1;
assert((pclk_div + 1) * PERIHP_PCLK_HZ ==
   PERIHP_ACLK_HZ && (pclk_div <= 0x7));
rk_clrsetreg(&cru->clksel_con[14],
  PCLK_PERIHP_DIV_CON_MASK | HCLK_PERIHP_DIV_CON_MASK |
  ACLK_PERIHP_PLL_SEL_MASK | ACLK_PERIHP_DIV_CON_MASK,
  pclk_div << PCLK_PERIHP_DIV_CON_SHIFT |
  hclk_div << HCLK_PERIHP_DIV_CON_SHIFT |
  ACLK_PERIHP_PLL_SEL_GPLL << ACLK_PERIHP_PLL_SEL_SHIFT |
  aclk_div << ACLK_PERIHP_DIV_CON_SHIFT);
rkclk_set_pll(&cru->gpll_con[0], &gpll_init_cfg);
}
./drivers/clk/rockchip/clk_px30.c
ret = clk_set_defaults(dev);
if (ret)
debug("%s clk_set_defaults failed %d\n", __func__, ret);
3. CPU
CPU 2
regulator regulator-init-microvolt=<...>
./drivers/clk/clk-uclass.c
./drivers/clk/rockchip/clk_rkxxx.c
./drivers/clk/rockchip/clk_pll.c
drivers/clk/rockchip , clk_pll.c
5.2.2
1. clk
clk-ops clk
./arch/arm64/boot/dts/rockchip/px30.dtsi
......
assigned-clocks =
<&pmucru PLL_GPLL>, <&pmucru PCLK_PMU_PRE>,
<&pmucru SCLK_WIFI_PMU>, <&cru ARMCLK>,
<&cru ACLK_BUS_PRE>, <&cru ACLK_PERI_PRE>,
<&cru HCLK_BUS_PRE>, <&cru HCLK_PERI_PRE>,
<&cru PCLK_BUS_PRE>, <&cru SCLK_GPU>;
assigned-clock-rates =
<1200000000>, <100000000>,
<26000000>, <600000000>,
<200000000>, <200000000>,
<150000000>, <150000000>,
<100000000>, <200000000>;
......
./arch/arm64/boot/dts/rockchip/px30-evb-ddr4-v10.dts
......
vdd_arm: DCDC_REG2 {
......
regulator-init-microvolt = <1100000>;
......
};
ulong (*get_rate)(struct clk *clk);
ulong (*set_rate)(struct clk *clk, ulong rate);
int (*get_phase)(struct clk *clk);
int (*set_phase)(struct clk *clk, int degrees);
int (*set_parent)(struct clk *clk, struct clk *parent);
2.
3. clk init
init:
probe rkclk_init() PLL CPU BUS
clk_set_defaults dev cru assigned-clocks
cru assigned-clocks VOP GMAC
PARENT
eMMC, I2C clk_get_by_indel() clk_get_by_name()
clk , clk_set_rate()
4. clk dump
clks_dump ID soc_clk_dump() PLL CPU
U-Boot clock , SoC clock ,
clock
5.3 GPIO
5.3.1
GPIO gpio-uclass uclass GPIO
struct gpio_desc device gpio device
ret = clk_get_by_name(crtc_state->dev, "dclk_vop", &dclk);
/* clocks = <&cru ACLK_VOPB>, <&cru DCLK_VOPB>, <&cru HCLK_VOPB>; */
ret = clk_get_by_index(rtc_state->dev, 1, &dclk)
if (!ret)
ret = clk_set_rate(&dclk, mode->clock * 1000);
if (IS_ERR_VALUE(ret)) {
printf("%s: Failed to set dclk: ret=%d\n", __func__, ret);
return ret;
}
./include/asm-generic/gpio.h
./drivers/gpio/gpio-uclass.c
./drivers/gpio/rk_gpio.c
5.3.2
1. gpio struct gpio_desc
int gpio_request_by_name(struct udevice *dev, const char *list_name,
int index, struct gpio_desc *desc, int flags);
int gpio_request_by_name_nodev(ofnode node, const char *list_name, int index,
struct gpio_desc *desc, int flags);
int gpio_request_list_by_name(struct udevice *dev, const char *list_name,
struct gpio_desc *desc_list, int max_count, int flags);
int gpio_request_list_by_name_nodev(ofnode node, const char *list_name,
struct gpio_desc *desc_list, int max_count, int
flags);
int dm_gpio_free(struct udevice *dev, struct gpio_desc *desc)
device gpio struct gpio_desc
2. gpio input/out
int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags);
flags GPIOD_IS_OUT GPIOD_IS_IN
3. gpio set/get
int dm_gpio_get_value(const struct gpio_desc *desc)
int dm_gpio_set_value(const struct gpio_desc *desc, int value)
dm_gpio_get_value() dts GPIO_ACTIVE_LOW/HIGH
1 0 gpios = <&gpio 0
GPIO_ACTIVE_LOW> 1 0
4.
struct gpio_desc *gpio;
int value;
gpio_request_by_name(dev, "gpios", 0, gpio, GPIOD_IS_OUT); // gpio
dm_gpio_set_value(gpio, enable);              // gpio
dm_gpio_set_dir_flags(gpio, GPIOD_IS_IN);          // gpio
value = dm_gpio_get_value(gpio);              // gpio
5.4 Pinctrl
5.4.1
pinctrl pinctrl-class uclass kernel dts pinctrl
./drivers/pinctrl/pinctrl-uclass.c
./include/dm/pinctrl.h
./drivers/pinctrl/pinctrl-rockchip.c
5.4.2
int pinctrl_select_state(struct udevice *dev, const char *statename) //
int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index) //
device probe "default"
probe
5.5. I2C
5.5.1
I2C i2c-uclass uclass i2c device
dts i2c bus i2c device i2c slave
./drivers/i2c/i2c-uclass.c
./drivers/i2c/rk_i2c.c
5.5.2
int dm_i2c_reg_read(struct udevice *dev, uint offset)
int dm_i2c_reg_write(struct udevice *dev, uint offset, unsigned int val);
5.6
5.6.1
Rockchip U-Boot RGB LVDS EDP MIPI HDMI CVBS DP
U-Boot kernel logo.bmp logo_kernel.bmp
resource.img :
1. 8bit 24bit BMP
2. logo.bmp logo_kernel.bmp
3. rk312x/px30/rk3308 vop lite VOP 24bit BMP
y PC y
drivers/video/drm/rockchip_display.c
drivers/video/drm/rockchip_display.h
vop:
drivers/video/drm/rockchip_crtc.c
drivers/video/drm/rockchip_crtc.h
drivers/video/drm/rockchip_vop.c
drivers/video/drm/rockchip_vop.h
drivers/video/drm/rockchip_vop_reg.c
drivers/video/drm/rockchip_vop_reg.h
rgb:
drivers/video/drm/rockchip_rgb.c
drivers/video/drm/rockchip_rgb.h
lvds:
drivers/video/drm/rockchip_lvds.c
drivers/video/drm/rockchip_lvds.h
mipi:
drivers/video/drm/rockchip_mipi_dsi.c
drivers/video/drm/rockchip_mipi_dsi.h
drivers/video/drm/rockchip-inno-mipi-dphy.c
edp:
drivers/video/drm/rockchip_analogix_dp.c
drivers/video/drm/rockchip_analogix_dp.h
drivers/video/drm/rockchip_analogix_dp_reg.c
drivers/video/drm/rockchip_analogix_dp_reg.h
hdmi:
drivers/video/drm/dw_hdmi.c
drivers/video/drm/dw_hdmi.h
drivers/video/drm/rockchip_dw_hdmi.c
drivers/video/drm/rockchip_dw_hdmi.h
panel:
drivers/video/drm/rockchip_panel.c
drivers/video/drm/rockchip_panel.h
5.6.2
1. U-Boot logo kernel logo
void rockchip_show_logo(void);
2. bmp logo
void rockchip_show_bmp(const char *bmp);
3. U-Boot dtb kernel logo crtc
BCSH
rockchip_display_fixup(void *blob);
5.6.3 DTS
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
drm_logo: drm-logo@00000000 {
compatible = "rockchip,drm-logo";
reg = <0x0 0x0 0x0 0x0>; // buffer kernel logo U-
Boot
};
};
&route-edp {
status = "okay"; // U-Boot logo
logo,uboot = "logo.bmp"; // U-Boot logo
logo,kernel = "logo_kernel.bmp"; // kernel logo
logo,mode = "center"; // center fullscreen
charge_logo,mode = "center"; // center fullscreen
connect = <&vopb_out_edp>; // vopb->edp->panel
};
&edp {
status = "okay"; // edp
};
&vopb {
status = "okay"; // vopb
};
&panel {
"simple-panel";
...
status = "okay";
disp_timings: display-timings {
native-mode = <&timing0>;
timing0: timing0 {
...
};
};
};
5.6.4 defconfig
RK3308 U-Boot defconfig dts
RK3308 defconfig
--- a/configs/evb-rk3308_defconfig
+++ b/configs/evb-rk3308_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_ROCKCHIP_RK3308=y
CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
CONFIG_RKIMG_BOOTLOADER=y
-# CONFIG_USING_KERNEL_DTB is not set
CONFIG_TARGET_EVB_RK3308=y
CONFIG_DEFAULT_DEVICE_TREE="rk3308-evb"
CONFIG_DEBUG_UART=y
@@ -55,6 +54,11 @@ CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_G_DNL_MANUFACTURER="Rockchip"
CONFIG_G_DNL_VENDOR_NUM=0x2207
CONFIG_G_DNL_PRODUCT_NUM=0x330d
+CONFIG_DM_VIDEO=y
+CONFIG_DISPLAY=y
+CONFIG_DRM_ROCKCHIP=y
+CONFIG_DRM_ROCKCHIP_RGB=y
+CONFIG_LCD=y
CONFIG_USE_TINY_PRINTF=y
CONFIG_SPL_TINY_MEMSET=y
CONFIG_ERRNO_STR=y
upstream defconfig
upstream rockchip U-Boot RK3288 RK3399
./drivers/video/rockchip/
CONFIG_VIDEO_ROCKCHIP CONFIG_DRM_ROCKCHIP
SDK
1.
2. HDMI DP
3. U-Boot logo kernel logo
5.7 PMIC/Regulator
5.7.1
PMIC/regulator pmic-uclass regulator-uclass PMIC
RK805/RK808/RK809/RK816/RK817/RK818
./drivers/power/pmic/pmic-uclass.c
./drivers/power/regulator/regulator-uclass.c
./drivers/power/pmic/rk8xx.c
./drivers/power/regulator/rk8xx.c
5.7.2
1. regulator
int regulator_get_by_platname(const char *platname, struct udevice **devp);
platname dts regulator regulator-name vdd_arm vdd_logic
devp vdd_arm vdd_logic regulator device
2. / regulator
int regulator_get_enable(struct udevice *dev);
int regulator_set_enable(struct udevice *dev, bool enable);
int regulator_set_suspend_enable(struct udevice *dev, bool enable);
3. regulator
int regulator_get_value(struct udevice *dev);
int regulator_set_value(struct udevice *dev, int uV);
int regulator_set_suspend_value(struct udevice *dev, int uV);
5.7.3
Buck1/2 regulator "regulator-min-microvolt" "regulator-min-
microvolt" regulator PMIC
"regulator-init-microvolt" U-Boot CPU
regulator-min-microvolt = <900000>
regulator-max-microvolt = <1500000>
regulator-init-microvolt = <1100000>// 1.1v
5.7.4 debug
1 regulator
regulator
./arch/arm/mach-rockchip/board.c
--> board_init
--> regulators_enable_boot_on(false);
"false" "true" regulator
UBoot-nextdev-probe-regulator-list
1. “-61” dts
#define ENODATA 61 /* No data available */
2. " ret: -38 "
#define ENOSYS 38 /* Invalid system call number */,
3.
static void regulator_show(struct udevice *dev, int ret)
2 regulator
U-Boot "regulator"
cmd/regulator.c
=> regulator
regulator - uclass operations
Usage:
regulator list - list UCLASS regulator devices
regulator dev [regulator-name] - show/[set] operating regulator device
regulator info - print constraints info
regulator status [-a] - print operating status [for all]
regulator value [val] [-f] - print/[set] voltage value [uV] (force)
regulator current [val] - print/[set] current value [uA]
regulator mode [id] - print/[set] operating mode id
regulator enable - enable the regulator output
regulator disable - disable the regulator output
3 regulator 2
U-Boot "rktest regulator" 11. rktest
5.8
5.8.1
U-Boot
RK809/RK816/RK817/RK818
./drivers/power/fuel_gauge/fuel_gauge_uclass.c
./drivers/power/fuel_gauge/fg_rk818.c
./drivers/power/fuel_gauge/fg_rk817.c // rk809
./drivers/power/fuel_gauge/fg_rk816.c
......
./drivers/power/charge-display-uclass.c
./drivers/power/charge_animation.c
charge_animation.c
charge-display-uclass.c
-> charge_animation.c
-> fuel_gauge_uclass.c
->fg_rk818.c/fg_rk817.c
5.8.2
resource.img
resource.img
./pack_resource.sh <input resource.img>
./tools/images/ resource.img resource.img U-
Boot resource.img
./pack_resource.sh /home/guest/3399/kernel/resource.img
Pack ./tools/images/ & /home/guest/3399/kernel/resource.img to resource.img ...
Unpacking old image(/home/guest/3399/kernel/resource.img):
rk-kernel.dtb logo.bmp logo_kernel.bmp
Pack to resource.img successed!
Packed resources:
rk-kernel.dtb battery_1.bmp battery_2.bmp battery_3.bmp battery_4.bmp battery_5.bmp
battery_fail.bmp logo.bmp logo_kernel.bmp battery_0.bmp
resource.img is packed ready
5.8.3 DTS
dts charge-animation
charge-animation {
compatible = "rockchip,uboot-charge";
status = "okay";
rockchip,uboot-charge-on = <0> // U-Boot
rockchip,android-charge-on = <1> // Android
rockchip,uboot-exit-charge-level = <5>; // U-Boot
rockchip,uboot-exit-charge-voltage = <3650> // U-Boot
rockchip,screen-on-voltage = <3400>; // U-Boot
rockchip,uboot-low-power-voltage = <3350>; // U-Boot
rockchip,system-suspend = <1>; // trust
rockchip,auto-off-screen-interval = <20>; // (
15s)
rockchip,auto-wakeup-interval = <10>; // ( 0
)
rockchip,auto-wakeup-screen-invert = <1>; // /
};
1. adc cpu
2.
5.8.4
power
power
5.8.5
1. ./tools/images/ 8bit 24bit bmp “ls |sort
pack_resource.sh resource
2. ./drivers/power/charge_animation.c
name
soc
period ms
** ** failed “soc=-1”
3. pack_resource.sh resource.img
5.9
U-Boot block
EMMC Nand flash SPI Nand flash SPI Nor flash
5.9.1
blk
/*
* IF you want to use your own charge images, please:
*
* 1. Update the following 'image[]' to point to your own images;
* 2. You must set the failed image as last one and soc = -1 !!!
*/
static const struct charge_image image[] = {
{ .name = "battery_0.bmp", .soc = 5, .period = 600 },
{ .name = "battery_1.bmp", .soc = 20, .period = 600 },
{ .name = "battery_2.bmp", .soc = 40, .period = 600 },
{ .name = "battery_3.bmp", .soc = 60, .period = 600 },
{ .name = "battery_4.bmp", .soc = 80, .period = 600 },
{ .name = "battery_5.bmp", .soc = 100, .period = 600 },
{ .name = "battery_fail.bmp", .soc = -1, .period = 1000 },
};
struct blk_desc *rockchip_get_bootdev(void)
unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, void *buffer)
unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
struct rockchip_image *img;
5.9.2 DTS
&nandc {
u-boot,dm-pre-reloc;
status = "okay";
};
&sfc {
u-boot,dm-pre-reloc;
status = "okay";
};
nandc nand flash sfc spi flash
nand flash spi flash
5.9.3 defconfig
rknand
rknand drivers/rknand/ Nand flash
Nandc host Nand flash device RKNandFlashSupportList
SLC MLC TLC Nand flash
CONFIG_RKNAND=y
rkflash
dev_desc = rockchip_get_bootdev(); // blk
img = memalign(ARCH_DMA_MINALIGN, RK_BLK_SIZE);
if (!img) {
printf("out of memory\n");
return -ENOMEM;
}
...
ret = blk_dread(dev_desc, 0x2000, 1, img); //
if (ret != 1) {
ret = -EIO;
goto err;
}
...
ret = blk_write(dev_desc, 0x2000, 1, img); //
if (ret != 1) {
ret = -EIO;
goto err;
}
rkflash drivers/rkflash/ Nand
flash Nandc host Nand flash device SPI flash sfc host SPI flash devices
128MB 256MB SLC Nand flash
SPI Nand flash
SPI Nor flash
RK SpiNor and SLC Nand SupportList
CONFIG_RKFLASH=y
CONFIG_RKNANDC_NAND=y
CONFIG_RKSFC_NOR=y
CONFIG_RKSFC_NAND=y
rknand/ rkflash/ ftl Nand
5.10
5.10.1
U-Boot log U-Boot Rockchip
U-Boot relocation board_init_f[] serial_init() U-
Boot debug console U-Boot uart2
1. iomux board_debug_uart_init() rkxxx.c
rk3399.c/rk3368.c/px30.c uart iomux
2. clock uart 24Mhz pre-loader U-Boot
pre-loader U-Boot
24Mhz board_debug_uart_init()
3. uart uart2 2
4. chosen stdout-path U-Boot
./drivers/serial/ns16550.c
./drivers/serial/serial-uclass.c
./include/debug_uart.h
&uart2 {
u-boot,dm-pre-reloc;
clock-frequency = <24000000>;
};
5. baudrate CONFIG_BAUDRATE defconfig rkxxx_common.h
5.10.2 Early Debug UART
debug console U-Boot
debug console
U-Boot debug Early Debug UART console
uart
1. defconfig DEBUG_UART UART
2. board board_debug_uart_init() iomux
board rkxxx.c
5.10.3
U-Boot loader trust 5.10.1
5.10.2 Early Debug UART
5.10.4 Pre-loader serial
loader loader trust U-Boot
1. loader U-Boot atags loader serial U-Boot
chosen {
stdout-path = "serial2:1500000n8"; //
};
//
chosen {
stdout-path = &uart2;
};
CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_BASE=0x10210000 //
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_DEBUG_UART_SHIFT=2
CONFIG_DEBUG_UART_BOARD_INIT=y
void board_debug_uart_init(void)
{
   static struct rk3308_grf * const grf = (void *)GRF_BASE;
   /* Enable early UART2 channel m1 on the rk3308 */
   rk_clrsetreg(&grf->gpio4d_iomux, GPIO4D3_MASK | GPIO4D2_MASK,
          GPIO4D2_UART2_RX_M1 << GPIO4D2_SHIFT |
          GPIO4D3_UART2_TX_M1 << GPIO4D3_SHIFT);
}
2. loader atags
3. U-Boot rkxx-u-boot.dtsi uart “u-boot,dm-pre-reloc;” aliases
serial ./arch/arm/dts/rk1808-u-boot.dtsi uart
5.10.5
CONFIG_SILENT_CONSOLE console UART
aliases {
mmc0 = &emmc;
mmc1 = &sdmmc;
//
serial0 = &uart0;
serial1 = &uart1;
serial2 = &uart2;
serial3 = &uart3;
serial4 = &uart4;
serial5 = &uart5;
serial6 = &uart6;
serial7 = &uart7;
};
.....
// u-boot,dm-pre-reloc
&uart0 {
u-boot,dm-pre-reloc;
};
&uart1 {
u-boot,dm-pre-reloc;
};
&uart2 {
u-boot,dm-pre-reloc;
clock-frequency = <24000000>;
status = "okay";
};
&uart3 {
u-boot,dm-pre-reloc;
};
&uart4 {
u-boot,dm-pre-reloc;
};
......
INFO: Entry point address = 0x200000
INFO: SPSR = 0x3c9
U-Boot: enable slient console // U-Boot
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
......
5.11
5.11.1
U-Boot
drivers/input/key-uclass.c
include/key.h
drivers/input/rk8xx_pwrkey.c // PMIC(RK805/RK809/RK816/RK817) pwrkey
drivers/input/rk_key.c // compatible = "rockchip,key"
drivers/input/gpio_key.c // compatible = "gpio-keys"
drivers/input/adc_key.c // compatible = "adc-keys"
4 Rockchip key
U-Boot cpu gpio
5.11.2
int key_read(int code)
code
/include/dt-bindings/input/linux-event-codes.h
enum key_state {
KEY_PRESS_NONE, // none
KEY_PRESS_DOWN, // -> press down
KEY_PRESS_LONG_DOWN, // press long down
KEY_NOT_EXIST, // code
};
KEY_PRESS_LONG_DOWN 2000ms U-Boot
#define KEY_LONG_DOWN_MS 2000
5.12 Vendor Storage
Vendor Storage SN MAC NVM EMMC NAND
appnote rk vendor
storage
5.12.1
vendor 4 vendor0 vendor1 vendor2 vendor3 vendorX hdr
version vendorX vendorX version
version vendor
vendor2 vendor3
5.12.2
Vendor Storage U-Boot
arch/arm/mach-rockchip/vendor.c
./arch/arm/include/asm/arch-rockchip/vendor.h
5.12.3
key_read(KEY_VOLUMEUP);
key_read(KEY_VOLUMEDOWN);
key_read(KEY_POWER);
key_read(KEY_HOME);
key_read(KEY_MENU);
key_read(KEY_ESC);
...
int vendor_storage_read(u16 id, void *pbuf, u16 size)
int vendor_storage_write(u16 id, void *pbuf, u16 size)
5.12.4
U-Boot "rktest vendor" Vendor Storage 11. rktest
Vendor Storage
pass
5.13 OPTEE Client
U-Boot OPTEE U-Boot OPTEE
Client OPTEE
CONFIG_OPTEE_CLIENT U-Boot trust CONFIG_OPTEE_V1
312x,322x,3288,3228H,3368,3399 CONFIG_OPTEE_V2 3326,3308
CONFIG_OPTEE_ALWAYS_USE_SECURITY_PARTITION emmc rpmb
6. USB download
6.1 rockusb
rockusb, Windows Loader , eMMC:
RKNAND:
6.2 Fastboot
Fastboot Google adb VID/PID, fastboot:
6.2.1 fastboot
fastboot flash < partition > [ < filename > ]
fastboot erase < partition >
fastboot getvar < variable > | all
fastboot set_active < slot >
fastboot reboot
fastboot reboot-bootloader
fastboot flashing unlock
fastboot flashing lock
fastboot stage [ < filename > ]
fastboot get_staged [ < filename > ]
rockusb 0 mmc 0
rockusb 0 rknand 0
fastboot usb 0
fastboot oem fuse at-perm-attr-data
fastboot oem fuse at-perm-attr
fastboot oem at-get-ca-request
fastboot oem at-set-ca-response
fastboot oem at-lock-vboot
fastboot oem at-unlock-vboot
fastboot oem at-disable-unlock-vboot
fastboot oem fuse at-bootloader-vboot-key
fastboot oem format
fastboot oem at-get-vboot-unlock-challenge
fastboot oem at-reset-rollback-index
6.2.2 fastboot
1. fastboot flash < partition > [ < filename > ]
fastboot flash boot boot.img
2. fastboot erase < partition >
fastboot erase boot
3. fastboot getvar < variable > | all
fastboot getvar all
variable
version /* fastboot */
version-bootloader /* uboot */
version-baseband
product /* */
serialno /* */
secure /* */
max-download-size /* fastboot */
logical-block-size /* */
erase-block-size /* */
partition-type : < partition > /* */
partition-size : < partition > /* */
unlocked /* lock */
off-mode-charge
battery-voltage
variant
battery-soc-ok
slot-count /* slot */
has-slot: < partition > /* slot */
current-slot /* slot */
slot-suffixes /* slot, name */
slot-successful: < _a | _b > /* */
slot-unbootable: < _a | _b > /* unbootable */
slot-retry-count: < _a | _b > /* retry-count */
at-attest-dh
at-attest-uuid
at-vboot-state
fastboot getvar all
PS E:\U-Boot-AVB\adb> .\fastboot.exe getvar all
(bootloader) version:0.4
(bootloader) version-bootloader:U-Boot 2017.09-gc277677
(bootloader) version-baseband:N/A
(bootloader) product:rk3229
(bootloader) serialno:7b2239270042f8b8
(bootloader) secure:yes
(bootloader) max-download-size:0x04000000
(bootloader) logical-block-size:0x512
(bootloader) erase-block-size:0x80000
(bootloader) partition-type:bootloader_a:U-Boot
(bootloader) partition-type:bootloader_b:U-Boot
(bootloader) partition-type:tos_a:U-Boot
(bootloader) partition-type:tos_b:U-Boot
(bootloader) partition-type:boot_a:U-Boot
(bootloader) partition-type:boot_b:U-Boot
(bootloader) partition-type:system_a:ext4
(bootloader) partition-type:system_b:ext4
(bootloader) partition-type:vbmeta_a:U-Boot
(bootloader) partition-type:vbmeta_b:U-Boot
(bootloader) partition-type:misc:U-Boot
(bootloader) partition-type:vendor_a:ext4
(bootloader) partition-type:vendor_b:ext4
(bootloader) partition-type:oem_bootloader_a:U-Boot
(bootloader) partition-type:oem_bootloader_b:U-Boot
(bootloader) partition-type:factory:U-Boot
(bootloader) partition-type:factory_bootloader:U-Boot
(bootloader) partition-type:oem_a:ext4
(bootloader) partition-type:oem_b:ext4
(bootloader) partition-type:userdata:ext4
(bootloader) partition-size:bootloader_a:0x400000
(bootloader) partition-size:bootloader_b:0x400000
(bootloader) partition-size:tos_a:0x400000
(bootloader) partition-size:tos_b:0x400000
(bootloader) partition-size:boot_a:0x2000000
(bootloader) partition-size:boot_b:0x2000000
(bootloader) partition-size:system_a:0x20000000
(bootloader) partition-size:system_b:0x20000000
(bootloader) partition-size:vbmeta_a:0x10000
(bootloader) partition-size:vbmeta_b:0x10000
(bootloader) partition-size:misc:0x100000
(bootloader) partition-size:vendor_a:0x4000000
(bootloader) partition-size:vendor_b:0x4000000
(bootloader) partition-size:oem_bootloader_a:0x400000
(bootloader) partition-size:oem_bootloader_b:0x400000
(bootloader) partition-size:factory:0x2000000
(bootloader) partition-size:factory_bootloader:0x1000000
(bootloader) partition-size:oem_a:0x10000000
(bootloader) partition-size:oem_b:0x10000000
(bootloader) partition-size:userdata:0x7ad80000
(bootloader) unlocked:no
(bootloader) off-mode-charge:0
(bootloader) battery-voltage:0mv
(bootloader) variant:rk3229_evb
(bootloader) battery-soc-ok:no
(bootloader) slot-count:2
(bootloader) has-slot:bootloader:yes
(bootloader) has-slot:tos:yes
(bootloader) has-slot:boot:yes
(bootloader) has-slot:system:yes
(bootloader) has-slot:vbmeta:yes
(bootloader) has-slot:misc:no
(bootloader) has-slot:vendor:yes
(bootloader) has-slot:oem_bootloader:yes
(bootloader) has-slot:factory:no
(bootloader) has-slot:factory_bootloader:no
(bootloader) has-slot:oem:yes
(bootloader) has-slot:userdata:no
(bootloader) current-slot:a
(bootloader) slot-suffixes:a,b
(bootloader) slot-successful:a:yes
(bootloader) slot-successful:b:no
(bootloader) slot-unbootable:a:no
(bootloader) slot-unbootable:b:yes
(bootloader) slot-retry-count:a:0
(bootloader) slot-retry-count:b:0
(bootloader) at-attest-dh:1:P256
(bootloader) at-attest-uuid:
all: Done!
finished. total time: 0.636s
4. fastboot set_active < slot >
slot
fastboot set_active _a
5. fastboot reboot
fastboot reboot
6. fastboot reboot-bootloader
fastboot
fastboot reboot-bootloader
7. fastboot flashing unlock
fastboot flashing unlock
8. fastboot flashing lock
fastboot flashing lock
9. fastboot stage [ < filename > ]
CONFIG_FASTBOOT_BUF_ADDR
fastboot stage atx_permanent_attributes.bin
10. fastboot get_staged [ < filename > ]
fastboot get_staged raw_atx_unlock_challenge.bin
11. fastboot oem fuse at-perm-attr
ATX hash
fastboot stage atx_permanent_attributes.bin
fastboot oem fuse at-perm-attr
12. fastboot oem fuse at-perm-attr-data
ATX RPMB
fastboot stage atx_permanent_attributes.bin
fastboot oem fuse at-perm-attr-data
13. fastboot oem at-get-ca-request
14. fastboot oem at-set-ca-response
15. fastboot oem at-lock-vboot
fastboot oem at-lock-vboot
16. fastboot oem at-unlock-vboot
authenticated unlock
fastboot oem at-get-vboot-unlock-challenge fastboot get_staged raw_atx_unlock_challenge.bin
./make_unlock.sh make_unlock.sh
fastboot stage atx_unlock_credential.bin fastboot oem at-unlock-vboot
how-to-generate-keys-about-avb.md
17. fastboot oem fuse at-bootloader-vboot-key
bootloader key hash
fastboot stage bootloader-pub-key.bin
fastboot oem fuse at-bootloader-vboot-key
18. fastboot oem format
$partitions
fastboot oem format
19. fastboot oem at-get-vboot-unlock-challenge
authenticated unlock unlock challenge
16. fastboot oem at-unlock-vboot
20. fastboot oem at-reset-rollback-index
rollback
fastboot oem at-reset-rollback-index
21. fastboot oem at-disable-unlock-vboot
fastboot oem at-unlock-vboot
fastboot oem at-disable-unlock-vboot
7.
RK parameter/GPT boot recovery kernel resource dtb
7.1
U-Boot RK parameter GPT GPT
RK parameter
7.1.1
GPT parameter.txt "TYPE: GPT" GPT RK
parameter
FIRMWARE_VER:8.1
MACHINE_MODEL:RK3399
MACHINE_ID:007
MANUFACTURER: RK3399
MAGIC: 0x5041524B
ATAG: 0x00200800
MACHINE: 3399
CHECK_MASK: 0x80
PWR_HLD: 0,0,A,0,1
TYPE: GPT
CMDLINE:mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(trust),0x0
0002000@0x00008000(misc),0x00008000@0x0000a000(resource),0x00010000@0x00012000(kernel),0x
00010000@0x00022000(boot),0x00020000@0x00032000(recovery),0x00038000@0x00052000(backup),0
x00002000@0x0008a000(security),0x00100000@0x0008c000(cache),0x00500000@0x0018c000(system)
,0x00008000@0x0068c000(metadata),0x00100000@0x00694000(vendor),0x00100000@0x00796000(oem)
,0x00000400@0x00896000(frp),-@0x00896400(userdata:grow)
GPT RK parameter Rockchip-Parameter-File-Format-Version1.4.md
7.1.2
U-Boot
part list <interface> <dev>
<interface>: mmc rknand rksfc
<dev>: 0 1 2....
1. GPT Partition Type: EFI
=> part list mmc 0
Partition Map for MMC device 0 -- Partition Type: EFI
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00004000 0x00005fff "uboot"
attrs: 0x0000000000000000
type: 3b600000-0000-423e-8000-128b000058ca
guid: 727b0000-0000-4069-8000-68d500005dea
2 0x00006000 0x00007fff "trust"
attrs: 0x0000000000000000
type: bf570000-0000-440f-8000-42dc000079ef
guid: ff3c0000-0000-4d3a-8000-5e9c00006be6
3 0x00008000 0x00009fff "misc"
attrs: 0x0000000000000000
type: 4f030000-0000-4744-8000-545300000e1e
guid: 0c240000-0000-4f6a-8000-207e00006722
4 0x0000a000 0x00011fff "resource"
attrs: 0x0000000000000000
type: d3460000-0000-4360-8000-37d9000037c0
guid: 81500000-0000-4f59-8000-166100000c05
5 0x00012000 0x00021fff "kernel"
attrs: 0x0000000000000000
type: 33770000-0000-401d-8000-505400004c3e
guid: 464f0000-0000-4317-8000-1f2f00004af7
6 0x00022000 0x00031fff "boot"
attrs: 0x0000000000000000
type: 575e0000-0000-4666-8000-74ae000055fe
guid: 43270000-0000-456c-8000-0ace00004560
7 0x00032000 0x00051fff "recovery"
attrs: 0x0000000000000000
type: 273b0000-0000-4d5e-8000-6fcd0000106a
guid: 614e0000-0000-4b53-8000-1d28000054a9
8 0x00052000 0x00089fff "backup"
attrs: 0x0000000000000000
type: 8c3f0000-0000-4d58-8000-009b00006ee9
guid: 86300000-0000-4f7a-8000-102300000338
9 0x0008a000 0x0008bfff "security"
attrs: 0x0000000000000000
type: 6c100000-0000-4e5c-8000-5afe000015e2
guid: 9b2f0000-0000-4843-8000-12a900001176
10 0x0008c000 0x0018bfff "cache"
attrs: 0x0000000000000000
type: b1490000-0000-4927-8000-24e000005fbf
guid: 891d0000-0000-4e45-8000-43a1000072cb
11 0x0018c000 0x0068bfff "system"
attrs: 0x0000000000000000
type: 41770000-0000-442b-8000-7928000058e7
guid: 36430000-0000-484a-8000-37f200004ca0
12 0x0068c000 0x00693fff "metadata"
attrs: 0x0000000000000000
type: 061c0000-0000-480a-8000-67be000043c2
guid: 8c5d0000-0000-4052-8000-798600007d5b
13 0x00694000 0x00793fff "vendor"
attrs: 0x0000000000000000
type: e62f0000-0000-4e1e-8000-738a000015b8
guid: 721a0000-0000-4d0e-8000-044400001366
14 0x00796000 0x00895fff "oem"
attrs: 0x0000000000000000
type: cb190000-0000-4c74-8000-137300007831
guid: cf200000-0000-4765-8000-4b1400005227
15 0x00896000 0x008963ff "frp"
attrs: 0x0000000000000000
type: 9c380000-0000-4c4b-8000-326400004995
guid: 8d060000-0000-4772-8000-32de00003108
16 0x00896400 0x00e8ffde "userdata"
attrs: 0x0000000000000000
type: 415f0000-0000-4419-8000-2f420000194c
guid: 93580000-0000-4303-8000-128a00005c6f
2. RK parameter Partition Type: RKPARM
=> part list mmc 0
Partition Map for MMC device 0 -- Partition Type: RKPARM
Part Start LBA Size Name
1 0x00004000 0x00002000 uboot
2 0x00006000 0x00002000 trust
3 0x00008000 0x00002000 misc
4 0x0000a000 0x00008000 resource
5 0x00012000 0x00010000 kernel
6 0x00022000 0x00010000 boot
7 0x00032000 0x00020000 recovery
8 0x00052000 0x00038000 backup
9 0x0008a000 0x00002000 security
10 0x0008c000 0x00100000 cache
11 0x0018c000 0x00500000 system
12 0x0068c000 0x00008000 metadata
13 0x00694000 0x00100000 vendor
14 0x00796000 0x00100000 oem
15 0x00896000 0x00000400 frp
16 0x00896400 0x005f9c00 userdata
7.2 dtb
dtb kernel dts dtb AOSP boot/recovery
RK resource
U-Boot dtb 9. U-Boot kernel DTB
7.3 boot/recovery
boot.img recovery.img AOSP Android RK
7.3.1 AOSP Android
”ANDROID!”
00000000 41 4E 44 52 4F 49 44 21 24 10 74 00 00 80 40 60 ANDROID!$.t...@`
00000010 F9 31 CD 00 00 00 00 62 00 00 00 00 00 00 F0 60 .1.....b.......`
boot.img = kernel + ramdisk dtb + android parameter
recovery.img = kernel + ramdisk(for recovery) + dtb
= RK parameter GPT 2 1
7.3.2 RK
RK kernel dtb boot recovery ”KRNL
00000000 4B 52 4E 4C 42 97 0F 00 1F 8B 08 00 00 00 00 00 KRNL..y.........
00000010 00 03 A4 BC 0B 78 53 55 D6 37 BE 4F 4E D2 A4 69 .....xSU.7.ON..i
kernel.img = kernel
resource.img = dtb + kernel logo + uboot logo
boot.img = ramdisk
recovery.img = kernel + ramdisk(for recovery) + dtb
= RK parameter GPT 2 1
7.3.3
U-Boot “boot_android” AOSP Android
“bootrkp” RK "run distro" Linux
7.4 Kernel
Kernel kernel zImage Image
7.5 resource
Resource dtb ”RSCE”
00000000 52 53 43 45 00 00 00 00 01 01 01 00 01 00 00 00 RSCE............
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
dtb logo
7.6
U-Boot ramdisk dtb kernel
......
=Booting Rockchip format image=
kernel @ 0x02080000 (0x0124e008)
ramdisk @ 0x0a200000 (0x0017871c)
## Flattened Device Tree blob at 01f00000
Booting using the fdt blob at 0x1f00000
Loading Ramdisk to 08087000, end 081ff71c ... OK
Loading Device Tree to 0000000008070000, end 00000000080860b7 ... OK
Adding bank: start=0x00200000, size=0x08200000
Adding bank: start=0x0a200000, size=0xede00000
Starting kernel ...
7.7
pre-loader => trust => U-Boot => kernel
7.8 HW-ID
7.8.1 HW-ID
wifi
HW_ID
7.8.2 HW-ID
dtb resource.img U-Boot kernel resource.img
dtb kernel ADC/GPIO
U-Boot dtb
7.8.3
ADC GPIO
ADC
RK3326-EVB\PX30-EVB :
MIPI :
mipi EVB ADC
V1 ADC ADC 1024 ADC_IN0 1.8V,MIPI
10K EVB ADC=1024*10K/(10K + 51K) =167.8
GPIO
GPIO
7.8.4
ADC GPIO dtb U-Boot dtb dtb
ADC HW_ID dtb
1. “.dtb”
2. HW_ID #[controller]ch[channel]=[adcval]
\[controller]: dts ADC
\[channel]: ADC
\[adcval]: ADC adcval+-30
3. 2
4. # 10
rk3326-evb-lp3-v10#saradc_ch2=111#saradc_ch1=810.dtb
rk3326-evb-lp3-v10#_saradc_ch2=569.dtb
GPIO HW_ID dtb
1. “.dtb”
2. HW_ID #gpio[pin]=[levle]
\[pin]: GPIO 0a2 gpio0a2
\[levle]: GPIO
3. 2
4. # 10
rk3326-evb-lp3-v10#gpio0a2=0#gpio0c3=1.dtb
7.8.5
uboot arch/arm/mach-rockchip/resource_img.c
static int rockchip_read_dtb_by_gpio(const char *file_name)
static int rockchip_read_dtb_by_adc(const char *file_name)
7.8.6
dtb resource.img kernel
scripts/mkmultidtb.py dtb DTBS ADC/GPIO
scripts/mkmultidtb.py PX30-EVB dtb resource.img dtb:
rk-kernel.dtb rk dtb dtb dtb DTBS dtb
dtb
rk3326-evb-lp3-v10#_saradc_ch0=166.dtb ADC rk3326 dtb
px30-evb-ddr3-lvds-v10#_saradc_ch0=512.dtb ADC px30 dtb
7.8.7 dtb
U-Boot log
mmc0(part 0) is current device boot mode: None DTB: rk3326-evb-lp3-v10#_saradc_ch0=166.dtb Using
kernel dtb
log resource.img rk3326-evb-lp3-v10#_saradc_ch0=166.dtb
rk-kernel.dtb
8. SPL TPL
SPL TPL
doc/README.TPL
doc/README.SPL
Rockchip TPL SPL Bootrom
: http://opensource.rock-chips.com/wiki_Boot_option
TPL DDR IRAM Bootrom SPL TPL DDR
Trust( ) U-Boot
SPL+TPL rockchip ddr.bin+miniloader
...
DTBS = {}
DTBS['PX30-EVB'] = OrderedDict([('rk3326-evb-lp3-v10', '#_saradc_ch0=166'),
('px30-evb-ddr3-lvds-v10', '#_saradc_ch0=512')])
...
9. U-Boot kernel DTB
9.1
U-Boot dts dts
U-Boot U-Boot
dts U-Boot U-Boot kernel dtb display
pmic/regulator pinctrl
u-boot dts kernel dts fdt kernel dts
kernel u-boot dts dts overlay kernel dts kernel u-boot
live dt Live dt
9.2 live dt
live dt v2017.07 :
https://lists.denx.de/pipermail/u-boot/2017-January/278610.html
live dt dtb struct device_node bind
dts device_node ofnode(device_node ) dtb
: doc/driver-model/livetree.txt
9.3 fdt live dt
ofnode (include/dm/ofnode.h) dt live dt device_node dt
fdt offset dt ofnode
47 * @np: Pointer to device node, used for live tree
48 * @of_offset: Pointer into flat device tree, used for flat tree. Note that this
49 * is not a really a pointer to a node: it is an offset value. See above.
50 */
51 typedef union ofnode_union {
52 const struct device_node *np; /* will be used for future live tree */
53 long of_offset;
54 } ofnode;
"dev" "ofnode" dt
dt
"of_" live dt
"fdtdec" "fdt" fdt
"live dt"
9.4 kernel dtb
kernel dtb board_init U-Boot dts mmc/nand
kernel dtb kernel dtb live dt bind gd->fdt_blob
kernel dtb
U-Boot dts kernel dts
.config CONFIG_USING_KERNEL_DTB kernel dtb live
dt dtb rk rk android Android
9.5 U-Boot dts
U-Boot dts/ dt.dtb dt-spl.dtb DTB dt.dtb defconfig
CONFIG_DEFAULT_DEVICE_TREE dts dtb dt-spl.dtb dt.dtb "u-boot,dm-
pre-reloc" CONFIG_OF_SPL_REMOVE_PROPS property
SPL dtb
dt-spl.dtb dmc uart mmc nand grf cru DDR
CRU/GRF
u-boot.bin dt.dtb CONFIG_USING_KERNEL_DTB dt-spl.dtb
kernel dts
U-Boot dtsi kernel dts evb kernel
dts U-Boot
U-Boot uart emmc alias rkxx-u-boot.dtsi
dtsi
10. U-Boot
10.1 trust_merger
trust_merger 64bit SoC bl30 bl31 bin bl32 bin TrustImage
10.1.1 trust
./tools/trust_merger [--pack] <config.ini>
ini
./tools/trust_merger --unpack <trust.img>
10.1.2
3368
[VERSION]
MAJOR=0 ----
MINOR=1 ----
[BL30_OPTION] ----bl30 mcu bin
SEC=1 ---- BL30 bin
PATH=tools/rk_tools/bin/rk33/rk3368bl30_v2.00.bin ---- bin
ADDR=0xff8c0000 ---- DDR
[BL31_OPTION] ----bl31 bin
SEC=1 ---- BL31 bin
PATH=tools/rk_tools/bin/rk33/rk3368bl31-20150401-v0.1.bin---- bin
ADDR=0x00008000 ---- DDR
[BL32_OPTION]
SEC=0 ---- BL31 bin
[BL33_OPTION]
SEC=0 ---- BL31 bin
[OUTPUT]
PATH=trust.img [OUTPUT] ----
10.2 boot_merger
boot_merger loader ddr bin usb plug bin loader
10.2.1 Loader
./tools/boot_merger [--pack] <config.ini>
ini
./tools/boot_merger --unpack <loader.bin>
10.2.2
3288
[CHIP_NAME]
NAME=RK320A ---- ”RK” maskrom 4B
[VERSION]
MAJOR=2 ----
MINOR=15 ----
[CODE471_OPTION] ----code471 ddr bin
NUM=1
Path1=tools/rk_tools/32_LPDDR2_300MHz_LPDDR3_300MHz_DDR3_300MHz_20140404.bin
[CODE472_OPTION] ----code472 usbplug bin
NUM=1
Path1=tools/rk_tools/rk32xxusbplug.bin
[LOADER_OPTION]
NUM=2
LOADER1=FlashData ----flash data ddr bin
LOADER2=FlashBoot ----flash boot U-Boot bin
FlashData=tools/rk_tools/32_LPDDR2_300MHz_LPDDR3_300MHz_DDR3_300MHz_20140404.bin
FlashBoot=u-boot.bin
[OUTPUT] ----
PATH=RK3288Loader_UBOOT.bin
10.3 resource_tool
resource_tool resource.img
./tools/resource_tool [--pack] [--image=<resource.img>] <file list>
./tools/resource_tool --unpack --image=<resource.img>
10.4 loaderimage
loaderimage rockchip miniloader , uboot.img 32bit trust.img :
loaderimage [--pack|--unpack] [--uboot|--trustos] file_in file_out [load_addr]
loaderimage --pack --trustos ${RKBIN}/${TOS} ./trust.img
loaderimage --pack --uboot u-boot.bin uboot.img 0x60000000
'load_addr' .
10.5 patman
tools/patman/README python , , patch ,
patch Upstream(U-Boot, Kernel) . :
format ;
checkpatch ;
commit upstream mailing list Cover-letter, patch version, version changes
;
commit change-id;
Maintainer patch ;
'~/.gitconfig' './.gitconfig' patch .
'-h' :
$ patman -h
Usage: patman [options]
Create patches from commits in a branch, check them and email them as
specified by tags you place in the commits. Use -n to do a dry run first.
Options:
-h, --help show this help message and exit
-H, --full-help Display the README file
-c COUNT, --count=COUNT
Automatically create patches from top n commits
-i, --ignore-errors Send patches email even if patch errors are found
-m, --no-maintainers Don't cc the file maintainers automatically
-n, --dry-run Do a dry run (create but don't email patches)
-p PROJECT, --project=PROJECT
Project name; affects default option values and
aliases [default: u-boot]
-r IN_REPLY_TO, --in-reply-to=IN_REPLY_TO
Message ID that this series is in reply to
-s START, --start=START
Commit to start creating patches from (0 = HEAD)
-t, --ignore-bad-tags
Ignore bad tags / aliases
--test run tests
-v, --verbose Verbose output of errors and warnings
--cc-cmd=CC_CMD Output cc list for patch file (used by git)
--no-check Don't check for patch compliance
--no-tags Don't process subject tags as aliaes
-T, --thread Create patches as a single thread
, 3 patch:
patman -t -c3
checkpatch error warning, abort, patch .
'-t' ":" TAG, patman , '-t'
'-i' warning( 80 ) , '-i'
'-s' tree top, '-s' top N
'-n' , checkpatch, '-n'
patchman commit message , upstream mailing list . commit:
commit 72aa9e3085e64e785680c3fa50a28651a8961feb
Author: Kever Yang <kever.yang@rock-chips.com>
Date: Wed Sep 6 09:22:42 2017 +0800
spl: add support to booting with OP-TEE
OP-TEE is an open source trusted OS, in armv7, its loading and
running are like this:
loading:
- SPL load both OP-TEE and U-Boot
running:
- SPL run into OP-TEE in secure mode;
- OP-TEE run into U-Boot in non-secure mode;
More detail:
https://github.com/OP-TEE/optee_os
and search for 'boot arguments' for detail entry parameter in:
core/arch/arm/kernel/generic_entry_a32.S
Cover-letter:
rockchip: add tpl and OPTEE support for rk3229
Add some generic options for TPL support for arm 32bit, and then
and TPL support for rk3229(cortex-A7), and then add OPTEE support
in SPL.
Tested on latest u-boot-rockchip master.
END
Series-version: 4
Series-changes: 4
- use NULL instead of '0'
- add fdt_addr as arg2 of entry
Series-changes: 2
- Using new image type for op-tee
Change-Id: I3fd2b8305ba8fa9ea687ab7f3fd1ffd2fac9ece6
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
patch patman , Cover-letter:
[PATCH v4 00/11] rockchip: add tpl and OPTEE support for rk3229
patch , version patch series :
[PATCH v4,07/11] spl: add support to booting with OP-TEE
Patch commit message , change-id , Cover-letter , version-changes
:
OP-TEE is an open source trusted OS, in armv7, its loading and
running are like this:
loading:
- SPL load both OP-TEE and U-Boot
running:
- SPL run into OP-TEE in secure mode;
- OP-TEE run into U-Boot in non-secure mode;
More detail:
https://github.com/OP-TEE/optee_os
and search for 'boot arguments' for detail entry parameter in:
core/arch/arm/kernel/generic_entry_a32.S
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
Changes in v4:
- use NULL instead of '0'
- add fdt_addr as arg2 of entry
Changes in v3: None
Changes in v2:
- Using new image type for op-tee
common/spl/Kconfig | 7 +++++++
common/spl/Makefile | 1 +
common/spl/spl.c | 9 +++++++++
common/spl/spl_optee.S | 13 +++++++++++++
include/spl.h | 13 +++++++++++++
5 files changed, 43 insertions(+)
create mode 100644 common/spl/spl_optee.S
, "Series-prefix", "Series-cc" README.
10.6 buildman
tools/buildman/README
, .
buildman toolchain , '~/.buildman' :
[toolchain]
arm: ~/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/
aarch64: ~/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-
gnu/
Rockchip U-Boot :
./tools/buildman/buildman rockchip
:
$ ./tools/buildman/buildman rockchip
boards.cfg is up to date. Nothing to do.
Building current source for 34 boards (4 threads, 1 job per thread)
34 0 0 /34 evb-rk3326
, pass ( ), warning ( ), error
( ). warning error, .
10.7 mkimage
doc/mkimage.1 U-Boot/SPL , Rockchip
bootrom IDBLOCK , u-boot-tpl.bin 4 byte Bootrom ID:
tools/mkimage -n rk3328 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
11. rktest
rktest
=> rktest
Command: rktest [module] [args...]
- module: timer|key|emmc|rknand|regulator|eth|ir|brom|rockusb|fastboot|vendor
- args: depends on module, try 'rktest [module]' for test or more help
- Enabled modules:
- timer: test timer and interrupt
- brom: enter bootrom download mode
- rockusb: enter rockusb download mode
- fastboot: enter fastboot download mode
- key: test board keys
- regulator: test regulator volatge set and show regulator status
- vendor: test vendor storage partition read/write
1. timer timer
=> rktest timer
sys timer delay test, round-1
desire delay 100us, actually delay 100us
desire delay 100ms, actually delay: 100ms
desire delay 1000ms, actually delay: 1000ms
sys timer delay test, round-2
desire delay 100us, actually delay 100us
desire delay 100ms, actually delay: 100ms
desire delay 1000ms, actually delay: 1000ms
sys timer delay test, round-3
desire delay 100us, actually delay 100us
desire delay 100ms, actually delay: 100ms
desire delay 1000ms, actually delay: 1000ms
sys timer delay test, round-4
desire delay 100us, actually delay 100us
desire delay 100ms, actually delay: 100ms
desire delay 1000ms, actually delay: 1000ms
timer_irq_handler: round-0, irq=114, period=1000ms
timer_irq_handler: round-1, irq=114, period=1000ms
timer_irq_handler: round-2, irq=114, period=1000ms
timer_irq_handler: round-3, irq=114, period=1000ms
timer_irq_handler: round-4, irq=114, period=1000ms
timer_irq_handler: irq test finish.
2. key
ctrl+c
=> rktest key
volume up key pressed..
volume up key pressed..
volume down key pressed..
volume down key pressed..
volume up key pressed..
power key short pressed..
power key short pressed..
power key long pressed..
3. emmc emmc
rktest emmc<start_lba> <blocks>
=> rktest emmc 0x2000 2000
Round up to 8192 blocks compulsively
MMC write: dev # 0, block # 8192, count 8192 ... 8192 blocks written: OK
eMMC write: size 4MB, used 187ms, speed 21MB/s
MMC read: dev # 0, block # 8192, count 8192 ... 8192 blocks read: OK
eMMC read: size 4MB, used 95ms, speed 43MB/s
4. rknand rknand
rktest rknand <start_lba> <blocks>
=> rktest rknand 0x2000 2000
Round up to 8192 blocks compulsively
rknand write: dev # 0, block # 8192, count 8192 ... 8192 blocks written: OK
rknand write: size 4MB, used 187ms, speed 21MB/s
rknand read: dev # 0, block # 8192, count 8192 ... 8192 blocks read: OK
rknand read: size 4MB, used 95ms, speed 43MB/s
5. vendor storage vendor storage
=> rktest vendor
[Vendor Test]:Test Start...
[Vendor Test]:Before Test, Vendor Resetting.
[Vendor Test]:<All Items Used> Test Start...
[Vendor Test]:item_num=126, size=448.
[Vendor Test]:<All Items Used> Test End,States:OK
[Vendor Test]:<Overflow Items Cnt> Test Start...
[Vendor Test]:id=126, size=448.
[Vendor Test]:<Overflow Items Cnt> Test End,States:OK
[Vendor Test]:<Single Item Memory Overflow> Test Start...
[Vendor Test]:id=0, size=6464.
[Vendor Test]:<Single Item Memory Overflow> Test End, States:OK
[Vendor Test]:<Total memory overflow> Test Start...
[Vendor Test]:item_num=9, size=6464.
[Vendor Test]:<Total memory overflow> Test End, States:OK
[Vendor Test]:After Test, Vendor Resetting...
[Vendor Test]:Test End.
6. maskrom maskrom
=> rktest brom
maskrom
7. regulator regulator dts BUCK
=> rktest regulator
dts
UBoot-nextdev-rktest-regulator
[DCDC_REG1@vdd_center] set: 900000 uV -> 912500 uV; ReadBack: 912500 uV
Confirm 'vdd_center' voltage, then hit any key to continue...
[DCDC_REG1@vdd_center] set: 912500 uV -> 937500 uV; ReadBack: 937500 uV
Confirm 'vdd_center' voltage, then hit any key to continue...
[DCDC_REG1@vdd_center] set: 937500 uV -> 975000 uV; ReadBack: 975000 uV
Confirm 'vdd_center' voltage, then hit any key to continue...
[DCDC_REG2@vdd_cpu_l] set: 900000 uV -> 912500 uV; ReadBack: 912500 uV
Confirm 'vdd_cpu_l' voltage, then hit any key to continue...
[DCDC_REG2@vdd_cpu_l] set: 912500 uV -> 937500 uV; ReadBack: 937500 uV
Confirm 'vdd_cpu_l' voltage, then hit any key to continue...
[DCDC_REG2@vdd_cpu_l] set: 937500 uV -> 975000 uV; ReadBack: 975000 uV
Confirm 'vdd_cpu_l' voltage, then hit any key to continue..
8. ethernet
Name start addr size Desc
Bootrom IRAM_START TPL_TEXT_BASE-IRAM_START data and stack
TAG TPL_TEXT_BASE 4 RKXX
text TEXT_BASE sizeof(text)
bss text_end sizeof(bss) append to text
dtb bss_end sizeof(dtb) append to bss
 
SP gd start stack
gd malloc_start - sizeof(gd) sizeof(gd)
malloc IRAM_END-MALLOC_F_LEN *PL_SYS_MALLOC_F_LEN malloc_simple
[TODO]
9. ir
[TODO]
IRAM (SPL/TPL)
bootRom Intermal SRAM(U-Boot IRAM), TPL SPL, TPL SPL
TPL map, SPL map .
text, bss, dtb malloc, gd, SP
dtb , , text , Stack dtb , dtb.
U-Boot (relocate )
U-Boot Loader TEXT_BASE ,U-Boot DRAM , relocate
ram_top , Relocation Offset = 'U-Boot start - TEXT_BASE'.
Name start addr size Desc
ATF RAM_START 0x200000 Reserved for bl31
OP-TEE 0x8400000 2M~16M TEE
kernel fdt fdt_addr_r
kernel kernel_addr_r
ramdisk ramdisk_addr_r
fastboot
buffer CONFIG_FASTBOOT_BUF_ADDR CONFIG_FASTBOOT_BUF_SIZE
 
SP  stack
FDT sizeof(dtb) U-Boot dtb
GD  sizeof(gd)
Board  sizeof(bd_t) board info, eg.
dram size
malloc  TOTAL_MALLOC_LEN 64M
U-Boot sizeof(mon) text, bss
Video FB fb size 32M
TLB table RAM_TOP-64K 32K
Video FB/U-Boot/malloc/Board/GD/FDT/SP , 4K
ATF armv8 , TE, armv7 OP-TEE armv7 TE+TOS, , TA
armv8 bl32(TOS), , TA U-Boot dram_init_banksize()
kernel fdt/kernel/ramdisk includ/config/rkxx_common.h
ENV_MEM_LAYOUT_SETTINGS , FASTBOOT/ROCKUSB BUFFER
, config/evb-rkxx_defconfig , FASTBOOT_BUF_ADDR ,
fastboot
make_unlock.sh
#!/bin/sh
python avb-challenge-verify.py raw_atx_unlock_challenge.bin atx_product_id.bin
python avbtool make_atx_unlock_credential --output=atx_unlock_credential.bin --
intermediate_key_certificate=atx_pik_certificate.bin --
unlock_key_certificate=atx_puk_certificate.bin --challenge=atx_unlock_challenge.bin --
unlock_key=testkey_atx_puk.pem
avb-challenge-verify.py
#/user/bin/env python
"this is a test module for getting unlock challenge"
import sys
import os
from hashlib import sha256
def challenge_verify():
if (len(sys.argv) != 3) :
print "Usage: rkpublickey.py [challenge_file] [product_id_file]"
return
if ((sys.argv[1] == "-h") or (sys.argv[1] == "--h")):
print "Usage: rkpublickey.py [challenge_file] [product_id_file]"
return
try:
challenge_file = open(sys.argv[1], 'rb')
product_id_file = open(sys.argv[2], 'rb')
challenge_random_file = open('atx_unlock_challenge.bin', 'wb')
challenge_data = challenge_file.read(52)
product_id_data = product_id_file.read(16)
product_id_hash = sha256(product_id_data).digest()
print("The challege version is %d" %ord(challenge_data[0]))
if (product_id_hash != challenge_data[4:36]) :
print("Product id verify error!")
return
challenge_random_file.write(challenge_data[36:52])
print("Success!")
finally:
if challenge_file:
challenge_file.close()
if product_id_file:
product_id_file.close()
if challenge_random_file:
challenge_random_file.close()
if __name__ == '__main__':
challenge_verify()
rkbin
1. Rockchip
gerrit -> project -> list -> Filter rk/rkbin” ->
2.
1 SDK
2 Github https://github.com/rockchip-linux/rkbin"
gcc
1. Rockchip
gerrit -> project -> list -> Filter gcc-linaro-6.3.1” ->
2.
SDK

Navigation menu