]> git.ipfire.org Git - people/ms/u-boot.git/blame - tools/gen_eth_addr.c
Remove CONFIG_SYS_BOOTCOUNT_SINGLEWORD
[people/ms/u-boot.git] / tools / gen_eth_addr.c
CommitLineData
5745185e
WD
1/*
2 * (C) Copyright 2001
3 * Murray Jensen <Murray.Jensen@cmst.csiro.au>
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
5745185e
WD
6 */
7
8#include <stdio.h>
9#include <stdlib.h>
10#include <unistd.h>
11#include <time.h>
12
13int
14main(int argc, char *argv[])
15{
16 unsigned long ethaddr_low, ethaddr_high;
17
3e4dad50 18 srand(time(0) + (getpid() << 8));
5745185e
WD
19
20 /*
21 * setting the 2nd LSB in the most significant byte of
22 * the address makes it a locally administered ethernet
23 * address
24 */
2eeb4e95
PT
25 ethaddr_high = (rand() & 0xfeff) | 0x0200;
26 ethaddr_low = rand();
5745185e
WD
27
28 printf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\n",
29 ethaddr_high >> 8, ethaddr_high & 0xff,
30 ethaddr_low >> 24, (ethaddr_low >> 16) & 0xff,
31 (ethaddr_low >> 8) & 0xff, ethaddr_low & 0xff);
32
33 return (0);
34}