Friday, 18 March 2016

Basic u-boot setup for porting

I have been doing some work on u-boot porting and I felt that I should write a small step by step guide for my reference.

  1. Pull the u-boot source from git repo.
  2. Create a separate branch. In this way you are creating
       isolating your changes to a separate branch. Once testing
       is done and is stable you can merge to the main branch.
       eg: git branch <yourbranchname> 
  3. Checkout to your branch.   eg: git checkout <yourbranchname> 
  4. Now we are ready to port u-boot to the new board. 
  5. Create a folder called <yourboardname> in board/vendor/
       eg: board/vendor/<yourboardname>
  6. Populate this folder with Kconfig,Makefile,<yourboardname>.c, any lds (linker script files) at a minimum.
    Modify Kconfig and Makefile accordingly. Any supporting files can be put in the above folder. 
  7. Create a configuration file in include/configs/<yourboardname>.h
  8. Create a defconfig file in configs/<yourboardname>_defconfig
  9. Edit arch/<cpu_architecture>/cpu/<cpu_architecture_variant>/<cpu_vendor>/Kconfig
        eg: arch/arm/cpu/armv7/mx6/Kconfig 
  10. Create a section TARGET_<yourboardname>
  11.  At the end of the file add the source path.
     eg: source "board/<vendor>/<yourboardname>/Kconfig"
  12.  Run
        CROSS_COMPILE="<yourcompilertoolchain>" make distclean
        CROSS_COMPILE="<yourcompilertoolchain>" make <yourboardname>_defconfig
        CROSS_COMPILE="<yourcompilertoolchain>" make
  13.  To flash the board with your new u-boot do:
        sudo dd if=u-boot.imx of=/dev/sdb bs=512 seek=2 conv=fsync

If you have a board similar to already existing boards use the configurations present
in the already existing board to jump start your changes.

No man should escape our universities without knowing how little he knows.
-J. Robert Oppenheimer

No comments:

Post a Comment