Duplicate MAC Addresses and Serial Numbers


#1

I have a huge problem with a set of Khadas Vim recently purchased. They all have the same serial numbers and Ethernet MAC addresses.

How do I get an original MAC address at least so the system doesn’t come into conflict on the network?


Random MAC Addresses
The mac number of vim1 will change every time it restarts. How can I not change it?
VIM2 Based Crypto currency Miner Build
Build Android (6.0/7.0) - system ui has stopped
Static mac address
#2

Hi, Guru:
We will check this first, and response you here then.


#3

You can set a custom MAC address during start-up by editing /etc/network/interfaces
or /etc/network/interfaces/eth0 and adding a line starting with hwaddress :

auto eth0
iface eth0 inet dhcp
  hwaddress ether XX:XX:XX:XX:XX:XX

#4

I’ve researched some other approaches like setup Mac Address via u-boot, will write documentation and publish at Khadas Docs then.


#5

Yes, via UBoot would be fine, this is for Android so editing etc/network/interfaces wouldn’t work (that’s Ubuntu).

How do I get the true MAC address/serial or what range is assigned from the manufacturer though?


#6

This is a huge problem for me having more than one devices as well.
Any development on this issue?
How to change MAC addresses?


#7

You can try to change the variable in u-boot “mac” (for example, using fw_setenv utility LE).


#8

It works! Thanks again :slight_smile:


#9

List the steps for reference:

  • Setup a new MAC address:
kvim# setenv ethaddr “00:15:18:01:81:32”
  • Keep the changes persistent:
kvim# saveenv
  • Reboot
kvim# reboot

Enjoy!


VIM random MAC address
#10

Hi @Gouwa .
The serial number on my VIM is 123456789abcdef , How to change?
Can I change the variable in u-boot “androidboot.serialno”?

PS . Change variable “androidboot.serialno” not working


#11

Are you on Android or Ubuntu?
I changed the variable in u-boot “androidboot.serialno”.
That’s ok on Android, but you need to rebuild the u-boot source code and reflash the u-boot.bin

####1. Modify the file in u-boot ‘board/khadas/configs/kvim.h’

diff --git a/board/khadas/configs/kvim.h b/board/khadas/configs/kvim.h
index 8f7a3e4..2a0e353 100644
--- a/board/khadas/configs/kvim.h
+++ b/board/khadas/configs/kvim.h
@@ -107,7 +107,7 @@
             "else fi;"\
             "\0"\
     "storeargs="\
-     "setenv bootargs ${initargs} androidboot.selinux=${EnableSelinux} logo=${display_layer},loaded,${fb_addr},${outputmode} maxcpus=${maxcpus} vout=${outputmode},enable hdmimode=${hdmimode} cvbsmode=${cvbsmode} hdmitx=${cecconfig} cvbsdrv=${cvbs_drv} androidboot.firstboot=${firstboot} jtag=${jtag}; "\
+     "setenv bootargs ${initargs} androidboot.selinux=${EnableSelinux} logo=${display_layer},loaded,${fb_addr},${outputmode} maxcpus=${maxcpus} vout=${outputmode},enable hdmimode=${hdmimode} cvbsmode=${cvbsmode} hdmitx=${cecconfig} cvbsdrv=${cvbs_drv} androidboot.firstboot=${firstboot} jtag=${jtag} androidboot.serialno=7654321abcdef; "\

####2. Rebuild u-boot

$ cd <path-to-your-project>/uboot
$ make CROSS_COMPILE=aarch64-linux-gnu- kvim_defconfig
$ make CROSS_COMPILE=aarch64-linux-gnu-

####3. Upgrade bootloader via TFTP

kvim# tftp 1080000 u-boot.bin
kvim# store rom_write 1080000 0 100000
kvim# defenv
kvim# saveenv
kvim# reset

About more informations for loading images with uboot via tftp, look LoadImagesWithUBootViaTFTP


#12

CONFIRM, It Works, thanks


#13

Not sure I got it right… How do I set following in Android Nougat built from source?

  • serial number
  • device id
  • MAC address of ethernet
  • MAC address of wi-fi
  • MAC address of bluetooth

#14

@terry What are the variables (androidboot.?) for ethernet, WiFi and Bluetooth MAC addresses?

In my case I didn’t succeed - even with those added to uboot/board/khadas/configs/kvim.h:

None of MAC addresses were set…


#15

List the steps for reference:

  • Setup a new MAC address:
kvim# setenv ethaddr “00:15:18:01:81:32”
  • Keep the changes persistent:
kvim# saveenv
  • Reboot
kvim# reboot

About WI-FI and Bluetooth MAC addresses, I still don’t try to modify it.
You can refer to the docs


#16

Hi Terry,

so if I understood correctly (ok well, more guessing, based on own experience and doc what I’m not really able to read)
S905X has three area where data can be stored

eFuses (most likely OTP area in chip - needs atleast kernel driver)
Nand (not use in VIM, like spi/etc…)
EMMC (in use)

so Khadas team not writing anythying into eFuses, so every VIM get random mac every starts, till some “own” mac is written in special emmc area, but anytime you reflash emmc, you lost your settings, right?

so is there any plan implement patch or include support for that eFuses?


#17

Yes, You are right .
We will take a look for OTP and add the support for it.
:smile:


#18

@terry any news on that? :slight_smile:


#19

Are these supposed to be executed when Android is booted on Khadas or when?


#20

I think you need type those while in uboot