Fixed patches and patching method as git apply is touchy

This commit is contained in:
SolidHal 2018-08-24 13:20:24 -05:00
parent 97e9e5ec2f
commit d9033e13c8
7 changed files with 100 additions and 74 deletions

View File

@ -103,7 +103,7 @@ rmdir $inmnt
losetup -d $indev
# move the 15GB image inside the 2GB one
cp -f Librean-stretch-c201-libre-15GB.img $outmnt/
cp -f librean-stretch-c201-libre-15GB.img $outmnt/
echo "DONE!"
cleanup

View File

@ -4,6 +4,7 @@
KVER=4.17.2
TEST_PATCHES=false
# build Linux-libre, with ath9k_htc, dwc2 from Chrome OS and without many useless drivers
[ ! -f linux-libre-$KVER-gnu.tar.lz ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz
@ -11,13 +12,11 @@ KVER=4.17.2
cd linux-$KVER
make clean
make mrproper
[ "$FRESH" = true ] && git apply ../patches-tested/*
#Apply the usb patch, quietly so
# git apply ../chromeos-dwc2-glue.patch
# git apply ../rockchip-dwc2-usb-partial-power-down.patch
#Apply the usb and mmc patches if unapplied
[ "$FRESH" = true ] && for i in ../patches-tested/*.patch; do patch -p1 < $i; done
#Apply all of the rockMyy patches that make sense
# git apply ../patches/kernel/*
# git apply ../patches/DTS/*
[ "$TEST_PATCHES" = true ] && for i in ../patches-untested/kernel/*.patch; do patch -p1 < $i; done
[ "$TEST_PATCHES" = true ] && for i in ../patches-untested/DTS/*.patch; do patch -p1 < $i; done
# reset the minor version number, so out-of-tree drivers continue to work after
# a kernel upgrade
sed s/'SUBLEVEL = .*'/'SUBLEVEL = 0'/ -i Makefile

View File

@ -1,11 +1,41 @@
From 0f09019241a0ea6eee0b9b596a70ec8a66b820ce Mon Sep 17 00:00:00 2001
From: SolidHal <hal@halemmerich.com>
Date: Fri, 24 Aug 2018 11:04:43 -0500
Subject: [PATCH] block: partitions: efi: Add support for IGNOREME GPT
signature
This patch adds support for a special GPT header signature marker (using
the string 'IGNOREME' instead of the spec's 'EFI PART'). This tells the
kernel to ignore this GPT completely and look at the other one instead.
Since the kernel always prefers the primary GPT anyway, all we really
need to do effectively is to check whether the primary GPT is marked
'IGNOREME' and force evaluation of the secondary one in that case.
Borrowed from the chrome os 3.14 kernel, the commit can be found here:
https://chromium.googlesource.com/chromiumos/third_party/kernel/+/abba28d0a1b7361da6e2023352e92687166ca30d
Also bundled in this commit
https://chromium.googlesource.com/chromiumos/third_party/kernel/+/bd0c62c7de0c8a63314b7955e5718d8f6192f9d2%5E%21/#F0
Which is a small compiler warning fix for the above patch
This patch fixes how the kernel detects and handles certain mmc
manufatures devices, and allows the partitions on the mmc to be bootable
and mountable.
Signed-off-by: SolidHal <hal@halemmerich.com>
---
block/partitions/efi.c | 31 ++++++++++++++++++++++---------
block/partitions/efi.h | 3 ++-
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 4bf0f97..b33671d 100644
index 39f70d9..aa08380 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -348,23 +348,32 @@
* @lba is the logical block address of the GPT header to test
* @gpt is a GPT header ptr, filled on return.
* @ptes is a PTEs ptr, filled on return.
@@ -344,23 +344,34 @@ static gpt_header *alloc_read_gpt_header(struct parsed_partitions *state,
* @lba: logical block address of the GPT header to test
* @gpt: GPT header ptr, filled on return.
* @ptes: PTEs ptr, filled on return.
+ * @ignored is filled on return with 1 if this is an IGNOREME GPT,
+ * 0 otherwise. May be NULL.
*
@ -17,7 +47,7 @@ index 4bf0f97..b33671d 100644
+ gpt_header **gpt, gpt_entry **ptes, int *ignored)
{
u32 crc, origcrc;
u64 lastlba;
u64 lastlba, pt_size;
+ if (ignored)
+ *ignored = 0;
@ -28,8 +58,10 @@ index 4bf0f97..b33671d 100644
/* Check the GUID Partition Table signature */
- if (le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) {
+
+ if (le64_to_cpu((*gpt)->signature) == GPT_HEADER_SIGNATURE_IGNORED) {
+ pr_debug("GUID Partition Table at LBA %llu marked IGNOREME\n");
+ pr_debug("GUID Partition Table at LBA %llu marked IGNOREME\n",
+ (unsigned long long)lba);
+ if (ignored)
+ *ignored = 1;
+ goto fail;
@ -37,7 +69,7 @@ index 4bf0f97..b33671d 100644
pr_debug("GUID Partition Table Header signature is wrong:"
"%lld != %lld\n",
(unsigned long long)le64_to_cpu((*gpt)->signature),
@@ -592,7 +601,7 @@
@@ -597,7 +608,7 @@ compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
gpt_entry **ptes)
{
@ -46,17 +78,17 @@ index 4bf0f97..b33671d 100644
gpt_header *pgpt = NULL, *agpt = NULL;
gpt_entry *pptes = NULL, *aptes = NULL;
legacy_mbr *legacymbr;
@@ -622,19 +631,20 @@
@@ -627,19 +638,20 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
}
good_pgpt = is_gpt_valid(state, GPT_PRIMARY_PARTITION_TABLE_LBA,
- &pgpt, &pptes);
+ &pgpt, &pptes, &pgpt_ignored);
+ &pgpt, &pptes, &pgpt_ignored);
if (good_pgpt)
good_agpt = is_gpt_valid(state,
le64_to_cpu(pgpt->alternate_lba),
- &agpt, &aptes);
- if (!good_agpt && force_gpt)
- if (!good_agpt && force_gpt)
- good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes);
+ &agpt, &aptes, NULL);
+ if (!good_agpt && (force_gpt || pgpt_ignored))
@ -72,21 +104,21 @@ index 4bf0f97..b33671d 100644
/* The good cases */
if (good_pgpt) {
@@ -651,7 +661,8 @@
@@ -656,7 +668,8 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
*ptes = aptes;
kfree(pgpt);
kfree(pptes);
- pr_warn("Primary GPT is invalid, using alternate GPT.\n");
+ pr_warn("Primary GPT is %s, using alternate GPT.\n",
+ pgpt_ignored ? "being ignored" : "invalid");
+ pr_warn("Primary GPT is %s, using alternate GPT.\n",
+ pgpt_ignored ? "being ignored" : "invalid");
return 1;
}
diff --git a/block/partitions/efi.h b/block/partitions/efi.h
index 4efcafb..3a13ef9 100644
index abd0b19..36cddc8 100644
--- a/block/partitions/efi.h
+++ b/block/partitions/efi.h
@@ -40,7 +40,8 @@
@@ -41,7 +41,8 @@
#define GPT_MBR_PROTECTIVE 1
#define GPT_MBR_HYBRID 2
@ -95,4 +127,7 @@ index 4efcafb..3a13ef9 100644
+#define GPT_HEADER_SIGNATURE_IGNORED 0x454d45524f4e4749ULL /* 'IGNOREME' */
#define GPT_HEADER_REVISION_V1 0x00010000
#define GPT_PRIMARY_PARTITION_TABLE_LBA 1
--
2.11.0

