Application development for IoT Gateway: userspace or kernelspace?

Hi, I am somewhat new to OpenWRT and Embedded Linux. Background: I am working with a MediaTek MT7628-based IoT Gateway hardware sourced from a partner vendor that is running a custom OpenWRT image (customized according to this vendor's own devicetree). The application logic is relatively simple from the POV of the MediaTek:

  1. Read data over USB (that's actually coming from another chip over a CP210x USB-to-UART bridge) periodically.
  2. Upload it to a backend (HTTP for now, but might switch to MQTT later). - That's it basically!
  3. Also there's some GPIO stuff for toggling LEDs and voltage regulators.

After some R&D I've managed to do these things separately:
(1) using stty (to set the baudrate) and cat to read from the /dev/ttyUSBx serial port device, (2) using curl (which I had to download with opkg) to make HTTP requests and (3) using the gpiod-tools package (also downloaded with opkg).

Since all these are "shell-level" programs, my intuition is to code up the application in an ash script and install it using the procd initi system so it runs every time on bootup. As I understand it, this would be a mostly user-space approach, correct?

Instead of relying on these external "shell-level" dependencies, another approach would be to use libraries like libusb, libcurl and libgpiod and write an OpenWRT package in C, compile it to a .ipk file and install it as a kernel module which would run in kernel-space. Of course this option would take more development effort but would there by any benefits (in terms of stability or flexibility) in the long term that could make this worthwhile? This is my first Embedded Linux project, so any insight is welcome. Thanks.

My two (or three) cents:

  • Custom "based on OpenWrt" derivatives are not OpenWrt, and any advice you might get here could be invalid for your device.
  • This is more a generic embedded software question that a OpenWrt question.l; you will probably get more help in other forums.
  • Just because you build a C program, does not mean it has to run in kernel space as a module. In fact, I would not run such a program in kernel space.
4 Likes

You should not take a project from a well known freelancer site, with a budget of 100 bucks and expect others to do your job here for free. One more "leecher" here.

2 Likes

How did you find out? Checking all those sites for "MT7628 IOT" or variations? Do you check systematically, or in case of suspicion only? 'One more "leecher"' makes it sound like a regular problem. I was not aware of that.

I agree with your point, just curious.

I regularly check relevant freelancer sites for interesting small projects, I might bid for. And to see, what actually is requested quite often. Yes, it regularly happens, that such projects are taken for lowest price, and then consultation for free is requested here. I even once had the unpleasant case, that I bid too high on a project, lost and the winner asked here for free advice.

Benefits? On the contrary, only detriments. If you need to ask, well...

1 Like