U-boot (plus MAC address) » History » Revision 4
Revision 3 (Alex Seferidis, 07/15/2025 01:53 PM) → Revision 4/6 (Alex Seferidis, 07/15/2025 01:56 PM)
# U-boot (plus MAC address)
**SOS** : do not use u-boot from Yocto
Use u-boot provided by Rockchip SDK
1. copy board.c to /arch/arm/mach-rockchip
2. file: configs/rk3568_defconfig
CONFIG_BOOTDELAY=5
Note: Read Docs: /home/SDK_4_19/docs
use these commands to build uboot:
```
./build.sh device/rockchip/rk356x/BoardConfig-evb2-lp4x-v10.mk rk3566-evb2-lp4x-v10.mk
./build.sh uboot
```
<img src="uboot.png" width="50%">
With this uboot MAC address can be written to flash. The uboot read MAC address and provides it to Linux.
example how to write MAC with PHP script (this script runs on device):
``` php
$mac = $_POST['mac'];
$mac_Arr = explode(":", $mac);
if (count($mac_Arr) != 6) {
echo "MAC address ERROR";
exit();
}
chdir("/data/firmware/htdocs");
$output = shell_exec('dd if=/dev/mmcblk0 skip=7170 of=mac.img bs=512 count=1');
$filesize = filesize('mac.img');
$fp = fopen('mac.img', 'rb');
$binary = fread($fp, $filesize);
fclose($fp);
$binary[0] = chr(hexdec($mac_Arr[0]));
$binary[1] = chr(hexdec($mac_Arr[1]));
$binary[2] = chr(hexdec($mac_Arr[2]));
$binary[3] = chr(hexdec($mac_Arr[3]));
$binary[4] = chr(hexdec($mac_Arr[4]));
$binary[5] = chr(hexdec($mac_Arr[5]));
$fp = fopen('mac_new.img', 'wb');
fwrite($fp, $binary);
fclose($fp);
$output = shell_exec('dd if=mac_new.img of=/dev/mmcblk0 seek=7170 bs=512 count=1');
```