Files
build/config/boards/xiaomi-elish.conf
Blieque Mariguan 8e75c8ebd1 feat: Use deb822 APT sources
- Replace `armbian.list` with `armbian.sources`. This holds the same
  information in a newer format, deb822.
- Replace HTTP with HTTPS for Armbian repositories.
2025-02-24 09:23:11 +01:00

117 lines
5.5 KiB
Plaintext

# Generate kernel and rootfs image for Qcom ABL booting
declare -g BOARD_NAME="Xiaomi Elish"
declare -g BOARD_MAINTAINER="amazingfate"
declare -g BOARDFAMILY="sm8250"
declare -g KERNEL_TARGET="current,edge"
declare -g KERNEL_TEST_TARGET="edge"
declare -g EXTRAWIFI="no"
declare -g MODULES="spi-geni-qcom nt36523_ts"
declare -g BOOTCONFIG="none"
declare -g IMAGE_PARTITION_TABLE="gpt"
declare -g -a ABL_DTB_LIST=("sm8250-xiaomi-elish-boe" "sm8250-xiaomi-elish-csot")
# Use the full firmware, complete linux-firmware plus Armbian's (for qcom/a650_sqe.fw)
declare -g BOARD_FIRMWARE_INSTALL="-full"
function xiaomi-elish_is_userspace_supported() {
[[ "${RELEASE}" == "jammy" ]] && return 0
[[ "${RELEASE}" == "trixie" ]] && return 0
[[ "${RELEASE}" == "noble" ]] && return 0
return 1
}
function post_family_tweaks_bsp__xiaomi-elish_firmware() {
display_alert "$BOARD" "Install firmwares for xiaomi elish" "info"
# alsa-ucm-conf profile for Xiaomi Elish
mkdir -p $destination/usr/share/alsa/ucm2/conf.d/sm8250
install -Dm644 $SRC/packages/bsp/xiaomi-elish/elish.conf $destination/usr/share/alsa/ucm2/Xiaomi/elish/elish.conf
install -Dm644 $SRC/packages/bsp/xiaomi-elish/elish_HiFi.conf $destination/usr/share/alsa/ucm2/Xiaomi/elish/HiFi.conf
# conifg file used by service hexagonrpcd-sdsp
install -Dm644 $SRC/packages/bsp/xiaomi-elish/hexagonrpcd-sdsp $destination/etc/conf.d/hexagonrpcd-sdsp
ln -sfv ../../Xiaomi/elish/elish.conf \
"$destination/usr/share/alsa/ucm2/conf.d/sm8250/Xiaomi Mi Pad 5 Pro.conf"
# USB Gadget Network service
mkdir -p $destination/usr/local/bin/
mkdir -p $destination/usr/lib/systemd/system/
mkdir -p $destination/etc/initramfs-tools/scripts/init-bottom/
install -Dm655 $SRC/packages/bsp/usb-gadget-network/setup-usbgadget-network.sh $destination/usr/local/bin/
install -Dm655 $SRC/packages/bsp/usb-gadget-network/remove-usbgadget-network.sh $destination/usr/local/bin/
install -Dm644 $SRC/packages/bsp/usb-gadget-network/usbgadget-rndis.service $destination/usr/lib/systemd/system/
install -Dm655 $SRC/packages/bsp/usb-gadget-network/usb-gadget-initramfs-hook $destination/etc/initramfs-tools/hooks/usb-gadget
install -Dm655 $SRC/packages/bsp/usb-gadget-network/usb-gadget-initramfs-premount $destination/etc/initramfs-tools/scripts/init-premount/usb-gadget
install -Dm655 $SRC/packages/bsp/usb-gadget-network/dropbear $destination/etc/initramfs-tools/scripts/init-premount/
install -Dm655 $SRC/packages/bsp/usb-gadget-network/kill-dropbear $destination/etc/initramfs-tools/scripts/init-bottom/
# Bluetooth MAC addr setup service
install -Dm655 $SRC/packages/bsp/generate-bt-mac-addr/bt-fixed-mac.sh $destination/usr/local/bin/
install -Dm644 $SRC/packages/bsp/generate-bt-mac-addr/bt-fixed-mac.service $destination/usr/lib/systemd/system/
# Kernel postinst script to update abl boot partition
install -Dm655 $SRC/packages/bsp/xiaomi-elish/zz-update-abl-kernel $destination/etc/kernel/postinst.d/
return 0
}
function post_family_tweaks__xiaomi-elish_enable_services() {
if ! xiaomi-elish_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
if [[ "${RELEASE}" == "jammy" ]] || [[ "${RELEASE}" == "noble" ]]; then
display_alert "Adding qcom-mainline PPA" "${BOARD}" "info"
do_with_retries 3 chroot_sdcard add-apt-repository ppa:liujianfeng1994/qcom-mainline --yes --no-update
fi
# we need unudhcpd from armbian repo, so enable it
mv "${SDCARD}"/etc/apt/sources.list.d/armbian.sources.disabled "${SDCARD}"/etc/apt/sources.list.d/armbian.sources
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 qbootctl qrtr-tools unudhcpd mkbootimg dropbear-bin
# Install hexagonrpc userspace service for kernel after 6.11, hexagonrpc in only packaged for noble now
if [[ "${RELEASE}" == "noble" ]]; then
do_with_retries 3 chroot_sdcard_apt_get_install hexagonrpc
chroot_sdcard systemctl enable hexagonrpcd-sdsp.service
fi
# disable armbian repo back
mv "${SDCARD}"/etc/apt/sources.list.d/armbian.sources "${SDCARD}"/etc/apt/sources.list.d/armbian.sources.disabled
do_with_retries 3 chroot_sdcard_apt_get_update
chroot_sdcard systemctl enable qbootctl.service
chroot_sdcard systemctl enable usbgadget-rndis.service
chroot_sdcard systemctl enable bt-fixed-mac.service
return 0
}
function post_family_tweaks_bsp__xiaomi-elish_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
add_file_from_stdin_to_bsp_destination "/etc/initramfs-tools/hooks/xiaomi-elish-firmware" <<- 'FIRMWARE_HOOK'
#!/bin/bash
[[ "$1" == "prereqs" ]] && exit 0
. /usr/share/initramfs-tools/hook-functions
for f in /lib/firmware/qcom/sm8250/xiaomi/elish/* ; do
add_firmware "${f#/lib/firmware/}"
done
add_firmware "qcom/a650_sqe.fw" # extra one for dpu
add_firmware "qcom/a650_gmu.bin" # extra one for gpu
FIRMWARE_HOOK
run_host_command_logged chmod -v +x "${file_added_to_bsp_destination}"
}
## Modules, required to boot, add them to initrd
function post_family_tweaks_bsp__xiaomi-elish_bsp_modules_in_initrd() {
display_alert "Adding to bsp-cli" "${BOARD}: modules in initrd" "info"
add_file_from_stdin_to_bsp_destination "/etc/initramfs-tools/modules" <<- 'EXTRA_MODULES'
spi-geni-qcom
nt36523_ts
panel_novatek_nt36523
EXTRA_MODULES
}