[U-Boot] [PATCH 11/11] tools: Add tool to add crc8 to a mac address
Joe Hershberger
joe.hershberger at gmail.com
Tue Nov 15 04:31:26 CET 2016
On Fri, Nov 11, 2016 at 10:18 AM, Simon Glass <sjg at chromium.org> wrote:
> Hi Olliver, (is it one l or two?)
>
> On 8 November 2016 at 08:54, Olliver Schinagl <oliver at schinagl.nl> wrote:
>> This patch adds a little tool that takes a generic MAC address and
>> generates a CRC byte for it. The output is the full MAC address without
>> any separators, ready written into an EEPROM.
>>
>> Signed-off-by: Olliver Schinagl <o.schinagl at ultimaker.com>
>> ---
>> tools/.gitignore | 1 +
>> tools/Makefile | 4 ++++
>> tools/gen_ethaddr_crc.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 57 insertions(+)
>> create mode 100644 tools/gen_ethaddr_crc.c
>>
>> diff --git a/tools/.gitignore b/tools/.gitignore
>> index cb1e722..0d1f076 100644
>> --- a/tools/.gitignore
>> +++ b/tools/.gitignore
>> @@ -6,6 +6,7 @@
>> /fit_check_sign
>> /fit_info
>> /gen_eth_addr
>> +/gen_ethaddr_crc
>> /ifdtool
>> /img2srec
>> /kwboot
>> diff --git a/tools/Makefile b/tools/Makefile
>> index 06afdb0..4879ded 100644
>> --- a/tools/Makefile
>> +++ b/tools/Makefile
>> @@ -43,6 +43,10 @@ envcrc-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o
>> hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
>> HOSTCFLAGS_gen_eth_addr.o := -pedantic
>>
>> +hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
>> +gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
>> +HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
>> +
>> hostprogs-$(CONFIG_CMD_LOADS) += img2srec
>> HOSTCFLAGS_img2srec.o := -pedantic
>>
>> diff --git a/tools/gen_ethaddr_crc.c b/tools/gen_ethaddr_crc.c
>> new file mode 100644
>> index 0000000..9b5bdb0
>> --- /dev/null
>> +++ b/tools/gen_ethaddr_crc.c
>> @@ -0,0 +1,52 @@
>> +/*
>> + * (C) Copyright 2016
>> + * Olliver Schinagl <oliver at schinagl.nl>
>> + *
>> + * SPDX-License-Identifier: GPL-2.0+
>> + */
>> +
>> +#include <ctype.h>
>> +#include <stdint.h>
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <string.h>
>> +#include <u-boot/crc.h>
>> +
>> +#define ARP_HLEN 6 /* Length of hardware address */
>
> Is there no #define for this in standard headers?
There is. ARP_HLEN is defined in include/net.h
More information about the U-Boot
mailing list