| .. | .. |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | #include <common.h> |
|---|
| 8 | 8 | #include <boot_rkimg.h> |
|---|
| 9 | +#include <malloc.h> |
|---|
| 9 | 10 | #include <misc.h> |
|---|
| 10 | 11 | #ifdef CONFIG_SPL_BUILD |
|---|
| 11 | 12 | #include <spl.h> |
|---|
| .. | .. |
|---|
| 25 | 26 | #if CONFIG_IS_ENABLED(FIT_IMAGE_POST_PROCESS) |
|---|
| 26 | 27 | |
|---|
| 27 | 28 | #define FIT_UNCOMP_HASH_NODENAME "digest" |
|---|
| 28 | | -#if CONFIG_IS_ENABLED(MISC_DECOMPRESS) || CONFIG_IS_ENABLED(GZIP) |
|---|
| 29 | +#if CONFIG_IS_ENABLED(MISC_DECOMPRESS) || CONFIG_IS_ENABLED(GZIP) || CONFIG_IS_ENABLED(LZMA) |
|---|
| 29 | 30 | static int fit_image_get_uncomp_digest(const void *fit, int parent_noffset) |
|---|
| 30 | 31 | { |
|---|
| 31 | 32 | const char *name; |
|---|
| .. | .. |
|---|
| 126 | 127 | else |
|---|
| 127 | 128 | misc_decompress_sync(comp); |
|---|
| 128 | 129 | #else |
|---|
| 130 | +#if CONFIG_IS_ENABLED(GZIP) |
|---|
| 129 | 131 | ret = gunzip((void *)(*load_addr), ALIGN(len, FIT_MAX_SPL_IMAGE_SZ), |
|---|
| 130 | 132 | (void *)(*src_addr), (void *)(&len)); |
|---|
| 133 | +#endif |
|---|
| 131 | 134 | #endif |
|---|
| 132 | 135 | } |
|---|
| 133 | 136 | |
|---|
| .. | .. |
|---|
| 154 | 157 | void board_fit_image_post_process(void *fit, int node, ulong *load_addr, |
|---|
| 155 | 158 | ulong **src_addr, size_t *src_len, void *spec) |
|---|
| 156 | 159 | { |
|---|
| 157 | | -#if CONFIG_IS_ENABLED(MISC_DECOMPRESS) || CONFIG_IS_ENABLED(GZIP) |
|---|
| 160 | +#if CONFIG_IS_ENABLED(MISC_DECOMPRESS) || CONFIG_IS_ENABLED(GZIP) || CONFIG_IS_ENABLED(LZMA) |
|---|
| 158 | 161 | fit_decomp_image(fit, node, load_addr, src_addr, src_len, spec); |
|---|
| 159 | 162 | #endif |
|---|
| 160 | 163 | |
|---|
| .. | .. |
|---|
| 169 | 172 | } |
|---|
| 170 | 173 | } |
|---|
| 171 | 174 | #endif |
|---|
| 175 | + |
|---|
| 176 | +#ifndef CONFIG_SPL_BUILD |
|---|
| 177 | + if (fit_image_check_type(fit, node, IH_TYPE_FIRMWARE)) { |
|---|
| 178 | + const char *uname; |
|---|
| 179 | + char *old, *new; |
|---|
| 180 | + size_t len; |
|---|
| 181 | + |
|---|
| 182 | + uname = fdt_get_name(fit, node, NULL); |
|---|
| 183 | + if (strcmp("bootargs", uname)) |
|---|
| 184 | + return; |
|---|
| 185 | + |
|---|
| 186 | + old = env_get("bootargs"); |
|---|
| 187 | + if (!old) |
|---|
| 188 | + return; |
|---|
| 189 | + |
|---|
| 190 | + len = strlen(old) + (*src_len) + 2; |
|---|
| 191 | + new = calloc(1, len); |
|---|
| 192 | + if (new) { |
|---|
| 193 | + strcpy(new, old); |
|---|
| 194 | + strcat(new, " "); |
|---|
| 195 | + strcat(new, (char *)(*src_addr)); |
|---|
| 196 | + env_set("bootargs", new); |
|---|
| 197 | + free(new); |
|---|
| 198 | + } |
|---|
| 199 | + |
|---|
| 200 | + } |
|---|
| 201 | +#endif |
|---|
| 172 | 202 | } |
|---|
| 173 | 203 | #endif /* FIT_IMAGE_POST_PROCESS */ |
|---|
| 174 | 204 | /* |
|---|