Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

RockpiE/dev/usb-install

< RockpiE‎ | dev
    ROCK Pi E >  Development >  Install from USB OTG port

ROCK Pi E supports maskrom mode, which is a special running mode the CPU is waiting for command from USB OTG port. The PC tool we use to communicate with ROCK Pi E in maskrom mode is rkdevelop tool, an open source tool by Rockchip.

Requirement

  • ROCK Pi E mainboard
  • eMMC module
  • Power adapter
  • USB Male A to Dupont cable.
    • One port is Male A type and the other includes three Dupont lines.
    • Hardware connection
ROCK Pi E 40-pin Header USB Interface USB Male A to Dupont Cable
PIN#18 Data+ Green wire
PIN#16 Data- White wire
PIN#14 GND Black wire

Rock-pi-e-usb-mala-a-to-dupont-cable.jpg

Make sure rkdeveloptool is set up on host computer

Linux

To build rkdeveloptool on a debain based Linux distribution, follow the instruction below:

Install build dependecy:

 sudo apt-get install libudev-dev libusb-1.0-0-dev dh-autoreconf

Clone the source code and build:

 git clone https://github.com/rockchip-linux/rkdeveloptool
 cd rkdeveloptool
 autoreconf -i
 ./configure
 make

If you encounter compile error like below

   ./configure: line 4269: syntax error near unexpected token `LIBUSB1,libusb-1.0'
   ./configure: line 4269: `PKG_CHECK_MODULES(LIBUSB1,libusb-1.0)'

You should install pkg-config libusb-1.0

   sudo apt-get install pkg-config libusb-1.0

Then re-run

   autoreconf -i
   ./configure
   make

Now you have rkdeveloptool executable at the current directory.

 sudo cp rkdeveloptool /usr/local/bin/

MacOS

To build rkdeveloptool on macOS, you need homebrew(or similar package manager) to install required packages.

Install build dependency:

   brew install automake autoconf libusb

Clone the source code and build:

   git clone https://github.com/rockchip-linux/rkdeveloptool
   cd rkdeveloptool
   autoreconf -i
   ./configure
   make

If you encounter compile error like below

   ./configure: line 4269: syntax error near unexpected token `LIBUSB1,libusb-1.0'
   ./configure: line 4269: `PKG_CHECK_MODULES(LIBUSB1,libusb-1.0)'

You should install pkg-config libusb-1.0

   brew install pkg-config

Then re-run

   autoreconf -i
   ./configure
   make

Now you have rkdeveloptool executable at the current directory.

   sudo cp rkdeveloptool /usr/local/bin/

Boot the board to maskrom mode

Note that ROCK Pi E OTG port consists of PIN#18, PIN#16 and PIN#14 on 40-pin Header.

To boot ROCK Pi E into maskrom mode is simple, you don't need to press any key

  • Power off the board and remove any bootable storage media, like Micro SD card, eMMC module, etc.
  • Plug the USB Male A to Dupont cable to ROCK Pi E OTG port, the other side to PC
  • Power on the board

Now on your Linux PC, lsusb command show show the following usb devices

   Bus 001 Device 090: ID 2207:320c

It means the device is in maskrom mode now.

  • Now plug the eMMC module and proceed the next step to flash.

Install to eMMC via USB

On your PC, run the rkdeveloptool

   rkdeveloptool ld        # List the device
   DevNo=1	Vid=0x2207,Pid=0x320c,LocationID=104	Maskrom

Download the loader (flash helper) to init the ram and prepare the flashing environment etc. If you don't have it, you can download it from here

   rkdeveloptool db rk3328_loader_xxx.bin

Write the GPT image to eMMC, start to write from offset 0.

   rkdeveloptool wl 0 /path/to/rockpie-xxx-gpt.img

Reboot the device

   rkdeveloptool rd

Now the device should boot the new image on eMMC

Install by partitions(optional)

Sometimes we only want to update a partition of the image, for example only the boot partition to update kernel only. We can flash by partitions

Part Number Offset Name Description
raw 32KB loader1 First stage loader
raw 8MB loader2 U-boot image
raw 12MB trust ATF
1 16MB boot Kernel partition, bootable
2 528MB rootfs Rootfs


When the board is in maskrom mode, flash the partitions with the following command and offset:

   rkdeveloptool db rk3328_loader_*.bin
   rkdeveloptool wl 64 idbloader.img
   rkdeveloptool wl 16384 uboot.img
   rkdeveloptool wl 24576 trust.img
   rkdeveloptool wl 32768 boot.img
   rkdeveloptool wl 1081344 rootfs.img

Troubleshooting