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

Rockpi4/dev/u-boot/es es

< Rockpi4‎ | dev‎ | u-boot
Revision as of 07:23, 20 October 2019 by HANLLEL (Talk | contribs)


       ROCK Pi 4 >  Desarrollando >  U-boot 

Compilar U-boot y ejecutarlo en ROCK Pi4

Requirement

  • ROCK Pi 4 mainboard
  • A EMMC module or a microSD card
  • 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.
  • A a PC/laptop running Linux

Step 1 Get the source code

You need Git to get multiple git repositories to build the image.

Install Git if you don't have it.

   sudo apt-get update
   sudo apt-get install git

Clone the source code

   git clone --recursive https://github.com/radxa/rockchip-bsp.git

You will get

   build  kernel  README.md  rkbin  rootfs  u-boot

Directories usage introductions:

  • build:
    • Some script files and configuration files for building u-boot, kernel and rootfs.
  • kernel:
    • kernel source code, current version is 4.4
  • rkbin:
    • Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).
  • rootfs:
    • Bootstrap a Debian based rootfs, support architechture armhf and arm64, support Debian Jessie and Stretch.
  • u-boot:
    • u-boot as the second stage bootloader

Step 2 Install tool-chain and other tools

   sudo apt-get install gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools
   sudo apt-get install bc python dosfstools

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/

Step 3 Build U-boot

  • If you use the ROCK Pi4 A
   ./build/mk-uboot.sh rockpi4a
  • If you use the ROCK Pi4B
   ./build/mk-uboot.sh rockpi4b

And then you can get the directory 'out'.

Flash and run U-boot on ROCK Pi4

Insert a empty EMMC module or microSD card on your ROCK Pi4

Use the USB Male A to Male A cable to connected your PC and ROCK Pi4 and then type

   rkdeveloptool ld

You can see the output just like this

   DevNo=1	Vid=0x2207,Pid=0x330c,LocationID=302	Maskrom

You can useing this command to flash U-boot

   cd ./out/u-boot
   sudo rkdeveloptool db ../../rkbin/bin/rk33/rk3399_loader_v1.12.112.bin
   sudo rkdeveloptool wl 0x40 idbloader.img
   sudo rkdeveloptool wl 0x4000 uboot.img
   sudo rkdeveloptool wl 0x6000 trust.img
   sudo rkdeveloptool rd

The U-boot were run on your ROCK Pi4 try to type 'help' or '?' to getting started!