Update odin2 config (#6363)

This commit is contained in:
FantasyGmm 2024-03-07 00:50:42 +08:00 committed by GitHub
parent 64649a76e6
commit f54e1b2d59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 8 deletions

View File

@ -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")
@ -35,6 +35,11 @@ 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
@ -42,13 +47,17 @@ function post_family_tweaks__ayn-odin2_enable_services() {
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"
@ -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

View File

@ -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

View File

@ -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