Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2011 Calxeda, Inc. |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
Przemyslaw Marczak | 2eb40ee | 2014-04-02 10:20:05 +0200 | [diff] [blame] | 6 | #include <common.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 7 | #include <command.h> |
Simon Glass | 5e6201b | 2019-08-01 09:46:51 -0600 | [diff] [blame] | 8 | #include <env.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 9 | #include <rand.h> |
Simon Glass | 495a5dc | 2019-11-14 12:57:30 -0700 | [diff] [blame] | 10 | #include <time.h> |
Simon Glass | 6f04498 | 2020-05-10 11:39:52 -0600 | [diff] [blame] | 11 | #include <uuid.h> |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 12 | #include <linux/ctype.h> |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 13 | #include <errno.h> |
| 14 | #include <common.h> |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 15 | #include <asm/io.h> |
| 16 | #include <part_efi.h> |
| 17 | #include <malloc.h> |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 18 | |
| 19 | /* |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 20 | * UUID - Universally Unique IDentifier - 128 bits unique number. |
| 21 | * There are 5 versions and one variant of UUID defined by RFC4122 |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 22 | * specification. A UUID contains a set of fields. The set varies |
| 23 | * depending on the version of the UUID, as shown below: |
| 24 | * - time, MAC address(v1), |
| 25 | * - user ID(v2), |
| 26 | * - MD5 of name or URL(v3), |
| 27 | * - random data(v4), |
| 28 | * - SHA-1 of name or URL(v5), |
| 29 | * |
| 30 | * Layout of UUID: |
| 31 | * timestamp - 60-bit: time_low, time_mid, time_hi_and_version |
| 32 | * version - 4 bit (bit 4 through 7 of the time_hi_and_version) |
| 33 | * clock seq - 14 bit: clock_seq_hi_and_reserved, clock_seq_low |
| 34 | * variant: - bit 6 and 7 of clock_seq_hi_and_reserved |
| 35 | * node - 48 bit |
| 36 | * |
| 37 | * source: https://www.ietf.org/rfc/rfc4122.txt |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 38 | * |
| 39 | * UUID binary format (16 bytes): |
| 40 | * |
| 41 | * 4B-2B-2B-2B-6B (big endian - network byte order) |
| 42 | * |
| 43 | * UUID string is 36 length of characters (36 bytes): |
| 44 | * |
| 45 | * 0 9 14 19 24 |
| 46 | * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
| 47 | * be be be be be |
| 48 | * |
| 49 | * where x is a hexadecimal character. Fields are separated by '-'s. |
| 50 | * When converting to a binary UUID, le means the field should be converted |
| 51 | * to little endian and be means it should be converted to big endian. |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 52 | * |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 53 | * UUID is also used as GUID (Globally Unique Identifier) with the same binary |
| 54 | * format but it differs in string format like below. |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 55 | * |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 56 | * GUID: |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 57 | * 0 9 14 19 24 |
| 58 | * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
| 59 | * le le le be be |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 60 | * |
| 61 | * GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id. |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 62 | */ |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 63 | int uuid_str_valid(const char *uuid) |
| 64 | { |
| 65 | int i, valid; |
| 66 | |
| 67 | if (uuid == NULL) |
| 68 | return 0; |
| 69 | |
| 70 | for (i = 0, valid = 1; uuid[i] && valid; i++) { |
| 71 | switch (i) { |
| 72 | case 8: case 13: case 18: case 23: |
| 73 | valid = (uuid[i] == '-'); |
| 74 | break; |
| 75 | default: |
| 76 | valid = isxdigit(uuid[i]); |
| 77 | break; |
| 78 | } |
| 79 | } |
| 80 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 81 | if (i != UUID_STR_LEN || !valid) |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 82 | return 0; |
| 83 | |
| 84 | return 1; |
| 85 | } |
| 86 | |
Patrick Delaunay | 65f94ed | 2015-10-27 11:00:28 +0100 | [diff] [blame] | 87 | #ifdef CONFIG_PARTITION_TYPE_GUID |
| 88 | static const struct { |
| 89 | const char *string; |
| 90 | efi_guid_t guid; |
| 91 | } list_guid[] = { |
| 92 | {"system", PARTITION_SYSTEM_GUID}, |
| 93 | {"mbr", LEGACY_MBR_PARTITION_GUID}, |
| 94 | {"msft", PARTITION_MSFT_RESERVED_GUID}, |
| 95 | {"data", PARTITION_BASIC_DATA_GUID}, |
| 96 | {"linux", PARTITION_LINUX_FILE_SYSTEM_DATA_GUID}, |
| 97 | {"raid", PARTITION_LINUX_RAID_GUID}, |
| 98 | {"swap", PARTITION_LINUX_SWAP_GUID}, |
| 99 | {"lvm", PARTITION_LINUX_LVM_GUID} |
| 100 | }; |
| 101 | |
| 102 | /* |
| 103 | * uuid_guid_get_bin() - this function get GUID bin for string |
| 104 | * |
| 105 | * @param guid_str - pointer to partition type string |
| 106 | * @param guid_bin - pointer to allocated array for big endian output [16B] |
| 107 | */ |
| 108 | int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin) |
| 109 | { |
| 110 | int i; |
| 111 | |
| 112 | for (i = 0; i < ARRAY_SIZE(list_guid); i++) { |
| 113 | if (!strcmp(list_guid[i].string, guid_str)) { |
| 114 | memcpy(guid_bin, &list_guid[i].guid, 16); |
| 115 | return 0; |
| 116 | } |
| 117 | } |
| 118 | return -ENODEV; |
| 119 | } |
| 120 | |
| 121 | /* |
| 122 | * uuid_guid_get_str() - this function get string for GUID. |
| 123 | * |
| 124 | * @param guid_bin - pointer to string with partition type guid [16B] |
| 125 | * @param guid_str - pointer to allocated partition type string [7B] |
| 126 | */ |
Simon Glass | 4acd4f0 | 2020-04-08 08:32:58 -0600 | [diff] [blame] | 127 | int uuid_guid_get_str(const unsigned char *guid_bin, char *guid_str) |
Patrick Delaunay | 65f94ed | 2015-10-27 11:00:28 +0100 | [diff] [blame] | 128 | { |
| 129 | int i; |
| 130 | |
| 131 | *guid_str = 0; |
| 132 | for (i = 0; i < ARRAY_SIZE(list_guid); i++) { |
| 133 | if (!memcmp(list_guid[i].guid.b, guid_bin, 16)) { |
| 134 | strcpy(guid_str, list_guid[i].string); |
| 135 | return 0; |
| 136 | } |
| 137 | } |
| 138 | return -ENODEV; |
| 139 | } |
| 140 | #endif |
| 141 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 142 | /* |
| 143 | * uuid_str_to_bin() - convert string UUID or GUID to big endian binary data. |
| 144 | * |
Patrick Delaunay | 65f94ed | 2015-10-27 11:00:28 +0100 | [diff] [blame] | 145 | * @param uuid_str - pointer to UUID or GUID string [37B] or GUID shorcut |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 146 | * @param uuid_bin - pointer to allocated array for big endian output [16B] |
| 147 | * @str_format - UUID string format: 0 - UUID; 1 - GUID |
| 148 | */ |
Simon Glass | 4acd4f0 | 2020-04-08 08:32:58 -0600 | [diff] [blame] | 149 | int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, |
| 150 | int str_format) |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 151 | { |
| 152 | uint16_t tmp16; |
| 153 | uint32_t tmp32; |
| 154 | uint64_t tmp64; |
| 155 | |
Patrick Delaunay | 65f94ed | 2015-10-27 11:00:28 +0100 | [diff] [blame] | 156 | if (!uuid_str_valid(uuid_str)) { |
| 157 | #ifdef CONFIG_PARTITION_TYPE_GUID |
| 158 | if (!uuid_guid_get_bin(uuid_str, uuid_bin)) |
| 159 | return 0; |
| 160 | #endif |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 161 | return -EINVAL; |
Patrick Delaunay | 65f94ed | 2015-10-27 11:00:28 +0100 | [diff] [blame] | 162 | } |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 163 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 164 | if (str_format == UUID_STR_FORMAT_STD) { |
| 165 | tmp32 = cpu_to_be32(simple_strtoul(uuid_str, NULL, 16)); |
| 166 | memcpy(uuid_bin, &tmp32, 4); |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 167 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 168 | tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 9, NULL, 16)); |
| 169 | memcpy(uuid_bin + 4, &tmp16, 2); |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 170 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 171 | tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 14, NULL, 16)); |
| 172 | memcpy(uuid_bin + 6, &tmp16, 2); |
| 173 | } else { |
| 174 | tmp32 = cpu_to_le32(simple_strtoul(uuid_str, NULL, 16)); |
| 175 | memcpy(uuid_bin, &tmp32, 4); |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 176 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 177 | tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 9, NULL, 16)); |
| 178 | memcpy(uuid_bin + 4, &tmp16, 2); |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 179 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 180 | tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 14, NULL, 16)); |
| 181 | memcpy(uuid_bin + 6, &tmp16, 2); |
| 182 | } |
| 183 | |
| 184 | tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 19, NULL, 16)); |
| 185 | memcpy(uuid_bin + 8, &tmp16, 2); |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 186 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 187 | tmp64 = cpu_to_be64(simple_strtoull(uuid_str + 24, NULL, 16)); |
| 188 | memcpy(uuid_bin + 10, (char *)&tmp64 + 2, 6); |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 189 | |
| 190 | return 0; |
| 191 | } |
| 192 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 193 | /* |
| 194 | * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID. |
| 195 | * |
Heinrich Schuchardt | 6f03566 | 2019-04-29 08:08:43 +0200 | [diff] [blame] | 196 | * @param uuid_bin: pointer to binary data of UUID (big endian) [16B] |
| 197 | * @param uuid_str: pointer to allocated array for output string [37B] |
| 198 | * @str_format: bit 0: 0 - UUID; 1 - GUID |
| 199 | * bit 1: 0 - lower case; 2 - upper case |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 200 | */ |
Simon Glass | 4acd4f0 | 2020-04-08 08:32:58 -0600 | [diff] [blame] | 201 | void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, |
| 202 | int str_format) |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 203 | { |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 204 | const u8 uuid_char_order[UUID_BIN_LEN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, |
| 205 | 9, 10, 11, 12, 13, 14, 15}; |
| 206 | const u8 guid_char_order[UUID_BIN_LEN] = {3, 2, 1, 0, 5, 4, 7, 6, 8, |
| 207 | 9, 10, 11, 12, 13, 14, 15}; |
| 208 | const u8 *char_order; |
Heinrich Schuchardt | 6f03566 | 2019-04-29 08:08:43 +0200 | [diff] [blame] | 209 | const char *format; |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 210 | int i; |
| 211 | |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 212 | /* |
| 213 | * UUID and GUID bin data - always in big endian: |
| 214 | * 4B-2B-2B-2B-6B |
| 215 | * be be be be be |
| 216 | */ |
Heinrich Schuchardt | 6f03566 | 2019-04-29 08:08:43 +0200 | [diff] [blame] | 217 | if (str_format & UUID_STR_FORMAT_GUID) |
| 218 | char_order = guid_char_order; |
| 219 | else |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 220 | char_order = uuid_char_order; |
Heinrich Schuchardt | 6f03566 | 2019-04-29 08:08:43 +0200 | [diff] [blame] | 221 | if (str_format & UUID_STR_UPPER_CASE) |
| 222 | format = "%02X"; |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 223 | else |
Heinrich Schuchardt | 6f03566 | 2019-04-29 08:08:43 +0200 | [diff] [blame] | 224 | format = "%02x"; |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 225 | |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 226 | for (i = 0; i < 16; i++) { |
Heinrich Schuchardt | 6f03566 | 2019-04-29 08:08:43 +0200 | [diff] [blame] | 227 | sprintf(uuid_str, format, uuid_bin[char_order[i]]); |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 228 | uuid_str += 2; |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 229 | switch (i) { |
| 230 | case 3: |
| 231 | case 5: |
| 232 | case 7: |
| 233 | case 9: |
Przemyslaw Marczak | 0c81336 | 2014-04-02 10:20:03 +0200 | [diff] [blame] | 234 | *uuid_str++ = '-'; |
Przemyslaw Marczak | fa90734 | 2014-04-02 10:20:02 +0200 | [diff] [blame] | 235 | break; |
| 236 | } |
| 237 | } |
Jason Hobbs | 6e39cce | 2011-08-23 11:06:56 +0000 | [diff] [blame] | 238 | } |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 239 | |
| 240 | /* |
| 241 | * gen_rand_uuid() - this function generates a random binary UUID version 4. |
| 242 | * In this version all fields beside 4 bits of version and |
| 243 | * 2 bits of variant are randomly generated. |
| 244 | * |
| 245 | * @param uuid_bin - pointer to allocated array [16B]. Output is in big endian. |
| 246 | */ |
Przemyslaw Marczak | 2eb40ee | 2014-04-02 10:20:05 +0200 | [diff] [blame] | 247 | #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID) |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 248 | void gen_rand_uuid(unsigned char *uuid_bin) |
| 249 | { |
Heinrich Schuchardt | 1c126e2 | 2019-07-14 23:31:50 +0200 | [diff] [blame] | 250 | u32 ptr[4]; |
| 251 | struct uuid *uuid = (struct uuid *)ptr; |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 252 | int i; |
| 253 | |
Eugeniu Rosca | 9d74ba6 | 2019-05-02 14:27:06 +0200 | [diff] [blame] | 254 | srand(get_ticks() + rand()); |
| 255 | |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 256 | /* Set all fields randomly */ |
Heinrich Schuchardt | 1c126e2 | 2019-07-14 23:31:50 +0200 | [diff] [blame] | 257 | for (i = 0; i < 4; i++) |
| 258 | ptr[i] = rand(); |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 259 | |
Heinrich Schuchardt | 1c126e2 | 2019-07-14 23:31:50 +0200 | [diff] [blame] | 260 | clrsetbits_be16(&uuid->time_hi_and_version, |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 261 | UUID_VERSION_MASK, |
| 262 | UUID_VERSION << UUID_VERSION_SHIFT); |
| 263 | |
Heinrich Schuchardt | 1c126e2 | 2019-07-14 23:31:50 +0200 | [diff] [blame] | 264 | clrsetbits_8(&uuid->clock_seq_hi_and_reserved, |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 265 | UUID_VARIANT_MASK, |
| 266 | UUID_VARIANT << UUID_VARIANT_SHIFT); |
| 267 | |
Heinrich Schuchardt | 1c126e2 | 2019-07-14 23:31:50 +0200 | [diff] [blame] | 268 | memcpy(uuid_bin, uuid, 16); |
Przemyslaw Marczak | b428514 | 2014-04-02 10:20:04 +0200 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | /* |
| 272 | * gen_rand_uuid_str() - this function generates UUID v4 (random) in two string |
| 273 | * formats UUID or GUID. |
| 274 | * |
| 275 | * @param uuid_str - pointer to allocated array [37B]. |
| 276 | * @param - uuid output type: UUID - 0, GUID - 1 |
| 277 | */ |
| 278 | void gen_rand_uuid_str(char *uuid_str, int str_format) |
| 279 | { |
| 280 | unsigned char uuid_bin[UUID_BIN_LEN]; |
| 281 | |
| 282 | /* Generate UUID (big endian) */ |
| 283 | gen_rand_uuid(uuid_bin); |
| 284 | |
| 285 | /* Convert UUID bin to UUID or GUID formated STRING */ |
| 286 | uuid_bin_to_str(uuid_bin, uuid_str, str_format); |
| 287 | } |
Przemyslaw Marczak | 2eb40ee | 2014-04-02 10:20:05 +0200 | [diff] [blame] | 288 | |
Marek Vasut | 51d85f6 | 2019-01-07 21:23:38 +0100 | [diff] [blame] | 289 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CMD_UUID) |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 290 | int do_uuid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
Przemyslaw Marczak | 2eb40ee | 2014-04-02 10:20:05 +0200 | [diff] [blame] | 291 | { |
| 292 | char uuid[UUID_STR_LEN + 1]; |
| 293 | int str_format; |
| 294 | |
| 295 | if (!strcmp(argv[0], "uuid")) |
| 296 | str_format = UUID_STR_FORMAT_STD; |
| 297 | else |
| 298 | str_format = UUID_STR_FORMAT_GUID; |
| 299 | |
| 300 | if (argc > 2) |
| 301 | return CMD_RET_USAGE; |
| 302 | |
| 303 | gen_rand_uuid_str(uuid, str_format); |
| 304 | |
| 305 | if (argc == 1) |
| 306 | printf("%s\n", uuid); |
| 307 | else |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 308 | env_set(argv[1], uuid); |
Przemyslaw Marczak | 2eb40ee | 2014-04-02 10:20:05 +0200 | [diff] [blame] | 309 | |
| 310 | return CMD_RET_SUCCESS; |
| 311 | } |
| 312 | |
| 313 | U_BOOT_CMD(uuid, CONFIG_SYS_MAXARGS, 1, do_uuid, |
| 314 | "UUID - generate random Universally Unique Identifier", |
| 315 | "[<varname>]\n" |
| 316 | "Argument:\n" |
| 317 | "varname: for set result in a environment variable\n" |
| 318 | "e.g. uuid uuid_env" |
| 319 | ); |
| 320 | |
| 321 | U_BOOT_CMD(guid, CONFIG_SYS_MAXARGS, 1, do_uuid, |
| 322 | "GUID - generate Globally Unique Identifier based on random UUID", |
| 323 | "[<varname>]\n" |
| 324 | "Argument:\n" |
| 325 | "varname: for set result in a environment variable\n" |
| 326 | "e.g. guid guid_env" |
| 327 | ); |
Przemyslaw Marczak | 5ec2ed2 | 2014-04-02 10:20:06 +0200 | [diff] [blame] | 328 | #endif /* CONFIG_CMD_UUID */ |
| 329 | #endif /* CONFIG_RANDOM_UUID || CONFIG_CMD_UUID */ |