Firstly, I have no idea how many parts I will write on this topic "Learning uboot".
Introduction
Namely part 1, let's take a look what u-boot is. Official website for u-boot is
http://www.denx.de/wiki/U-Boot/WebHome.
u-boot is a kind of bootloader on embedded device (eg. routers). Mother Board initialization is what it suppose to do.
What happen after powering on your device
Power on -> bootloader (ROM) -> firmware (STORAGE somewhere) -> user-space interface ( COMMAND LINE or something like that)
My goal
My job is implementing a function for loading firmwares via cat5 cable (IE no SERIAL CONSOLE RS232). A suggestion from my supervisor is starting from bootloader. Basically, that's why this thread coming out :D
1. Browsing the u-boot project
Since I have no expereince on related topics, I can only read documentations, tutorials, googling etc....
Here is my summery for files useful for my goal.
Assume prefix <u-boot project> is presented
/include/configs/cavium_cns3000.h /* u-boot console default environment variable value */
/board/cavium/cns3000/vega.c /* board manufacturer info */
/common/env_common.c /* where environment variable will be assign */
/common/devices.c /* How devices will be enabled */
/common/main.c /* How Interactive Shell implemented */
/net/net.c /* How tftp, arp, ping implemented */
2a. Execution flow
cpu/..../start.S
board/.../lowlevel_init.S
board/.../lowlevel_init.c
cpu/.../start.S
lib_.../board.c
2b. Command flow
/common/main.c
main_loop() -> readline() -> run_command() ->
/common/command.c
find_cmd() -> corresponding function()
3. Short summery
Compile issue:
Make sure your board model is supported by u-boot. (Ask your board manufacturer what to do for bootloader issue)
U-boot provides you a way to build relevant configuration files. (`make <board>_config`)
Make sure your tool chain directory is presented in $PATH.
Script issue:
Following commands are useful for scripting in u-boot.
setenv; setting environment variable
saveenv: saving environment variable permanently on rom
printenv: printing environment variable
run <var>: run the variable contents
coninfo: list of available devices
Script example:
setenv loader tftpboot 0x800000 loader.bin\;erase 0x10000000 +\$(filesize)\;cp.b 0x800000 0x10000000 \$(filesize)\;reset
run loader
Reference
Illustrate the u-boot project hierarchy in chinese
http://gordenhao.pixnet.net/blog/post/29189867-%5B%E8%B3%87%E6%96%99%5D-u-boot-%E7%B0%A1%E4%BB%8B
How to compile uboot
http://home.educities.edu.tw/fushiyun2000/gameconsole_snk_neogeox_hack_compile_official_uboot_program.htm
Execution flow
https://sites.google.com/site/myembededlife/Home/u-boot/u-boot-startup-sequence