changeset 1570:bee6b26a006d

Linux 3.7.
author Rob Landley <rob@landley.net>
date Wed, 12 Dec 2012 03:50:07 -0600
parents a91fb1944247
children ffa79617fb3f
files download.sh sources/patches/linux-arm.patch sources/patches/linux-bootraw.patch sources/patches/linux-fixext4.patch sources/patches/linux-noperl-capflags.patch sources/patches/linux-noperl-headers.patch sources/patches/linux-noperl-timeconst.patch
diffstat 7 files changed, 67 insertions(+), 355 deletions(-) [+]
line wrap: on
line diff
--- a/download.sh	Mon Dec 10 12:14:51 2012 -0600
+++ b/download.sh	Wed Dec 12 03:50:07 2012 -0600
@@ -25,8 +25,8 @@
 SHA1=4d8d67d6754409bd10015d67d1ce7a04c0b001ba \
 maybe_fork "download || dienow"
 
-URL=http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.6.tar.bz2 \
-SHA1=9beb98fddbd7246381b1dbb08cd9a170f03fd67b \
+URL=http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.7.tar.bz2 \
+SHA1=4eab447788385b49cb4db170baec8788d5d7dda7 \
 maybe_fork "download || dienow"
 
 
--- a/sources/patches/linux-arm.patch	Mon Dec 10 12:14:51 2012 -0600
+++ b/sources/patches/linux-arm.patch	Wed Dec 12 03:50:07 2012 -0600
@@ -9,14 +9,14 @@
 index c1f38f6..fe5738c 100644
 --- a/arch/arm/mach-versatile/Kconfig
 +++ b/arch/arm/mach-versatile/Kconfig
-@@ -3,7 +3,6 @@ menu "Versatile platform type"
- 
+@@ -4,7 +4,6 @@ menu "Versatile platform type"
  config ARCH_VERSATILE_PB
  	bool "Support Versatile Platform Baseboard for ARM926EJ-S"
+ 	default y
 -	select CPU_ARM926T
  	select MIGHT_HAVE_PCI
- 	default y
  	help
+ 	  Include support for the ARM(R) Versatile Platform Baseboard
 @@ -12,7 +11,6 @@ config ARCH_VERSATILE_PB
  
  config MACH_VERSATILE_AB
@@ -61,7 +61,7 @@
 +	bool "Support ARM920T processor" if ARCH_INTEGRATOR || ARCH_VERSATILE_PB || ARCH_VERSATILE_AB
  	select CPU_32v4T
  	select CPU_ABRT_EV4T
- 	select CPU_PABRT_LEGACY
+ 	select CPU_CACHE_V4WT
 @@ -89,7 +89,7 @@ config CPU_ARM920T
  
  # ARM922T
@@ -70,7 +70,7 @@
 +	bool "Support ARM922T processor" if ARCH_INTEGRATOR || ARCH_VERSATILE_PB || ARCH_VERSATILE_AB
  	select CPU_32v4T
  	select CPU_ABRT_EV4T
- 	select CPU_PABRT_LEGACY
+ 	select CPU_CACHE_V4WT
 @@ -127,7 +127,7 @@ config CPU_ARM925T
  
  # ARM926T
@@ -79,12 +79,12 @@
 +	bool "Support ARM926T processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || ARCH_VERSATILE_PB || ARCH_VERSATILE_AB
  	select CPU_32v5
  	select CPU_ABRT_EV5TJ
- 	select CPU_PABRT_LEGACY
+ 	select CPU_CACHE_VIVT
 @@ -135,6 +135,7 @@ config CPU_ARM926T
  	select CPU_CP15_MMU
- 	select CPU_COPY_V4WB if MMU
+ 	select CPU_PABRT_LEGACY
  	select CPU_TLB_V4WBI if MMU
-+	depends on !CPU_V6 && !CPU_V7
++	select ARCH_SUPPORTS_BIG_ENDIAN
  	help
  	  This is a variant of the ARM920.  It has slightly different
  	  instruction sequences for cache and TLB operations.  Curiously,
@@ -97,4 +97,20 @@
 +
  	select CPU_32v6
  	select CPU_ABRT_EV6
