Skip to content

Commit

Permalink
Patch by Yuli Barcohen, 14 Aug 2003:
Browse files Browse the repository at this point in the history
add support for bzip2 uncompression
  • Loading branch information
wdenk committed Aug 29, 2003
1 parent ca75add commit c29fdfc
Show file tree
Hide file tree
Showing 12 changed files with 3,688 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changes for U-Boot 0.4.7:
======================================================================

* Patch by Yuli Barcohen, 14 Aug 2003:
add support for bzip2 uncompression

* Add GCC library to examples/Makefile so GCC utility functions will
be resolved, too

* Add I2C and RTC support for RMU board using software I2C driver
(because of better response to iprobe command); fix problem with
"reset" command
Expand Down
13 changes: 11 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,16 @@ The following options need to be configured:
allows for a "silent" boot where a splash screen is
loaded very quickly after power-on.

- Compression support:
CONFIG_BZIP2

If this option is set, support for bzip2 compressed
images is included. If not, only uncompressed and gzip
compressed images are supported.

NOTE: the bzip2 algorithm requires a lot of RAM, so
the malloc area (as defined by CFG_MALLOC_LEN) should
be at least 4MB.

- Ethernet address:
CONFIG_ETHADDR
Expand Down Expand Up @@ -2263,8 +2273,7 @@ defines the following image properties:
* Target CPU Architecture (Provisions for Alpha, ARM, Intel x86,
IA64, MIPS, MIPS, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit;
Currently supported: PowerPC).
* Compression Type (Provisions for uncompressed, gzip, bzip2;
Currently supported: uncompressed, gzip).
* Compression Type (uncompressed, gzip, bzip2)
* Load Address
* Entry Point
* Image Name
Expand Down
24 changes: 23 additions & 1 deletion common/cmd_bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <image.h>
#include <malloc.h>
#include <zlib.h>
#include <bzlib.h>
#include <environment.h>
#include <asm/byteorder.h>

Expand Down Expand Up @@ -142,6 +143,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
ulong addr;
ulong data, len, checksum;
ulong *len_ptr;
uint unc_len = 0x400000;
int i, verify;
char *name, *s;
int (*appl)(cmd_tbl_t *, int, int, char *[]);
Expand Down Expand Up @@ -307,13 +309,26 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
break;
case IH_COMP_GZIP:
printf (" Uncompressing %s ... ", name);
if (gunzip ((void *)ntohl(hdr->ih_load), 0x400000,
if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
(uchar *)data, (int *)&len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
SHOW_BOOT_PROGRESS (-6);
do_reset (cmdtp, flag, argc, argv);
}
break;
#ifdef CONFIG_BZIP2
case IH_COMP_BZIP2:
printf (" Uncompressing %s ... ", name);
i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
&unc_len, (char *)data, len, 0, 0);
if (i != BZ_OK) {
printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
SHOW_BOOT_PROGRESS (-6);
udelay(100000);
do_reset (cmdtp, flag, argc, argv);
}
break;
#endif /* CONFIG_BZIP2 */
default:
if (iflag)
enable_interrupts();
Expand Down Expand Up @@ -1206,6 +1221,13 @@ int gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
return (0);
}

#ifdef CONFIG_BZIP2
void bz_internal_error(int errcode)
{
printf ("BZIP2 internal error %d\n", errcode);
}
#endif /* CONFIG_BZIP2 */

static void
do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong addr, ulong *len_ptr, int verify)
Expand Down
5 changes: 4 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ endif
LIBCOBJS= stubs.o
LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)

gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)

CPPFLAGS += -I..

all: .depend $(LIB) $(SREC) $(BIN)
Expand All @@ -88,7 +90,8 @@ $(LIB): .depend $(LIBOBJS)
$(AR) crv $@ $(LIBOBJS)

%.srec: %.o $(LIB)
$(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB)
$(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB) \
-L$(gcclibdir) -lgcc
$(OBJCOPY) -O srec $(<:.o=) $@

%.bin: %.srec
Expand Down
Loading

0 comments on commit c29fdfc

Please sign in to comment.