Thursday 23 January 2014

Explore the U-boot Environment !!

Hi guys...

I hope you all are enjoying the journey of learning uClinux or embedded linux compilation and building on the target board.
In my last blog we have discussed how to build hex image of U-boot for our target board that is quite easy steps but any way as a beginner we have to learn and understand each and every steps... =D

So finally we got a hex image of u-boot bootloader so we can flash it on our board... today we will learn how to flash u-boot.hex into LPC2468 and we'll try to explore u-boot environment.

Steps to load u-boot.hex into our board :

1) Start the FlashMagic tool (can be downloaded here). See Figure below for what FlashMagic looks like when it is started.
2) Click the “Browse” button and browse to the location of the u-boot.hex file.

3) Change the COM port to the COM port used by your target. Select baudrate as same as your com port have.

4) Click the “Start” button to download the u-boot.bin file to the target.








Explore the u-boot environment :Now we will see how to connect  the board with a terminal application and then explore the u-boot console and environment. You can use a terminal application of your choice. In this example we will use an application known as Tera Term.

Connect a Terminal to the Board :
1. Start the Tera Term application and configure the serial port. Setup Serial port
                               Setup ---> Serial port
2. Configure the port to use a baud rate of 115200, 8-bit data, no parity, 1 stop bit and no flow control, see Figure below.

3. Click the “OK” button and Tera Term will connect to the board. If you have selected the wrong COM port or if it is already in use you will get an
error message telling you that Tera Term cannot open the COM port.

4. Press the Reset button on the base board to make sure the board restarts. You should now see output from the u-boot in the terminal, see Figure below. Make sure to hit any key to stop the auto boot procedure in 3 seconds.......


Commands to operate U-boot :

1) help:- List all available commands by using the help command.
# help
? - alias for 'help'
autoscr - run script from memory
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
...


2) Get specific instructions about a command, the example shows help text for the setenv command.
# help setenv
setenv name value ...
- set environment variable 'name' to 'value ...'
setenv name
- delete environment variable 'name'


3) printenv :- Print the current environment by using the printenv command.
# printenv
bootargs=root=/dev/ram initrd=0xa1800000,4000k console=ttyS0,115200N8
bootcmd=echo ;echo Booting from NAND FLASH (may take some seconds);echo
First loads 'uLinux.bin' and then 'jffs2.img';run nand_boot

bootdelay=3
baudrate=115200
tftp_boot=tftpboot a1500000 uLinux.bin;tftpboot a1800000 romfs.img;bootm
a1500000
nand_boot=nboot a1500000 0;bootm a1500000
nor_boot=bootm 80000000
...


etc.. etc...

This is how you can explore the environment for U-boot which provides you a command interface to give commands & these commands will help you to boot kernel image from different type of storage media that we will discuss later. So now your board is loaded with bootloader which is same as placenta in mother's uterus which loads life or new soul... in our case new soul is OS =D

In my next post we'll load our kernel image into board using usb method and we'll se the different method of loading kernel into board... if u have any queries please post below... hope u all will njoy !! :)


Thats it for today!!

Abhishek Mourya