[U-Boot-Users] Altera Stratix II support
eran liberty
eran.liberty at gmail.com
Mon Jun 4 22:32:47 CEST 2007
This last patch will add the command bunzip2 to the u-boot shell.
allowing to uncompress a buffer in memory (or flash) into another location.
============== sof =================
diff -x .svn -Nuar u-boot.git/common/cmd_bzip2.c
u-boot-exsw6000/common/cmd_bzip2.c
--- u-boot.git/common/cmd_bzip2.c 1970-01-01 02:00:00.000000000 +0200
+++ u-boot-exsw6000/common/cmd_bzip2.c 2007-06-03 22:37:27.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/common/Makefile u-boot-exsw6000/common/Makefile
--- u-boot.git/common/Makefile 2007-05-28 02:11:11.000000000 +0300
+++ u-boot-exsw6000/common/Makefile 2007-06-03 22:23:57.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 \
============== eof =================
Thats it,
Have fun,
Liberty.
More information about the U-Boot
mailing list