Updating u-boot

Kernel hacking implies a lot of iterative small changes followed by a deployment on the board, that  become really annoying if we have to switch the SD card from the board to the computer in order to copy the kernel and put it back to the board again, without speaking about the degradation of the SD card adapter by these multiple mechanical operations.

A solution is to have u-boot to download the kernel directly from the compilation host. I used to have tftpboot loading the kernel and the dtb. For this, we need an u-boot supporting the rock960 and hopefully the upstream support is almost ready (patches are submitted and very likely they will be merged soon 09-26-2018). In addition an USB dongle with ASIX chipset must be used (it is the one I'm used to have), you can find this with the following keywords over internet : USB 2.0 RJ45 Lan Ethernet Asix AX8872B

Until we have those patches merged, this is the quick summary of what is needed to compile u-boot for the rock960.

Before going forward, make sure:

  • no USB-A connected but only USB-C. The board works in OTG or host mode, so if something is plugged on the USB-A, the OTG won't work
  • no MMC is inserted. . If a MMC card is inserted, the flashing mode won't switch. 
  • flashing the board with the rk tools as root
  • USB2 only (USB3 not supported on u-boot)

Generating the u-boot:

  • Clone the upstream u-boot git tree
    • git clone git://git.denx.de/u-boot.git
  • After setting the .pwclientrc file with the u-boot project, apply the patches with the command  (please refer to pwclient documentation on the patchwork website):
      • pwclient git-am -s -p uboot 975858 975861 975860 975859
    • Note these patches may be already merged when you read this howto
  • Follow the instructions you can find in the README file in the u-boot source tree
    • board/vamrs/rock960_rk3399/README
  • In case you are lost, get some additionnal information from the 96boards rock960 howto
There are two recipes at one moment for u-boot, SPL and miniloader. Use the latter if you have a 4GB memory board.

At this point, you have compiled and flashed u-boot. However PHY USB support and USB ethernet dongle will be missing, so you have to tweak the configuration via menuconfig.
  • make ARCH=arm64 menuconfig
  • Set USB phy for Rockchip option (CONFIG_ROCKCHIP_USB2_PHY=y)
    • Device drivers => USB Support => Rockchip USB2 PHY
  • Set USB ethernet dongle option (CONFIG_USB_ETHER_ASIX=y)
    • Device drivers => USB Support => USB to Ethernet Controller Drivers => ASIX AX8817X (USB 2.0) support
And redo the operations compilation and flashing (I could have added those information before but for the sake of clarity I decided to not nest them with the others).

At this point, u-boot is compiled and flashed on the board. We now begin the configuration steps, for this, let's remove the USB-C and plug the USB ethernet dongle, reset the board.

On the u-boot prompt, type usb start and see if it finds an ethernet dongle


USB0:   USB EHCI 1.00
USB1:   USB EHCI 1.00  
scanning bus 0 for devices... 2 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 1 Ethernet Device(s) found

If yes, then we can go further.


Commentaires

Posts les plus consultés de ce blog

Custom kernel compilation