On Sunday, January 26, 2014 01:22:46 AM Vladimir 'φ-coder/phcoder' Serbinenko wrote:
Hello, all. There is amount of information that should be unique to each machine and is supplied by coreboot. Most common examples are:
- mobo serial number
- UUID
- Internal mac.
There are a few things you will need to go about solving this (in this exact order):
1. A format for the key-value pairs. Here, you'd use your talk page on the wiki to make suggestions, and fine something sane. most likely a key (C valid name, followed by a colon, followed by the value string, followed by either a newline (easier to read the file as text), or a null character (easier to parse it as a string). Since you'll probably have to validate these strings at runtime, there is little value to making them null-terminated.
example 1 (null separator ignore newlines):
ether_mac1:C0:3E:B0:07:00:01\0 mainboard_name:Mambo Jumbo\0 ether_mac2:C0:3E:B0:07:00:01\0 <EOF>
example 2 (newline separator):
ether_mac1:C0:3E:B0:07:00:01 mainboard_name:Mambo Jumbo #`~!@#$%^&*()-_=+# UBXT ether_mac2:C0:3E:B0:07:00:02 <EOF>
2. A tool to generate and append new key-value pairs to the file. You might even use "echo >>", but something which verifies the strings for validity is preferred.
3. Integrate the new tool into the build system, and allow arbitrary key- value pairs to be generated. Maybe take inspiration from how we handle "cbfs- file-y"
4. Provide an implemented API coreboot-wise which reads these keys. This should be fairly similar to get_option(). (But of course, instead of a value, you'd get a string)
5. Convince people on gerrit that your idea is good.
All being said, this is actually pretty simple.
Alex