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

Difference between revisions of "Rockpi4/dev/usb-install"

< Rockpi4‎ | dev
Line 3: Line 3:
 
     [[rockpi4 | ROCK Pi 4]] > [[rockpi4/dev | Development]] > [[rockpi4/dev/usb-install | Install from USB OTG port]]
 
     [[rockpi4 | ROCK Pi 4]] > [[rockpi4/dev | Development]] > [[rockpi4/dev/usb-install | Install from USB OTG port]]
  
Rock PI supports Maskrom mode, which is a special operation mode for CPU to wait for USB OTG port command. <br/>
+
Rock PI supports Maskrom mode, which is a special operation mode for CPU to wait for USB OTG port command.
The PC tools we use to communicate with rock PI in Maskrom mode are the '''rkdevelopment tool''' and '''AndroidTool tool'''. <br/>
+
The PC tools we use to communicate with rock PI in Maskrom mode are the '''rkdevelopment tool''' and '''AndroidTool tool'''.  
We use '''the rkdevelopment tool in Linux and MAC systems''' and '''the AndroidTool tool in Windows systems'''.
+
We use '''the rkdevelopment tool in Linux/macOS ''' and '''the AndroidTool tool under Windows'''.
  
 
=== Requirement ===
 
=== Requirement ===
Line 13: Line 13:
 
