diff options
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | common/cmd_ximg.c | 144 | ||||
-rw-r--r-- | doc/README.mpc85xxads | 23 | ||||
-rw-r--r-- | include/cmd_confdefs.h | 13 | ||||
-rw-r--r-- | include/configs/ADNPESC1.h | 1 | ||||
-rw-r--r-- | include/configs/DK1C20.h | 3 | ||||
-rw-r--r-- | include/configs/DK1S10.h | 3 | ||||
-rw-r--r-- | include/configs/LANTEC.h | 3 | ||||
-rw-r--r-- | include/configs/MPC8260ADS.h | 5 | ||||
-rw-r--r-- | include/configs/MPC8266ADS.h | 5 | ||||
-rw-r--r-- | include/configs/RBC823.h | 5 | ||||
-rw-r--r-- | include/configs/RPXClassic.h | 2 | ||||
-rw-r--r-- | include/configs/ZPC1900.h | 3 | ||||
-rw-r--r-- | include/configs/ep8260.h | 5 | ||||
-rw-r--r-- | include/configs/hymod.h | 3 |
15 files changed, 193 insertions, 28 deletions
diff --git a/CHANGELOG b/CHANGELOG index 132aa6f9fb6..5d2866bceca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,9 @@ Changes since U-Boot 1.1.1: ====================================================================== +* Patch by Robert Schwebel, 13 May 2004: + Add 'imgextract' command: extract one part of a multi file image. + * Patches by Jon Loeliger, 11 May 2004: Dynamically handle REV1 and REV2 MPC85xx parts. (Jon Loeliger, 10-May-2004). diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c new file mode 100644 index 00000000000..8359153b2b5 --- /dev/null +++ b/common/cmd_ximg.c @@ -0,0 +1,144 @@ +/* + * (C) Copyright 2000-2004 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * (C) Copyright 2003 + * Kai-Uwe Bloem, Auerswald GmbH & Co KG, <linux-development@auerswald.de> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#if (CONFIG_COMMANDS & CFG_CMD_XIMG) + +/* + * Multi Image extract + */ +#include <common.h> +#include <command.h> +#include <image.h> +#include <asm/byteorder.h> + +int +do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +{ + ulong addr = load_addr, dest = 0; + ulong data, len, checksum; + ulong *len_ptr; + int i, verify, part = 0; + char pbuf[10], *s; + image_header_t header; + + s = getenv("verify"); + verify = (s && (*s == 'n')) ? 0 : 1; + + if (argc > 1) { + addr = simple_strtoul(argv[1], NULL, 16); + } + if (argc > 2) { + part = simple_strtoul(argv[2], NULL, 16); + } + if (argc > 3) { + dest = simple_strtoul(argv[3], NULL, 16); + } + + printf("## Copying from image at %08lx ...\n", addr); + + /* Copy header so we can blank CRC field for re-calculation */ + memmove(&header, (char *) addr, sizeof (image_header_t)); + + if (ntohl(header.ih_magic) != IH_MAGIC) { + printf("Bad Magic Number\n"); + return 1; + } + + data = (ulong) & header; + len = sizeof (image_header_t); + + checksum = ntohl(header.ih_hcrc); + header.ih_hcrc = 0; + + if (crc32(0, (char *) data, len) != checksum) { + printf("Bad Header Checksum\n"); + return 1; + } +#ifdef DEBUG + print_image_hdr((image_header_t *) addr); +#endif + + data = addr + sizeof (image_header_t); + len = ntohl(header.ih_size); + + if (header.ih_type != IH_TYPE_MULTI) { + printf("Wrong Image Type for %s command\n", cmdtp->name); + return 1; + } + + if (header.ih_comp != IH_COMP_NONE) { + printf("Wrong Compression Type for %s command\n", cmdtp->name); + return 1; + } + + if (verify) { + printf(" Verifying Checksum ... "); + if (crc32(0, (char *) data, len) != ntohl(header.ih_dcrc)) { + printf("Bad Data CRC\n"); + return 1; + } + printf("OK\n"); + } + + len_ptr = (ulong *) data; + + data += 4; /* terminator */ + for (i = 0; len_ptr[i]; ++i) { + data += 4; + if (argc > 2 && part > i) { + u_long tail; + len = ntohl(len_ptr[i]); + tail = len % 4; + data += len; + if (tail) { + data += 4 - tail; + } + } + } + if (argc > 2 && part >= i) { + printf("Bad Image Part\n"); + return 1; + } + len = ntohl(len_ptr[part]); + + if (argc > 3) { + memcpy((char *) dest, (char *) data, len); + } + + sprintf(pbuf, "%8lx", data); + setenv("fileaddr", pbuf); + sprintf(pbuf, "%8lx", len); + setenv("filesize", pbuf); + + return 0; +} + +U_BOOT_CMD(imxtract, 4, 1, do_imgextract, + "imxtract- extract a part of a multi-image\n", + "addr part [dest]\n" + " - extract <part> from image at <addr> and copy to <dest>\n"); + +#endif /* CONFIG_COMMANDS & CFG_CMD_XIMG */ diff --git a/doc/README.mpc85xxads b/doc/README.mpc85xxads index 4c1686faa97..c49b2a896bc 100644 --- a/doc/README.mpc85xxads +++ b/doc/README.mpc85xxads @@ -5,10 +5,12 @@ Created 10/15/03 ----------------------------------------- 0. Toolchain -The Binutils in current ELDK toolchain will not support MPC85xx chip. You need -use the newest binutils-2.14.tar.bz2 from http://ftp.gnu.org/gnu/binutils. +The Binutils in ELDK toolchain 3.0 or earlier does not support the +MPC85xx chip. You need use the newest binutils-2.14.tar.bz2 from +http://ftp.gnu.org/gnu/binutils. 1. SWITCH SETTINGS & JUMPERS + 1.1 First, make sure the board default setting is consistent with the document shipped with your board. Then apply the following changes: SW3[1-6]="all OFF" (boot from 32bit flash, no boot sequence is used) @@ -19,11 +21,13 @@ use the newest binutils-2.14.tar.bz2 from http://ftp.gnu.org/gnu/binutils. SW22[1-4]="OFF OFF ON OFF" SW5[1-10[="ON ON OFF OFF OFF OFF OFF OFF OFF OFF" J1 = "Enable Prog" (Make sure your flash is programmable for development) + 1.2 If you want to test PCI functionality with a 33Mhz PCI card, you will have to change the system clock from the default 66Mhz to 33Mhz by setting SW15[1]="OFF" and SW17[8]="OFF". After that you may also need double your platform clock(SW6) because the system clock is now only - half of its original value. + half of its original value. + 1.3 SW6 is a very important switch, it decides your platform clock and CPU clock based on the on-board system clock(default 66MHz). Check the document along with your board for details. @@ -35,7 +39,7 @@ use the newest binutils-2.14.tar.bz2 from http://ftp.gnu.org/gnu/binutils. between u-boot and linux kernel, you can customize it based on your system requirements: - 0x0000_0000 0x7fff_ffff DDR 2G + 0x0000_0000 0x7fff_ffff DDR 2G 0x8000_0000 0x9fff_ffff PCI MEM 512M 0xc000_0000 0xdfff_ffff Rapid IO 512M 0xe000_0000 0xe000_ffff CCSR 1M @@ -52,7 +56,9 @@ use the newest binutils-2.14.tar.bz2 from http://ftp.gnu.org/gnu/binutils. arch/ppc/configs/mpc8540_ads_defconfig arch/ppc/configs/mpc8560_ads_defconfig + 3. DEFINITIONS AND COMPILATION + 3.1 Explanation on NEW definitions in include/configs/MPC8540ADS.h and include/ configs/MPC8560ADS.h CONFIG_BOOKE BOOKE(e.g. Motorola MPC85xx, IBM 440, etc) @@ -74,7 +80,6 @@ use the newest binutils-2.14.tar.bz2 from http://ftp.gnu.org/gnu/binutils. if you can program the flash directly, undef this. Other than the above definitions, the rest in the config files are straightforward. - 3.2 Compilation export CROSS_COMPILE=your-cross-compile-prefix(assuming you're using BASH shell) cd u-boot @@ -82,7 +87,9 @@ use the newest binutils-2.14.tar.bz2 from http://ftp.gnu.org/gnu/binutils. make MPC8560ADS_config (or make MPC8540ADS_config) make + 4. Notes: + 4.1 When connecting with kermit, the following commands must be present.in your .kermrc file. These are especially important when booting as MPC8560, as the serial console will not work without them: @@ -93,7 +100,6 @@ set handshake none set flow-control none robust - 4.2 Sometimes after U-Boot is up, the 'tftp' won't work well with TSEC ethernet. If that happens, you can try the following steps to make network work: MPC8560ADS>tftp 1000000 pImage @@ -103,9 +109,9 @@ robust >1 >. (to quit this memory operation) MPC8560ADS>tftp 1000000 pImage -4.3 If you're one of the early developers using the Rev1 8540/8560 chips, please use U-Boot - 1.0.0, as the newer silicon will only support Rev2 and future revisions of 8540/8560. +4.3 If you're one of the early developers using the Rev1 8540/8560 chips, please use U-Boot + 1.0.0, as the newer silicon will only support Rev2 and future revisions of 8540/8560. 4.4 Reflash U-boot Image using U-boot @@ -116,6 +122,7 @@ robust 5. Screen dump: + 5.1 MPC8540ADS board U-Boot 1.0.0-pre (Oct 15 2003 - 13:40:33) diff --git a/include/cmd_confdefs.h b/include/cmd_confdefs.h index 7a4dfe1ec8c..877753ecfba 100644 --- a/include/cmd_confdefs.h +++ b/include/cmd_confdefs.h @@ -22,7 +22,7 @@ */ /* - * Definitions for Configuring the monitor commands + * Definitions for Configuring the monitor commands */ #ifndef _CMD_CONFIG_H #define _CMD_CONFIG_H @@ -78,17 +78,18 @@ #define CFG_CMD_SPI 0x0000100000000000U /* SPI utility */ #define CFG_CMD_FDOS 0x0000200000000000U /* Floppy DOS support */ #define CFG_CMD_VFD 0x0000400000000000U /* VFD support (TRAB) */ -#define CFG_CMD_NAND 0x0000800000000000U /* NAND support */ +#define CFG_CMD_NAND 0x0000800000000000U /* NAND support */ #define CFG_CMD_BMP 0x0001000000000000U /* BMP support */ -#define CFG_CMD_PORTIO 0x0002000000000000U /* Port I/O */ +#define CFG_CMD_PORTIO 0x0002000000000000U /* Port I/O */ #define CFG_CMD_PING 0x0004000000000000U /* ping support */ #define CFG_CMD_MMC 0x0008000000000000U /* MMC support */ #define CFG_CMD_FAT 0x0010000000000000U /* FAT support */ -#define CFG_CMD_IMLS 0x0020000000000000U /* List all found images */ +#define CFG_CMD_IMLS 0x0020000000000000U /* List all found images */ #define CFG_CMD_ITEST 0x0040000000000000U /* Integer (and string) test */ #define CFG_CMD_NFS 0x0080000000000000U /* NFS support */ -#define CFG_CMD_REISER 0x0100000000000000U /* Reiserfs support */ +#define CFG_CMD_REISER 0x0100000000000000U /* Reiserfs support */ #define CFG_CMD_CDP 0x0200000000000000U /* Cisco Discovery Protocol */ +#define CFG_CMD_XIMG 0x0400000000000000U /* Load part of Multi Image */ #define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFU /* ALL commands */ @@ -156,7 +157,7 @@ #define CONFIG_BOOTP_BOOTFILESIZE 0x00000020 #define CONFIG_BOOTP_DNS 0x00000040 #define CONFIG_BOOTP_DNS2 0x00000080 -#define CONFIG_BOOTP_SEND_HOSTNAME 0x00000100 +#define CONFIG_BOOTP_SEND_HOSTNAME 0x00000100 #define CONFIG_BOOTP_VENDOREX 0x80000000 diff --git a/include/configs/ADNPESC1.h b/include/configs/ADNPESC1.h index e2dc3432736..2d212c91c5f 100644 --- a/include/configs/ADNPESC1.h +++ b/include/configs/ADNPESC1.h @@ -599,6 +599,7 @@ CFG_CMD_SCSI | \ CFG_CMD_VFD | \ CFG_CMD_USB | \ + CFG_CMD_XIMG | \ __SPI_CMD_OFF ) ) diff --git a/include/configs/DK1C20.h b/include/configs/DK1C20.h index 358f7f4b91c..b758e94e793 100644 --- a/include/configs/DK1C20.h +++ b/include/configs/DK1C20.h @@ -475,7 +475,8 @@ CFG_CMD_SCSI | \ CFG_CMD_SPI | \ CFG_CMD_VFD | \ - CFG_CMD_USB ) ) + CFG_CMD_USB | \ + CFG_CMD_XIMG ) ) #include <cmd_confdefs.h> diff --git a/include/configs/DK1S10.h b/include/configs/DK1S10.h index db8c05a98f0..b2e86c84a19 100644 --- a/include/configs/DK1S10.h +++ b/include/configs/DK1S10.h @@ -484,7 +484,8 @@ CFG_CMD_SCSI | \ CFG_CMD_SPI | \ CFG_CMD_VFD | \ - CFG_CMD_USB ) ) + CFG_CMD_USB | \ + CFG_CMD_XIMG ) ) #include <cmd_confdefs.h> diff --git a/include/configs/LANTEC.h b/include/configs/LANTEC.h index 49ffb931e4f..17402f0c9f5 100644 --- a/include/configs/LANTEC.h +++ b/include/configs/LANTEC.h @@ -107,7 +107,8 @@ & ~CFG_CMD_SCSI \ & ~CFG_CMD_SPI \ & ~CFG_CMD_USB \ - & ~CFG_CMD_VFD ) + & ~CFG_CMD_VFD \ + & ~CFG_CMD_XIMG ) #if CONFIG_LANTEC >= 2 #define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h index 7bd0d8e88d1..626f23b6a43 100644 --- a/include/configs/MPC8260ADS.h +++ b/include/configs/MPC8260ADS.h @@ -195,11 +195,12 @@ CFG_CMD_NAND | \ CFG_CMD_PCI | \ CFG_CMD_PCMCIA | \ - CFG_CMD_REISER | \ + CFG_CMD_REISER | \ CFG_CMD_SCSI | \ CFG_CMD_SPI | \ CFG_CMD_USB | \ - CFG_CMD_VFD + CFG_CMD_VFD | \ + CFG_CMD_XIMG #if CONFIG_ADSTYPE >= CFG_PQ2FADS #define CONFIG_COMMANDS (CFG_CMD_ALL & ~( \ diff --git a/include/configs/MPC8266ADS.h b/include/configs/MPC8266ADS.h index 86a5986cf8b..a4018f8cedd 100644 --- a/include/configs/MPC8266ADS.h +++ b/include/configs/MPC8266ADS.h @@ -164,11 +164,12 @@ CFG_CMD_MMC | \ CFG_CMD_NAND | \ CFG_CMD_PCMCIA | \ - CFG_CMD_REISER | \ + CFG_CMD_REISER | \ CFG_CMD_SCSI | \ CFG_CMD_SPI | \ CFG_CMD_VFD | \ - CFG_CMD_USB ) ) + CFG_CMD_USB | \ + CFG_CMD_XIMG ) ) /* Define a command string that is automatically executed when no character * is read on the console interface withing "Boot Delay" after reset. diff --git a/include/configs/RBC823.h b/include/configs/RBC823.h index 1666d646c0a..3592290d508 100644 --- a/include/configs/RBC823.h +++ b/include/configs/RBC823.h @@ -111,10 +111,11 @@ ~CFG_CMD_PCMCIA & \ ~CFG_CMD_REISER & \ ~CFG_CMD_SCSI & \ - ~CFG_CMD_SETGETDCR & \ + ~CFG_CMD_SETGETDCR & \ ~CFG_CMD_SPI & \ ~CFG_CMD_USB & \ - ~CFG_CMD_VFD ) + ~CFG_CMD_VFD & \ + ~CFG_CMD_XIMG ) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <cmd_confdefs.h> diff --git a/include/configs/RPXClassic.h b/include/configs/RPXClassic.h index 9746b64b0b2..7294561b0b7 100644 --- a/include/configs/RPXClassic.h +++ b/include/configs/RPXClassic.h @@ -93,7 +93,7 @@ #define CONFIG_CLOCKS_IN_MHZ 1 /* clocks passsed to Linux in MHz */ -#define CONFIG_COMMANDS (CFG_CMD_ALL & ~CFG_CMD_NONSTD | CFG_CMD_ELF) +#define CONFIG_COMMANDS ((CFG_CMD_ALL & ~CFG_CMD_NONSTD) | CFG_CMD_ELF) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <cmd_confdefs.h> diff --git a/include/configs/ZPC1900.h b/include/configs/ZPC1900.h index 03331d6c03f..d3c8eb9c0c5 100644 --- a/include/configs/ZPC1900.h +++ b/include/configs/ZPC1900.h @@ -134,7 +134,8 @@ CFG_CMD_SCSI | \ CFG_CMD_SPI | \ CFG_CMD_USB | \ - CFG_CMD_VFD ) ) + CFG_CMD_VFD | \ + CFG_CMD_XIMG ) ) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <cmd_confdefs.h> diff --git a/include/configs/ep8260.h b/include/configs/ep8260.h index 274bd7d17d7..d8db530e14d 100644 --- a/include/configs/ep8260.h +++ b/include/configs/ep8260.h @@ -275,6 +275,7 @@ ~CFG_CMD_DCR & \ ~CFG_CMD_DHCP & \ ~CFG_CMD_DOC & \ + ~CFG_CMD_DTT & \ ~CFG_CMD_EEPROM & \ ~CFG_CMD_FDC & \ ~CFG_CMD_FDOS & \ @@ -287,12 +288,12 @@ ~CFG_CMD_NAND & \ ~CFG_CMD_PCI & \ ~CFG_CMD_PCMCIA & \ - ~CFG_CMD_SCSI & \ ~CFG_CMD_REISER & \ + ~CFG_CMD_SCSI & \ ~CFG_CMD_SPI & \ ~CFG_CMD_USB & \ ~CFG_CMD_VFD & \ - ~CFG_CMD_DTT ) + ~CFG_CMD_XIMG ) /* Where do the internal registers live? */ #define CFG_IMMR 0xF0000000 diff --git a/include/configs/hymod.h b/include/configs/hymod.h index 75f52b5a52e..6f19909614e 100644 --- a/include/configs/hymod.h +++ b/include/configs/hymod.h @@ -191,7 +191,8 @@ CFG_CMD_REISER | \ CFG_CMD_SCSI | \ CFG_CMD_SPI | \ - CFG_CMD_VFD ) ) + CFG_CMD_VFD | \ + CFG_CMD_XIMG ) ) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <cmd_confdefs.h> |