- 	select CPU_PABRT_V6
+ 	select CPU_CACHE_V6
+diff -ruN linux/arch/arm/mach-versatile/Kconfig linux.new/arch/arm/mach-versatile/Kconfig
+--- linux/arch/arm/mach-versatile/Kconfig	2012-12-03 00:24:33.494770199 -0600
++++ linux.new/arch/arm/mach-versatile/Kconfig	2012-12-03 00:17:31.172705566 -0600
+@@ -1,6 +1,12 @@
+ menu "Versatile platform type"
+ 	depends on ARCH_VERSATILE
+ 
++if ARCH_VERSATILE
++config ARCH_SUPPORTS_BIG_ENDIAN
++        bool
++        default y
++endif
++
+ config ARCH_VERSATILE_PB
+ 	bool "Support Versatile Platform Baseboard for ARM926EJ-S"
+ 	default y
--- a/sources/patches/linux-bootraw.patch	Mon Dec 10 12:14:51 2012 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
---- linux.bak/arch/mips/Kconfig	2011-01-04 18:50:19.000000000 -0600
-+++ linux/arch/mips/Kconfig	2011-01-10 08:15:26.000000000 -0600
-@@ -787,9 +787,6 @@
- config ARCH_MAY_HAVE_PC_FDC
- 	bool
- 
--config BOOT_RAW
--	bool
--
- config CEVT_BCM1480
- 	bool
- 
-@@ -2222,6 +2219,18 @@
- 	help
- 	  Include support for flattened device tree machine descriptions.
- 
-+config BOOT_RAW
-+	bool "Enable the kernel to be executed from the load address"
-+	default n
-+	help
-+	 Allow the kernel to be executed from the load address for
-+	 bootloaders which cannot read the ELF format. This places
-+	 a jump to start_kernel at the load address.
-+
-+	 If unsure, say N.
-+
-+
-+
- endmenu
- 
- config LOCKDEP_SUPPORT
--- a/sources/patches/linux-fixext4.patch	Mon Dec 10 12:14:51 2012 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,282 +0,0 @@
-commit f2a09af645b762f8230e7eba7fee3b6f7e6e96e7
-Author: Yongqiang Yang <xiaoqiangnk@gmail.com>
-Date:   Sun Sep 23 23:16:03 2012 -0400
-
-    ext4: check free inode count before allocating an inode
-    
-    Recently, I ecountered some corrupted filesystems in which some
-    groups' free inode counts were 65535, it seemed that free inode
-    count was overflow.  This patch teaches ext4 to check free inode
-    count before allocaing an inode.
-    
-    Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
-    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-
-diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
-index 26154b8..fa36372 100644
---- a/fs/ext4/ialloc.c
-+++ b/fs/ext4/ialloc.c
-@@ -697,6 +697,15 @@ got_group:
- 		if (!gdp)
- 			goto fail;
- 
-+		/*
-+		 * Check free inodes count before loading bitmap.
-+		 */
-+		if (ext4_free_inodes_count(sb, gdp) == 0) {
-+			if (++group == ngroups)
-+				group = 0;
-+			continue;
-+		}
-+
- 		brelse(inode_bitmap_bh);
- 		inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
- 		if (!inode_bitmap_bh)
-commit 79f1ba49569e5aec919b653c55b03274c2331701
-Author: Tao Ma <boyu.mt@taobao.com>
-Date:   Mon Oct 22 00:34:32 2012 -0400
-
-    ext4: Checksum the block bitmap properly with bigalloc enabled
-    
-    In mke2fs, we only checksum the whole bitmap block and it is right.
-    While in the kernel, we use EXT4_BLOCKS_PER_GROUP to indicate the
-    size of the checksumed bitmap which is wrong when we enable bigalloc.
-    The right size should be EXT4_CLUSTERS_PER_GROUP and this patch fixes
-    it.
-    
-    Also as every caller of ext4_block_bitmap_csum_set and
-    ext4_block_bitmap_csum_verify pass in EXT4_BLOCKS_PER_GROUP(sb)/8,
-    we'd better removes this parameter and sets it in the function itself.
-    
-    Signed-off-by: Tao Ma <boyu.mt@taobao.com>
-    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-    Reviewed-by: Lukas Czerner <lczerner@redhat.com>
-    Cc: stable@vger.kernel.org
-
-diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
-index 1b50890..cf18217 100644
---- a/fs/ext4/balloc.c
-+++ b/fs/ext4/balloc.c
-@@ -174,8 +174,7 @@ void ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
- 		ext4_free_inodes_set(sb, gdp, 0);
- 		ext4_itable_unused_set(sb, gdp, 0);
- 		memset(bh->b_data, 0xff, sb->s_blocksize);
--		ext4_block_bitmap_csum_set(sb, block_group, gdp, bh,
--					   EXT4_BLOCKS_PER_GROUP(sb) / 8);
-+		ext4_block_bitmap_csum_set(sb, block_group, gdp, bh);
- 		return;
- 	}
- 	memset(bh->b_data, 0, sb->s_blocksize);
-@@ -212,8 +211,7 @@ void ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
- 	 */
- 	ext4_mark_bitmap_end(num_clusters_in_group(sb, block_group),
- 			     sb->s_blocksize * 8, bh->b_data);
--	ext4_block_bitmap_csum_set(sb, block_group, gdp, bh,
--				   EXT4_BLOCKS_PER_GROUP(sb) / 8);
-+	ext4_block_bitmap_csum_set(sb, block_group, gdp, bh);
- 	ext4_group_desc_csum_set(sb, block_group, gdp);
- }
- 
-@@ -350,7 +348,7 @@ void ext4_validate_block_bitmap(struct super_block *sb,
- 		return;
- 	}
- 	if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
--			desc, bh, EXT4_BLOCKS_PER_GROUP(sb) / 8))) {
-+			desc, bh))) {
- 		ext4_unlock_group(sb, block_group);
- 		ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
- 		return;
-diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
-index 5c2d181..3285aa5 100644
---- a/fs/ext4/bitmap.c
-+++ b/fs/ext4/bitmap.c
-@@ -58,11 +58,12 @@ void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
- 
- int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
- 				  struct ext4_group_desc *gdp,
--				  struct buffer_head *bh, int sz)
-+				  struct buffer_head *bh)
- {
- 	__u32 hi;
- 	__u32 provided, calculated;
- 	struct ext4_sb_info *sbi = EXT4_SB(sb);
-+	int sz = EXT4_CLUSTERS_PER_GROUP(sb) / 8;
- 
- 	if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
- 					EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
-@@ -84,8 +85,9 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
- 
- void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
- 				struct ext4_group_desc *gdp,
--				struct buffer_head *bh, int sz)
-+				struct buffer_head *bh)
- {
-+	int sz = EXT4_CLUSTERS_PER_GROUP(sb) / 8;
- 	__u32 csum;
- 	struct ext4_sb_info *sbi = EXT4_SB(sb);
- 
-diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
-index 78971cf..3c20de1 100644
---- a/fs/ext4/ext4.h
-+++ b/fs/ext4/ext4.h
-@@ -1882,10 +1882,10 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
- 				  struct buffer_head *bh, int sz);
- void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
- 				struct ext4_group_desc *gdp,
--				struct buffer_head *bh, int sz);
-+				struct buffer_head *bh);
- int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
- 				  struct ext4_group_desc *gdp,
--				  struct buffer_head *bh, int sz);
-+				  struct buffer_head *bh);
- 
- /* balloc.c */
- extern void ext4_validate_block_bitmap(struct super_block *sb,
-diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
-index fa36372..4facdd2 100644
---- a/fs/ext4/ialloc.c
-+++ b/fs/ext4/ialloc.c
-@@ -762,9 +762,7 @@ got:
- 			ext4_free_group_clusters_set(sb, gdp,
- 				ext4_free_clusters_after_init(sb, group, gdp));
- 			ext4_block_bitmap_csum_set(sb, group, gdp,
--						   block_bitmap_bh,
--						   EXT4_BLOCKS_PER_GROUP(sb) /
--						   8);
-+						   block_bitmap_bh);
- 			ext4_group_desc_csum_set(sb, group, gdp);
- 		}
- 		ext4_unlock_group(sb, group);
-diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
-index a415465..eb1e385 100644
---- a/fs/ext4/mballoc.c
-+++ b/fs/ext4/mballoc.c
-@@ -2805,8 +2805,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
- 	}
- 	len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len;
- 	ext4_free_group_clusters_set(sb, gdp, len);
--	ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh,
--				   EXT4_BLOCKS_PER_GROUP(sb) / 8);
-+	ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh);
- 	ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp);
- 
- 	ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
-@@ -4666,8 +4665,7 @@ do_more:
- 
- 	ret = ext4_free_group_clusters(sb, gdp) + count_clusters;
- 	ext4_free_group_clusters_set(sb, gdp, ret);
--	ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh,
--				   EXT4_BLOCKS_PER_GROUP(sb) / 8);
-+	ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh);
- 	ext4_group_desc_csum_set(sb, block_group, gdp);
- 	ext4_unlock_group(sb, block_group);
- 	percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters);
-@@ -4811,8 +4809,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
- 	mb_free_blocks(NULL, &e4b, bit, count);
- 	blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc);
- 	ext4_free_group_clusters_set(sb, desc, blk_free_count);
--	ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh,
--				   EXT4_BLOCKS_PER_GROUP(sb) / 8);
-+	ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh);
- 	ext4_group_desc_csum_set(sb, block_group, desc);
- 	ext4_unlock_group(sb, block_group);
- 	percpu_counter_add(&sbi->s_freeclusters_counter,
-diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
-index 7a75e10..47bf06a 100644
---- a/fs/ext4/resize.c
-+++ b/fs/ext4/resize.c
-@@ -1212,8 +1212,7 @@ static int ext4_set_bitmap_checksums(struct super_block *sb,
- 	bh = ext4_get_bitmap(sb, group_data->block_bitmap);
- 	if (!bh)
- 		return -EIO;
--	ext4_block_bitmap_csum_set(sb, group, gdp, bh,
--				   EXT4_BLOCKS_PER_GROUP(sb) / 8);
-+	ext4_block_bitmap_csum_set(sb, group, gdp, bh);
- 	brelse(bh);
- 
- 	return 0;
-commit ffb5387e85d528fb6d0d924abfa3fbf0fc484071
-Author: Eric Sandeen <sandeen@redhat.com>
-Date:   Sun Oct 28 22:24:57 2012 -0400
-
-    ext4: fix unjournaled inode bitmap modification
-    
-    commit 119c0d4460b001e44b41dcf73dc6ee794b98bd31 changed
-    ext4_new_inode() such that the inode bitmap was being modified
-    outside a transaction, which could lead to corruption, and was
-    discovered when journal_checksum found a bad checksum in the
-    journal during log replay.
-    
-    Nix ran into this when using the journal_async_commit mount
-    option, which enables journal checksumming.  The ensuing
-    journal replay failures due to the bad checksums led to
-    filesystem corruption reported as the now infamous
-    "Apparent serious progressive ext4 data corruption bug"
-    
-    [ Changed by tytso to only call ext4_journal_get_write_access() only
-      when we're fairly certain that we're going to allocate the inode. ]
-    
-    I've tested this by mounting with journal_checksum and
-    running fsstress then dropping power; I've also tested by
-    hacking DM to create snapshots w/o first quiescing, which
-    allows me to test journal replay repeatedly w/o actually
-    power-cycling the box.  Without the patch I hit a journal
-    checksum error every time.  With this fix it survives
-    many iterations.
-    
-    Reported-by: Nix <nix@esperi.org.uk>
-    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
-    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-    Cc: stable@vger.kernel.org
-
-diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
-index 4facdd2..3a100e7 100644
---- a/fs/ext4/ialloc.c
-+++ b/fs/ext4/ialloc.c
-@@ -725,6 +725,10 @@ repeat_in_this_group:
- 				   "inode=%lu", ino + 1);
- 			continue;
- 		}
-+		BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
-+		err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
-+		if (err)
-+			goto fail;
- 		ext4_lock_group(sb, group);
- 		ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data);
- 		ext4_unlock_group(sb, group);
-@@ -738,6 +742,11 @@ repeat_in_this_group:
- 	goto out;
- 
- got:
-+	BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
-+	err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
-+	if (err)
-+		goto fail;
-+
- 	/* We may have to initialize the block bitmap if it isn't already */
- 	if (ext4_has_group_desc_csum(sb) &&
- 	    gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
-@@ -771,11 +780,6 @@ got:
- 			goto fail;
- 	}
- 
--	BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
--	err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
--	if (err)
--		goto fail;
--
- 	BUFFER_TRACE(group_desc_bh, "get_write_access");
- 	err = ext4_journal_get_write_access(handle, group_desc_bh);
- 	if (err)
-@@ -823,11 +827,6 @@ got:
- 	}
- 	ext4_unlock_group(sb, group);
- 
--	BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
--	err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
--	if (err)
--		goto fail;
--
- 	BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata");
- 	err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh);
- 	if (err)
--- a/sources/patches/linux-noperl-capflags.patch	Mon Dec 10 12:14:51 2012 -0600
+++ b/sources/patches/linux-noperl-capflags.patch	Wed Dec 12 03:50:07 2012 -0600
@@ -10,9 +10,9 @@
  arch/x86/kernel/cpu/mkcapflags.sh |   39 ++++++++++++++++++++++++
  3 files changed, 41 insertions(+), 47 deletions(-)
 
