Patch by Robert Schwebel, 13 May 2004:

Add 'imgextract' command: extract one part of a multi file image.
master
wdenk 20 years ago
parent 547b4cb25e
commit 48abe7bfab
  1. 3
      CHANGELOG
  2. 144
      common/cmd_ximg.c
  3. 23
      doc/README.mpc85xxads
  4. 13
      include/cmd_confdefs.h
  5. 1
      include/configs/ADNPESC1.h
  6. 3
      include/configs/DK1C20.h
  7. 3
      include/configs/DK1S10.h
  8. 3
      include/configs/LANTEC.h
  9. 5
      include/configs/MPC8260ADS.h
  10. 5
      include/configs/MPC8266ADS.h
  11. 5
      include/configs/RBC823.h
  12. 2
      include/configs/RPXClassic.h
  13. 3
      include/configs/ZPC1900.h
  14. 5
      include/configs/ep8260.h
  15. 3
      include/configs/hymod.h

@ -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).

@ -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 */

@ -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)

@ -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

@ -599,6 +599,7 @@
CFG_CMD_SCSI | \
CFG_CMD_VFD | \
CFG_CMD_USB | \
CFG_CMD_XIMG | \
__SPI_CMD_OFF ) )

@ -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>

@ -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>

@ -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 */

@ -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 & ~( \

@ -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.

@ -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>

@ -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>

@ -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>

@ -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

@ -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>

Loading…
Cancel
Save