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

Add kernel support for more ARM64 boards #4

Merged
merged 9 commits into from
Jan 8, 2024

Conversation

alpernebbi
Copy link
Collaborator

@alpernebbi alpernebbi commented Dec 10, 2023

I tried to enable whatever I could make sense of based on device-trees, see individual commits. Did not enable anything for SDM845 or SC7280, SoCs whose Chromebooks were never released to public as far as I can tell.

Tested on Cozmo (MT8183) and Hana (MT8173) which were already working, and on Kevin (RK3399). Kevin is failing to actually kexec anything though, needs investigation. I don't have anything with newer MediaTek or Qualcomm SoCs, so can't test for that, hope it works out.

After building the kernel, you can pack it into a ChromeOS kernel partition with:

    depthchargectl build \
        --board arm64 --compress lzma \
        --kernel arch/arm64/boot/Image.gz \
        --initramfs none \
        --fdtdir arch/arm64/boot/dts \
        --root none \
        --kernel-cmdline "console=tty0" \
        -o submarine-arm64.img

The kernel submodule we use is at v6.6.3, but the kernel configuration
is for v6.7.0-rc4. Run `make ARCH=arm64 olddefconfig` to roll it back.

Signed-off-by: Alper Nebi Yasak <[email protected]>
The kernel config for MT8183 can already boot on Hana boards. The lowest
of depthcharge size limits on ARM64 is a comfortable 32MiB, so we can
try to create a arch-generic kernel, and probably even an arch-generic
image. Rename the config and its references to "a64" as in the Makefile.

Signed-off-by: Alper Nebi Yasak <[email protected]>
Enable USB-attached SCSI in the ARM64 kernel, useful for some external
USB-to-SATA disks and the like.

Signed-off-by: Alper Nebi Yasak <[email protected]>
Add configs for RK3399 Chromebooks based on device-tree analysis. It
boots on Kevin with everything looking like it works, and even tries to
boot into Debian, but can't. It can't even kexec itself, so I expect
something is breaking down when it's trying to shutdown before launching
the next kernel. I occasionally had display problems around suspend, so
maybe rockchip-drm doesn't handle being deinitialized well.

Based on the device-trees, following are still missing:

     INPUT_MOUSE n -> y
     INPUT_TOUCHSCREEN n -> y
     ROCKCHIP_CDN_DP n -> y
     SENSORS_NTC_THERMISTOR n -> y
     STAGING n -> y
     USB_UHCI_HCD n -> y
    +ARM_BIG_LITTLE_CPUIDLE y
    +ARM_CPUIDLE y
    +ARM_GIC_V3_ITS_FSL_MC y
    +BT y
    +BT_HCIBTUSB y
    +DWMAC_ROCKCHIP y
    +ETHERNET y
    +MOUSE_ELAN_I2C y
    +MWIFIEX y
    +MWIFIEX_PCIE y
    +NET_VENDOR_STMICRO y
    +PCIE_ROCKCHIP_EP y
    +ROCKCHIP_DTPM y
    +SND y
    +SND_SIMPLE_CARD y
    +SND_SOC y
    +SND_SOC_DA7219 y
    +SND_SOC_DMIC y
    +SND_SOC_MAX98357A y
    +SND_SOC_RK3399_GRU_SOUND y
    +SND_SOC_ROCKCHIP_I2S y
    +SND_SOC_ROCKCHIP_SPDIF y
    +SND_SOC_RT5514 y
    +SND_SOC_RT5514_SPI y
    +SND_SOC_RT5514_SPI_BUILTIN y
    +STMMAC_ETH y
    +TOUCHSCREEN_ATMEL_MXT y
    +TOUCHSCREEN_ELAN y
    +USB_PHY y
    +VIDEO_HANTRO y
    +VIDEO_OV2685 y
    +VIDEO_OV5695 y
    +VIDEO_ROCKCHIP_ISP1 y
    +VIDEO_ROCKCHIP_RGA y
    +VIDEO_ROCKCHIP_VDEC y
    +WLAN y
    +WLAN_VENDOR_MARVELL y

ROCKCHIP_CDN_DP is about display over USB-C, needs firmware so disabled.
USB_PHY and ARM_GIC_V3_ITS_FSL_MC cannot be selected, have no prompt.

Signed-off-by: Alper Nebi Yasak <[email protected]>
Enable the pin controller for MT8186. Looks like most other necessary
configs for MT8186 are enabled, as far as I can tell from device tree
compatibles. The following are still missing but none of which look
essential for booting:

     INPUT_MOUSE n -> y
     REMOTEPROC n -> y
     SX9324 n -> y
     USB_UHCI_HCD n -> y
    +ARM_BIG_LITTLE_CPUIDLE y
    +ARM_CPUIDLE y
    +CROS_EC_RPMSG y
    +MOUSE_ELAN_I2C y
    +MTK_SCP y
    +SND y
    +SND_SOC y
    +SND_SOC_BT_SCO y
    +SND_SOC_DMIC y
    +SND_SOC_MT6358 y
    +SND_SOC_MT8186 y
    +SND_SOC_MT8186_MT6366_RT1019_RT5682S y
    +SND_SOC_RK3399_GRU_SOUND y
    +SND_SOC_RT1015P y
    +SND_SOC_RT5682S y
    +SND_SOC_SOF_MT8186 y
    +SND_SOC_SOF_MTK_TOPLEVEL y
    +USB_PHY y

