[U-Boot-Users] [PATCH] addes bunzip2 command.
eran liberty
eran.liberty at gmail.com
Thu Jun 21 08:11:15 CEST 2007
Signed-off-by: Eran Liberty
diff -x .svn -Nuar
u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/common/cmd_bzip2.c
u-boot.exsw6000/common/cmd_bzip2.c
--- u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/common/cmd_bzip2.c 1970-01-01
02:00:00.000000000 +0200
+++ u-boot.exsw6000/common/cmd_bzip2.c 2007-06-20 19:05:00.000000000 +0300
@@ -0,0 +1,67 @@
+/*
+ * (C) Copyright 2007
+ * Liberty Eran, Extricom, eran.liberty at gmail.com
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <command.h>
+#include <bzlib.h>
+
+#if defined(CONFIG_BZIP2)
+int do_bunzip2 ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ ulong addr, dest, count;
+ unsigned int destSize;
+ int rc;
+
+ if (argc != 4) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ /* Check for size specification.
+ */
+ addr = simple_strtoul(argv[1], NULL, 16);
+ dest = simple_strtoul(argv[2], NULL, 16);
+ count = simple_strtoul(argv[3], NULL, 16);
+
+ if (count == 0) {
+ puts ("BUNZIP2 ERROR: Zero length ???\n");
+ return 1;
+ }
+
+ if ((rc = BZ2_bzBuffToBuffDecompress((char*)dest,&destSize,(char*)addr,count,1,0))
!= BZ_OK) {
+ printf ("BUNZIP2 ERROR: %d\n", rc);
+ return 1;
+ }
+ printf("BUNZIP2: decompressed image address & size: 0x%08x 0x%x
(%d)\n",dest,destSize,destSize);
+ return 0;
+
+}
+
+U_BOOT_CMD(
+ bunzip2 , 4, 4, do_bunzip2,
+ "bunzip2 - decompress bz2 buffers\n",
+ "src dest size_of_src\n"
+);
+#endif
+
+
diff -x .svn -Nuar
u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/common/Makefile
u-boot.exsw6000/common/Makefile
--- u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/common/Makefile 2007-06-18
22:38:46.000000000 +0300
+++ u-boot.exsw6000/common/Makefile 2007-06-20 19:05:00.000000000 +0300
@@ -39,7 +40,7 @@
cmd_nand.o cmd_net.o cmd_nvedit.o \
cmd_pci.o cmd_pcmcia.o cmd_portio.o \
cmd_reginfo.o cmd_reiser.o cmd_scsi.o cmd_spi.o cmd_universe.o \
- cmd_usb.o cmd_vfd.o \
+ cmd_usb.o cmd_vfd.o cmd_bzip2.o \
command.o console.o cyclon2.o devices.o dlmalloc.o docecc.o \
environment.o env_common.o \
env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
More information about the U-Boot
mailing list