mz20mon-tinker その4 (kernelビルド!)

USB-LTEモデムをFujisoftのやつに変えたら、dwc2のエラー出まくりが、ひどくなったので、kernelをビルドすることに。

調査した結果、そもそもbugっぽいので、バックポートパッチを。

# diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 71b7592354cb..4a709204b79d 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -315,6 +315,9 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg)
        usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
        usbcfg &= ~(GUSBCFG_HNPCAP | GUSBCFG_SRPCAP);
 
+       /* Set HS/FS Timeout Calibration */
+       usbcfg |= GUSBCFG_TOUTCAL(7);
+
        switch (hsotg->hw_params.op_mode) {
        case GHWCFG2_OP_MODE_HNP_SRP_CAPABLE:
                if (hsotg->core_params->otg_cap ==
@@ -2045,12 +2048,16 @@ static int dwc2_hcd_endpoint_reset(struct dwc2_hsotg *hsotg,
  */
 int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq)
 {
-       u32 usbcfg, otgctl;
+       u32 usbcfg, otgctl, trdtrim;
        int retval;
 
        dev_dbg(hsotg->dev, "%s(%p)\n", __func__, hsotg);
 
        usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
+       usbcfg &= ~GUSBCFG_USBTRDTIM_MASK;
+       trdtrim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
+       usbcfg |= (trdtrim << GUSBCFG_USBTRDTIM_SHIFT); + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
 
        /* Set ULPI External VBUS bit if needed */
        usbcfg &= ~GUSBCFG_ULPI_EXT_VBUS_DRV;

ビルドするよ!

    • gcc-patch
      diff --git a/drivers/media/i2c/soc_camera/rockchip/Makefile b/drivers/media/i2c/soc_camera/rockchip/Makefile
      index 7933bcd1..2486999a 100755
      --- a/drivers/media/i2c/soc_camera/rockchip/Makefile
      +++ b/drivers/media/i2c/soc_camera/rockchip/Makefile
      @@ -1,2 +1,3 @@
       obj-\$(CONFIG_VIDEO_OV8858) += ov_camera_module.o rk_camera_module.o ov8858_v4l2-i2c-subdev.o
       obj-\$(CONFIG_VIDEO_IMX219) += imx_camera_module.o rk_camera_module.o imx219_v4l2-i2c-subdev.o
      +ccflags-y += -Wno-misleading-indentation # GCC6
      diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile b/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile
      index 40715655..bd33c700 100644
      --- a/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile
      +++ b/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile
      @@ -16,6 +16,7 @@ EXTRA_CFLAGS += -Wno-unused
       #EXTRA_CFLAGS += -Wno-uninitialized
       #EXTRA_CFLAGS += -Wno-error=date-time  # Fix compile error on gcc 4.9 and later
      
      +EXTRA_CFLAGS += -Wno-misleading-indentation # GCC6
       EXTRA_CFLAGS += -I\$(src)/include
       EXTRA_CFLAGS += -I\$(src)/hal/phydm

      patch -p1 < hoge.diff

  • Makefile修正
    VERSION = 4
    PATCHLEVEL = 4
    SUBLEVEL = 132
    EXTRAVERSION = -mz20mon-tinker
    NAME = Blurry Fish Butt
    
    ...
    ...
    ...
  • config
    # make ARCH=arm miniarm-rk3288_defconfig
  • zImage
    # time make ARCH=arm -j6 zImage 2>&1 | tee 1.log
  • modules
    # time make ARCH=arm -j6 modules 2>&1 | tee 2.log
  • dtbs
    # time make ARCH=arm dtbs 2>&1 | tee 3.log
  • Install
    # make ARCH=arm modules_install
    # mv -v /boot/zImage{,.bak}
    # mv -v /boot/rk3288-miniarm.dtb{,.bak}
    # cp -v arch/arm/boot/{zImage,dts/rk3288-miniarm.dtb} /boot

こんな感じ〜

dwc2のエラーは激減したね。

つづく〜