---- linux/arch/x86/kernel/cpu/mkcapflags.pl	2012-07-10 11:10:30.081283128 -0500
-+++ /dev/null	2012-07-11 05:54:12.790418331 -0500
-@@ -1,45 +0,0 @@
+--- linux/arch/x86/kernel/cpu/mkcapflags.pl
++++ /dev/null
+@@ -1,48 +0,0 @@
 -#!/usr/bin/perl -w
 -#
 -# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h
@@ -23,7 +23,10 @@
 -open(IN, "< $in\0")   or die "$0: cannot open: $in: $!\n";
 -open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
 -
--print OUT "#include <asm/cpufeature.h>\n\n";
+-print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n";
+-print OUT "#include <asm/cpufeature.h>\n";
+-print OUT "#endif\n";
+-print OUT "\n";
 -print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
 -
 -%features = ();
@@ -60,7 +63,7 @@
 -exit(0);
 --- /dev/null	2012-07-11 05:54:12.790418331 -0500
 +++ linux/arch/x86/kernel/cpu/mkcapflags.sh	2012-07-22 13:13:57.700823094 -0500
-@@ -0,0 +1,39 @@
+@@ -0,0 +1,41 @@
 +#!/bin/sh
 +#
 +# Generate the x86_cap_flags[] array from include/asm/cpufeature.h
