From: eran.liberty at gmail.com <eran.liberty@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Adds a bunzip2 command in common/cmd_bzip2.c
Date: Tue, 03 Jul 2007 16:30:42 -0000 [thread overview]
Message-ID: <E1I5lGx-00050N-4S@mail.sourceforge.net> (raw)
Adds a bunzip2 <src addr> <dst addr> <size>
to uncompress buffer in memory
Signed-off-by: Eran Liberty <eran.liberty@gmail.com>
Index: common/cmd_bzip2.c
===================================================================
--- common/cmd_bzip2.c (.../tags/trunk/20070620_2_merge_to_exsw6000) (revision 0)
+++ common/cmd_bzip2.c (.../branches/exsw6000) (revision 69)
@@ -0,0 +1,66 @@
+/*
+ * (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
Index: common/Makefile
===================================================================
--- common/Makefile (.../tags/trunk/20070620_2_merge_to_exsw6000) (revision 69)
+++ common/Makefile (.../branches/exsw6000) (revision 69)
@@ -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 \
next reply other threads:[~2007-07-03 16:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-03 16:30 eran.liberty at gmail.com [this message]
2007-07-03 17:26 ` [U-Boot-Users] [PATCH] Adds a bunzip2 command in common/cmd_bzip2.c Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1I5lGx-00050N-4S@mail.sourceforge.net \
--to=eran.liberty@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox