Project

General

Profile

Feature #1889

Add USB Ethernet support

Added by Kurtis Hanna 8 months ago. Updated 15 days ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Wi-Fi
Target version:
Start date:
09/01/2018
Due date:
% Done:

0%

Resolution:
Device:

Description

Currently Replicant devices can connect to the Internet via a USB connection to a computer that's connected to the Internet: https://redmine.replicant.us/projects/replicant/wiki/ReplicantUSBNetworking

However, Replicant devices can't connect to the Internet via a a USB Ethernet Adapter: https://redmine.replicant.us/boards/9/topics/8001

It seems as though the reason why Replicant doesn't currently work with USB Ethernet Adapters is due to the fact that upstream LineageOS disables kernel module support for security reasons. https://www.reddit.com/r/LineageOS/comments/5xrapo/ethernet_on_lineage/ https://redmine.replicant.us/boards/9/topics/8001?r=8031#message-8031

It seems like Android 6 does support this type of feature: https://www.youtube.com/watch?v=uisnj8Xufp0

I'm not sure if this is helpful, but I figured I'd add this link to LineageOS' source code as well: https://git.replicant.us/LineageOS-mirror/android_frameworks_opt_net_ethernet/log/?h=cm-13.0

Would it be a security issue to add this functionality to all Replicant devices by enabling kernel module support to get ethernet working, as the LineageOS dev suggested on the reddit post?

Replicant 6 currently supports 3 "Wi-Fi only" tablets. Without mobile data or the ability to use the internal Wi-Fi card with software freedom, users must choose between reverse tethering their Replicant device to a computer that is on the internet or buying an external USB Wi-Fi dongle and using RepWifi. It'd be great to offer another option.

Lastly, I couldn't find a Category for this issue that made sense. Please feel free to create an "Other" category in redmine or move this issue to a Category that makes more sense.

History

#1 Updated by Denis 'GNUtoo' Carikli 8 months ago

Hi,

As I understand the best way to solve this bug would be to simply compile in the kernel image, all USB Ethernet adapters drivers. This should be trivial to do.

It would be better to have them as modules (as it would use less RAM and would carry less risk of making the kernel image too big for the boot partition) but as far as I know we have no good enough module loading mechanism in Android 6.x to do that.

#2 Updated by Kurtis Hanna 3 months ago

I'd love to research this issue more. Does anyone have any links to articles or documentation or code about this? I would really like to be able to connect my phone to my ethernet cable if it is a somewhat trival thing to make happen in software.

#3 Updated by Denis 'GNUtoo' Carikli about 2 months ago

The following might work:
  • Start to work on it for a device that you can easily test on
  • try to build an image and test it
  • go in your kernel source code and run:
    export ARCH=arm
    make xconfig # select the drivers you want to add, like the asix driver
    make savedefconfig
    

    Then copy the generated defconfig in the place of your kenrel default configuration

For the Galaxy S3 4G, in device/samsung/i9305/BoardConfig.mk we have:

# Kernel
TARGET_KERNEL_SOURCE := kernel/samsung/smdk4412
TARGET_KERNEL_CONFIG := lineageos_i9305_defconfig

You can then go in kernel/samsung/smdk4412 and you have arch/arm/configs/lineageos_i9305_defconfig
You can then run the following to change the kernel configuration:

export ARCH=arm
make lineageos_i9305_defconfig
make xconfig # select the drivers you want to add, like the asix driver
make savedefconfig
cp defconfig arch/arm/configs/lineageos_i9305_defconfig

However if you do that, the Android build system might complain that your kernel source tree is dirty, so you can remove the binaries changes with the following:

make clean
make mrproper
make distclean

This is because running "make xconfig" will compile the graphical utility that enables you to change the kernel configuration.

Alternatively you can just clone the kernel again outside of the Replicant tree and do that there, and copy the resulting defconfig in Replicant source tree.

Once it's cleaned you can re-launch a build as usual, sign the build and install it as usual.

While this takes more time and it not very convenient it's way safer than flashing the boot.img.

If you do still attempt to flash the boot.img make sure to double check that you are not flashing the kernel in the bootloader partition, otherwise your may break your device if you do that.

This mistake is not that far fetched: On some devices like the Galaxy SII, the PIT partition named BOOT is the bootloader, while on many other devices it's the boot.img

#4 Updated by Denis 'GNUtoo' Carikli 15 days ago

  • Target version changed from Replicant 6.0 0005 to Replicant 6.0 0004

Also available in: Atom PDF