View File

@ -0,0 +1,34 @@
From 7d49850b0a41f6db81dfeb0a829d4b7e66ddb473 Mon Sep 17 00:00:00 2001
From: SolidHal <hal@halemmerich.com>
Date: Fri, 24 Aug 2018 11:31:45 -0500
Subject: [PATCH] Do not force GUID partition with 'gpt' command line option.
Fixes a bug where left over partition tables that aren't over written are read
instead of the proper partition table.
Described here: https://bugs.chromium.org/p/chromium/issues/detail?id=260040
Signed-off-by: SolidHal <hal@halemmerich.com>
---
block/partitions/efi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index aa08380..ffcdc16 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -112,7 +112,11 @@ static int force_gpt;
static int __init
force_gpt_fn(char *str)
{
- force_gpt = 1;
+ /* Do not force GPT even if 'gpt' command line option is
+ * specified for ChromeOS kernel.
+ */
+ force_gpt = 0;
+ pr_warn("Not forcing GPT even though 'gpt' specified on cmd line.\n");
return 1;
}
__setup("gpt", force_gpt_fn);
--
2.11.0

View File

@ -1,27 +0,0 @@
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index dc51f46..4bf0f97 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -112,7 +112,11 @@
static int __init
force_gpt_fn(char *str)
{
- force_gpt = 1;
+ /* Do not force GPT even if 'gpt' command line option is
+ * specified for ChromeOS kernel.
+ */
+ force_gpt = 0;
+ pr_warn("Not forcing GPT even though 'gpt' specified on cmd line.\n");
return 1;
}
__setup("gpt", force_gpt_fn);
@@ -623,7 +627,7 @@
good_agpt = is_gpt_valid(state,
le64_to_cpu(pgpt->alternate_lba),
&agpt, &aptes);
- if (!good_agpt && force_gpt)
+ if (!good_agpt && force_gpt)
good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes);
/* The obviously unsuccessful case */

View File

@ -1,16 +0,0 @@
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index b33671d..068d5a6 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -369,7 +369,9 @@
/* Check the GUID Partition Table signature */
if (le64_to_cpu((*gpt)->signature) == GPT_HEADER_SIGNATURE_IGNORED) {
- pr_debug("GUID Partition Table at LBA %llu marked IGNOREME\n");
+ pr_debug("GUID Partition Table at LBA %llu marked IGNOREME\n",
+ (unsigned long long)lba);
+
if (ignored)
*ignored = 1;
goto fail;

View File

@ -28,16 +28,17 @@ Signed-off-by: Hal Emmerich <hal@halemmerich.com>
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index f03e41879224..492607adc506 100644
index f03e418..492607a 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -82,6 +82,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)
p->host_perio_tx_fifo_size = 256;
p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 <<
GAHBCFG_HBSTLEN_SHIFT;
+ p->power_down = 0;
p->host_perio_tx_fifo_size = 256;
p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 <<
GAHBCFG_HBSTLEN_SHIFT;
+ p->power_down = 0;
}
static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg)
--
2.11.0
--
2.11.0