Skip to content

Commit 6bf3593

Browse files
committed
board: photonicat2: add auto-loading for common USB modem drivers add custom kernel configuration for PHOTONICAT_PM driver
1 parent 0aed348 commit 6bf3593

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

config/boards/photonicat2.csc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,44 @@ BOOT_SCENARIO="spl-blobs"
1212
IMAGE_PARTITION_TABLE="gpt"
1313
ENABLE_EXTENSIONS="radxa-aic8800"
1414
AIC8800_TYPE="usb"
15+
16+
# Ensure common USB modem drivers are auto-loaded in the built image
17+
function post_family_tweaks__photonicat2() {
18+
display_alert "$BOARD" "Installing Photonicat2 modem module list" "info"
19+
mkdir -p "${destination}"/etc/modprobe.d
20+
mkdir -p "${destination}"/etc/modules-load.d
21+
22+
# Modules that are commonly required for USB cellular modems and WWAN devices.
23+
# Adjust this list if you know your modem needs a different driver.
24+
cat > "${destination}"/etc/modules-load.d/photonicat2-modems.conf <<- EOT
25+
cdc-wdm
26+
qmi_wwan
27+
cdc_mbim
28+
cdc_ncm
29+
option
30+
usbserial
31+
EOT
32+
33+
return 0
34+
}
35+
36+
# Set PHOTONICAT_PM driver to module for Photonicat2 kernel builds
37+
# This hook runs during kernel config (see kernel-config.sh call_extensions_kernel_config)
38+
function custom_kernel_config__photonicat2() {
39+
kernel_config_modifying_hashes+=("photonicat2-photonicat-pm")
40+
if [[ -f .config ]]; then
41+
# Use kernel's scripts/config if available to set tristate to 'm'
42+
if [[ -x scripts/config ]]; then
43+
# set PHOTONICAT_PM to built-in (y)
44+
./scripts/config --set-val PHOTONICAT_PM y || true
45+
else
46+
# fallback: sed replace - best effort (olddefconfig will validate later)
47+
sed -i 's/^CONFIG_PHOTONICAT_PM=.*/CONFIG_PHOTONICAT_PM=y/' .config || true
48+
# ensure entry exists
49+
if ! grep -q '^CONFIG_PHOTONICAT_PM=' .config; then
50+
echo 'CONFIG_PHOTONICAT_PM=y' >> .config
51+
fi
52+
fi
53+
fi
54+
return 0
55+
}

0 commit comments

Comments
 (0)