[U-Boot] how to programatically add a second hash table to the environment?

Robert P. J. Day rpjday at crashcourse.ca
Fri Sep 16 16:01:08 CEST 2016


  i'm hoping this is a simple question -- at boot time, i've added a
misc_init_r() routine that digs around in some legacy flash, pulls out
a string of (vxworks) "var=val" settings, and imports that in one shot
into an initial hash table. works fine.

  as the second step, i walk that table and, for the vxworks settings
i care about, i translate them to u-boot env variable names, possibly
massage the data values, and add those values to a *second* hash table
that now contains proper keys and values as u-boot would understand
them. (for example, vxworks would have "g=gateway", whereas i
translate that to "gatewayip=gateway" for the second hash table.)

  i now want to just add/overwrite the current u-boot environment with
what's in that second hash, and as i see it, i could just walk that
second hash and, for each ENTRY, do a call to hsearch_r() referring to
the hash table "env_htab", yes?

  i see no single call that allows me to combine hash tables, but it's
not as if i will have a lot of values to enter, so is that the right
approach -- just a short series of calls of the form:

  hsearch_r(entry, ENTER, &ep, &env_htab, 0);

seems straightforward enough, just want to confirm i'm not overlooking
anything.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



More information about the U-Boot mailing list