Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gadget: Try to replace Android Gadget with mainline #4

Open
PsychoGame opened this issue Jul 25, 2021 · 5 comments
Open

Gadget: Try to replace Android Gadget with mainline #4

PsychoGame opened this issue Jul 25, 2021 · 5 comments

Comments

@PsychoGame
Copy link
Contributor

PsychoGame commented Jul 25, 2021

Edit 1:
I've opened this issue to keep track of my experiment in trying to replace the Android Gadget driver with mainline gadget driver.
Also some discussion between developers can take place in this thread, so we can share some ideas and knowledge.
Step 1: Switch over Sysinitv to SystemD. (It's not mandatory, but a lot of scripts which are necessary are written for SystemD, otherwise would need to rewrite a lot). Also we might benefit from using SystemD in boot times as it is a parallel boot manager. It can handle multiple services at the same time, while Sysinitv boots up one after the other.
Step 2: Getting ADB up/running on the modem, or replace adb with OpenSSH exposed through the mainline gadget.
Step 3: QMI: Try to get a QMI interface up and running (Investigate if we can use opensource qmi_wwan driver)

@PsychoGame
Copy link
Contributor Author

My preference is to use OpenSSH exposed through the mainline gadget driver (Like mobian does) instead of ADB. Try to make the modem as less dependent on android code as possible.

@PsychoGame
Copy link
Contributor Author

Some additional information about wiring the QMI interface to the USB Serial interface: https://github.com/bacnh85/Quectel_Linux_USB_Driver

@PsychoGame
Copy link
Contributor Author

@PsychoGame
Copy link
Contributor Author

PsychoGame commented Jan 11, 2022

Hello @Biktorgj,

I've been away for some time, but I would like to pick-up this project.
This year I can donate some spare time to this project as this year is a little more quite for me than last year.
I know you are very busy with the current modem as is, and using mainline kernel is not high on you priority list right now, but if I could get this up-and-running we could have a major breakthrough.
The only problem the last time was that my knowledge about the Yocto building is lacking to much to produce buildable images.
Are you willing to guide me through this proces when I have some questions?
I have seen you use Telegram as well, is it okay if I add you there?

This is my new plan of approach, tell me what you think about it?
- Step 1: Getting ADB running over the mainline gadget driver:
This step should be fairly easy. The scripts for it already exist, they are linked in the comment above this one. In this example they use SystemD to initialize everything, but it should be fairly simple to port it over to our init system. It's doing nothing really fancy, only running some basic shell scripts to set-up the gadget driver, and to enable the gadget driver. First I was in favour of using SSH over android interface, but I suspect this will make things very hard with updating modem firmware (like getting in download mode etc.) what do you think?
- Step 2: Expose the QMI interface over TTY interface, to be able to let userspace communicate with modem.
Greetings Jasper

@Biktorgj
Copy link
Collaborator

Hi Jasper!

Hello @Biktorgj,

I've been away for some time, but I would like to pick-up this project. This year I can donate some spare time to this project as this year is a little more quite for me than last year. I know you are very busy with the current modem as is, and using mainline kernel is not high on you priority list right now, but if I could get this up-and-running we could have a major breakthrough. The only problem the last time was that my knowledge about the Yocto building is lacking to much to produce buildable images. Are you willing to guide me through this proces when I have some questions? I have seen you use Telegram as well, is it okay if I add you there?

Of course, feel free to ping me either in Telegram or Matrix

This is my new plan of approach, tell me what you think about it? - Step 1: Getting ADB running over the mainline gadget driver: This step should be fairly easy. The scripts for it already exist, they are linked in the comment above this one. In this example they use SystemD to initialize everything, but it should be fairly simple to port it over to our init system. It's doing nothing really fancy, only running some basic shell scripts to set-up the gadget driver, and to enable the gadget driver. First I was in favour of using SSH over android interface, but I suspect this will make things very hard with updating modem firmware (like getting in download mode etc.) what do you think? - Step 2: Expose the QMI interface over TTY interface, to be able to let userspace communicate with modem. Greetings Jasper

The current initialization script is here: https://github.com/Biktorgj/meta-qcom/blob/honister/recipes-scripts/usb-normalboot/files/init.d/usb

I did a quick look to ConfigFS in 3.18.140 but never got it to correctly work. I would advise you to start with the current kernel, as going straight to mainline as it is currently might introduce lots of other problems unrelated to whatever you do, and with 3.18 you have all the other drivers in place and ready.

If you're going to build this you're going to have to build the images lots of times, so if you're using the SDK, let me recommend you some things:

  1. Play with the recovery image (usb init script here: https://github.com/Biktorgj/meta-qcom/tree/honister/recipes-scripts/usb-recoveryboot)
  2. Build a modified recovery image (make recovery_fs) with your custom kernel and use only the recovery slots (fastboot flash recovery [kernel.img]; fastboot flash recoveryfs [your recovery filesystem image], and boot it with 'fastboot oem reboot-recovery'
    That way if nothing works you just need to reboot the modem to get it to a working state. It also allows you to then boot to the default image and mount the recovery partition from the main system and modify the image in place instead of having to rebuild everything all the time
    Hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants