changeset 1813:db11c049b66b draft

Linux 4.2
author Rob Landley <rob@landley.net>
date Thu, 12 Nov 2015 07:56:16 -0600
parents acaa88463c0c
children 5ff5fea0ad7a
files download.sh sources/patches/linux-noperl-timeconst.patch sources/patches/linux-shutup.patch
diffstat 3 files changed, 155 insertions(+), 152 deletions(-) [+]
line wrap: on
line diff
--- a/download.sh	Thu Nov 12 07:55:05 2015 -0600
+++ b/download.sh	Thu Nov 12 07:56:16 2015 -0600
@@ -29,8 +29,8 @@
 SHA1=e098ce88e7dd4398c178240b4c380771c5b4fe6b \
 maybe_fork "download || dienow"
 
-URL=ftp://kernel.org/pub/linux/kernel/v4.x/linux-4.1.tar.gz \
-SHA1=dce24ac1874f362000e40027075e7d24ba123b73 \
+URL=ftp://kernel.org/pub/linux/kernel/v4.x/linux-4.2.tar.gz \
+SHA1=70db3c22960e3da16b7d7b0a55066154b8d92900 \
 maybe_fork "download || dienow"
 
 
--- a/sources/patches/linux-noperl-timeconst.patch	Thu Nov 12 07:55:05 2015 -0600
+++ b/sources/patches/linux-noperl-timeconst.patch	Thu Nov 12 07:56:16 2015 -0600
@@ -1,122 +1,9 @@
 Replace timeconst.bc with the c version I've been using for years (to replace
 the perl version). Eventually I should add bc to toybox, but for now...
 
---- /dev/null
-+++ linux/kernel/time/mktimeconst.c
-@@ -0,0 +1,110 @@
-+/* Copyright 2010 Parallels Inc, licensed under GPLv2 */
-+/* Copyright 2010-2013 Rob Landley <rob@landley.net> */
-+
-+#include <inttypes.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+
-+int main(int argc, char *argv[])
-+{
-+	uint64_t hz, periods[] = {1000, 1000000};
-+	char *names[] = {"MSEC", "USEC"};
-+	FILE *file;
-+	int i, j;
-+
-+	if (argc != 3 || (hz = atol(argv[1])) < 1
-+	    || !(file = fopen(argv[2], "w")))
-+	{
-+		fprintf(stderr, "Usage: mktimeconst HZ FILENAME\n\n");
-+		fprintf(stderr, "Generate a header file with constants to convert between\n");
-+		fprintf(stderr, "decimal HZ timer ticks and milisecond or microsecond delays,\n");
-+		fprintf(stderr, "using reciprocal multiplication to avoid 64 bit division.\n");
-+		exit(1);
-+	}
-+
-+	fprintf(file,
-+		"/* Automatically generated by kernel/mktimeconst */\n"
-+		"/* Conversion constants for HZ == %"PRIu64" */\n\n"
-+		"#ifndef __KERNEL_TIMECONST_H\n"
-+		"#define __KERNEL_TIMECONST_H\n\n"
-+		"#include <linux/param.h>\n"
-+		"#include <linux/types.h>\n\n"
-+		"#if HZ != %"PRIu64"\n"
-+		"#error \"kernel/timeconst.h has the wrong HZ value!\"\n"
-+		"#endif\n\n", hz, hz);
-+
-+	/* Repeat for MSEC and USEC */
-+
-+	for (i = 0; i < 2; i++) {
-+		uint64_t gcd, period;
-+
-+		/* Find greatest common denominator using Euclid's algorithm. */
-+
-+		gcd = hz;
-+		period = periods[i];
-+		while (period) {
-+			uint64_t temp = gcd % period;
-+			gcd = period;
-+			period = temp;
-+		}
-+
-+		/* Output both directions (HZ_TO_PERIOD and PERIOD_TO_HZ) */
-+
-+		for (j = 0; j < 2; j++) {
-+			char name[16];
-+			uint64_t from = j ? periods[i] : hz;
-+			uint64_t to = j ? hz : periods[i];
-+			uint64_t mul32 = 0, adj32 = 0, shift = 0;
-+
-+			sprintf(name, j ? "%s_TO_HZ" : "HZ_TO_%s", names[i]);
-+
-+			/* Figure out what shift value gives 32 significant
-+			   bits of MUL32 data.  (Worst case to=1 from=1000000
-+			   uses 52 bits, to<<shift won't overflow 64 bit math.)
-+			*/
-+
-+			for (;;) {
-+				mul32 = ((to << shift) + from - 1) / from;
-+				if (mul32 >= (1UL<<31))
-+					break;
-+				shift++;
-+			}
-+
-+			/* ADJ32 is is just (((FROM/GCD)-1)<<SHIFT)/(FROM/GCD)
-+			   but this can overflow 64 bit math (examples, HZ=24
-+			   or HZ=122).  Worst case scenario uses 32+20+20=72
-+			   bits.  Workaround: split off bottom 32 bits and
-+			   reassemble after calculation (32+64=96 bits). */
-+
-+			adj32 = from / gcd;
-+
-+			if (shift > 32) {
-+				uint64_t upper, lower;
-+
-+				upper = (adj32 - 1) << (shift - 32);
-+				lower = (upper % adj32) << 32;
-+				adj32 = ((upper/adj32) << 32) + (lower/adj32);
-+			} else
-+				adj32 = ((adj32 - 1) << shift) / adj32;
-+
-+			/* Emit the constants into the header file. */
-+
-+			fprintf(file, "#define %s_MUL32\tU64_C(0x%"PRIx64")\n",
-+				name, mul32);
-+			fprintf(file, "#define %s_ADJ32\tU64_C(0x%"PRIx64")\n",
-+				name, adj32);
-+			fprintf(file, "#define %s_SHR32\t%"PRIu64"\n",
-+				name, shift);
-+			fprintf(file, "#define %s_NUM\t\tU64_C(%"PRIu64")\n",
-+				name, to/gcd);
-+			fprintf(file, "#define %s_DEN\t\tU64_C(%"PRIu64")\n\n",
-+				name, from/gcd);
-+		}
-+	}
-+	fprintf(file, "#endif /* __KERNEL_TIMECONST_H */\n");
-+
-+	/* Notice if the disk fills up. */
-+
-+	fflush(stdout);
-+	return ferror(stdout);
-+}
 --- linux/kernel/time/timeconst.bc	2013-04-28 19:36:01.000000000 -0500
 +++ /dev/null	2013-02-23 10:58:11.743993346 -0600
