Update to using 4.17.5. Added kernel rebuild script

This commit is contained in:
SolidHal 2018-07-10 17:32:08 -05:00
parent b52e95e467
commit 5a35da895e
9 changed files with 4116 additions and 4007 deletions

BIN
blank_kernel Normal file

Binary file not shown.

View File

@ -3,12 +3,12 @@
# Build fs, image
KVER=4.17.2
KVER=4.17.5
outmnt=$(mktemp -d -p `pwd`)
inmnt=$(mktemp -d -p `pwd`)
outdev=/dev/loop4
outdev=/dev/loop4
indev=/dev/loop5
#A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted.

View File

@ -3,7 +3,7 @@
#Build kenerl, wifi firmware
KVER=4.17.2
KVER=4.17.5
# 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,9 +11,11 @@ KVER=4.17.2
cd linux-$KVER
make clean
make mrproper
#Apply the usb patch
#git apply ../chromeos-dwc2-glue.patch
#Apply all of the rockMyy patches that make sense
git apply ../patches/kernel/*
git apply ../patches/DTS/*
# git apply ../patches/kernel/*
# git apply ../patches/DTS/*
# reset the minor version number, so out-of-tree drivers continue to work after
# a kernel upgrade
sed s/'SUBLEVEL = .*'/'SUBLEVEL = 0'/ -i Makefile

45
buildNewKernelIntoFS.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh -xe
KVER=4.17.5
outmnt=$(mktemp -d -p `pwd`)
outdev=/dev/loop7
#A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted.
#Without this, a reboot is required to properly clean the loop devices and ensure a clean build
cleanuptwice() {
cleanup
cleanup
}
cleanup() {
set +e
#umount -l $inmnt > /dev/null 2>&1
#rmdir $inmnt > /dev/null 2>&1
#losetup -d $indev > /dev/null 2>&1
umount -l $outmnt > /dev/null 2>&1
rmdir $outmnt > /dev/null 2>&1
losetup -d $outdev > /dev/null 2>&1
}
trap cleanuptwice INT TERM EXIT
#Mount the build filesystem image
losetup -P $outdev debian-stretch-c201-libre-2GB*
mount -o noatime ${outdev}p2 $outmnt
# put the kernel in the kernel partition, modules in /lib/modules and AR9271
# firmware in /lib/firmware
dd if=blank_kernel of=${outdev}p1 conv=notrunc
dd if=linux-$KVER/vmlinux.kpart of=${outdev}p1 conv=notrunc
make -C linux-$KVER ARCH=arm INSTALL_MOD_PATH=$outmnt modules_install
rm -f $outmnt/lib/modules/3.14.0/{build,source}
install -D -m 644 open-ath9k-htc-firmware/target_firmware/htc_9271.fw $outmnt/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
echo "DONE!"
cleanup

150
chromeos-dwc2-glue.patch Normal file
View File

@ -0,0 +1,150 @@
diff -rup linux-4.17.2-orig/arch/arm/boot/dts/rk3288.dtsi linux-4.17.2/arch/arm/boot/dts/rk3288.dtsi
--- linux-4.17.2-orig/arch/arm/boot/dts/rk3288.dtsi 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/arch/arm/boot/dts/rk3288.dtsi 2018-04-21 17:56:26.360024274 +0300
@@ -582,6 +582,9 @@
dr_mode = "host";
phys = <&usbphy2>;
phy-names = "usb2-phy";
+ resets = <&cru SRST_USBHOST1_PHY>;
+ reset-names = "phy-full-reset";
+ snps,need-phy-full-reset-on-wake;
status = "disabled";
};
diff -rup linux-4.17.2-orig/arch/arm/boot/dts/rk3288-veyron.dtsi linux-4.17.2/arch/arm/boot/dts/rk3288-veyron.dtsi
--- linux-4.17.2-orig/arch/arm/boot/dts/rk3288-veyron.dtsi 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/arch/arm/boot/dts/rk3288-veyron.dtsi 2018-04-21 17:47:25.796011427 +0300
@@ -429,6 +429,7 @@
&usb_host1 {
status = "okay";
+ snps,need-phy-for-wake;
};
&usb_otg {
@@ -437,6 +438,7 @@
assigned-clocks = <&cru SCLK_USBPHY480M_SRC>;
assigned-clock-parents = <&usbphy0>;
dr_mode = "host";
+ snps,need-phy-for-wake;
};
&vopb {
diff -rup linux-4.17.2-orig/drivers/base/dd.c linux-4.17.2/drivers/base/dd.c
--- linux-4.17.2-orig/drivers/base/dd.c 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/drivers/base/dd.c 2018-04-21 13:01:30.280037034 +0300
@@ -523,6 +523,9 @@ int driver_probe_device(struct device_dr
bool driver_allows_async_probing(struct device_driver *drv)
{
+ if (drv->async_probe)
+ return true;
+
switch (drv->probe_type) {
case PROBE_PREFER_ASYNCHRONOUS:
return true;
diff -rup linux-4.17.2-orig/drivers/usb/common/common.c linux-4.17.2/drivers/usb/common/common.c
--- linux-4.17.2-orig/drivers/usb/common/common.c 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/drivers/usb/common/common.c 2018-04-21 13:36:51.184087441 +0300
@@ -105,6 +105,30 @@ static const char *const usb_dr_modes[]
[USB_DR_MODE_OTG] = "otg",
};
+/**
+ * of_usb_get_dr_mode - Get dual role mode for given device_node
+ * @np: Pointer to the given device_node
+ *
+ * The function gets phy interface string from property 'dr_mode',
+ * and returns the correspondig enum usb_dr_mode
+ */
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
+{
+ const char *dr_mode;
+ int err, i;
+
+ err = of_property_read_string(np, "dr_mode", &dr_mode);
+ if (err < 0)
+ return USB_DR_MODE_UNKNOWN;
+
+ for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++)
+ if (!strcmp(dr_mode, usb_dr_modes[i]))
+ return i;
+
+ return USB_DR_MODE_UNKNOWN;
+}
+EXPORT_SYMBOL_GPL(of_usb_get_dr_mode);
+
static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str)
{
int ret;
diff -rup linux-4.17.2-orig/drivers/usb/core/hub.c linux-4.17.2/drivers/usb/core/hub.c
--- linux-4.17.2-orig/drivers/usb/core/hub.c 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/drivers/usb/core/hub.c 2018-04-21 17:58:20.456026986 +0300
@@ -3063,13 +3063,14 @@ static int usb_disable_remote_wakeup(str
}
/* Count of wakeup-enabled devices at or below udev */
-static unsigned wakeup_enabled_descendants(struct usb_device *udev)
+unsigned usb_wakeup_enabled_descendants(struct usb_device *udev)
{
struct usb_hub *hub = usb_hub_to_struct_hub(udev);
return udev->do_remote_wakeup +
(hub ? hub->wakeup_enabled_descendants : 0);
}
+EXPORT_SYMBOL_GPL(usb_wakeup_enabled_descendants);
/*
* usb_port_suspend - suspend a usb device's upstream port
@@ -3178,7 +3179,7 @@ int usb_port_suspend(struct usb_device *
* Therefore we will turn on the suspend feature if udev or any of its
* descendants is enabled for remote wakeup.
*/
- else if (PMSG_IS_AUTO(msg) || wakeup_enabled_descendants(udev) > 0)
+ else if (PMSG_IS_AUTO(msg) || usb_wakeup_enabled_descendants(udev) > 0)
status = set_port_feature(hub->hdev, port1,
USB_PORT_FEAT_SUSPEND);
else {
@@ -3581,7 +3582,7 @@ static int hub_suspend(struct usb_interf
}
if (udev)
hub->wakeup_enabled_descendants +=
- wakeup_enabled_descendants(udev);
+ usb_wakeup_enabled_descendants(udev);
}
if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) {
diff -rup linux-4.17.2-orig/include/linux/device.h linux-4.17.2/include/linux/device.h
--- linux-4.17.2-orig/include/linux/device.h 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/include/linux/device.h 2018-04-21 13:06:59.172044851 +0300
@@ -270,6 +270,7 @@ struct device_driver {
bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
enum probe_type probe_type;
+ bool async_probe;
const struct of_device_id *of_match_table;
const struct acpi_device_id *acpi_match_table;
diff -rup linux-4.17.2-orig/include/linux/of.h linux-4.17.2/include/linux/of.h
--- linux-4.17.2-orig/include/linux/of.h 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/include/linux/of.h 2018-04-21 18:03:18.492034069 +0300
@@ -521,6 +521,8 @@ const char *of_prop_next_string(struct p
bool of_console_check(struct device_node *dn, char *name, int index);
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
+
#else /* CONFIG_OF */
static inline void of_core_init(void)
diff -rup linux-4.17.2-orig/include/linux/usb/hcd.h linux-4.17.2/include/linux/usb/hcd.h
--- linux-4.17.2-orig/include/linux/usb/hcd.h 2018-04-20 09:21:08.000000000 +0300
+++ linux-4.17.2/include/linux/usb/hcd.h 2018-04-21 18:02:33.620033003 +0300
@@ -640,6 +640,7 @@ extern wait_queue_head_t usb_kill_urb_qu
#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))
#ifdef CONFIG_PM
+extern unsigned usb_wakeup_enabled_descendants(struct usb_device *udev);
extern void usb_root_hub_lost_power(struct usb_device *rhdev);
extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);

File diff suppressed because it is too large Load Diff

41
config
View File

@ -648,7 +648,8 @@ CONFIG_ATAGS=y
# CONFIG_DEPRECATED_PARAM_STRUCT is not set
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
# CONFIG_ARM_APPENDED_DTB is not set
CONFIG_ARM_APPENDED_DTB=y
# CONFIG_ARM_ATAG_DTB_COMPAT is not set
CONFIG_CMDLINE=""
CONFIG_KEXEC=y
CONFIG_ATAGS_PROC=y
@ -2848,13 +2849,11 @@ CONFIG_USB_UAS=y
# CONFIG_USB_MUSB_HDRC is not set
# CONFIG_USB_DWC3 is not set
CONFIG_USB_DWC2=y
# CONFIG_USB_DWC2_HOST is not set
CONFIG_USB_DWC2_HOST=y
#
# Gadget/Dual-role mode requires USB Gadget support to be enabled
#
# CONFIG_USB_DWC2_PERIPHERAL is not set
CONFIG_USB_DWC2_DUAL_ROLE=y
# CONFIG_USB_DWC2_PCI is not set
# CONFIG_USB_DWC2_DEBUG is not set
# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set
@ -2904,39 +2903,7 @@ CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GPIO_VBUS=y
# CONFIG_USB_ISP1301 is not set
# CONFIG_USB_ULPI is not set
CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG is not set
# CONFIG_USB_GADGET_DEBUG_FILES is not set
# CONFIG_USB_GADGET_DEBUG_FS is not set
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
#
# USB Peripheral Controller
#
# CONFIG_USB_FOTG210_UDC is not set
# CONFIG_USB_GR_UDC is not set
# CONFIG_USB_R8A66597 is not set
# CONFIG_USB_PXA27X is not set
CONFIG_USB_MV_UDC=y
CONFIG_USB_MV_U3D=y
CONFIG_USB_SNP_CORE=y
CONFIG_USB_SNP_UDC_PLAT=y
# CONFIG_USB_M66592 is not set
CONFIG_USB_BDC_UDC=y
#
# Platform Support
#
CONFIG_USB_BDC_PCI=y
# CONFIG_USB_AMD5536UDC is not set
# CONFIG_USB_NET2272 is not set
# CONFIG_USB_NET2280 is not set
# CONFIG_USB_GOKU is not set
# CONFIG_USB_EG20T is not set
# CONFIG_USB_GADGET_XILINX is not set
# CONFIG_USB_DUMMY_HCD is not set
# CONFIG_USB_CONFIGFS is not set
# CONFIG_USB_GADGET is not set
# CONFIG_TYPEC is not set
# CONFIG_USB_LED_TRIG is not set
# CONFIG_USB_ULPI_BUS is not set

3909
config-4.9 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
#Runs Make menuconfig with the proper enviroment vars for cross compiling arm
#Grabs the file named config in the same directory as this script, and updates it
KVER=4.17.2
KVER=4.17.5
[ ! -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
[ ! -d linux-$KVER ] && tar --lzip -xvf linux-libre-$KVER-gnu.tar.lz