Revision as of 13:40, 27 March 2012

Contents

Introduction

This whitepaper explains how to modify and set the MAC address on a LeopardBoard DM36x. LeopardBoard boards have two independent MAC address: u-boot's MAC address used on u-boot start up and kernel's MAC address used once the Ethernet interface is set up on kernel space.

Modifying U-Boot's MAC address

U-Boot's MAC address on the LeopardBoard DM36x (not applicable to all systems) is wired in software on the file $DEVDIR/bootloader/u-boot-2010.12-rc2-psp03.01.01.39/src/include/configs/davinci_dm36xleopard.h with a line similar to the following:

#define CONFIG_ETHADDR "00:0C:0C:A0:02:b5"

Since the only way to change the u-boot's MAC address is on code, you need to change this value to the desired MAC address for U-Boot and rebuild it with the following command:

make bootloader

Once your bootloader has been built with the new MAC address just install it in your board by running the following command

make install

This way a new bootloader with a new MAC address will be flashed to the board.

Setting a fixed MAC address for the kernel

By default the kernel will start up with a random and different MAC address each time you reboot your board, sometimes this is not a desired behavior if you need to work with several boards with network connection since the existence of two or more devices with the same MAC address could cause conflicts in the network. The following sections shows how to set a fixed MAC address for the Kernel.

Setting a user defined MAC address

It is possible to set a user defined MAC address for the Kernel. In order to do that we just need to add the following extra kernel parameter

davinci_emac.ethaddr=<MAC address>

on

-> Kernel configuration
-> Extra kernel arguments

where <MAC address> is the desired MAC address in the form: xx:xx:xx:xx:xx:xx

After that you just need to rebuild your cmdline with the following command

make cmdline

and install the SDK on your board

make install

Setting the same MAC address used for u-boot

We also can set a fixed MAC address for the Kernel using the same MAC address that was set for the U-Boot, in order to do that we need to modify the bootcmd parameter in the U-Boot environment. We can find this environment variable either in the u-boot's prompt if we are using NAND booting or in the uEnv.txt file if we are using SD card booting.

Modifying the boot command when using NAND booting

In order to set the kernel's MAC address to the u-boot's MAC address follow the next steps:

1. Get into your minicom/termnet session and stop your board on the u-boot's prompt.

2. Type

printenv

3. Look for the bootcmd variable, you should see something like this

bootcmd=nboot 0x82000000 0 ${kerneloffset}

4. We need to specify the board to set the MAC address on the bootargs on booting to the same value of the u-boot's ethaddr environment variable, in order to do that we modify the bootcmd as is shown below:

7. Now your board will boot using the same MAC address in u-boot and kernel.

Modifying the boot command when using a SD card

When you are booting from SD Card you need to modify the uEnv.txt command on it to set the fixed MAC address since is on this file where you will find the bootcmd variable. In order to do that follow the next steps: