Thursday, July 14, 2011

Persistent MAC Address on the PandaBoard

The PandaBoard doesn't have an EEPROM to store a MAC address for the on-board NIC, and as a result, a new random MAC address is generated on boot.  This can be a problem for DHCP lease pools, firewall rules, and more.

I mentioned in an earlier post that Ubuntu 11.04 is somehow keeping the NIC's MAC address persistent despite the lack of an EEPROM.  I investigated a bit and found it was a simple combination of (1) setting a MAC address in the NetworkManager settings and (2) this driver patch going into the latest upstream kernels: smsc95xx: generate random MAC address once, not every ifup.

Back in Fedora 13, I upgraded to David Marlin's latest 2.6.39-1.01.fc13.armv7l kernel from — which includes the above patch — and booted the PandaBoard.

The first thing I noticed was that the NIC is named eth0 now instead of usb0 (that's a nice touch) and, as expected, it has a new random MAC address:
[root@fedora-arm ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 4E:19:68:14:3C:F9
          BROADCAST MULTICAST  MTU:1492  Metric:1

I changed the MAC address using the standard tools and it appeared to stick:
[root@fedora-arm ~]# ifconfig eth0 hw ether CA:BC:15:4D:B4:49
[root@fedora-arm ~]# ifconfig eth0
eth0      Link encap:Ethernet HWaddr CA:BC:15:4D:B4:49
          BROADCAST MULTICAST MTU:1492 Metric:1

I wanted to make this survive a reboot, so I looked at the /etc/sysconfig/network-scripts/ifup-eth script and found this chunk:
# this isn't the same as the MAC in the configuration filename. It is
# available as a configuration option in the config file, forcing the kernel
# to think an ethernet card has a different MAC address than it really has.
if [ -n "${MACADDR}" ]; then
   ip link set dev ${DEVICE} address ${MACADDR}

(The ip command is preferred over the older ifconfig command.)

So, I edited /etc/sysconfig/network-scripts/ifcfg-eth0 and removed the HWADDR variable and set MACADDR instead:

I rebooted the PandaBoard and it worked:
                Welcome to Fedora
                Press 'I' to enter interactive startup.
Starting udev: [  OK  ]
Setting hostname fedora-arm:  [  OK  ]
fedora-arm login: root
Last login: Thu Jul 14 16:48:49 on console
[root@fedora-arm ~]# ifconfig eth0 | grep HWaddr
eth0      Link encap:Ethernet HWaddr CA:BC:15:4D:B4:49

Hooray for persistent MAC addresses!

Saturday, July 9, 2011

PandaBoard Display Resolution

I wanted to return to the persistent-MAC-address problem and compare Fedora vs Ubuntu, so I swapped SD cards to Ubuntu and powered up the PandaBoard.  To my surprise, Ubuntu set the display resolution to 640x480.  This Samsung 2233SW monitor supports 1920x1080, so why is it so low?  I checked the Monitor Preferences and it only listed 640x480 as an option, and I fired up a terminal and 'xrand -q' reported the same.  I know the last time I booted into Ubuntu in May, it was much higher than 640x480.  What changed?

I tried adding a new mode with 'xrandr  --new-mode ...' but that didn't work.

I found the Omappedia Bootargs for Enabling Display page and tried modifying my /boot/boot.script (and running flash-kernel) to add omapfb.mode=dvi:1920x1080MR-24@60 to the kernel command line arguments, but that didn't work either.

A few hours and many unsuccessful attempts later, I looked around the room and saw an older Dell 1707FPc monitor sitting in the corner.  Maybe I was using that monitor in May?  It only supports 1280x1024, so maybe it will work better?  I cleaned up my boot.script and swapped monitors and voila, it came up with 1280x1024!

I guess the PandaBoard doesn't like this Samsung display for some reason.