summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
commit62b8c978ee6b8d135d9e7953221de58000dba986 (patch)
tree683b04b2e627f6710c22c151b23c8cc9a165315e /usr
parent78fd82238d0e5716578c326404184a27ba67fd6e (diff)
downloadlinux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'usr')
-rw-r--r--usr/Makefile23
-rw-r--r--usr/gen_init_cpio.c27
2 files changed, 27 insertions, 23 deletions
diff --git a/usr/Makefile b/usr/Makefile
index e767f01..029ffe6 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -6,23 +6,20 @@ klibcdirs:;
PHONY += klibcdirs
+# Gzip
+suffix_$(CONFIG_INITRAMFS_COMPRESSION_GZIP) = .gz
+
# Bzip2
-suffix_$(CONFIG_RD_BZIP2) = .bz2
+suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) = .bz2
# Lzma
-suffix_$(CONFIG_RD_LZMA) = .lzma
+suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma
# XZ
-suffix_$(CONFIG_RD_XZ) = .xz
+suffix_$(CONFIG_INITRAMFS_COMPRESSION_XZ) = .xz
# Lzo
-suffix_$(CONFIG_RD_LZO) = .lzo
-
-# Lz4
-suffix_$(CONFIG_RD_LZ4) = .lz4
-
-# Gzip
-suffix_$(CONFIG_RD_GZIP) = .gz
+suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo
AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
@@ -56,10 +53,7 @@ endif
quiet_cmd_initfs = GEN $@
cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
-targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 \
- initramfs_data.cpio.lzma initramfs_data.cpio.xz \
- initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \
- initramfs_data.cpio
+targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio.xz initramfs_data.cpio.lzo initramfs_data.cpio
# do not try to update files included in initramfs
$(deps_initramfs): ;
@@ -72,3 +66,4 @@ $(deps_initramfs): klibcdirs
$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
$(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
$(call if_changed,initfs)
+
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 225ad24..af8c925 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -382,15 +382,24 @@ error:
static char *cpio_replace_env(char *new_location)
{
char expanded[PATH_MAX + 1];
- char *start, *end, *var;
-
- while ((start = strstr(new_location, "${")) &&
- (end = strchr(start + 2, '}'))) {
- *start = *end = 0;
- var = getenv(start + 2);
- snprintf(expanded, sizeof expanded, "%s%s%s",
- new_location, var ? var : "", end + 1);
- strcpy(new_location, expanded);
+ char env_var[PATH_MAX + 1];
+ char *start;
+ char *end;
+
+ for (start = NULL; (start = strstr(new_location, "${")); ) {
+ end = strchr(start, '}');
+ if (start < end) {
+ *env_var = *expanded = '\0';
+ strncat(env_var, start + 2, end - start - 2);
+ strncat(expanded, new_location, start - new_location);
+ strncat(expanded, getenv(env_var),
+ PATH_MAX - strlen(expanded));
+ strncat(expanded, end + 1,
+ PATH_MAX - strlen(expanded));
+ strncpy(new_location, expanded, PATH_MAX);
+ new_location[PATH_MAX] = 0;
+ } else
+ break;
}
return new_location;