Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions config/boards/ayn-odin2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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 BOOTIMG_CMDLINE_EXTRA="clk_ignore_unused pd_ignore_unused panic=30 audit=0 allow_mismatched_32bit_el0 rw mem_sleep_default=s2idle"
declare -g IMAGE_PARTITION_TABLE="gpt"
declare -g -a ABL_DTB_LIST=("qcs8550-ayn-odin2-hypdtbo")

Expand Down Expand Up @@ -35,20 +35,29 @@ function post_family_tweaks__ayn-odin2_enable_services() {
return 0
fi

if [[ "${RELEASE}" == "noble" ]];then
display_alert "Adding Mesa PPA For Ubuntu " "${BOARD}" "info"
do_with_retries 3 chroot_sdcard add-apt-repository ppa:oibaf/graphics-drivers --yes --no-update
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"" > "${SDCARD}"/etc/udev/rules.d/99-ignore-gamepad.rules
# Add video decoder/encoder udev rule
echo 'SUBSYSTEM=="video4linux", ATTR{name}=="qcom-venus-decoder", SYMLINK+="video-dec%n"' >> "${SDCARD}"/etc/udev/rules.d/90-browser-video.rules
echo 'SUBSYSTEM=="video4linux", ATTR{name}=="qcom-venus-encoder", SYMLINK+="video-enc%n"' >> "${SDCARD}"/etc/udev/rules.d/90-browser-video.rules


# Add Gamepad udev rule
echo 'SUBSYSTEM=="input", ATTRS{name}=="Ayn Odin2 Gamepad", MODE="0666", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="1"'> "${SDCARD}"/etc/udev/rules.d/99-ignore-gamepad.rules
# Add video decoder/encoder udev rule
echo 'SUBSYSTEM=="video4linux", ATTR{name}=="qcom-venus-decoder", SYMLINK+="video-dec%n"' >> "${SDCARD}"/etc/udev/rules.d/90-browser-video.rules
echo 'SUBSYSTEM=="video4linux", ATTR{name}=="qcom-venus-encoder", SYMLINK+="video-enc%n"' >> "${SDCARD}"/etc/udev/rules.d/90-browser-video.rules
# No driver support for suspend
chroot_sdcard systemctl mask suspend.target
# Add Bt Mac Fixed service
install -Dm655 $SRC/packages/bsp/ayn-odin2/bt-fixed-mac.sh "${SDCARD}"/usr/local/bin/
install -Dm644 $SRC/packages/bsp/ayn-odin2/bt-fixed-mac.service "${SDCARD}"/usr/lib/systemd/system/
chroot_sdcard systemctl enable bt-fixed-mac

do_with_retries 3 chroot_sdcard_apt_get_update
display_alert "$BOARD" "Installing board tweaks" "info"
Expand All @@ -64,6 +73,9 @@ function post_family_tweaks__ayn-odin2_enable_services() {
}

function post_family_tweaks_bsp__ayn-odin2_bsp_firmware_in_initrd() {
random_mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
declare -g BOOTIMG_CMDLINE_EXTRA="${BOOTIMG_CMDLINE_EXTRA} bt_mac=${random_mac}"
display_alert "Generate a random Bluetooth MAC address, Mac:${random_mac}" "info"
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
Expand Down
11 changes: 11 additions & 0 deletions packages/bsp/ayn-odin2/bt-fixed-mac.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Bluetooth Fixed Mac Address
After=bluetooth.service
Wants=bluetooth.service
[Service]
Type=oneshot
RemainAfterExit=yes
SyslogIdentifier=bt-fixed-mac
ExecStart=/usr/local/bin/bt-fixed-mac.sh
[Install]
WantedBy=bluetooth.target
11 changes: 11 additions & 0 deletions packages/bsp/ayn-odin2/bt-fixed-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

cmdline=$(cat /proc/cmdline)

if [[ $cmdline == *'bt_mac='* ]]; then
bt_mac=$(echo $cmdline | grep -o 'bt_mac=[^ ]*' | cut -d'=' -f2)
else
bt_mac="2C:6D:C1:F1:93:32"
fi

/usr/bin/bluetoothctl mgmt.public-addr $bt_mac