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,
30 * FIXME: Add code to test image and it's header.
33 image_check(ulong addr)
35 return valid_elf_image(addr);
48 * Get test image address
50 if ((envp = getenv("testaddr")) != NULL)
51 testaddr = simple_strtoul(envp, NULL, 16);
56 * Are we going to test boot and image?
58 if ((testaddr != -1) && image_check(testaddr)) {
60 /* Set alt_loadaddr */
61 alt_loadaddr = testaddr;
62 sprintf(buf, "%lX", alt_loadaddr);
63 setenv("alt_loadaddr", buf);
66 setenv("testaddr", NULL);
69 * Save current environment with alt_loadaddr,
70 * and cleared testaddr.
75 * Setup temporary loadaddr to alt_loadaddr
76 * XXX - DO NOT SAVE ENVIRONMENT!
78 loadaddr = alt_loadaddr;
79 sprintf(buf, "%lX", loadaddr);
80 setenv("loadaddr", buf);
82 } else { /* Normal boot */
83 setenv("alt_loadaddr", NULL); /* Clear alt_loadaddr */
84 setenv("testaddr", NULL); /* Clear testaddr */