Duplicate MAC Addresses and Serial Numbers

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?

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

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
1 Like

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

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?

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

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

1 Like

It works! Thanks again :slight_smile:

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!

2 Likes

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

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

3 Likes

CONFIRM, It Works, thanks

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

@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…

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

1 Like

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?

1 Like

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

@Terry any news on that? :slight_smile:

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

I think you need type those while in uboot

1 Like