From f855b0c26f5356e3903543866b3c646d400b42f1 Mon Sep 17 00:00:00 2001 From: Brandon McNama Date: Fri, 30 Dec 2022 22:53:05 -0500 Subject: [PATCH] feat: add support for ODroid HC4 Adds the kernel module required to ensure proper functioning of the ODroid HC4's GPU so that HDMI output works as expected. Adds the kernel module required to ensure proper functioning of the SATA ODroid HC4's SATA ports. Adds a u-boot variant for the ODroid HC4. This is not used directly, but rather flashed into the SPI of the unit so that it can boot Talos. Documentation on this process can be found in the Talos repo. Signed-off-by: Brandon McNama Signed-off-by: Noel Georgi --- Pkgfile | 5 ++++ kernel/build/config-arm64 | 7 +++-- .../odroid_hc4/patches/fixup-usb-boot.patch | 14 +++++++++ u-boot/pkg.yaml | 30 +++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 u-boot/odroid_hc4/patches/fixup-usb-boot.patch diff --git a/Pkgfile b/Pkgfile index 2ed17b66a..ff26b3bea 100644 --- a/Pkgfile +++ b/Pkgfile @@ -167,6 +167,11 @@ vars: arm_trusted_firmware_sha256: 60fad60eeb6840097f8e64f16093c06ddb2ef269c7a22affed02beaa6cefe466 arm_trusted_firmware_sha512: 958cf8f9e258638e59d0fbd8b053fce7d8a9ea2fc922686c9d20ea16f79f55219ac18a12ab240c528ee98e49c2e0eef4c963fdb255cc14b92437a5b3cffc8640 + # renovate: datasource=git-refs versioning=git depName=LibreELEC/amlogic-boot-fip.git + amlogic_boot_fip_ref: 36f258b88ca019be511d315e58dfbb3a964d5b78 + amlogic_boot_fip_sha256: 655e5b2a1451e7e404783dd481e6655e198adef4f1471f0ecc1fb54a3ec44896 + amlogic_boot_fip_sha512: 947dcefdc0487e918a16712ceeb353a0e6aaded1f7bef4d39ef19d0d058f9dd3a0ed6afb1f0f7061e3bedb7401332f395b108be003374227416c62e2680d007b + # renovate: datasource=github-tags extractVersion=^v(?.*)$ depName=u-boot/u-boot uboot_version: 2023.01 uboot_sha256: 69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f diff --git a/kernel/build/config-arm64 b/kernel/build/config-arm64 index ae2bea5ef..7b740b219 100644 --- a/kernel/build/config-arm64 +++ b/kernel/build/config-arm64 @@ -1901,7 +1901,7 @@ CONFIG_PCIE_ARMADA_8K=y # CONFIG_PCIE_ROCKCHIP_DW_HOST is not set # CONFIG_PCIE_KIRIN is not set # CONFIG_PCIE_HISI_STB is not set -# CONFIG_PCI_MESON is not set +CONFIG_PCI_MESON=m CONFIG_PCIE_TEGRA194=y CONFIG_PCIE_TEGRA194_HOST=y # CONFIG_PCIE_TEGRA194_EP is not set @@ -1970,7 +1970,9 @@ CONFIG_FW_CACHE=y # CONFIG_FW_UPLOAD is not set # end of Firmware loader +CONFIG_WANT_DEV_COREDUMP=y CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y # CONFIG_DEBUG_DRIVER is not set CONFIG_DEBUG_DEVRES=y # CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set @@ -4686,6 +4688,7 @@ CONFIG_DRM_DISPLAY_HDMI_HELPER=y # CONFIG_DRM_DP_CEC is not set CONFIG_DRM_GEM_DMA_HELPER=y CONFIG_DRM_GEM_SHMEM_HELPER=y +CONFIG_DRM_SCHED=y # # I2C encoder or helper chips @@ -4906,7 +4909,7 @@ CONFIG_DRM_MESON_DW_HDMI=y # CONFIG_DRM_PL111 is not set # CONFIG_DRM_XEN_FRONTEND is not set # CONFIG_DRM_LIMA is not set -# CONFIG_DRM_PANFROST is not set +CONFIG_DRM_PANFROST=y # CONFIG_DRM_TIDSS is not set # CONFIG_DRM_GUD is not set # CONFIG_DRM_SSD130X is not set diff --git a/u-boot/odroid_hc4/patches/fixup-usb-boot.patch b/u-boot/odroid_hc4/patches/fixup-usb-boot.patch new file mode 100644 index 000000000..c84e3590c --- /dev/null +++ b/u-boot/odroid_hc4/patches/fixup-usb-boot.patch @@ -0,0 +1,14 @@ +# We need to enumerate PCI devices in order to be able to detect USB devices and boot from them +# TODO Remove this patch once fixed upstream +diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h +index c3a2414b91..95b7eb5675 100644 +--- a/include/config_distro_bootcmd.h ++++ b/include/config_distro_bootcmd.h +@@ -289,6 +289,7 @@ + #define BOOTENV_SHARED_USB \ + "boot_net_usb_start=usb start\0" \ + "usb_boot=" \ ++ BOOTENV_RUN_PCI_ENUM \ + "usb start; " \ + BOOTENV_SHARED_BLKDEV_BODY(usb) + #define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV diff --git a/u-boot/pkg.yaml b/u-boot/pkg.yaml index ee41c411d..f409885e7 100644 --- a/u-boot/pkg.yaml +++ b/u-boot/pkg.yaml @@ -10,6 +10,8 @@ # - https://u-boot.readthedocs.io/en/latest/board/rockchip/rockchip.html # Broadcom/RaspberryPi # - https://github.com/u-boot/u-boot/blob/master/doc/board/broadcom/raspberrypi.rst +# ODroid HC4 +# - https://u-boot.readthedocs.io/en/latest/board/amlogic/odroid-c4.html name: u-boot variant: scratch shell: /toolchain/bin/bash @@ -23,6 +25,10 @@ steps: destination: arm-trusted-firmware.tar.gz sha256: "{{ .arm_trusted_firmware_sha256 }}" sha512: "{{ .arm_trusted_firmware_sha512 }}" + - url: https://github.com/LibreELEC/amlogic-boot-fip/archive/{{ .amlogic_boot_fip_ref }}.tar.gz + destination: amlogic-boot-fip.tar.gz + sha256: "{{ .amlogic_boot_fip_sha256 }}" + sha512: "{{ .amlogic_boot_fip_sha512 }}" - url: https://ftp.denx.de/pub/u-boot/u-boot-{{ .uboot_version }}.tar.bz2 destination: u-boot.tar.bz2 sha256: "{{ .uboot_sha256 }}" @@ -40,6 +46,8 @@ steps: ROCK_PI_4C_RK3399_U_BOOT: rock-pi-4c-rk3399_u-boot JETSON_NANO_U_BOOT: jetson-nano_u-boot NANOPI_R4S_U_BOOT: nanopi-r4s_u-boot + ODROID_HC4_AMLOGIC_BOOT_FIP: odroid-hc4_amlogic-boot-fip + ODROID_HC4_U_BOOT: odroid-hc4_u-boot prepare: - | mkdir -p /usr/bin \ @@ -135,6 +143,15 @@ steps: cd ${NANOPI_R4S_U_BOOT} make nanopi-r4s-rk3399_defconfig sed -i "s/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/" .config + # odroid-hc4 + - | + mkdir ${ODROID_HC4_U_BOOT} + tar -xjf u-boot.tar.bz2 --strip-components=1 -C ${ODROID_HC4_U_BOOT} + cd ${ODROID_HC4_U_BOOT} + echo Applying fixup patch for USB boot + patch -p1 < /pkg/odroid_hc4/patches/fixup-usb-boot.patch + make odroid-hc4_defconfig + sed -i "s/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/" .config build: # sun50i_a64 - | @@ -222,6 +239,11 @@ steps: export BL31=$(pwd)/${RK3399_ARM_TRUSTED_FIRMWARE}/build/rk3399/release/bl31/bl31.elf cd ${NANOPI_R4S_U_BOOT} make -j $(nproc) HOSTLDLIBS_mkimage="-lssl -lcrypto" + # odroid-hc4 + - | + mkdir ${ODROID_HC4_AMLOGIC_BOOT_FIP} + cd ${ODROID_HC4_U_BOOT} + make -j $(nproc) HOSTLDLIBS_mkimage="-lssl -lcrypto" install: # libretech_all_h3_cc_h5 - | @@ -265,6 +287,14 @@ steps: - | mkdir -p /rootfs/nanopi_r4s cp -v ${NANOPI_R4S_U_BOOT}/u-boot-rockchip.bin /rootfs/nanopi_r4s + # odroid-hc4 + - | + mkdir -p /rootfs/odroid_hc4 + export U_BOOT_BIN=$(pwd)/${ODROID_HC4_U_BOOT}/u-boot.bin + tar -xf amlogic-boot-fip.tar.gz --strip-components=1 -C ${ODROID_HC4_AMLOGIC_BOOT_FIP} + cd ${ODROID_HC4_AMLOGIC_BOOT_FIP} + ./build-fip.sh odroid-hc4 ${U_BOOT_BIN} /rootfs/odroid_hc4 + # {{ else }} - install: - |