@@ -73,7 +76,9 @@
 +trap 'rm "$OUT"' EXIT
 +
 +(
++	echo "#ifndef _ASM_X86_CPUFEATURE_H"
 +	echo "#include <asm/cpufeature.h>"
++	echo "#endif"
 +	echo ""
 +	echo "const char * const x86_cap_flags[NCAPINTS*32] = {"
 +
--- a/sources/patches/linux-noperl-headers.patch	Mon Dec 10 12:14:51 2012 -0600
+++ b/sources/patches/linux-noperl-headers.patch	Wed Dec 12 03:50:07 2012 -0600
@@ -25,16 +25,15 @@
 @@ -0,0 +1,43 @@
 +#!/bin/sh
 +
-+if [ $# -lt 2 ]
++if [ $# -lt 1 ]
 +then
-+	echo "Usage: headers_install.sh INDIR OUTDIR [FILES...]
++	echo "Usage: headers_install.sh OUTDIR [FILES...]
 +	echo
 +	echo "Prepares kernel header files for use by user space, by removing"
 +	echo "all compiler.h definitions and #includes, removing any"
 +	echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
 +	echo "asm/inline/volatile keywords."
 +	echo
-+	echo "INDIR:  directory to read each kernel header FILE from."
 +	echo "OUTDIR: directory to write each userspace header FILE to."
 +	echo "FILES:  list of header files to operate on."
 +
@@ -43,44 +42,41 @@
 +
 +# Grab arguments
 +
-+INDIR="$1"
-+shift
 +OUTDIR="$1"
 +shift
 +
 +# Iterate through files listed on command line
 +
-+trap "rm -f $OUTDIR/$i $OUTDIR.sed" EXIT
++FILE=
++trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
 +for i in "$@"
 +do
++	FILE="$(basename "$i")"
 +	sed -r \
 +		-e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
 +		-e 's/__attribute_const__([ \t]|$)/\1/g' \
 +		-e 's@^#include <linux/compiler.h>@@' \
 +		-e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
 +		-e 's/(^|[ \t])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
-+		"$INDIR/$i" > "$OUTDIR/$i.sed" || exit 1
-+	scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$i.sed" \
-+		> "$OUTDIR/$i"
++		-e 's@#(ifndef|define|endif /[*]) _UAPI@#\1 @' \
++		"$i" > "$OUTDIR/$FILE.sed" || exit 1
++	scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
++		> "$OUTDIR/$FILE"
 +	[ $? -gt 1 ] && exit 1
-+	rm -f "$OUTDIR/$i.sed"
++	rm -f "$OUTDIR/$FILE.sed"
 +done
 +trap - EXIT
 diff -ruN linux-3.1/scripts/Makefile.headersinst
 --- linux-3.1/scripts/Makefile.headersinst
 +++ linux/scripts/Makefile.headersinst
-@@ -55,9 +55,9 @@
+@@ -55,7 +55,7 @@
  quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
                              file$(if $(word 2, $(all-files)),s))
        cmd_install = \
--        $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
--        $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
--        $(PERL) $< $(objtree)/$(gen) $(install) $(SRCARCH) $(genhdr-y); \
-+        $(CONFIG_SHELL) $< $(srctree)/$(obj) $(install) $(header-y); \
-+        $(CONFIG_SHELL) $< $(objtree)/$(obj) $(install) $(objhdr-y); \
-+        $(CONFIG_SHELL) $< $(objtree)/$(gen) $(install) $(genhdr-y); \
+-        $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \
++        $(CONFIG_SHELL) $< $(installdir) $(input-files); \
          for F in $(wrapper-files); do                                   \
-                 echo "\#include <asm-generic/$$F>" > $(install)/$$F;    \
+                 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F;    \
          done;                                                           \
 @@ -83,7 +83,7 @@
  	@:
@@ -93,15 +89,14 @@
  	$(call if_changed,install)
 --- a/scripts/headers_install.pl
 +++ /dev/null
-@@ -1,58 +0,0 @@
+@@ -1,63 +0,0 @@
 -#!/usr/bin/perl -w
 -#
 -# headers_install prepare the listed header files for use in
 -# user space and copy the files to their destination.
 -#
 -# Usage: headers_install.pl readdir installdir arch [files...]
--# readdir:    dir to open files
--# installdir: dir to install the files
+-# installdir: dir to install the files to
 -# arch:       current architecture
 -#             arch is used to force a reinstallation when the arch
 -#             changes because kbuild then detect a command line change.
@@ -114,15 +109,18 @@
 -
 -use strict;
 -
--my ($readdir, $installdir, $arch, @files) = @ARGV;
+-my ($installdir, $arch, @files) = @ARGV;
 -
 -my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
 -
--foreach my $file (@files) {
+-foreach my $filename (@files) {
+-	my $file = $filename;
+-	$file =~ s!^.*/!!;
+-
 -	my $tmpfile = "$installdir/$file.tmp";
 -
--	open(my $in, '<', "$readdir/$file")
--	    or die "$readdir/$file: $!\n";
+-	open(my $in, '<', $filename)
+-	    or die "$filename: $!\n";
 -	open(my $out, '>', $tmpfile)
 -	    or die "$tmpfile: $!\n";
 -	while (my $line = <$in>) {
@@ -136,6 +134,9 @@
 -		$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
 -		$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
 -		$line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
+-		$line =~ s/#ifndef _UAPI/#ifndef /;
+-		$line =~ s/#define _UAPI/#define /;
+-		$line =~ s!#endif /[*] _UAPI!#endif /* !;
 -		printf {$out} "%s", $line;
 -	}
 -	close $out;
--- a/sources/patches/linux-noperl-timeconst.patch	Mon Dec 10 12:14:51 2012 -0600
+++ b/sources/patches/linux-noperl-timeconst.patch	Wed Dec 12 03:50:07 2012 -0600
@@ -23,7 +23,7 @@
 index 5669f71..ba9ce6d 100644
 --- a/kernel/Makefile
 +++ b/kernel/Makefile
-@@ -133,8 +133,10 @@ $(obj)/config_data.h: $(obj)/config_data.gz FORCE
+@@ -133,11 +133,13 @@ $(obj)/config_data.h: $(obj)/config_data.gz FORCE
  
  $(obj)/time.o: $(obj)/timeconst.h
  
@@ -38,6 +38,9 @@
 -	$(call if_changed,timeconst)
 +$(obj)/timeconst.h: $(obj)/mktimeconst FORCE
 +	$(call if_changed,mktimeconst)
+ 
+ ifeq ($(CONFIG_MODULE_SIG),y)
+ #
 --- /dev/null	2011-01-13 17:00:36.470564274 -0600
 +++ b/kernel/mktimeconst.c	2011-01-16 12:44:04.091168778 -0600
 @@ -0,0 +1,109 @@