From cb25e67665c95369fc4a974d2b2f6fed9557ccba Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Thu, 8 Aug 2013 11:38:37 +0200 Subject: [PATCH] kernel-module-atheros: apply load parameters to correct module In Linux 2.6.35, the kernel module accepting the parameters on load was 'ath6kl_sdio' while in 3.10 is 'ath6kl_core'. So we need to apply the load parameters to either module depending on the kernel version. This is solved by configuring the modprobe configuration file '/etc/modprobe.d/atheros.conf' with the parameters to the correct module instead of passing them in the command line. Signed-off-by: Javier Viguera --- .../kernel-module-atheros.bb | 2 ++ .../kernel-module-atheros/ccardimx28js/atheros | 10 ++++------ .../kernel-module-atheros/cpx2/atheros | 16 ++++++---------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros.bb b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros.bb index e464fd56f..8c3c66fb2 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros.bb +++ b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros.bb @@ -28,6 +28,7 @@ SRC_URI += " \ S = "${WORKDIR}/git" ATH_ONLY_INSTALL_FW = "${@base_version_less_or_equal('PREFERRED_VERSION_linux-dey', '2.6.35.14', '', '1', d)}" +ATH6KL_MOD = "${@base_conditional('ATH_ONLY_INSTALL_FW', '1' , 'ath6kl_core', 'ath6kl_sdio', d)}" EXTRA_OEMAKE = "DEL_PLATFORM=${MACHINE} KLIB_BUILD=${STAGING_KERNEL_DIR} ATH_ONLY_INSTALL_FW=${ATH_ONLY_INSTALL_FW}" @@ -40,6 +41,7 @@ do_install_append() { install -m 0755 ${WORKDIR}/atheros ${D}${sysconfdir}/network/if-pre-up.d/ install -d ${D}${sysconfdir}/modprobe.d install -m 0644 ${WORKDIR}/atheros.conf ${D}${sysconfdir}/modprobe.d/ + echo "options ${ATH6KL_MOD} ath6kl_p2p=1 softmac_enable=1" >> ${D}${sysconfdir}/modprobe.d/atheros.conf } FILES_${PN} += " \ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros index b37cd6f8c..ffe894661 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros +++ b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/ccardimx28js/atheros @@ -27,7 +27,7 @@ MAC_FILENAME="softmac" # Get the wlan MAC address from kernel command line. Use a default # value if the address has not been set. # -MAC_ADDR="$(sed -e 's,.\+ethaddr2=\([^[:blank:]]\+\)[[:blank:]].*,\1,g' /proc/cmdline)" +MAC_ADDR="$(sed -ne 's,.\+ethaddr2=\([^[:blank:]]\+\)[[:blank:]].*,\1,g;T;p' /proc/cmdline)" if [ -z "${MAC_ADDR}" -o "${MAC_ADDR}" = "00:00:00:00:00:00" ]; then MAC_ADDR="00:04:F3:4C:B1:D3" fi @@ -53,7 +53,7 @@ if ! cmp -s ${RAM_DRIVE}/${MAC_FILENAME} ${FIRMWARE_DIR}/${MAC_FILENAME}; then fi rm -f ${RAM_DRIVE}/${MAC_FILENAME} -BDATA_SOURCE=Digi_6203-6233-World.bin +BDATA_SOURCE="Digi_6203-6233-World.bin" if [ -e "/sys/kernel/machine/name" ]; then # Figure out which wireless region we are in. The US has rules for # what channels can be used and at what power level. We use a different set of @@ -65,7 +65,7 @@ if [ -e "/sys/kernel/machine/name" ]; then MACHINE="$(cat /sys/kernel/machine/name)" REGION_CODE="$(cat /sys/kernel/${MACHINE}/mod_cert)" if [ -z "${REGION_CODE}" -o "${US_CODE}" = "${REGION_CODE}" ]; then - BDATA_SOURCE=Digi_6203-6233-US.bin + BDATA_SOURCE="Digi_6203-6233-US.bin" fi else logger -t atheros "Undefined machine, defaulting to world region." @@ -79,10 +79,8 @@ if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${FIRMWARE_DIR}/${BDATA fi # ath6kl_sdio.ko -ATH6KL_PARAMS="ath6kl_p2p=1 softmac_enable=1" -[ -f "/root/wifi_test_mode" ] && { ATH6KL_PARAMS="${ATH6KL_PARAMS} testmode=1"; test_mode_str=" in test mode"; } grep -qs ath6kl_sdio /proc/modules || \ - modprobe --ignore-install -q ath6kl_sdio ${ATH6KL_PARAMS} || echo "Loading ath6kl_sdio module${test_mode_str}: [FAILED]" + modprobe --ignore-install -q ath6kl_sdio || echo "Loading ath6kl_sdio module: [FAILED]" # Delay required for the interface 'wlan0' to settle down before trying to configure it. sleep 0.5 diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/cpx2/atheros b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/cpx2/atheros index cbeea1a39..8a7cafa19 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/cpx2/atheros +++ b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/cpx2/atheros @@ -27,7 +27,7 @@ MAC_FILENAME="softmac" # Get the wlan MAC address from kernel command line. Use a default # value if the address has not been set. # -MAC_ADDR="$(sed -e 's,.\+ethaddr2=\([^[:blank:]]\+\)[[:blank:]].*,\1,g' /proc/cmdline)" +MAC_ADDR="$(sed -ne 's,.\+ethaddr2=\([^[:blank:]]\+\)[[:blank:]].*,\1,g;T;p' /proc/cmdline)" if [ -z "${MAC_ADDR}" -o "${MAC_ADDR}" = "00:00:00:00:00:00" ]; then MAC_ADDR="00:04:F3:4C:B1:D3" fi @@ -53,8 +53,8 @@ if ! cmp -s ${RAM_DRIVE}/${MAC_FILENAME} ${FIRMWARE_DIR}/${MAC_FILENAME}; then fi rm -f ${RAM_DRIVE}/${MAC_FILENAME} +BDATA_SOURCE="calData_AR6103_Digi_X2e_B_world.bin" if [ -e "/sys/kernel/machine/name" ]; then - MACHINE="$(cat /sys/kernel/machine/name)" # Figure out which wireless region we are in. The US has rules for # what channels can be used and at what power level. We use a different set of # rules for the other regions in the world that we sell into. The mod_cert field @@ -62,15 +62,13 @@ if [ -e "/sys/kernel/machine/name" ]; then # appropriate calibration file is loaded. # US_CODE="0x0" + MACHINE="$(cat /sys/kernel/machine/name)" REGION_CODE="$(cat /sys/kernel/${MACHINE}/mod_cert)" if [ -z "${REGION_CODE}" -o "${US_CODE}" = "${REGION_CODE}" ]; then - BDATA_SOURCE=calData_AR6103_Digi_X2e_B.bin - else - BDATA_SOURCE=calData_AR6103_Digi_X2e_B_world.bin + BDATA_SOURCE="calData_AR6103_Digi_X2e_B.bin" fi else - echo "Undefined machine, defaulting to world region." - BDATA_SOURCE=calData_AR6103_Digi_X2e_B_world.bin + logger -t atheros "Undefined machine, defaulting to world region." fi # We don't want to rewrite NAND every time we boot so only @@ -81,10 +79,8 @@ if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${FIRMWARE_DIR}/${BDATA fi # ath6kl_sdio.ko -ATH6KL_PARAMS="ath6kl_p2p=1 softmac_enable=1" -[ -f "/root/wifi_test_mode" ] && { ATH6KL_PARAMS="${ATH6KL_PARAMS} testmode=1"; test_mode_str=" in test mode"; } grep -qs ath6kl_sdio /proc/modules || \ - modprobe --ignore-install -q ath6kl_sdio ${ATH6KL_PARAMS} || echo "Loading ath6kl_sdio module${test_mode_str}: [FAILED]" + modprobe --ignore-install -q ath6kl_sdio || echo "Loading ath6kl_sdio module: [FAILED]" # Delay required for the interface 'wlan0' to settle down before trying to configure it. sleep 0.5