CROS_EC_RPMSG and REMOTEPROC are about MTK_SCP, which needs firmware.

Signed-off-by: Alper Nebi Yasak <[email protected]>
Enable the MT1892 pin controller and clocks. The clocks might or might
not be optional, but better not risk it being broken, we are not limited
on size. Based on the device-tree, following are still missing, but none
of which look essential for booting:

     INPUT_MOUSE n -> y
     INPUT_TOUCHSCREEN n -> y
     REMOTEPROC n -> y
     USB_UHCI_HCD n -> y
    +ARM_BIG_LITTLE_CPUIDLE y
    +ARM_CPUIDLE y
    +BT_HCIUART_3WIRE y
    +CROS_EC_RPMSG y
    +MOUSE_ELAN_I2C y
    +MTK_SCP y
    +SND y
    +SND_SOC y
    +SND_SOC_DMIC y
    +SND_SOC_MT8192 y
    +SND_SOC_RK3399_GRU_SOUND y
    +SND_SOC_RT1015P y
    +SND_SOC_RT5682_I2C y
    +TOUCHSCREEN_ELAN y
    +USB_PHY y
    +VIDEO_MEDIATEK_VCODEC y

Signed-off-by: Alper Nebi Yasak <[email protected]>
Enable MT8195 pin controller. Like MT8186, most essenial stuff looks
like they're already enabled. Other than that, following are still
missing, but none of which look essential for booting:

     ARM_DSU_PMU n -> y
     CROS_KBD_LED_BACKLIGHT n -> y
     INPUT_MOUSE n -> y
     MTK_LVTS_THERMAL n -> y
     PHY_MTK_UFS n -> y
     REMOTEPROC n -> y
     USB_UHCI_HCD n -> y
    +ARM_BIG_LITTLE_CPUIDLE y
    +ARM_CPUIDLE y
    +CROS_EC_RPMSG y
    +DWMAC_MEDIATEK y
    +ETHERNET y
    +MOUSE_ELAN_I2C y
    +MTK_SCP y
    +NET_VENDOR_STMICRO y
    +SND y
    +SND_SOC y
    +SND_SOC_DMIC y
    +SND_SOC_MT8195 y
    +SND_SOC_MT8195_MT6359 y
    +SND_SOC_RK3399_GRU_SOUND y
    +SND_SOC_RT1015P y
    +SND_SOC_RT5682S y
    +SND_SOC_RT5682_I2C y
    +SND_SOC_SOF_MT8195 y
    +SND_SOC_SOF_MTK_TOPLEVEL y
    +SPI_SLAVE_MT27XX y
    +STMMAC_ETH y
    +USB_PHY y
    +VIDEO_MEDIATEK_JPEG y
    +VIDEO_MEDIATEK_VCODEC y

ARM_DSU_PMU is about performance monitoring. PHY_MTK_UFS and
SPI_SLAVE_MT27XX actually look unused, have status = "disabled".

Signed-off-by: Alper Nebi Yasak <[email protected]>
This tries to enable configs for SC7180 Chromebooks based on device-tree
files, but I have no idea how much of it is useful, or if the end result
works at all. There are more things from device-trees, but none I could
justify when considering just booting:

     CROS_EC_MKBP_PROXIMITY n -> y
     INPUT_MOUSE n -> y
     INPUT_TOUCHSCREEN n -> y
     LEDS_CLASS_FLASH n -> y
     QCOM_SPMI_ADC_TM5 n -> y
     QCOM_SPMI_TEMP_ALARM n -> y
     QCOM_TSENS n -> y
     REMOTEPROC n -> y
     SX9310 n -> y
     SX9324 n -> y
    +ARM_BIG_LITTLE_CPUIDLE y
    +ARM_CPUIDLE y
    +ARM_GIC_V3_ITS_FSL_MC y
    +ATH10K y
    +ATH10K_SNOC y
    +BT_HCIUART_QCA y
    +LEDS_QCOM_FLASH y
    +MOUSE_ELAN_I2C y
    +QCOM_IPA y
    +QCOM_Q6V5_MSS y
    +QCOM_Q6V5_PAS y
    +SND y
    +SND_SOC y
    +SND_SOC_ADAU7002 y
    +SND_SOC_LPASS_SC7180 y
    +SND_SOC_MAX98357A y
    +SND_SOC_RT5682S y
    +SND_SOC_RT5682_I2C y
    +SND_SOC_SC7180 y
    +TOUCHSCREEN_ELAN y
    +USB_PHY y
    +VIDEO_QCOM_VENUS y
    +WLAN y
    +WLAN_VENDOR_ATH y

