5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * FIXME: Add code to test image and it's header.
31 extern int valid_elf_image (unsigned long addr
);
34 image_check(ulong addr
)
36 return valid_elf_image(addr
);
49 * Get test image address
51 if ((envp
= getenv("testaddr")) != NULL
)
52 testaddr
= simple_strtoul(envp
, NULL
, 16);
57 * Are we going to test boot and image?
59 if ((testaddr
!= -1) && image_check(testaddr
)) {
61 /* Set alt_loadaddr */
62 alt_loadaddr
= testaddr
;
63 sprintf(buf
, "%lX", alt_loadaddr
);
64 setenv("alt_loadaddr", buf
);
67 setenv("testaddr", NULL
);
70 * Save current environment with alt_loadaddr,
71 * and cleared testaddr.
76 * Setup temporary loadaddr to alt_loadaddr
77 * XXX - DO NOT SAVE ENVIRONMENT!
79 loadaddr
= alt_loadaddr
;
80 sprintf(buf
, "%lX", loadaddr
);
81 setenv("loadaddr", buf
);
83 } else { /* Normal boot */
84 setenv("alt_loadaddr", NULL
); /* Clear alt_loadaddr */
85 setenv("testaddr", NULL
); /* Clear testaddr */