Add ayn odin2 config (#6305)

This commit is contained in:
FantasyGmm 2024-03-03 07:59:56 +08:00 committed by GitHub
parent e3575ecd1d
commit 52889b1079
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1240 additions and 2 deletions

View File

@ -0,0 +1,84 @@
# Generate kernel and rootfs image for Qcom ABL booting
declare -g BOARD_NAME="Ayn Odin2"
declare -g BOARD_MAINTAINER="FantasyGmm"
declare -g BOARDFAMILY="qcom-abl"
declare -g KERNEL_TARGET="sm8550"
declare -g KERNELPATCHDIR="arm64-sm8550"
declare -g EXTRAWIFI="no"
declare -g BOOTCONFIG="none"
declare -g BOOTIMG_CMDLINE_EXTRA="clk_ignore_unused pd_ignore_unused panic=30 audit=0 loglevel=8 allow_mismatched_32bit_el0 rw drm.debug=0x100 mem_sleep_default=s2idle"
declare -g IMAGE_PARTITION_TABLE="gpt"
declare -g -a ABL_DTB_LIST=("qcs8550-ayn-odin2-hypdtbo")
# Use the full firmware, complete linux-firmware plus Armbian's
declare -g BOARD_FIRMWARE_INSTALL="-full"
function post_family_config_branch_sm8550__edk2_kernel() {
declare -g KERNELSOURCE='https://github.com/edk2-porting/linux-next'
declare -g KERNEL_MAJOR_MINOR="6.7" # Major and minor versions of this kernel.
declare -g KERNELBRANCH="branch:integration/ayn-odin2"
declare -g LINUXCONFIG="linux-${ARCH}-${BRANCH}" # for this board: linux-arm64-sm8550
display_alert "Setting up kernel ${KERNEL_MAJOR_MINOR} for" "${BOARD}" "info"
}
function ayn-odin2_is_userspace_supported() {
[[ "${RELEASE}" == "trixie" ]] && return 0
[[ "${RELEASE}" == "noble" ]] && return 0
return 1
}
function post_family_tweaks__ayn-odin2_enable_services() {
if ! ayn-odin2_is_userspace_supported; then
if [[ "${RELEASE}" != "" ]]; then
display_alert "Missing userspace for ${BOARD}" "${RELEASE} does not have the userspace necessary to support the ${BOARD}" "warn"
fi
return 0
fi
# We need unudhcpd from armbian repo, so enable it
mv "${SDCARD}"/etc/apt/sources.list.d/armbian.list.disabled "${SDCARD}"/etc/apt/sources.list.d/armbian.list
# Add zink env
echo '__GLX_VENDOR_LIBRARY_NAME=mesa' | tee -a "${SDCARD}"/etc/environment
echo 'MESA_LOADER_DRIVER_OVERRIDE=zink' | tee -a "${SDCARD}"/etc/environment
echo 'GALLIUM_DRIVER=zink' | tee -a "${SDCARD}"/etc/environment
# Add Gamepad udev rule
echo "SUBSYSTEM=="input", ATTRS{name}=="Ayn Odin2 Gamepad", MODE="0666", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="1"" > /etc/udev/rules.d/99-ignore-gamepad.rules
do_with_retries 3 chroot_sdcard_apt_get_update
display_alert "$BOARD" "Installing board tweaks" "info"
do_with_retries 3 chroot_sdcard_apt_get_install alsa-ucm-conf unudhcpd mkbootimg git
# Disable armbian repo back
mv "${SDCARD}"/etc/apt/sources.list.d/armbian.list "${SDCARD}"/etc/apt/sources.list.d/armbian.list.disabled
do_with_retries 3 chroot_sdcard_apt_get_update
do_with_retries 3 chroot_sdcard_apt_get_install mesa-vulkan-drivers qbootctl qrtr-tools protection-domain-mapper tqftpserv
return 0
}
function post_family_tweaks_bsp__ayn-odin2_bsp_firmware_in_initrd() {
display_alert "Adding to bsp-cli" "${BOARD}: firmware in initrd" "info"
declare file_added_to_bsp_destination # Will be filled in by add_file_from_stdin_to_bsp_destination
# Using odin2's firmware for now
add_file_from_stdin_to_bsp_destination "/etc/initramfs-tools/hooks/ayn-odin2-firmware" <<- 'FIRMWARE_HOOK'
#!/bin/bash
[[ "$1" == "prereqs" ]] && exit 0
. /usr/share/initramfs-tools/hook-functions
for f in /lib/firmware/qcom/sm8550/ayn/odin2/* ; do
add_firmware "${f#/lib/firmware/}"
done
add_firmware "qcom/a740_sqe.fw" # Extra one for dpu
add_firmware "qcom/gmu_gen70200.bin" # Extra one for gpu
# Extra one for wifi
for f in /lib/firmware/ath12k/WCN7850/hw2.0/* ; do
add_firmware "${f#/lib/firmware/}"
done
# Extra one for bt
for f in /lib/firmware/qca/* ; do
add_firmware "${f#/lib/firmware/}"
done
FIRMWARE_HOOK
run_host_command_logged chmod -v +x "${file_added_to_bsp_destination}"
}

View File

@ -7,6 +7,7 @@ declare -g KERNELPATCHDIR="arm64-sm8250"
declare -g EXTRAWIFI="no"
declare -g MODULES="spi-geni-qcom"
declare -g BOOTCONFIG="none"
declare -g BOOTIMG_CMDLINE_EXTRA="clk_ignore_unused pd_ignore_unused"
declare -g IMAGE_PARTITION_TABLE="gpt"
declare -g -a ABL_DTB_LIST=("sm8250-xiaomi-umi")

File diff suppressed because it is too large Load Diff

View File

@ -25,20 +25,21 @@ function post_build_image__900_convert_to_abl_img() {
rm -rf ${old_rootfs_image_mount_dir} ${DESTIMG}/rootfs.img
display_alert "Replace root partition uuid from ${old_rootfs_image_uuid} to ${new_rootfs_image_uuid} in /etc/fstab" "${EXTENSION}" "info"
sed -i "s|${old_rootfs_image_uuid}|${new_rootfs_image_uuid}|g" ${new_rootfs_image_mount_dir}/etc/fstab
declare -g bootimg_cmdline="${BOOTIMG_CMDLINE_EXTRA} root=UUID=${new_rootfs_image_uuid} slot_suffix=${abl_boot_partition_label#boot}"
if [ ${#ABL_DTB_LIST[@]} -ne 0 ]; then
display_alert "Going to create abl kernel boot image" "${EXTENSION}" "info"
source ${new_rootfs_image_mount_dir}/boot/armbianEnv.txt
gzip -c ${new_rootfs_image_mount_dir}/boot/vmlinuz-*-* > ${DESTIMG}/Image.gz
for dtb_name in "${ABL_DTB_LIST[@]}"; do
display_alert "Creatng abl kernel boot image with dtb ${dtb_name} and cmdline root=UUID=${new_rootfs_image_uuid} slot_suffix=${abl_boot_partition_label#boot}" "${EXTENSION}" "info"
display_alert "Creatng abl kernel boot image with dtb ${dtb_name} and cmdline ${bootimg_cmdline} " "${EXTENSION}" "info"
cat ${DESTIMG}/Image.gz ${new_rootfs_image_mount_dir}/usr/lib/linux-image-*/qcom/${dtb_name}.dtb > ${DESTIMG}/Image.gz-${dtb_name}
/usr/bin/mkbootimg \
--kernel ${DESTIMG}/Image.gz-${dtb_name} \
--ramdisk ${new_rootfs_image_mount_dir}/boot/initrd.img-*-* \
--base 0x0 \
--second_offset 0x00f00000 \
--cmdline "clk_ignore_unused pd_ignore_unused root=UUID=${new_rootfs_image_uuid} slot_suffix=${abl_boot_partition_label#boot}" \
--cmdline "${bootimg_cmdline}" \
--kernel_offset 0x8000 \
--ramdisk_offset 0x1000000 \
--tags_offset 0x100 \

View File

@ -0,0 +1,34 @@
From 2fd526ca3197f01c5075e3c81948c4decd016f06 Mon Sep 17 00:00:00 2001
From: amazingfate <liujianfeng1994@gmail.com>
Date: Wed, 24 Jan 2024 18:03:52 +0800
Subject: [PATCH] tools/Makefile: delete missing cgroup_clean
---
tools/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/Makefile b/tools/Makefile
index 37e9f68048..9903abe51d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -169,7 +169,7 @@ acpi_clean:
cpupower_clean:
$(call descend,power/cpupower,clean)
-cgroup_clean counter_clean hv_clean firewire_clean bootconfig_clean spi_clean usb_clean virtio_clean mm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean tracing_clean:
+counter_clean hv_clean firewire_clean bootconfig_clean spi_clean usb_clean virtio_clean mm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean tracing_clean:
$(call descend,$(@:_clean=),clean)
libapi_clean:
@@ -209,7 +209,7 @@ freefall_clean:
build_clean:
$(call descend,build,clean)
-clean: acpi_clean cgroup_clean counter_clean cpupower_clean hv_clean firewire_clean \
+clean: acpi_clean counter_clean cpupower_clean hv_clean firewire_clean \
perf_clean selftests_clean turbostat_clean bootconfig_clean spi_clean usb_clean virtio_clean \
mm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
freefall_clean build_clean libbpf_clean libsubcmd_clean \
--
2.34.1