I followed http://wiki.osdev.org/ARM_Beagleboard to create a simple startup program for my beaglebone. In that tutorial, we copy the file to a address using tftp and use "go" command to transfer the control.

But, normally we use a uboot compatible format to boot the images using "bootm" command. To make our image in this format, we use "mkimage" command. You need to download uboot source and build this mkimage

The command we are going to use is

mkimage -A arm -O myARM -T kernel -C none -a 0x80200000 -e 0x80200040 -n kernel -d boot.bin os_uImage

-A -- architecture type

-O -- os type

-T -- type of image

-C -- compression used

-a -- load address

-e -- entry point

-d -- data file to be booted

os_uImage -- resultant uboot compatible image

To boot the image follow the following commands


U-Boot# setenv ipaddr 10.117.83.43
U-Boot# setenv serverip 10.117.83.34
U-Boot# tftp 0x80200000 os_uImage
link up on port 0, speed 100, full duplex
Using cpsw device
TFTP from server 10.117.83.34; our IP address is 10.117.83.43
Filename 'os_uImage'.
Load address: 0x80200000
Loading: #
         44.9 KiB/s
done
Bytes transferred = 92 (5c hex)
U-Boot# bootm
## Booting kernel from Legacy Image at 80200000 ...
   Image Name:   kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    28 Bytes = 28 Bytes
   Load Address: 80200000
   Entry Point:  80200040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

@@@



I made the image to hang so that we can see the output.

The advantage is we can specify image name and we can do compression on our command. If we use go command it needs to be raw data file. By using bootm command we can use all the facilities provided by uboot.

Initially, my tries failed because I gave load address and entry point to be the same. Then I changed the entry point to load_addr+ 0x40 and boot succeeded.
 This is just a trial and error since the my data file started at that address in the resulting uImage. 0x40 bytes for uboot header I guess. I must check this and confirm if it is okay.
In this post, I will explain how to setup beaglebone black to boot from tftp. This  saves us time in programming the SDcard every time we need to change the image. For baremetal programming, we may need to change the image frequently and this method will be of real help. For this method you need serial console access.

I found a very good article on the same topic in the following website
http://wiki.beyondlogic.org/index.php/BeagleBoneBlack_Building_Kernel
This article provides some extra points.

1. How to compile latest mainline kernel for beaglebone black
2. NFS root issues while booting

All the steps mentioned are for UBUNTU. Seriously, your life will be easier , if you use ubuntu.

This is what we are going to do

1. Build an image
2. start tftp server
3. Stop in uboot prompt.
4. Set up environment variables
5. Use NFS file system for ramdisk

BUILD THE IMAGE:
               In many of the articles available in the net, they will ask you to use a arch linux based kernel. We need to download it , compile and boot it. But we need the latest linux kernel and not a distro. This is important beacuse, we need the mainline kernel which has all the latest changes to the linux kernel. Secondly, if you want to  learn Linux system/driver programming it is always better to have the latest version. For instance, the kernel mentioned in beagleboard website, the version is 3.12. The  latest version as i write this blog is 3.18.

1. Download the latest kernel from kernel.org and unzip it.
https://www.kernel.org/

2. We are going to use a cross compiler to compile our image. I am using ubuntu 14.04LTS OS. You need to install arm-linux-gnueabi tools for cross compilation.
apt-get utility can help you.

3. After installing we are ready for compilation.
    We need to use a default config file. For this use, arch/arm/configs/omap2plus_defconfig

4. compilation steps
    
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-  omap2plus_defconfig -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4
 
5. For setting up the tftp server and nfs root follow the link 
provided.

6. While setting up the server, you need to give dhcp command 
in uboot prompt. It will tell you an available ip address.
 
7. You need to mention this in your /etc/exports file in the 
following format. Otherwise, nfs mount will fail
/home/ragu/work/linux/busybox/src/busybox-1.21.0/arm_install/ 10.117.83.172(rw,sync,no_root_squash,no_subtree_check)
/home/ragu/work/linux/busybox/src/busybox-1.21.0/arm_install/ 10.117.83.175(rw,sync,no_root_squash,no_subtree_check) 

Follow the instructions mentioned in the reference article for
booting.

We use busybox for ramdisk. Thats all i wanted and it is good enough for me.



 

  


Hi . In this post I will explain how to get started with beaglebone black.

Beaglebone black is a dev board from Texas Instruments. It consists of

1. ARM processor
2. Ethernet Port
3. USB port
4. External 5V power supply
5. USB to Serial ports
6. USB console
7. Inbuilt storage of 4GB
8. External sdMMC storage support

This is mainly aimed at those who, want to do some baremetal programming with beaglebone black.

Out of the support:
1. It will have the board.
2. A linux distro image is written to internal storage and you will be able to boot from it
3. A USB console.

You can connect the USB console to your system and start working with it at the go. For Linux, you need to set some udev rules and you are good to go. For windows, you need to install some drivers. They can be found here
http://beagleboard.org/getting-started

A network interface is created for the usb console and you can ssh to it.
This is sufficient for baremetal programming

For baremetal programming, we need

1. A serial console so that we can see what is going on while booting
2. Access to uboot prompt so that we can change images frequently

For this buy a USB to serial 4 pin connector. I found this in eBay and has to come from Trivandrum. It took 25 days for me to get one. So better to order at the earliest
http://www.ebay.in/itm/USB-To-RS232-TTL-UART-PL2303HX-Auto-Converter-USB-to-COM-Cable-Adapter-Module-/261685009055?pt=LH_DefaultDomain_203&hash=item3ceda45a9f

Drivers are already present in ubuntu. It works seemlessly and very good.

This solves our problem of serial console. In the next blog, I will explain how to boot beaglebone from tftp server and nfs root.


OPENRISC toolchain for FreeBSD

Exact steps.

1. Download gcc and other utils  zip files from openrisc git page

2. Unzip the scr file. It has binutils and other required files

3. run configure
./configure --target=$TARGET --prefix=$PREFIX --with-sysroot --enable-maintainermode --enable-shared --enable-ld

4. configure will succeed. Then run make command

5.
the make failed ld
 
10. adding the option to ld
 
added this, line ld/configure.tgt
or1k-*-freebsd* | or1knd-*-freebsd*)        targ_emul=elf32or1k ;;

other bsd targets had _fbsd extension. It throwed some error when configured like that.
so leaving as elf as used by rtems. need to revisit
 
6. Next gdb compilation will fail , because -lsim is not added.
    Added it in the gdb/Makefile after -ls lm. It succeeded
 
7. rda compilation failed. You need to compile rda in or1k-freebsd* directory. Otherwise it will fail
You may need to maunually edit acinclude.m4 file for correct path 
   It will say gcc cannot compile binaries. ZTo fix you need to manualyy compile 
rda. for this go rda directorr

./configure -- target=$TARGET --prefix=$PREFIX

it may fail at some libtool version mismatch error (LT__INIT). To fix this you follow

http://www.howtodoityourself.org/how-to-fix-libtool-version-mismatch-error.html

after this make and make install
 
 

8.  this makes binutils and complete
 
9/ Now compile GCC
 
gcc we need to edit gcc/config.gcc and libgcc/config.host and add the corresponding entries
 
10. after that there is in libatomic library. I removed its compilation --disable-libatomic
 
11. after compilation succeeded
 
12. make install installed file