mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-07-06 19:26:16 +09:00
ppc4xx: fix PMC440 painit command
This patch fixes the PMC440 BSP command painit. The implementation was broken since the step to the new environment handling. Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu> Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
baa3713fe2
commit
a6569c63b3
|
@ -342,7 +342,8 @@ U_BOOT_CMD(
|
||||||
|
|
||||||
#if defined(CONFIG_PRAM)
|
#if defined(CONFIG_PRAM)
|
||||||
#include <environment.h>
|
#include <environment.h>
|
||||||
extern env_t *env_ptr;
|
#include <search.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
|
@ -351,6 +352,10 @@ int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
u32 param;
|
u32 param;
|
||||||
ulong *lptr;
|
ulong *lptr;
|
||||||
|
|
||||||
|
env_t *envp;
|
||||||
|
char *res;
|
||||||
|
int len;
|
||||||
|
|
||||||
v = getenv("pram");
|
v = getenv("pram");
|
||||||
if (v)
|
if (v)
|
||||||
pram = simple_strtoul(v, NULL, 10);
|
pram = simple_strtoul(v, NULL, 10);
|
||||||
|
@ -384,7 +389,15 @@ int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
|
|
||||||
/* env is first (4k aligned) */
|
/* env is first (4k aligned) */
|
||||||
nextbase -= ((CONFIG_ENV_SIZE + 4096 - 1) & ~(4096 - 1));
|
nextbase -= ((CONFIG_ENV_SIZE + 4096 - 1) & ~(4096 - 1));
|
||||||
memcpy((void*)nextbase, env_ptr, CONFIG_ENV_SIZE);
|
envp = (env_t *)nextbase;
|
||||||
|
res = (char *)envp->data;
|
||||||
|
len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
|
||||||
|
if (len < 0) {
|
||||||
|
error("Cannot export environment: errno = %d\n", errno);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
envp->crc = crc32(0, envp->data, ENV_SIZE);
|
||||||
|
|
||||||
*(--lptr) = CONFIG_ENV_SIZE; /* size */
|
*(--lptr) = CONFIG_ENV_SIZE; /* size */
|
||||||
*(--lptr) = base - nextbase; /* offset | type=0 */
|
*(--lptr) = base - nextbase; /* offset | type=0 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user