*/
int set_km_env(void)
{
- uchar buf[32];
unsigned int pnvramaddr;
unsigned int pram;
unsigned int varaddr;
pnvramaddr = CONFIG_SYS_SDRAM_BASE + gd->ram_size -
CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM - CONFIG_KM_PNVRAM;
- sprintf((char *)buf, "0x%x", pnvramaddr);
- env_set("pnvramaddr", (char *)buf);
+ env_set_hex("pnvramaddr", pnvramaddr);
/* try to read rootfssize (ram image) from environment */
p = env_get("rootfssize");
strict_strtoul(p, 16, &rootfssize);
pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
CONFIG_KM_PNVRAM) / 0x400;
- sprintf((char *)buf, "0x%x", pram);
- env_set("pram", (char *)buf);
+ env_set_ulong("pram", pram);
varaddr = CONFIG_SYS_SDRAM_BASE + gd->ram_size -
CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
- sprintf((char *)buf, "0x%x", varaddr);
- env_set("varaddr", (char *)buf);
+ env_set_hex("varaddr", varaddr);
kernelmem = gd->ram_size - 0x400 * pram;
- sprintf((char *)buf, "0x%x", kernelmem);
- env_set("kernelmem", (char *)buf);
+ env_set_hex("kernelmem", kernelmem);
return 0;
}
p = env_get("hwkey");
if (p)
rc = strict_strtoul(p, 16, &envhwkey);
-
if (rc != 0) {
printf("strict_strtoul returns error: %d", rc);
return rc;
* set the values in environment variables.
*/
if (bid == ivmbid && hwkey == ivmhwkey) {
- char buf[10];
-
found = 1;
envbid = bid;
envhwkey = hwkey;
- sprintf(buf, "%lx", bid);
- env_set("boardid", buf);
- sprintf(buf, "%lx", hwkey);
- env_set("hwkey", buf);
+ env_set_hex("boardid", bid);
+ env_set_hex("hwkey", hwkey);
}
} /* end while( ! found ) */
}