# Tlv eeprom

**URL:** <https://community.solid-run.com/t/tlv-eeprom/552>\
**Category:** OCTEON CN9130\
**Created:** [December 30, 2022, 9:09am UTC](https://community.solid-run.com/t/tlv-eeprom/552 "2022-12-30T09:09:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 30, 2022, 9:09am UTC](https://community.solid-run.com/t/tlv-eeprom/552/1 "2022-12-30T09:09:51Z")

</div>

Hy Ladies and Gentlemen 🙂

Thanks to this link [here](https://solidrun.atlassian.net/wiki/spaces/developer/pages/340623388/CN913x+EEPROM+Programming+-+TLV);  
i can custom some information for my boards ( product name and serial number).

I need to extract one information during uboot :  
-product name : to select the good device tree

I know how to display all information, but i failed to read only the product name .

```auto
DiagBox>> tlv
TLV: 0
TlvInfo Header:
   Id String: TlvInfo
   Version: 1
   Total Length: 38
TLV Name Code Len Value
-------------------- ---- --- -----
Serial Number 0x23 17 Orange00000000001
Product Name 0x21 11 DiagBox pro
CRC-32 0xFE 4 0x9E8C2BA2
Checksum is valid.
DiagBox>> tlv help
tlv_eeprom - Display and program the system EEPROM data block.

Usage:
tlv_eeprom [read|write|set <type_code> <string_value>|erase|list]
tlv_eeprom
    - With no arguments display the current contents.
tlv_eeprom dev [dev]
    - List devices or set current EEPROM device.
tlv_eeprom read
    - Load EEPROM data from device to memory.
tlv_eeprom write
    - Write the EEPROM data to persistent storage.
tlv_eeprom set <type_code> <string_value>
    - Set a field to a value.
    - If no string_value, field is deleted.
    - Use 'tlv_eeprom write' to make changes permanent.
tlv_eeprom erase
    - Reset the in memory EEPROM data.
    - Use 'tlv_eeprom read' to refresh the in memory EEPROM data.
    - Use 'tlv_eeprom write' to make changes permanent.
tlv_eeprom list
    - List the understood TLV codes and names.

DiagBox>> tlv read
EEPROM data loaded from device to memory.
DiagBox>>

```

Can someone help me please?

Thanks by advance

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 30, 2022, 12:52pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/2 "2022-12-30T12:52:34Z")

</div>

This functionality was never exposed through the tlv\_eeprom command in u-boot. Generally this is done programatically for the specific board. You can reference the patch here to see how we are doing it with our SKU, but of course it can be easily adapted to your Product Name. [cn913x\_build/0013-find-fdtfile-from-tlv-eeprom.patch at master · SolidRun/cn913x\_build · GitHub](https://github.com/SolidRun/cn913x_build/blob/master/patches/u-boot/0013-find-fdtfile-from-tlv-eeprom.patch)

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 30, 2022, 1:00pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/3 "2022-12-30T13:00:53Z")

</div>

I will add that if you do feel this is feature you would like, we can probably add it to our u-boot patches easy enough. We already have a patch to pull a single TLV entry out, there just isn’t a command interface for it yet.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 30, 2022, 1:12pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/4 "2022-12-30T13:12:41Z")

</div>

Thank you to answer.

In fact, i use a fit files with kernel,dtbs into.  
I have two configurations : pro and base.

> /dts-v1/;  
> / {  
> description = “Kernel et dtb”;
> 
> ```auto
> #address-cells = <1>;
> images {
> kernel {
> description = "Kernel";
> data = /incbin/("/a/Image");
> type = "kernel";
> arch = "arm64";
> os = "linux";
> compression = "none";
> load = <0x44000000>;
> entry = <0x44000000>;
> hash-1 {
> algo = "sha1";
> };
> };
> fdt-pro {
> description = "dtb";
> data = /incbin/("/a/diagbox_pro.dtb");
> type = "flat_dt";
> arch = "arm64";
> load = <0x47000000>;
> compression = "none";
> hash-1 {
> algo = "sha1";
> };
> };
> fdt-base {
> description = "dtb";
> data = /incbin/("/a/diagbox_base.dtb");
> type = "flat_dt";
> arch = "arm64";
> load = <0x47000000>;
> compression = "none";
> hash-1 {
> algo = "sha1";
> };
> };
> };
> 
> configurations {
> default = "conf-pro";
> conf-pro {
> description = "Configuration";
> kernel = "kernel";
> fdt = "fdt-pro";
> hash-1 {
> algo = "sha1";
> };
> };
> conf-base {
> description = "Configuration";
> kernel = "kernel";
> fdt = "fdt-base";
> hash-1 {
> algo = "sha1";
> };
> };
> };
> 
> ```

I tried to select thé configuration thanks to thé product name.  
I will try to adapt your patch with my product names.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 30, 2022, 2:00pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/5 "2022-12-30T14:00:29Z")

</div>

I forgot to say : i don’t use a distro boot but a uEnv.txt system.

That’s why i try to get the name of board for my environnment.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 31, 2022, 12:26pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/6 "2022-12-31T12:26:04Z")

</div>

One question please.  
With your patch, we can know the type or thé board(base or pro) thanks to tlv if i understand.  
Is it possible by modifying your patch, ro create a files or folder ,its name depending thé board(base or pro)?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 31, 2022, 12:32pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/7 "2022-12-31T12:32:34Z")

</div>

With our patches we parse the SKU that is programmed to the TLV and then construct the name of the dtb file to load based on the hardware properties that the SKU designates. The specific .dtb file and name need to already be built as part of the OS image, specifically for the kernel.

You could create files and folders, based on the information parsed but generally this is not something a firmware should be doing. It should only be trying to load and determine the existing environment it is trying to boot.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [January 6, 2023, 7:54pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/8 "2023-01-06T19:54:25Z")

</div>

Hy,  
So if i undestand, i can parse some information from tlv for my new environnment by modifying your patch.  
your patch select the right Device tree, so i can replace the information to select base or pro board?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [January 7, 2023, 11:24am UTC](https://community.solid-run.com/t/tlv-eeprom/552/9 "2023-01-07T11:24:52Z")

</div>

Yes that is correct. With the included patches we make it easy to pull out a single value from the TLV. You can then use that to build your device-tree path, or set an env variable for you to read out and use to load the device-tree you want.

If you want any code reviewed just email me, or support and we can do that for you.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [January 7, 2023, 4:48pm UTC](https://community.solid-run.com/t/tlv-eeprom/552/10 "2023-01-07T16:48:50Z")

</div>

Hy  
Thank you to answer me 🙂

I will try to modify the patch, to learn and if i don’t succeed, i will send you an email with my code.
