On Sat, 12 Apr 2025 03:21:49 -0300
riveravaldez <riveravaldezm...@gmail.com> wrote:

> Wi-Fi dongles is certainly an option, gonna check it.
> 
> > Promoting nonguix is not allowed on this list.  Mentioning it, as I
> > have, is right up against the line.  We want you to use free
> > hardware.
Another valid option is to find a way to replace the internal WiFi
card. 

While it is not trivial, the advantages of doing that are better
range, lower power consumption, works in conferences (some recent
ath9k compatible cards support both 2.4 GHz and 5GHz, and you probably
need 5GHz in conferences like the FOSDEM due to the huge amount of
people (2.4 GHz is probably saturated there)), and better features
(WiFi access point with no limits, mesh network protocols, etc) compared
with USB cards (USB cards could also get these features but the
firmware tend to do too much, so the amount of work to fix is probably
big as you would need to move some things from the firmware to the
driver).

The first step to replace the internal WiFi card is to find a card
compatible with both the laptop connectors and Guix.

According https://www.thinkwiki.org/wiki/Category:X260 the X260 has an
"M.2-2230 slot with, one of the following, no SATA lanes" and a Wifi
card connected to it.

I'm not used to M.2 so I don't know if this one could work but it has 
"2230 (ie dimensions are 22x30mm)", the question is if it has the same
keying.

If the laptop BIOS/UEFI was not whitelisting WiFi card it should then
work. But the ThinkPad X260 BIOS/UEFI has this kind of whitelisting. 

So the next step is to actually bypass that whitelisting. I know 2
possible ways:

- One way to do that is to modify (or replace) the nonfree BIOS to allow
  replacing the internal WiFi card and It's however much more complex
  and risky than just plugging an external WiFi card.

  I did a quick research and found that:
  
https://www.techinferno.com/index.php?/topic/12801-lenovo-thinkpad-x250-x260-unlocked-bios-menu-wlan-wi-fi-whitelist-mod/

  I also looked and the ThinkPad X260 doesn't seem supported by
  Libreboot yet (nowadays Libreboot supports modern computers by adding
  nonfree blobs to do that, so maybe it could be supported at some
  point if security doesn't prevent that).

- Another way might work without modifying the BIOS but it
  has not been tried recently: the trick is to modify the WiFi card PCI
  identifiers (vendor and product IDs and maybe other similar data as
  well) to match the data of card that is currently in the laptop.

  The theory behind that is that this way the BIOS/UEFI won't complain,
  so you'd be able to boot under GNU/Linux.

  And then once booted, you would need to teach Linux that you have an
  ath9k compatible card and not one compatible with an Intel or
  Broadcom driver. This can be done with simple echo as root in sysfs
  to add the IDs to the right driver (as root, with 'sudo su' before).

  Here's an example that doesn't work (because the IDs are already in
  the driver, add other IDs to make it work):
  # echo "168c 002b" > \
  /sys/bus/pci/drivers/ath9k/module/drivers/pci:ath9k/new_id

  The IDs can be found with sudo lspci -nn which gives things like that:
  02:00.0 Network controller [0280]: Qualcomm Atheros AR9285 Wireless
  Network Adapter (PCI-Express) [168c:002b] (rev 01)
  
  As for preventing the Intel or broadcom drivers from loading, the
  best way is to use module_blacklist=<driver> (example:
  module_blacklist=iwlwifi) as kernel argument.

  If the module is built in it's still possible to not load it with the 
  initcall_blacklist= parameter (example:
  initcall_blacklist=uhci_hcd_init) but this is much more complex as
  you'll need to find the driver __init function by reading the kernel
  code (it's trivial if you're used to reading such code though).

  The hardest part is probably to try to change the IDs of the Atheros
  card, there is code to do that but it's very old and it lives in a
  branch, so it's completely unknown if it works with more recent cards.

  I've written some documentation with where to find the code here[2].

  If that doesn't work and that the WiFi card has some flash chip
  easily accessible, you could use a flash chip programmer and a clip
  to connect to the chip to reprogram the IDs, though you'll also need
  to find where are the IDs.

  If you go this route (making it work without modifying the BIOS/UEFI)
  it could be a good idea to have some sort of tutorial or improve the
  documentation somehow.

  Another big unknown is that there is not only your BIOS/UEFI or
  operating system that interact with your internal WiFi card.

  On computers like the X230, There are probably features like AMT[1],
  and AMT does interact with the WiFi card. So at least deactivating AMT
  through the BIOS settings or equivalent could be a good idea if you
  go this route.

  AMT is independent from the BIOS/UEFI or operating system (see [1]
  for more details) and since you'll have a card with the same IDs than
  the Intel/Broadcom one, it could confuse the chip/computer that runs
  AMT in some way, make it crash, etc, which could make your computer
  reboot/shutdown/hang. In that case the only option would probably be
  to instead modify the BIOS to remove the whitelist or to put back the
  stock WiFi card and use some USB WiFi card instead.

In general it could also be a good idea to spread the word and to
promote laptop vendors that at least allow replacing the WiFi card.

For people looking for modern laptops, while they have nonfree software
in their BIOS/UEFI, there are many options that allow to replace the
WiFi card.

I don't know all the brands but typically vendors that advertise
BIOS/UEFI replacements like "Coreboot" typically include nonfree
software in the BIOS/UEFI replacement but they also typically enable
users to replace the WiFi card. 

For instance https://minifree.org and https://puri.sm are known to
do that, but there are many more (See "How to get hardware with
coreboot?"
in https://coreboot.org/end_users.html but beware that not all have 
replaceable WiFi cards. For instance moderns Chromebooks don't).

There are also laptops with free software boot
at https://tehnoetic.com (they are the only one listed on 
https://ryf.fsf.org that still sells laptops) and they seem to be good
quality but they tend to have very long shipping times due to the
difficulty of getting laptops of good conditions. 

You can also make your own by refurbishing some older ThinkPads though
the quality might not be as good as Technoetical because finding good
conditions laptops is not necessarily easy (it probably depends on
luck, one where you live, if you know people that refurbish
laptops, etc).

An idea to do all that would be to somehow point the Guix manual to some
external resources like [2] or maybe instead directly list laptops that
are known to work well with Guix while also informing users that "works
with Guix" doesn't necessarily mean 100% free (because of the
BIOS/UEFI) and also point to or mention modifications to make it work if
needed ("ThinkPad X260 modified to remove the BIOS WiFi Whitelist -> OK").

References:
-----------
[1]https://www.fsf.org/blogs/sysadmin/the-management-engine-an-attack-on-computer-users-freedom
 
[2]https://libreplanet.org/wiki/Group:Hardware/Restrictions/Mini_PCIe_slot_restrictions_on_wireless_cards

Denis.

Attachment: pgprzNf2qRsmi.pgp
Description: OpenPGP digital signature

Reply via email to