Allow for configurations which don't define some environment variables.
Unified handling of (default) load address.
Change compiler options to reduce code size.
image_header_t header;
+ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */
void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
{
void (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
image_header_t *hdr = &header;
- if (argc < 2) {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return;
- }
-
s = getenv ("verify");
verify = (s && (*s == 'n')) ? 0 : 1;
- addr = simple_strtoul(argv[1], NULL, 16);
+ if (argc < 2) {
+ addr = load_addr;
+ } else {
+ addr = simple_strtoul(argv[1], NULL, 16);
+ }
printf ("## Booting Linux kernel at %08lx ...\n", addr);
switch (argc) {
case 1:
- addr = CFG_TFTP_LOADADDR;
+ addr = CFG_LOAD_ADDR;
boot_device = getenv ("bootdevice");
break;
case 2:
}
- /* Loading ok, check if we should attempt an auto-start */
+ /* Loading ok, update default load address */
+
+ load_addr = addr;
+
+ /* Check if we should attempt an auto-start */
if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) {
- char *local_args[3];
- char local_str[32];
+ char *local_args[2];
extern void do_bootm (cmd_tbl_t *, bd_t *, int, int, char *[]);
- sprintf (local_str, "%lX", addr);
local_args[0] = argv[0];
- local_args[1] = local_str;
- local_args[2] = NULL;
+ local_args[1] = NULL;
- printf ("Automatic boot of image at addr 0x%08lX ...\n",
- addr);
+ printf ("Automatic boot of image at addr 0x%08lX ...\n", addr);
- do_bootm (cmdtp, bd, 0, 2, local_args);
+ do_bootm (cmdtp, bd, 0, 1, local_args);
}
}
if (NetOurSubnetMask) {
NetIPaddr (NetOurSubnetMask, tmp);
- setenv("subnetmask", tmp);
+ setenv("netmask", tmp);
}
if (NetOurHostName[0])
ulong addr;
int rc;
char *s;
- extern ulong TftpLoadAddress;
switch (argc) {
case 1: rc = NetLoop(bd, proto, "", -1);
/* Loading ok, check if we should attempt an auto-start */
if (((s = getenv("autostart")) != NULL) && (strcmp(s,"yes") == 0)) {
- char *local_args[3];
- char local_str[32];
- sprintf (local_str, "%lX", TftpLoadAddress);
+ char *local_args[2];
local_args[0] = argv[0];
- local_args[1] = local_str;
- local_args[2] = NULL;
+ local_args[1] = NULL;
printf ("Automatic boot of image at addr 0x%08lX ...\n",
- TftpLoadAddress);
+ load_addr);
- do_bootm (cmdtp, bd, 0, 2, local_args);
+ do_bootm (cmdtp, bd, 0, 1, local_args);
}
}
#define MK_STR(x) XMK_STR(x)
static uchar default_environment[] = {
+#ifdef CONFIG_BOOTARGS
"bootargs=" CONFIG_BOOTARGS "\0"
+#endif
+#ifdef CONFIG_BOOTCOMMAND
"bootcmd=" CONFIG_BOOTCOMMAND "\0"
+#endif
#if (CONFIG_BOOTDELAY >= 0)
"bootdelay=" MK_STR(CONFIG_BOOTDELAY) "\0"
#endif
#endif
.globl environment
environment:
+#ifdef CONFIG_BOOTARGS
.ascii "bootargs="
.ascii CONFIG_BOOTARGS
.ascii "\0"
+#endif
+#ifdef CONFIG_BOOTCOMMAND
.ascii "bootcmd="
.ascii CONFIG_BOOTCOMMAND
.ascii "\0"
+#endif
#if (CONFIG_BOOTDELAY >= 0)
.ascii "bootdelay="
.ascii MK_STR(CONFIG_BOOTDELAY)
RELFLAGS= $(PLATFORM_RELFLAGS)
DBGFLAGS= #-g -DDEBUG
-OPTFLAGS= -O2 -fomit-frame-pointer
+OPTFLAGS= -Os -fomit-frame-pointer
#LDSCRIPT := $(BOARD)/ppcboot.lds.debug
LDSCRIPT := $(BOARD)/ppcboot.lds
#define CMD_TBL_BOOTM MK_CMD_TBL_ENTRY( \
"bootm", 5, CFG_MAXARGS, 1, do_bootm, \
"bootm - boot application image from memory\n", \
- "addr [arg ...]\n - boot application image stored in memory\n" \
+ "[addr [arg ...]]\n - boot application image stored in memory\n" \
" passing arguments 'arg ...'; when booting a Linux kernel,\n" \
" 'arg' can be the address of an initrd image\n" \
),
#define CFG_BAUDRATE_MAX 115200 /* highest possible baudrate */
#define CFG_BAUDRATE_DEFAULT CONFIG_BAUDRATE /* default baudrate */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*-----------------------------------------------------------------------
* Definitions for initial stack pointer and data area (in DPRAM)
#define CFG_BAUDRATE_MAX 115200 /* highest possible baudrate */
#define CFG_BAUDRATE_DEFAULT CONFIG_BAUDRATE /* default baudrate */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
#define CFG_EXTBDINFO 1 /* To use extended board_into (bd_t) */
/*-----------------------------------------------------------------------
#define CFG_MEMTEST_START 0x0300000 /* memtest works on */
#define CFG_MEMTEST_END 0x0700000 /* 3 ... 7 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*
* Low Level Configuration Settings
"bootp ;" \
"setenv bootargs console=tty0 console=ttyS0 " \
"root=/dev/nfs nfsroot=$(serverip):$(rootpath) " \
-"ip=$(ipaddr):$(serverip):$(gatewayip):$(subnetmask):$(hostname):eth0:off ;" \
+"ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):eth0:off ;" \
"bootm"
#else
#define CONFIG_BOOTDELAY 0 /* autoboot disabled */
#define CFG_MEMTEST_START 0x00000000 /* memtest works on */
#define CFG_MEMTEST_END 0x01000000 /* 4 ... 16 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x00100000 /* default load address */
+#define CFG_LOAD_ADDR 0x00100000 /* default load address */
/*
* Low Level Configuration Settings
* (address mappings, register initial values, etc.)
#define CFG_MEMTEST_START 0x00000000 /* memtest works on */
#define CFG_MEMTEST_END 0x00800000 /* 4 ... 8 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x00100000 /* default load address */
+#define CFG_LOAD_ADDR 0x00100000 /* default load address */
/*
* Low Level Configuration Settings
#define CFG_MEMTEST_START 0x0100000 /* memtest works on */
#define CFG_MEMTEST_END 0x0400000 /* 1 ... 4 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x00100000
+#define CFG_LOAD_ADDR 0x00100000
/*
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*
* Low Level Configuration Settings
#define CFG_MEMTEST_START 0x00000000 /* memtest works on */
#define CFG_MEMTEST_END 0x00800000 /* 4 ... 8 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x00100000 /* default load address */
+#define CFG_LOAD_ADDR 0x00100000 /* default load address */
/*
* Low Level Configuration Settings
* (address mappings, register initial values, etc.)
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*
* Low Level Configuration Settings
#define CFG_MEMTEST_START 0x00100000 /* memtest works on */
#define CFG_MEMTEST_END 0x00F00000 /* 1 ... 15MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x00100000 /* default load address */
+#define CFG_LOAD_ADDR 0x00100000 /* default load address */
#define CFG_PIO_MODE 0 /* IDE interface in PIO Mode 0 */
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*
* Low Level Configuration Settings
#else
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
#endif
-#define CONFIG_BOOTCOMMAND "bootm 40020000" /* autoboot command */
-#define CONFIG_BOOTARGS "root=/dev/nfs rw " \
- "nfsroot=10.0.0.2:/LinuxPPC " \
- "nfsaddrs=10.0.0.99:10.0.0.2"
+#undef CONFIG_BOOTARGS
+#define CONFIG_BOOTCOMMAND \
+ "bootp; " \
+ "setenv bootargs root=/dev/nfs nfsroot=$(serverip):$(rootpath) " \
+ "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off; " \
+ "bootm"
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
#undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*
* Low Level Configuration Settings
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*
* Low Level Configuration Settings
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
-#define CFG_TFTP_LOADADDR 0x100000 /* default load address */
+#define CFG_LOAD_ADDR 0x100000 /* default load address */
/*
* Low Level Configuration Settings
/* common/cmd_bootm.c */
void print_image_hdr (image_header_t *hdr);
+extern ulong load_addr; /* Default Load Address */
+
/* common/cmd_nvedit.c */
char *getenv (uchar *);
void inline setenv (char *, char *);
#ifdef DEBUG_BOOTP_EXT
printf("[BOOTP] Received fields: \n");
- if (NetOurSubnetMask)
- printf(" NetOurSubnetMask : "); NetPrintIPaddr (NetOurSubnetMask); putc("\n");
+ if (NetOurSubnetMask) {
+ puts ("NetOurSubnetMask : ");
+ NetPrintIPaddr (NetOurSubnetMask);
+ putc('\n');
+ }
- if (NetOurGatewayIP)
- printf("\n NetOurGatewayIP : "); NetPrintIPaddr (NetOurGatewayIP); putc("\n");
+ if (NetOurGatewaysIP[0]) {
+ puts ("NetOurGatewaysIP : ");
+ NetPrintIPaddr (NetOurGatewaysIP[0]);
+ putc('\n');
+ }
- if (NetBootFileSize)
- printf(" NetBootFileSize : %d\n", NetBootFileSize);
+ if (NetBootFileSize) {
+ printf("NetBootFileSize : %d\n", NetBootFileSize);
+ }
- if (NetOurHostName[0])
- printf(" NetOurHostName : %s\n", NetOurHostName);
+ if (NetOurHostName[0]) {
+ printf("NetOurHostName : %s\n", NetOurHostName);
+ }
- if (NetOurRootPath[0])
- printf(" NetOurRootPath : %s\n", NetOurRootPath);
+ if (NetOurRootPath[0]) {
+ printf("NetOurRootPath : %s\n", NetOurRootPath);
+ }
- if (NetOurNISDomain[0])
- printf(" NetOurNISDomain : %s\n", NetOurNISDomain);
+ if (NetOurNISDomain[0]) {
+ printf("NetOurNISDomain : %s\n", NetOurNISDomain);
+ }
#endif
}
{
Bootp_t * bp;
-#if 0
- printf("got BOOTP packet (src=%d, dst=%d, len=%d)\n", src, dest, len);
+#ifdef DEBUG
+ printf("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%d)\n",
+ src, dest, len, sizeof (Bootp_t));
#endif /* DEBUG */
bp = (Bootp_t *)pkt;
uchar bp_chaddr[16]; /* Client hardware address */
char bp_sname[64]; /* Server host name */
char bp_file[128]; /* Boot file name */
- char bp_vend[128]; /* Vendor information */
+ char bp_vend[64]; /* Vendor information */
} Bootp_t;
#define BOOTP_HDR_SIZE sizeof (Bootp_t)
#define STATE_DATA 2
#define STATE_TOO_LARGE 3
#define STATE_BAD_MAGIC 4
-ulong TftpLoadAddress; /* Place to load the image into */
static __inline__ void
store_block (unsigned block, uchar * src, unsigned len)
{
- (void)memcpy((void *)(TftpLoadAddress + block * 512), src, len);
+ (void)memcpy((void *)(load_addr + block * 512), src, len);
}
/**********************************************************************/
printf ("\n");
if (loadAdr == ~0) {
- TftpLoadAddress = CFG_TFTP_LOADADDR;
- printf ("No load address; using 0x%lx\n", TftpLoadAddress);
+ load_addr = CFG_LOAD_ADDR;
+ printf ("No load address; using 0x%lx\n", load_addr);
} else {
- TftpLoadAddress = loadAdr;
- printf ("Load address: 0x%lx\n", TftpLoadAddress);
+ load_addr = loadAdr;
+ printf ("Load address: 0x%lx\n", load_addr);
}
printf ("Loading: *\b");