* '''USB Male A to Male A cable'''(important) USB-C has been seen as not working, an adaptor for USB-C to USB-A has worked. [https://forum.radxa.com/t/otg-flashing-not-working/717 See discussion].
 
* '''USB Male A to Male A cable'''(important) USB-C has been seen as not working, an adaptor for USB-C to USB-A has worked. [https://forum.radxa.com/t/otg-flashing-not-working/717 See discussion].
  
=== Make sure AndroidTool is set up on host computer ===
+
=== Install Tools&Drivers ===
 
==== Windows ====
 
==== Windows ====
Step 1:Install Android tool:<br/>
+
=====Step 1:Install Android tool=====
The tool is provided in a compressed package. First, download the compressed package of this tool, and click the download link [https://dl.radxa.com/tools/windows/AndroidTool_Release_v2.69.zip (AndroidTool_Release_v2.3.zip)]. After downloading, unzip it. Installation is complete.
+
The tool is provided in a compressed package. First, download the compressed package of this tool, and click the download link [https://dl.radxa.com/tools/windows/AndroidTool_Release_v2.69.zip (AndroidTool_Release_v2.69.zip)]. After downloading, unzip it. Installation is complete.
  
Step 2:Install driver:<br/>
+
=====Step 2:Install driver=====
 
Using the RK driver assistant tool to install the driver.
 
Using the RK driver assistant tool to install the driver.
  
There’s no need to connect your Rockchip device during this procedure just download and extract [https://dl.radxa.com/tools/windows/DriverAssitant_v4.8.zip RKDriverAssistant.zip]<br/>
+
There’s no need to connect your Rockchip device during this procedure just download and extract [https://dl.radxa.com/tools/windows/DriverAssitant_v4.8.zip RKDriverAssistant.zip]
Then double click on DriverInstall.exe in the RKDriverAssistant directory to start the utility.If you've previously tried to install<br/>
+
 
the Rockchip USB drivers for any Rockchip devices make sure you click “Uninstall Driver” first.
+
Then double click on DriverInstall.exe in the RKDriverAssistant directory to start the utility. If you installed the Rockchip USB drivers for any other Rockchip devices already, make sure you click “Uninstall Driver” first.
  
 
[[File:RK_Driver_Assistant_Install_Uninstall.jpg]]
 
[[File:RK_Driver_Assistant_Install_Uninstall.jpg]]
  
Then click “Install Driver”, the driver has finish installing.<br/>
+
Then click “Install Driver”, the driver has finish installing.
  
=== Make sure rkdeveloptool is set up on host computer ===
 
 
==== Linux====
 
==== Linux====
To build rkdeveloptool on a debain based Linux distribution, follow the instruction below:
+
For Linux, we build the rkdeveloptool from source code.
  
Install build dependecy:
+
To build rkdeveloptool on a Debian based Linux distribution, follow the instruction below:
 +
 
 +
Install build dependency:
 
   sudo apt-get install libudev-dev libusb-1.0-0-dev dh-autoreconf
 
   sudo apt-get install libudev-dev libusb-1.0-0-dev dh-autoreconf
  
Line 60: Line 61:
  
 
==== MacOS ====
 
==== MacOS ====
 +
For macOS, we build the rkdeveloptool from source code.
  
 
To build rkdeveloptool on macOS, you need [https://brew.sh/ homebrew](or similar package manager) to install required packages.
 
To build rkdeveloptool on macOS, you need [https://brew.sh/ homebrew](or similar package manager) to install required packages.
Line 65: Line 67:
 
Install build dependency:
 
Install build dependency:
  
     brew install automake autoconf libusb
+
     brew install automake autoconf libusb lsusb
  
 
Clone the source code and build:
 
Clone the source code and build:
Line 93: Line 95:
  
 
=== Boot the board to maskrom mode ===
 
=== Boot the board to maskrom mode ===
 +
 
To boot ROCK Pi into maskrom mode is simple, you don't need to press any key
 
To boot ROCK Pi into maskrom mode is simple, you don't need to press any key
  
* Power off the board and '''remove any bootable storage media''', remove microSD card, remove eMMC module.
+
* 1. Power off the board and '''remove any bootable storage media''', remove microSD card, remove eMMC module.
* Plug the USB Male A to Mail A cable to ROCK Pi 4 OTG port(the upper USB3 port), the other side to PC
+
* 2. Plug the USB Male A to Mail A cable to ROCK Pi 4 OTG port(the upper USB3 port), the other side to PC
* Power on the board
+
* 3. Power on the board
  
 +
** 4. For Linux/macOS
 
Now on your Linux PC, '''lsusb''' command show show the following usb devices
 
Now on your Linux PC, '''lsusb''' command show show the following usb devices
  
 
     Bus 003 Device 005: ID 2207:330c
 
     Bus 003 Device 005: ID 2207:330c
  
Or open device manager in your Windows PC, and the following devices will be displayed<br/>
+
** 4. For Windows
 +
Open device manager in your Windows PC, check the Device Manager:
 +
 
 
[[File:RK_Driver_Assistant_Install_Usb_driver.png]]
 
[[File:RK_Driver_Assistant_Install_Usb_driver.png]]
  
 
It means the device is in '''maskrom mode''' now.
 
It means the device is in '''maskrom mode''' now.
  
* Now plug the eMMC module and proceed the next step to flash.
+
* 5. Now plug the eMMC module and proceed the next step to flash.
  
=== Install to eMMC via USB ===
+
=== Begin Installation USB -> eMMC ===
==== Linux user follow here: ====
+
==== Linux/macOS ====
 
On your PC, run the rkdeveloptool
 
On your PC, run the rkdeveloptool
  
Line 131: Line 137:
 
Now the device should boot the new image on eMMC
 
Now the device should boot the new image on eMMC
  
==== Windows user follow here: ====
+
==== Windows ====
Open the tool and you will see the following interface:<br/>
+
Double click the '''AndroidTool.exe''' and you will see the following interface:
First, after opening the tool, you can see that the red box shows that the Rock Pi is in the maskrom mode. Then, clean up the redundant items, right-click = > select "Clear Items".<br/>
+
 
 +
If your ROCK Pi is in maskrom mode and connects to PC, you can see that the program detect it, as the red box shown below:
 +
 
 
[[File:AndroidTool1.PNG | 600px]]
 
[[File:AndroidTool1.PNG | 600px]]
  
Then, add an item, right-click = > select "add item".<br/>
+
===== Step 1: Select Profile =====
[[File:AndroidTool2.PNG | 600px]]
+
 
 +
Then, select a profile for the newly added item, right-click = > select "load config":
 +
 
 +
[[File:Android3.PNG | 600px]]
 +
 
 +
Open the folder of Android tool and select "config_ rockpi_gpt"Configuration file for GPT.
  
Then, select a profile for the newly added item, right-click = > select "load config".<br/>
 
[[File:Android3.PNG | 600px]]<br/>
 
Open the folder of Android tool and select "config_ rockpi_gpt"Configuration file for GPT.<br/>
 
 
[[File:Android4.PNG | 600px]]
 
[[File:Android4.PNG | 600px]]
  
Then, you can see "image" in the name column of the newly added item. Next, click the button in the red box on the far right of the first item and select "rk3399_ loader_ xxxxx.bin ", <br/>
+
Then, you can see two rows, one is '''Loader''' and the other is '''Image'''.  
and then click the right most button of the second item to select the image you want to burn.<br/>
+
 
 +
 
 +
===== Step 2: Select Loader =====
 +
 
 +
Next, click the button in the red box on the right last columns select the loader "rk3399_ loader_ xxxxx.bin ",  
 +
 
 
[[File:AndroidTool8.PNG | 600px]]
 
[[File:AndroidTool8.PNG | 600px]]
  
Finally, click the "run" button in the red box below, and you will see the content in the red box on the right. When the progress reaches 100%, the download is completed.<br/>
+
''Note:'' the loader (flash helper) is used to init the ram and prepare the flashing environment etc. If you don't have it, you can download it from [https://dl.radxa.com/rockpi/images/loader/ here]
 +
 
 +
===== Step 3: Select Image =====
 +
 
 +
Then click the right last columns to in the Image row and choose the image you want to flash.
 +
 
 +
''Note'': Normally the image name should ends with xxx-gpt.img. If the image name ends with xxx-rkupdate.img, you can not flash with this method.
 +
 
 +
 
 +
===== Step 4: Run =====
 +
 
 +
Finally, click the "run" button in the red box below, and you will see the content in the red box on the right. When the progress reaches 100%, the download is completed.
 +
 
 
[[File:Androidtool5.PNG | 600px]]
 
[[File:Androidtool5.PNG | 600px]]
  
=== Install by partitions(optional) ===
+
=== Install by partitions(Advanced) ===
 +
==== Linux/macOS ====
 
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
 
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
  
Line 172: Line 200:
 
     rkdeveloptool wl 32768 boot.img
 
     rkdeveloptool wl 32768 boot.img
 
     rkdeveloptool wl 262144 rootfs.img
 
     rkdeveloptool wl 262144 rootfs.img
 +
 +
 +
==== Windows ====
 +
 +
TBD.
  
 
=== Troubleshooting ===
 
=== Troubleshooting ===
  
 
* If you have issue with flashing via USB OTG, start a new post on the forum. https://forum.radxa.com/c/dev
 
* If you have issue with flashing via USB OTG, start a new post on the forum. https://forum.radxa.com/c/dev

Revision as of 10:27, 28 May 2020

    ROCK Pi 4 >  Development >  Install from USB OTG port

Rock PI supports Maskrom mode, which is a special operation mode for CPU to wait for USB OTG port command. The PC tools we use to communicate with rock PI in Maskrom mode are the rkdevelopment tool and AndroidTool tool. We use the rkdevelopment tool in Linux/macOS and the AndroidTool tool under Windows.

Requirement

  • ROCK Pi 4 mainboard
  • eMMC module
  • Power adapter
  • USB Male A to Male A cable(important) USB-C has been seen as not working, an adaptor for USB-C to USB-A has worked. See discussion.

Install Tools&Drivers

Windows

Step 1:Install Android tool

The tool is provided in a compressed package. First, download the compressed package of this tool, and click the download link (AndroidTool_Release_v2.69.zip). After downloading, unzip it. Installation is complete.

Step 2:Install driver

Using the RK driver assistant tool to install the driver.

There’s no need to connect your Rockchip device during this procedure just download and extract RKDriverAssistant.zip

Then double click on DriverInstall.exe in the RKDriverAssistant directory to start the utility. If you installed the Rockchip USB drivers for any other Rockchip devices already, make sure you click “Uninstall Driver” first.

RK Driver Assistant Install Uninstall.jpg

Then click “Install Driver”, the driver has finish installing.

Linux

For Linux, we build the rkdeveloptool from source code.

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

Install build dependency:

 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

For macOS, we build the rkdeveloptool from source code.

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

Install build dependency:

   brew install automake autoconf libusb lsusb

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

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

  • 1. Power off the board and remove any bootable storage media, remove microSD card, remove eMMC module.
  • 2. Plug the USB Male A to Mail A cable to ROCK Pi 4 OTG port(the upper USB3 port), the other side to PC
  • 3. Power on the board
    • 4. For Linux/macOS

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

   Bus 003 Device 005: ID 2207:330c
    • 4. For Windows

Open device manager in your Windows PC, check the Device Manager:

RK Driver Assistant Install Usb driver.png

It means the device is in maskrom mode now.

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

Begin Installation USB -> eMMC

Linux/macOS

On your PC, run the rkdeveloptool

   rkdeveloptool ld        # List the device
   DevNo=1	Vid=0x2207,Pid=0x330c,LocationID=305	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 rk3399_loader_vxxxx.bin

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

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

Reboot the device

   rkdeveloptool rd

Now the device should boot the new image on eMMC

Windows

Double click the AndroidTool.exe and you will see the following interface:

If your ROCK Pi is in maskrom mode and connects to PC, you can see that the program detect it, as the red box shown below:

AndroidTool1.PNG

Step 1: Select Profile

Then, select a profile for the newly added item, right-click = > select "load config":

Android3.PNG

Open the folder of Android tool and select "config_ rockpi_gpt"Configuration file for GPT.

Android4.PNG

Then, you can see two rows, one is Loader and the other is Image.


Step 2: Select Loader

Next, click the button in the red box on the right last columns select the loader "rk3399_ loader_ xxxxx.bin ",

AndroidTool8.PNG

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

Step 3: Select Image

Then click the right last columns to in the Image row and choose the image you want to flash.

Note: Normally the image name should ends with xxx-gpt.img. If the image name ends with xxx-rkupdate.img, you can not flash with this method.


Step 4: Run

Finally, click the "run" button in the red box below, and you will see the content in the red box on the right. When the progress reaches 100%, the download is completed.

Androidtool5.PNG

Install by partitions(Advanced)

Linux/macOS

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                |
| ----------- | ------ | ------- | -------------------------- |
| 1           | 32KB   | loader1 | First stage loader         |
| 2           | 8MB    | loader2 | U-boot image               |
| 3           | 12MB   | trust   | ATF                        |
| 4           | 16MB   | boot    | Kernel partition, bootable |
| 5           | 128MB  | rootfs  | Rootfs                     |

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

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


Windows

TBD.

Troubleshooting