mb1986 / rm-hacks

Small improvements and tweaks for rM devices, covering both rM1 and rM2.
Other
438 stars 9 forks source link

Handle new update mechanism disable #353

Open Eeems opened 3 weeks ago

Eeems commented 3 weeks ago

All swupdate related files I was able to find in a rM1 update image:

/etc/systemd/system/multi-user.target.wants/swupdate.service
/etc/systemd/system/sockets.target.wants/swupdate.socket
/etc/swupdate.cfg
/lib/systemd/system-preset/98-swupdate.preset
/lib/systemd/system/swupdate.service.d
/lib/systemd/system/swupdate.service.d/swupdate-service-override.conf
/lib/systemd/system/swupdate.service
/lib/systemd/system/swupdate.socket.d
/lib/systemd/system/swupdate.socket.d/swupdate-socket-override.conf
/lib/systemd/system/swupdate-progress.service
/lib/systemd/system/swupdate.socket
/usr/bin/swupdate-progress
/usr/bin/swupdate
/usr/bin/swupdate-ipc
/usr/lib/swupdate
/usr/lib/swupdate/conf.d/09-swupdate-args
/usr/lib/swupdate/swupdate.sh
/usr/lib/libswupdate.so.0.1
/usr/lib/tmpfiles.d/swupdate.conf
/usr/sbin/swupdate-from-image-file
/usr/share/common-licenses/swupdate-tools-hawkbit
/usr/share/common-licenses/swupdate-tools-ipc
/usr/share/common-licenses/swupdate-rootdev
/usr/share/common-licenses/swupdate-progress
/usr/share/common-licenses/swupdate
/usr/share/common-licenses/swupdate-helper
/usr/share/swupdate
/usr/share/swupdate/swupdate-payload-key-pub.pem

Some files of interest:

Eeems commented 3 weeks ago

More files of interest:

Eeems commented 3 weeks ago

I've been trying to track down what handles getting the update to the device, and from there what the server it's pulling it from is. I believe this is used somehow: https://docs.memfault.com/docs/linux/reference-memfaultd-configuration/

Eeems commented 3 weeks ago

/etc/memfaultd.conf

{
  "persist_dir": "/home/root/.memfault/",
  "upload_interval_seconds": 1200,
  "heartbeat_interval_seconds": 1200,
  "enable_data_collection": true,
  "software_version": "3.11.2.5",
  "software_type": "device",
  "project_key": "JLPsMk3iNn9rmBptmhVq2NYtO4RaiFM7",
  "base_url": "https://device.cloud.remarkable.com",
  "swupdate": {
    "input_file": "/etc/swupdate.cfg",
    "output_file": "/tmp/swupdate.cfg"
},
  "http_server": {
    "bind_address": "127.0.0.1:8787"
},
  "coredump": {
    "coredump_max_size_kib": 96000,
    "rate_limit_count": 5,
    "rate_limit_duration_seconds": 3600,
    "storage_min_headroom_kib": 10240,
    "storage_max_usage_kib": 96000
  }
}
Eeems commented 3 weeks ago
Eeems commented 3 weeks ago

https://docs.memfault.com/docs/linux/ota/

Eeems commented 3 weeks ago

/tmp/swupdate.cfg

globals :
{
  verbose = false;
  loglevel = 2;
  syslog = true;
};
download :
{
  retries = 3;
  timeout = 1800;
};
suricatta :
{
  confirm = 0;
  polldelay = 300;
  retry = 4;
  retrywait = 200;
  loglevel = 10;
  userid = 0;
  groupid = 0;
  max_artifacts = 1;
  url = "https://device.cloud.remarkable.com/api/v0/hawkbit";
  id = "...";
  tenant = "default";
  gatewaytoken = "...";
};
identify = (
  {
    name = "memfault__current_version";
    value = "3.11.2.5";
  },
  {
    name = "memfault__hardware_version";
    value = "reMarkable1";
  },
  {
    name = "memfault__software_type";
    value = "device";
  } );

I've snipped two things, as I don't know if they are generated on device or not.

Eeems commented 3 weeks ago

https://github.com/sbabic/swupdate/blob/master/suricatta/server_hawkbit.c This appears to be what consumes the settings to communicate with the server.

Eeems commented 3 weeks ago

https://eclipse.dev/hawkbit/apis/ddi_api/