QCOM_SPMI_ADC_TM5, QCOM_SPMI_TEMP_ALARM, QCOM_TSENS are for thermals.
SX9310, SC9324 are proximity sensors. QCOM_IPA, QCOM_Q6V5_* are some
kind of a modem.

Signed-off-by: Alper Nebi Yasak <[email protected]>
@ellyq
Copy link
Collaborator

ellyq commented Dec 10, 2023

SC7180 = Qualcomm Snapdragon 7c AFAIK

Check Lenovo Chromebook Duet 5 (STRONGBAD?). Doesn't exists in Coreboot tree as far as I can tell, but Skawt from Chrultrabook community reported that he owns one :)

config BOARD_GOOGLE_HOMESTAR
        select BOARD_GOOGLE_TROGDOR_COMMON

It seems like strongbad is a board, homestar is a baseboard and trogdor is a reference board. What a mess...

@alpernebbi
Copy link
Collaborator Author

alpernebbi commented Dec 10, 2023

Can't buy one myself -- no local listings, and I would have to personally pay too much money for it. Someone to test with would be nice, but I'm running out of time I can spare for now.

Oh, that was a reply to my SoCs whose Chromebooks were never released to public as far as I can tell. comment... SC7280 is Herobrine etc.

@nettybun
Copy link

nettybun commented Dec 13, 2023

Is there any way I can help test? I have a Duet 3 with a Snapdragon 7c Gen 2. The diagnostics app in ChromeOS says SC7180P. In chrome://version it says the Firmware is "Google_Wormdingler" but the Platform says "stable-channel strongbad". As @elly pointed out it's probably related to trogdor...I saw a page on PostmarketOS wiki about it.

I was gathering notes on how to flash and stumbled on this repo. Haven't found much support for arm64, but I realize Submarine might not be ready yet!

The dmesg says Google Wormdingler rev1+ BOE panel board. Theres a few lines in very early boot about CPU features and lists a few numbers for ARM errata... not sure what info is useful. I'll try reading about next steps :)

@WeirdTreeThing
Copy link
Collaborator

WeirdTreeThing commented Dec 13, 2023

Download the build artifact then unzip it. Flash submarine-a64.bin to a usb drive. Then on the chromebook, run crossystem dev_boot_usb=1 and crossystem dev_boot_signed_only=0. Plug in your usb drive before you boot the chromebook and press ctrl + u on the dev mode screen.

EDIT: Turns out the CI builds are currently broken. We have a test build here. Though you will need to manually create the partitions correctly. The easiest way to do that is to create a 32MB partition with cfdisk, then use cgpt to set the correct flags like cgpt add -i <partition number> -t kernel -P 15 -T 1 -S 1 /dev/<drive>. You can then dd submarine-arm64.img to the partition you just created and hopefully it boots.

@ellyq
Copy link
Collaborator

ellyq commented Dec 13, 2023

Also, important: Just because you have a bootloader doesn't mean you can boot any distribution.

Distributions need to enable necessary kernel modules, you might need devicetree patches, probably also missing drivers/missing functionality.

Qualcomm should have better support than MediaTek, but it's hard to tell without having a device in hand and they're unfortunately absurdly expensive in Europe.

If you'd like to help out, please open an issue and port kernel configuration from ChromeOS.

mkdir /tmp/usb
mount /dev/sdX /tmp/usb
modprobe configs; gunzip /proc/config.gz /tmp/usb/cros-wormdingler.log
umount /tmp/usb

I'm a Fedora contributor, while @alpernebbi is a Debian contributor, so we can work with upstream distros on it.

Thanks to submarine you likely won't need SuzyQ, but it would be great to have one just in case :)

@nettybun
Copy link

I was hoping to pull the kernel config (or the kernel itself) right off the ChromeOS rootfs... still poking around. The PostmarketOS wiki page was giving me some hope about components working OOTB https://wiki.postmarketos.org/wiki/Google_Trogdor_Chromebook_(google-trogdor) 🤞🤞

@ellyq
Copy link
Collaborator

ellyq commented Dec 13, 2023

Added information on how to extract kernel configuration from ChromeOS (should we document it for people willing to contribute @WeirdTreeThing @alpernebbi @lleyton?)

As for issues mentioned in postmarketOS wiki, broken jack detection is definitely an UCM issue that can be easily solved (common mistake for developers who haven't worked with ChromeOS hardware before), and modem power management is probably a devicetree issue :)

It would be useful if you could dump devicetree from the device as well, but please make sure to redact serial number of the device and IMEI if the device has a modem (by the way, Chromebook with a modem? that's so cool!)

@WeirdTreeThing
Copy link
Collaborator

Added information on how to extract kernel configuration from ChromeOS

Where?

@nettybun
Copy link

Added information on how to extract kernel configuration from ChromeOS

Where?

She edited her comment above in this thread. (I was also looking for it everywhere at first)

Running into a minor USB issue but I do have the kernel config and the device tree exported :) I'll make a repo for it. Thanks everyone!

@WeirdTreeThing
Copy link
Collaborator

In response to elly's question, we should document this.

@lleyton lleyton merged commit f4dd060 into FyraLabs:main Jan 8, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

5 participants