diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-12-16 11:23:45 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-12-16 11:23:45 +0100 |
commit | c4de673b775e4db48cd2db6277e0c6714332ca0c (patch) | |
tree | 84f9e4728e6ccf257236d2ba063b6e784ec8b65d /usr | |
parent | bafdc614a1f4f8be8cde41b8ab10ac17e67c1837 (diff) | |
parent | 55957fb7a0b61d8ab6ff3f04e279b8fc22b738fa (diff) |
Merge remote-tracking branch 'wireless-next/master' into mac80211-next
Diffstat (limited to 'usr')
-rw-r--r-- | usr/Makefile | 23 | ||||
-rw-r--r-- | usr/gen_init_cpio.c | 27 |
2 files changed, 23 insertions, 27 deletions
diff --git a/usr/Makefile b/usr/Makefile index 029ffe6cd0d8..e767f019accf 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -6,20 +6,23 @@ klibcdirs:; PHONY += klibcdirs -# Gzip -suffix_$(CONFIG_INITRAMFS_COMPRESSION_GZIP) = .gz - # Bzip2 -suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) = .bz2 +suffix_$(CONFIG_RD_BZIP2) = .bz2 # Lzma -suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma +suffix_$(CONFIG_RD_LZMA) = .lzma # XZ -suffix_$(CONFIG_INITRAMFS_COMPRESSION_XZ) = .xz +suffix_$(CONFIG_RD_XZ) = .xz # Lzo -suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo +suffix_$(CONFIG_RD_LZO) = .lzo + +# Lz4 +suffix_$(CONFIG_RD_LZ4) = .lz4 + +# Gzip +suffix_$(CONFIG_RD_GZIP) = .gz AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)" @@ -53,7 +56,10 @@ 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 +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 # do not try to update files included in initramfs $(deps_initramfs): ; @@ -66,4 +72,3 @@ $(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 af8c925e93eb..225ad244cf88 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c @@ -382,24 +382,15 @@ error: static char *cpio_replace_env(char *new_location) { char expanded[PATH_MAX + 1]; - 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; + 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); } return new_location; |