|
| 1 | +# Qualcomm Robotics RB5 Configuration |
| 2 | +declare -g BOARD_NAME="Qualcomm Robotics RB5" |
| 3 | +declare -g BOARD_MAINTAINER="FantasyGmm" |
| 4 | +declare -g BOARDFAMILY="sm8250" |
| 5 | +declare -g KERNEL_TARGET="current,edge" |
| 6 | +declare -g KERNEL_TEST_TARGET="edge" |
| 7 | +declare -g EXTRAWIFI="no" |
| 8 | +declare -g BOOTCONFIG="none" |
| 9 | +declare -g IMAGE_PARTITION_TABLE="gpt" |
| 10 | +# Reserve for ABL Boot |
| 11 | +# declare -g BOOTIMG_CMDLINE_EXTRA="clk_ignore_unused pd_ignore_unused console=tty0 console=ttyMSM0,1500000n8 pcie_pme=nomsi panic=30 allow_mismatched_32bit_el0 mem_sleep_default=s2idle" |
| 12 | +# declare -g -a ABL_DTB_LIST=("qrb5165-rb5") |
| 13 | + |
| 14 | +# Use the full firmware, complete linux-firmware plus Armbian's (for qcom/a650_sqe.fw) |
| 15 | +declare -g BOARD_FIRMWARE_INSTALL="-full" |
| 16 | + |
| 17 | +declare -g SERIALCON="${SERIALCON:-tty1}" |
| 18 | +declare -g GRUB_CMDLINE_LINUX_DEFAULT="clk_ignore_unused pd_ignore_unused console=tty0 arm64.nopauth efi=noruntime console=ttyMSM0,1500000n8 pcie_pme=nomsi panic=30 allow_mismatched_32bit_el0 mem_sleep_default=s2idle" |
| 19 | +declare -g BOOT_FDT_FILE="qcom/qrb5165-rb5.dtb" |
| 20 | +declare -g SECTOR_SIZE="4096" |
| 21 | +enable_extension "grub" |
| 22 | +enable_extension "grub-with-dtb" # important, puts the whole DTB handling in place. |
| 23 | + |
| 24 | +function qcom-robotics-rb5_is_userspace_supported() { |
| 25 | + [[ "${RELEASE}" == "noble" ]] && return 0 |
| 26 | + [[ "${RELEASE}" == "trixie" ]] && return 0 |
| 27 | + return 1 |
| 28 | +} |
| 29 | + |
| 30 | +function post_family_tweaks_bsp__qcom-robotics-rb5_firmware() { |
| 31 | + if ! qcom-robotics-rb5_is_userspace_supported; then |
| 32 | + if [[ "${RELEASE}" != "" ]]; then |
| 33 | + display_alert "Missing userspace for ${BOARD}" "${RELEASE} does not have the userspace necessary to support the ${BOARD}" "warn" |
| 34 | + fi |
| 35 | + return 0 |
| 36 | + fi |
| 37 | + |
| 38 | + display_alert "$BOARD" "Add services" "info" |
| 39 | + |
| 40 | + # USB Gadget Network service |
| 41 | + mkdir -p $destination/usr/local/bin/ |
| 42 | + mkdir -p $destination/usr/lib/systemd/system/ |
| 43 | + mkdir -p $destination/etc/initramfs-tools/scripts/init-bottom/ |
| 44 | + install -Dm655 $SRC/packages/bsp/usb-gadget-network/setup-usbgadget-network.sh $destination/usr/local/bin/ |
| 45 | + install -Dm655 $SRC/packages/bsp/usb-gadget-network/remove-usbgadget-network.sh $destination/usr/local/bin/ |
| 46 | + install -Dm644 $SRC/packages/bsp/usb-gadget-network/usbgadget-rndis.service $destination/usr/lib/systemd/system/ |
| 47 | + install -Dm655 $SRC/packages/bsp/usb-gadget-network/usb-gadget-initramfs-hook $destination/etc/initramfs-tools/hooks/usb-gadget |
| 48 | + install -Dm655 $SRC/packages/bsp/usb-gadget-network/usb-gadget-initramfs-premount $destination/etc/initramfs-tools/scripts/init-premount/usb-gadget |
| 49 | + install -Dm655 $SRC/packages/bsp/usb-gadget-network/dropbear $destination/etc/initramfs-tools/scripts/init-premount/ |
| 50 | + install -Dm655 $SRC/packages/bsp/usb-gadget-network/kill-dropbear $destination/etc/initramfs-tools/scripts/init-bottom/ |
| 51 | +} |
| 52 | + |
| 53 | +function post_family_tweaks__qcom-robotics-rb5_enable_services() { |
| 54 | + if ! qcom-robotics-rb5_is_userspace_supported; then |
| 55 | + if [[ "${RELEASE}" != "" ]]; then |
| 56 | + display_alert "Missing userspace for ${BOARD}" "${RELEASE} does not have the userspace necessary to support the ${BOARD}" "warn" |
| 57 | + fi |
| 58 | + return 0 |
| 59 | + fi |
| 60 | + |
| 61 | + display_alert "$BOARD" "Enable services" "info" |
| 62 | + chroot_sdcard systemctl enable usbgadget-rndis.service |
| 63 | + |
| 64 | + return 0 |
| 65 | +} |
| 66 | + |
| 67 | +function post_family_tweaks__qcom-robotics-rb5_extra_packages() { |
| 68 | + if ! qcom-robotics-rb5_is_userspace_supported; then |
| 69 | + if [[ "${RELEASE}" != "" ]]; then |
| 70 | + display_alert "Missing userspace for ${BOARD}" "${RELEASE} does not have the userspace necessary to support the ${BOARD}" "warn" |
| 71 | + fi |
| 72 | + return 0 |
| 73 | + fi |
| 74 | + |
| 75 | + if [[ "${RELEASE}" == "noble" ]]; then |
| 76 | + do_with_retries 3 chroot_sdcard_apt_get_update |
| 77 | + do_with_retries 3 chroot_sdcard_apt_get_install software-properties-common |
| 78 | + fi |
| 79 | + |
| 80 | + if [[ "${RELEASE}" == "noble" ]]; then |
| 81 | + display_alert "Adding qcom-mainline PPA For" "${BOARD}" "info" |
| 82 | + do_with_retries 3 chroot_sdcard add-apt-repository ppa:liujianfeng1994/qcom-mainline --yes --no-update |
| 83 | + fi |
| 84 | + |
| 85 | + # We need unudhcpd from armbian repo, so enable it |
| 86 | + mv "${SDCARD}"/etc/apt/sources.list.d/armbian.sources.disabled "${SDCARD}"/etc/apt/sources.list.d/armbian.sources |
| 87 | + do_with_retries 3 chroot_sdcard_apt_get_update |
| 88 | + display_alert "Installing ${BOARD} tweaks" "warn" |
| 89 | + do_with_retries 3 chroot_sdcard_apt_get_install vulkan-tools mesa-vulkan-drivers mtools zstd alsa-ucm-conf qbootctl qrtr-tools unudhcpd |
| 90 | + # disable armbian repo back |
| 91 | + mv "${SDCARD}"/etc/apt/sources.list.d/armbian.sources "${SDCARD}"/etc/apt/sources.list.d/armbian.sources.disabled |
| 92 | + |
| 93 | + if [[ "${DESKTOP_ENVIRONMENT}" == "kde-plasma" ]]; then |
| 94 | + display_alert "Adding Extra KDE Package" "${BOARD}" "info" |
| 95 | + do_with_retries 3 chroot_sdcard_apt_get_install plasma-workspace plasma-desktop plasma-systemmonitor plasma-nm kde-standard kde-spectacle kinfocenter kscreen krfb kfind filelight \ |
| 96 | + dolphin clinfo wayland-utils |
| 97 | + fi |
| 98 | + |
| 99 | + if [[ "${RELEASE}" == "noble" ]]; then |
| 100 | + chroot_sdcard systemctl enable qbootctl.service |
| 101 | + fi |
| 102 | + |
| 103 | + # No driver support for suspend |
| 104 | + chroot_sdcard systemctl mask suspend.target |
| 105 | +} |
| 106 | + |
| 107 | +function post_family_tweaks_bsp__qcom-robotics-rb5_bsp_firmware_in_initrd() { |
| 108 | + display_alert "Adding to bsp-cli" "${BOARD}: firmware in initrd" "info" |
| 109 | + declare file_added_to_bsp_destination # Will be filled in by add_file_from_stdin_to_bsp_destination |
| 110 | + # Using Elish's firmware for now |
| 111 | + add_file_from_stdin_to_bsp_destination "/etc/initramfs-tools/hooks/qcom-robotics-rb5-firmware" <<- 'FIRMWARE_HOOK' |
| 112 | + #!/bin/bash |
| 113 | + [[ "$1" == "prereqs" ]] && exit 0 |
| 114 | + . /usr/share/initramfs-tools/hook-functions |
| 115 | + for f in /lib/firmware/qcom/sm8250/Thundercomm/RB5/* ; do |
| 116 | + add_firmware "${f#/lib/firmware/}" |
| 117 | + done |
| 118 | + add_firmware "qcom/sm8250/a650_zap.mbn" # Extra one for dpu |
| 119 | + add_firmware "qcom/a650_sqe.fw" # Extra one for dpu |
| 120 | + add_firmware "qcom/a650_gmu.bin" # Extra one for gpu |
| 121 | + FIRMWARE_HOOK |
| 122 | + run_host_command_logged chmod -v +x "${file_added_to_bsp_destination}" |
| 123 | +} |
0 commit comments