-@@ -1,108 +0,0 @@
+@@ -1,109 +0,0 @@
 -scale=0
 -
 -define gcd(a,b) {
@@ -169,7 +56,7 @@
 -	print "#include <linux/types.h>\n\n"
 -
 -	print "#if HZ != ", hz, "\n"
--	print "#error \qkernel/timeconst.h has the wrong HZ value!\q\n"
+-	print "#error \qinclude/generated/timeconst.h has the wrong HZ value!\q\n"
 -	print "#endif\n\n"
 -
 -	if (hz < 2) {
@@ -224,29 +111,144 @@
 -	halt
 -}
 -
+-hz = read();
 -timeconst(hz)
---- linux/kernel/time/Makefile
-+++ linux/kernel/time/Makefile
-@@ -125,17 +125,11 @@
+diff --git a/Kbuild b/Kbuild
+index f55cefd..e412515 100644
+--- a/Kbuild
++++ b/Kbuild
+@@ -53,16 +53,18 @@ $(obj)/$(bounds-file): kernel/bounds.s FORCE
+ timeconst-file := include/generated/timeconst.h
+ 
+ targets += $(timeconst-file)
++hostprogs-y += mktimeconst
++mktimeconst-objs = kernel/time/mktimeconst.o
  
- $(obj)/time.o: $(obj)/timeconst.h
+ quiet_cmd_gentimeconst = GEN     $@
+ define cmd_gentimeconst
+-	(echo $(CONFIG_HZ) | bc -q $< ) > $@
++	$(obj)/mktimeconst $(CONFIG_HZ) $@
+ endef
+ define filechk_gentimeconst
+-	(echo $(CONFIG_HZ) | bc -q $< )
++	$(obj)/mktimeconst $(CONFIG_HZ) -
+ endef
+ 
+-$(obj)/$(timeconst-file): kernel/time/timeconst.bc FORCE
++$(obj)/$(timeconst-file): $(obj)/mktimeconst FORCE
+ 	$(call filechk,gentimeconst)
  
--quiet_cmd_hzfile = HZFILE  $@
--      cmd_hzfile = echo "hz=$(CONFIG_HZ)" > $@
--
--targets += hz.bc
--$(obj)/hz.bc: $(objtree)/include/config/hz.h FORCE
--	$(call if_changed,hzfile)
--
--quiet_cmd_bc  = BC      $@
--      cmd_bc  = bc -q $(filter-out FORCE,$^) > $@
-+hostprogs-y    += mktimeconst
-+quiet_cmd_mktimeconst = TIMEC   $@
-+	cmd_mktimeconst = $(obj)/mktimeconst $(CONFIG_HZ) $@ || ( rm -f $@ && exit 1 )
- 
- targets += timeconst.h
--$(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
--	$(call if_changed,bc)
-+$(obj)/timeconst.h: $(obj)/mktimeconst FORCE
-+	$(call if_changed,mktimeconst)
- 
+ #####
+--- /dev/null
++++ b/kernel/time/mktimeconst.c
+@@ -0,0 +1,110 @@
++ /* Copyright 2010-2013 Rob Landley <rob@landley.net> */
++ 
++ #include <inttypes.h>
++ #include <stdio.h>
++ #include <stdlib.h>
++ #include <string.h>
++ 
++ int main(int argc, char *argv[])
++ {
++ 	uint64_t hz, periods[] = {1000, 1000000};
++ 	char *names[] = {"MSEC", "USEC"};
++ 	FILE *file;
++ 	int i, j;
++ 
++ 	if (argc != 3 || (hz = atol(argv[1])) < 1
++ 	    || !(file = !strcmp(argv[2], "-") ? stdout : fopen(argv[2], "w")))
++ 	{
++ 		fprintf(stderr, "Usage: mktimeconst HZ FILENAME\n\n");
++ 		fprintf(stderr, "Generate a header file with constants to convert between\n");
++ 		fprintf(stderr, "decimal HZ timer ticks and milisecond or microsecond delays,\n");
++ 		fprintf(stderr, "using reciprocal multiplication to avoid 64 bit division.\n");
++ 		exit(1);
++ 	}
++ 
++ 	fprintf(file,
++ 		"/* Automatically generated by kernel/mktimeconst */\n"
++ 		"/* Conversion constants for HZ == %"PRIu64" */\n\n"
++ 		"#ifndef __KERNEL_TIMECONST_H\n"
++ 		"#define __KERNEL_TIMECONST_H\n\n"
++ 		"#include <linux/param.h>\n"
++ 		"#include <linux/types.h>\n\n"
++ 		"#if HZ != %"PRIu64"\n"
++ 		"#error \"include/generated/timeconst.h has the wrong HZ value!\"\n"
++ 		"#endif\n\n", hz, hz);
++ 
++ 	/* Repeat for MSEC and USEC */
++ 
++ 	for (i = 0; i < 2; i++) {
++ 		uint64_t gcd, period;
++ 
++ 		/* Find greatest common denominator using Euclid's algorithm. */
++ 
++ 		gcd = hz;
++ 		period = periods[i];
++ 		while (period) {
++ 			uint64_t temp = gcd % period;
++ 			gcd = period;
++ 			period = temp;
++ 		}
++ 
++ 		/* Output both directions (HZ_TO_PERIOD and PERIOD_TO_HZ) */
++ 
++ 		for (j = 0; j < 2; j++) {
++ 			char name[16];
++ 			uint64_t from = j ? periods[i] : hz;
++ 			uint64_t to = j ? hz : periods[i];
++ 			uint64_t mul32 = 0, adj32 = 0, shift = 0;
++ 
++ 			sprintf(name, j ? "%s_TO_HZ" : "HZ_TO_%s", names[i]);
++ 
++ 			/* Figure out what shift value gives 32 significant
++ 			   bits of MUL32 data.  (Worst case to=1 from=1000000
++ 			   uses 52 bits, to<<shift won't overflow 64 bit math.)
++ 			*/
++ 
++ 			for (;;) {
++ 				mul32 = ((to << shift) + from - 1) / from;
++ 				if (mul32 >= (1UL<<31))
++ 					break;
++ 				shift++;
++ 			}
++ 
++ 			/* ADJ32 is is just (((FROM/GCD)-1)<<SHIFT)/(FROM/GCD)
++ 			   but this can overflow 64 bit math (examples, HZ=24
++ 			   or HZ=122).  Worst case scenario uses 32+20+20=72
++ 			   bits.  Workaround: split off bottom 32 bits and
++ 			   reassemble after calculation (32+64=96 bits). */
++ 
++ 			adj32 = from / gcd;
++ 
++ 			if (shift > 32) {
++ 				uint64_t upper, lower;
++ 
++ 				upper = (adj32 - 1) << (shift - 32);
++ 				lower = (upper % adj32) << 32;
++ 				adj32 = ((upper/adj32) << 32) + (lower/adj32);
++ 			} else
++ 				adj32 = ((adj32 - 1) << shift) / adj32;
++ 
++ 			/* Emit the constants into the header file. */
++ 
++ 			fprintf(file, "#define %s_MUL32\tU64_C(0x%"PRIx64")\n",
++ 				name, mul32);
++ 			fprintf(file, "#define %s_ADJ32\tU64_C(0x%"PRIx64")\n",
++ 				name, adj32);
++ 			fprintf(file, "#define %s_SHR32\t%"PRIu64"\n",
++ 				name, shift);
++ 			fprintf(file, "#define %s_NUM\t\tU64_C(%"PRIu64")\n",
++ 				name, to/gcd);
++ 			fprintf(file, "#define %s_DEN\t\tU64_C(%"PRIu64")\n\n",
++ 				name, from/gcd);
++ 		}
++ 	}
++ 	fprintf(file, "#endif /* __KERNEL_TIMECONST_H */\n");
++ 
++ 	/* Notice if the disk fills up. */
++ 
++ 	fflush(file);
++ 	return ferror(file);
++ }
--- a/sources/patches/linux-shutup.patch	Thu Nov 12 07:55:05 2015 -0600
+++ b/sources/patches/linux-shutup.patch	Thu Nov 12 07:56:16 2015 -0600
@@ -1,17 +1,5 @@
 Modern kernels crap asynchronus messages over the serial console after lauching init, hiding the shell prompt. Silence two of them.
 
-diff -ru linux/drivers/char/random.c linux.bak/drivers/char/random.c
---- linux/drivers/char/random.c	2014-06-08 13:19:54.000000000 -0500
-+++ linux.bak/drivers/char/random.c	2014-09-06 21:40:09.430230266 -0500
-@@ -657,7 +657,7 @@
- 		if (r == &nonblocking_pool) {
- 			prandom_reseed_late();
- 			wake_up_interruptible(&urandom_init_wait);
--			pr_notice("random: %s pool is initialized\n", r->name);
-+			pr_debug("random: %s pool is initialized\n", r->name);
- 		}
- 	}
- 
 diff -ru linux/drivers/net/ethernet/intel/e1000/e1000_main.c linux.bak/drivers/net/ethernet/intel/e1000/e1000_main.c
 --- linux/drivers/net/ethernet/intel/e1000/e1000_main.c	2014-06-08 13:19:54.000000000 -0500
 +++ linux.bak/drivers/net/ethernet/intel/e1000/e1000_main.c	2014-09-06 20:55:29.974299985 -0500
@@ -24,3 +12,16 @@
  				"Flow Control: %s\n",
  				netdev->name,
  				adapter->link_speed,
+diff --git a/drivers/char/random.c b/drivers/char/random.c
+index d0da5d8..085ec6a 100644
+--- a/drivers/char/random.c
++++ b/drivers/char/random.c
+@@ -681,7 +681,7 @@ retry:
+ 			prandom_reseed_late();
+ 			process_random_ready_list();
+ 			wake_up_all(&urandom_init_wait);
+-			pr_notice("random: %s pool is initialized\n", r->name);
++			pr_debug("random: %s pool is initialized\n", r->name);
+ 		}
+ 	}
+