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.
If you have a board similar to already existing boards use the configurations present
in the already existing board to jump start your changes.
- Pull the u-boot source from git repo.
- 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> - Checkout to your branch. eg: git checkout <yourbranchname>
- Now we are ready to port u-boot to the new board.
- Create a folder called <yourboardname> in board/vendor/
eg: board/vendor/<yourboardname> - 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. - Create a configuration file in include/configs/<yourboardname>.h
- Create a defconfig file in configs/<yourboardname>_defconfig
- Edit arch/<cpu_architecture>/cpu/<cpu_architecture_variant>/<cpu_vendor>/Kconfig
eg: arch/arm/cpu/armv7/mx6/Kconfig - Create a section TARGET_<yourboardname>
<...>
<...>
<...> - At the end of the file add the source path.
eg: source "board/<vendor>/<yourboardname>/Kconfig" - Run
CROSS_COMPILE="<yourcompilertoolchain>" make distclean
CROSS_COMPILE="<yourcompilertoolchain>" make <yourboardname>_defconfig
CROSS_COMPILE="<yourcompilertoolchain>" make - 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