summaryrefslogtreecommitdiffstats
path: root/meta/packages/uboot/u-boot-mkimage-openmoko-native/cmd-unzip.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/cmd-unzip.patch')
-rw-r--r--meta/packages/uboot/u-boot-mkimage-openmoko-native/cmd-unzip.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/cmd-unzip.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/cmd-unzip.patch
new file mode 100644
index 0000000000..ee4c1984fc
--- /dev/null
+++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/cmd-unzip.patch
@@ -0,0 +1,58 @@
1common/cmd_mem.c: new command "unzip srcaddr dstaddr [dstsize]" to unzip from
2 memory to memory, and option CONFIG_UNZIP to enable it
3
4- Werner Almesberger <werner@openmoko.org>
5
6Index: u-boot/common/cmd_mem.c
7===================================================================
8--- u-boot.orig/common/cmd_mem.c
9+++ u-boot/common/cmd_mem.c
10@@ -1148,6 +1148,34 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int fl
11 }
12 #endif /* CONFIG_CRC32_VERIFY */
13
14+
15+#ifdef CONFIG_UNZIP
16+int gunzip (void *, int, unsigned char *, unsigned long *);
17+
18+int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
19+{
20+ unsigned long src, dst;
21+ unsigned long src_len = ~0UL, dst_len = ~0UL;
22+ int err;
23+
24+ switch (argc) {
25+ case 4:
26+ dst_len = simple_strtoul(argv[3], NULL, 16);
27+ /* fall through */
28+ case 3:
29+ src = simple_strtoul(argv[1], NULL, 16);
30+ dst = simple_strtoul(argv[2], NULL, 16);
31+ break;
32+ default:
33+ printf ("Usage:\n%s\n", cmdtp->usage);
34+ return 1;
35+ }
36+
37+ return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
38+}
39+#endif /* CONFIG_UNZIP */
40+
41+
42 /**************************************************/
43 #if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
44 U_BOOT_CMD(
45@@ -1251,5 +1279,13 @@ U_BOOT_CMD(
46 );
47 #endif /* CONFIG_MX_CYCLIC */
48
49+#ifdef CONFIG_UNZIP
50+U_BOOT_CMD(
51+ unzip, 4, 1, do_unzip,
52+ "unzip - unzip a memory region\n",
53+ "srcaddr dstaddr [dstsize]\n"
54+);
55+#endif /* CONFIG_UNZIP */
56+
57 #endif
58 #endif /* CFG_CMD_MEMORY */