Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build the kernel #2

Closed
scpcom opened this issue Jul 11, 2023 · 3 comments
Closed

How to build the kernel #2

scpcom opened this issue Jul 11, 2023 · 3 comments

Comments

@scpcom
Copy link

scpcom commented Jul 11, 2023

Hi, I am currently running Debian 11 with Kernel 3.2.102 on Comcerto 2000/LS1024A inside my Zyxel NAS540.
The bootloader (barebox 2011.06.0) is the untouched vendor version.

Can you provide some basic information to start build and run your kernel?

  • A defconfig
  • Recommended compiler
  • The Image format (currently I tried and uImage containing zImage with dtb appended)
  • Does the UIMAGE_LOADADDR need to be changed?
  • Does it work without modifying barebox?

I am able to take care on the difference between QNAP TS-x31 and Zyxel NAS5xx (LEDs, buttons, built-in ASMedia USB Hub and Card Reader) and can provide a DTS if I get beyond the build problem.

Thank you.

@scpcom scpcom changed the title Howto build the kernel How to build the kernel Jul 11, 2023
@scpcom
Copy link
Author

scpcom commented Aug 22, 2023

The kernel is running now. I created the DTS and extra drivers for the Zyxel NAS5xx series and published it here:
https://github.com/scpcom/linux/commits/ls1024a-6.1.y

Working:

  • Booting with untouched barebox loader
  • UART/serial console
  • Booting Debian 11 from internal USB card reader (Logilink CR0012)
  • Reading loader env from SPI NOR Flash (mx25l8005)
  • Control LEDs via trigger or /sys/class/leds/ and legacy userspace tools
  • Control Zyxel MCU WDT via /proc/mcu_wdt to avoid reset
  • Get and set fan speed (init via regmap, get via I2C, set via mmio)
  • Get temparature (via I2C)
  • Power off (via GPIO)
  • Buttons (via new platform driver)
  • Buzzer (via new platform driver, controlling pwm via regmap)
  • All SATA hard disks working (2x SoC SATA, 2x PCIe SATA ASMedia ASM1062)
  • Network (PFE)

Todo:

  • Buttons with gpio-keys driver (the gpio-keys driver says "Unable to get irq number for GPIO")
  • Buzzer with pinctrl/pwm driver
  • Fan with pinctrl/pwm driver
  • NAND (AMD NAND 256MiB 3,3V 8-bit, page size: 2048, OOB size: 64) @ comcerto_nand 0xc8300000

Since this is currently the only option, I ported the PFE driver (pfe_13_00_2) to Kernel 6.1. It is completly device tree based now.

There is only one big issue l left, before the new kernel is ready for 24/7 usage:
When running a RAID re-sync (MD RAID1) or a client is frequently accessing the data via SMB share, I get reproducible frozen errors likes this:

[10637.380000] ata2.00: exception Emask 0x0 SAct 0x8000 SErr 0x0 action 0x6 frozen
[10637.380000] ata2.00: failed command: WRITE FPDMA QUEUED
[10637.390000] ata2.00: cmd 61/80:78:80:6a:58/08:00:ef:00:00/40 tag 15 ncq dma 1114112 ou
[10637.390000] res 40/00:01:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
[10637.400000] ata2.00: status: { DRDY }
[10637.410000] ata2: hard resetting link
[10637.410000] ata1.00: exception Emask 0x0 SAct 0x400000 SErr 0x0 action 0x6 frozen
[10637.420000] ata1.00: failed command: READ FPDMA QUEUED
[10637.420000] ata1.00: cmd 60/00:b0:00:73:58/07:00:ef:00:00/40 tag 22 ncq dma 917504 in
[10637.420000] res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
[10637.440000] ata1.00: status: { DRDY }
[10637.440000] ata1: hard resetting link
[10637.970000] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[10637.980000] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)

The RAID sync can run for 1 or 2 hours without problem, but when the error happens both disks connected to the SoC SATA are not accessible until reboot.
The other two disks (ata3/ata4 connected to PCIe ASMedia SATA) do not seem to be affected.
I have no problem testing this for a longer time because the physical disks, the RAID and the data stay OK.

@scpcom
Copy link
Author

scpcom commented Sep 27, 2023

I found a solution for the issue.

The related WA can be found here in the old vendor kernel:
https://github.com/scpcom/linux/blob/nas5xx-3.2.y/arch/arm/mach-comcerto/pcie-c2000.c#L597

It was adapted by Google Fiber here:
https://github.com/scpcom/linux/blob/gfiber-4.1.y-mindspeed/drivers/pci/host/pcie-designware.c#L187
scpcom/linux@4589f32

So I did implement it too:
https://github.com/scpcom/linux/blob/ls1024a-6.1.y/drivers/pci/controller/dwc/pcie-designware-host.c#L179
scpcom/linux@bd52870

I am currently running the new kernel two days without any issue. The resync of a 3TB RAID1 worked without any problem.

@scpcom
Copy link
Author

scpcom commented Oct 7, 2023

I ported the mtd nand driver from Kernel 4.1 to 6.1 now, read and write works without error on my hardware.
Tested by flashing the kernel itself, booting it and comparing the checksums of the content via nanddump files.
https://github.com/scpcom/linux/commits/ls1024a-6.1.y/drivers/mtd

All components are covered by a driver now and can be used like on the old kernel.
Thank you for your work, without it I could not get so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant