]> xenbits.xensource.com Git - xenclient/build.git/commitdiff
amt bit swizzling boot time component
authorJames Mckenzie <jamesmck@taoand.cam.xci-test.com>
Fri, 11 Dec 2009 14:23:45 +0000 (14:23 +0000)
committerJames Mckenzie <jamesmck@taoand.cam.xci-test.com>
Fri, 11 Dec 2009 14:23:45 +0000 (14:23 +0000)
target/generic/target_xenclient_skeleton/etc/init.d/S45swizzlemac [new file with mode: 0755]

diff --git a/target/generic/target_xenclient_skeleton/etc/init.d/S45swizzlemac b/target/generic/target_xenclient_skeleton/etc/init.d/S45swizzlemac
new file mode 100755 (executable)
index 0000000..325ae99
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# set the 2nd lsb of the 1st octet of the mac address
+# if /etc/amt-pt is present
+
+if [ -f /etc/amt-pt ]; then
+       NEWMAC=$( /usr/bin/awk '
+               BEGIN { 
+                       RS=":"; 
+                       n=0; 
+               };
+               { 
+                       $1="0x"$1; 
+                       n++; 
+                       if (n==1) {
+                               $1=or($1,2); 
+                       };
+                       printf "%02x",$1; 
+                       if (n<6) printf ":";
+               }
+               '  < /sys/class/net/eth0/address
+       )
+       /sbin/ifconfig eth0 down
+       /sbin/ifconfig eth0 hw ether $NEWMAC
+fi     
+